<?php
    $conf_basedir	= "../../";	//相对主目录的位置
    $conf_where		= "admin";	//选择调用相应模块
    $directory		= basename(dirname(__FILE__));	//定义当前所在的目录，引入模块公用函数
    include_once($conf_basedir."base.inc.php");
    checkAuth('31');	//判断登录和权限
    $js = "<script type='text/javascript' src='http://esfadmin.house365.com/script/js/showpic.js'></script>"; 
    //获得小区图库

     $wherecond="";
     if($sort == 0){
         if($hall!=""&&!is_array($hall))
         {
             $wherecond.=" bi_hall='".$hall."' and ";
         }
         if($room!=""&&!is_array($room))
         {
             $wherecond.=" bi_room='".$room."' and " ;
         } 
          $wherecond .= "bi_type=0";
     }elseif($sort ==1){
         //外景图 xue 2014-2-15
         
         if($outside!=""){
             $wherecond .= "bi_type =".$outside."";
         }else{
             $wherecond .= "bi_type in (51,52,53,54,55)";
         }
     }   
     $wherecond .= " order by id desc";
     $id = $id !='' ? $id : $blockid;
     //$q = "select * from block_img where bi_blockid='" . $id . "' and $wherecond";


   //  $totalrows = $dbback->GetAll($q);
    // $numrows = count($totalrows);
    /*
       //分页参数
    $pagesize	= $display_rows ? intval($display_rows) : 6;
    $page_now	= $page_now ? max(1, intval($page_now)) : 1 ; // 获取当前页数
    $offset		= ( $page_now - 1 ) * $pagesize;
     */
 
    $q = "select * from block_img where bi_blockid='" . $id . "' and ".$wherecond." ";
     
    $blockimg = $dbback->GetAll($q); 
    for($i=0;$i<count($blockimg);$i++){
        $blockimg[$i]['picType'] = getOutPicType($blockimg[$i]['bi_type']);      
    }


    $block_num = count($blockimg);
   // $pagenum = count($blockimg);//当前页面数量
    //$numrows = $numrows >0 ? $numrows : 0;
    $time = time();
	/*
    if( $numrows <= 0 || $pagenum <=0){
        $pages = 0 ;  //计算总页数
    }else{
        $pages = ceil($numrows/$pagesize) ;  //计算总页数
        $new_pagenavi = new_pagenavi($page_now,$pages,$numrows);
    }
*/
  
  //外景图类型  xue 2014-2-15
    function getOutPicType($type){
        switch ($type){
            case '51': $typeName = "小区正门";
                break;
            case '52': $typeName = "外立面";
                break;
            case '53': $typeName ="小区环境";
                break;
            case '54': $typeName ="内部设施";
                break;
            case '55': $typeName ="周边设施";
                break;
            default : $typeName ="";
        }
        return $typeName;
    }

      //引用模版文件
    include_once(Template("block/block_img"));

?>