<?php
    $conf_basedir	= "../../";	//相对主目录的位置
    $conf_where		= "admin";	//选择调用相应模块
    $directory		= basename(dirname(__FILE__));	//定义当前所在的目录，引入模块公用函数
    include_once($conf_basedir."base.inc.php");
    checkAuth('68');	//判断登录和权限

    $title = "小区完善属性锁定修改";
    
	//查询出相应小区数据
	$data = array();
	$sql = "select  b.*,s.streetname  from block as b left join street as s  on b.streetid = s.id where b.id='$id'";
	$data = $dbback->GetRow($sql);
    
	/*
	//房屋类型
	$infotype = $conf_house['infotype'] ;  
	$b_property_val = '';
	if($data['b_property_type'] != ''){
		$b_property_type = explode(',',$data['b_property_type']);
		if(is_array($infotype) && is_array($b_property_type)){
			foreach($infotype as $key=>$val){
				if(in_array($key,$b_property_type)){
					$b_property_val .= $infotype[$key].',';
				}
			}
		$b_property_val = trim($b_property_val,',');
		}
	}
	$data['b_property_type'] = $b_property_val ;
    */
	$data['streetid'] = $data['streetname'] ;

	if($data){
        //查询出目前开放完善的字段并组合数据
		$block_attrs = getBlockAttrs();

		//查询小区各属性锁定情况
		$sql = "select id,attr_name from growth_block_attr_lock  where block_id = '".$id."'";
		$lockInfo = $dbback->GetAll($sql);
         
		if(is_array($block_attrs)){
			foreach($block_attrs as $key=>$val){
				$lock_id = '';
				$lock = 0;
				if(is_array($lockInfo)){
					foreach($lockInfo as $v){
						if($key == $v['attr_name']){
							$lock_id = $v['id'];
							$lock = 1;
							break;
						}else{
							$lock_id = '';
							$lock = 0;
						}
				    }
				}
	
				$lock = $data['lock_flag'] == 1 ? 1 : $lock;
				if($key == 'b_map'){
					$b_map_info = array('field'=>$key,'name'=>$val,'b_map_x'=>$data['b_map_x'],'b_map_y'=>$data['b_map_y'],'lock'=>$lock,'lock_id'=>$lock_id);
				}else{
					$data_info[] = array('field'=>$key,'name'=>$val,'name_value'=>$data[$key],'lock'=>$lock,'lock_id'=>$lock_id);	
				}
			}
		}
	}

    //引用模版文件
    include_once(Template("header"));
    include_once(Template("block/lock_modify"));
    include_once(Template("footer"));
?>