<?php
    $conf_basedir	= "../../";	//相对主目录的位置
    $conf_where		= "admin";	//选择调用相应模块
    $directory		= basename(dirname(__FILE__));	//定义当前所在的目录，引入模块公用函数
    include_once($conf_basedir."base.inc.php");
    checkAuth('67');	//判断登录和权限
    
	//查询小区部分信息
	$sql = "select b.*,s.streetname from  block as b left join street as s on b.streetid=s.id where  b.id = {$block_id}";
    $block_info = $dbback->GetRow($sql);
    
	$title = "小区完善资料审核---".$block_info['blockname'];
   	//查询小区完善属性字段名和属性名称对应数据
	$block_attrs = getBlockAttrs();

	if($do == 'check'){
		$data_info['attr_field'] = $attr_field;
		$data_info['attr_name'] = $block_attrs[$attr_field] ;
		if($attr_field == 'b_map'){
			$data_info['b_map_x'] = $block_info['b_map_x'];
		    $data_info['b_map_y'] = $block_info['b_map_y'];
		}else{
			if($attr_field == 'streetid'){
			    $data_info['attr_info'] = $block_info['streetname'];
			}else{
				$data_info['attr_info'] = $block_info[$attr_field];
			}
			
		}
       
	    //获得下一个小区属性审核信息
		$sql = "select block_id,attr_field from growth_block_improve_audit where status=0 order by block_id desc" ;
		$next_info = $dbback->GetRow($sql);

		//引用模版文件
		include_once(Template("header"));
		include_once(Template("block/block_improve_check"));
		include_once(Template("footer"));
	
	}else{
		if($attr_field == 'streetid'){
			$sql2 = "select g.*,s.streetname from  growth_block_improve_audit as g left join street as s on g.attr_info = s.id where g.block_id = {$block_id} and g.attr_field = 'streetid' and status = 0 order by g.id asc;";
		}else{
			$sql2 = "select * from  growth_block_improve_audit where block_id = {$block_id} and attr_field = '{$attr_field}' and status = 0 order by id asc;";
		}
		$data = $dbback->GetAll($sql2);

		$data_info = array();
		if(is_array($data) && $data){
			$data_info['num'] = count($data);
			$data_info['attr_field'] = $attr_field ;
			$data_info['attr_name'] = $block_attrs[$attr_field] ;
			if($attr_field == 'b_map' ){
				$data_info['attr_old'] = $block_info['b_map_x']."||".$block_info['b_map_y'];
                $data_info['b_map_x'] = $block_info['b_map_x'];
                $data_info['b_map_y'] = $block_info['b_map_y'];
			}elseif($attr_field == 'streetid' ){
                $data_info['attr_old'] = $block_info['streetname'];
		    }else{
				$data_info['attr_old'] = $block_info[$attr_field];
			}
			foreach($data as $key=>$val){
                if($attr_field == 'b_map' ){
					$b_map = explode('||',$val['attr_info']);
					$val['b_map'] = "百度地图X坐标：".$b_map[0]."&nbsp;&nbsp;&nbsp;百度地图Y坐标：".$b_map[1];
					$val['attr_info'] = $b_map[0]."||".$b_map[1];
				}elseif($attr_field == 'streetid'){
					$val['attr_info'] = $val['streetname'];
				}
				$data_info['attr_new'][] = array('improve_id'=>$val['id'],'attr_info'=>$val['attr_info'],'b_map'=>$val['b_map']);
			}
		}
	 
		//引用模版文件
		include_once(Template("header"));
		include_once(Template("block/block_improve_audit"));
		include_once(Template("footer"));
		
	}
?>