예제 #1
0
 function _filter(&$map)
 {
     //用户只能查看自己发布的信息
     if (!authsuperadmin(session('uid'))) {
         $map['_logic'] = 'and';
         $map['uid'] = array('eq', session("uid"));
     }
     if (IS_POST) {
         if (isset($_REQUEST['s_startdt']) && $_REQUEST['s_startdt'] != '' && isset($_REQUEST['s_enddt']) && $_REQUEST['s_enddt'] != '') {
             $map['_logic'] = 'or';
             $map['startdt'] = array(array('egt', I('s_startdt')), array('elt', I('s_enddt')));
             $map['_logic'] = 'or';
             $map['enddt'] = array(array('egt', I('s_startdt')), array('elt', I('s_enddt')));
         }
         if (isset($_REQUEST['s_title']) && $_REQUEST['s_title'] != '') {
             $map['_logic'] = 'and';
             $map['title'] = array('like', "%" . I('s_title') . "%");
         }
         if (isset($_REQUEST['s_orgname']) && $_REQUEST['s_orgname'] != '' || isset($_REQUEST['s_keysname']) && $_REQUEST['s_keysname'] != '') {
             $map['_logic'] = 'and';
             //$map['_string'] = 'status=1 AND score>10';
             $map['_string'] = " 1=1 ";
             if (isset($_REQUEST['s_orgname']) && $_REQUEST['s_orgname'] != '') {
                 $map['_string'] .= " and concat(',',orgsname,',') regexp concat(',(',replace('" . $_REQUEST['s_orgname'] . "',',','|'),'),')";
             }
             if (isset($_REQUEST['s_keysname']) && $_REQUEST['s_keysname'] != '') {
                 $map['_string'] .= " and concat(',',keysname,',') regexp concat(',(',replace('" . $_REQUEST['s_keysname'] . "',',','|'),'),')";
             }
         }
         if (isset($_REQUEST['s_importantid']) && $_REQUEST['s_importantid'] != '') {
             $map['_logic'] = 'and';
             $map['importantid'] = array('eq', I('s_importantid'));
         }
         if (isset($_REQUEST['s_statusid']) && $_REQUEST['s_statusid'] != '' && $_REQUEST['s_statusid'] != '-1') {
             $map['_logic'] = 'and';
             $map['status'] = array('eq', I('s_statusid'));
         }
         //return $map;
         //var_dump($map);
     }
 }
예제 #2
0
 public function GetReservByID($id)
 {
     $demo = M("uv_getmeetingreserv");
     $list = $demo->where("id = '" . $id . "'")->select();
     /*
       	$list=$demo->table(C('DB_PREFIX')."meetingreserv a")
       	->join("left join ".C('DB_PREFIX')."meeting b ON (a.meetingid=b.id)")
       	->join("left join ".C('DB_PREFIX')."user c ON (a.userid=c.id)")
       	->field("a.id,a.meetingid,b.name,c.username,a.title,
     			date_format(a.startdate,'%Y-%m-%d') as startdate,
     			date_format(a.starttime,'%H:%i') as starttime,
     			date_format(a.endtime,'%H:%i') as endtime,
     			a.status,a.note,a.hasallday,a.timelength,a.orgid,a.userid,
     			b.hastv,b.hasprojection,b.hasvideo,b.hastel")
       	    			->order("a.startdate,a.startdate desc")
       	    			->where("a.id = '".$id."'")
       	    			->select();
       	
     echo $demo->getLastSql();
     */
     $nowDate = date('Y-m-d', time());
     $Date315 = date('Y') . "-03-15";
     $Date331 = date('Y-m-d', time());
     if (intval(date("n", time())) >= 4) {
         $Date331 = date('Y') + 1 . "-03-31";
     } else {
         $Date331 = date('Y') . "-03-31";
     }
     //             if($nowDate>=$Date315&&$nowDate<=$Date331)
     //             {
     $maxDate = $Date331;
     //             }
     //             else
     //            {
     //                 $maxDate="2050-12-31";
     //             }
     //var_dump($maxDate);
     //var_dump($demo->getLastSql());
     //die();
     $builtindevices = $list[0]["builtindevices"];
     $listbuiltindevices = array();
     if ($builtindevices == '' || !isset($builtindevices)) {
         $listbuiltindevices = array("hastv" => "unchecked", "hasprojection" => "unchecked", "hasvideo" => "unchecked", "hastel" => "unchecked");
     } else {
         $arrbuiltindevices = explode(',', $builtindevices);
         $listbuiltindevices = array("hastv" => $arrbuiltindevices[0], "hasprojection" => $arrbuiltindevices[1], "hasvideo" => $arrbuiltindevices[2], "hastel" => $arrbuiltindevices[3]);
     }
     //工厂长,部长,副总,总经理,秘书 可以预约 5#和接待室
     $demo = M("meetingreserv");
     $listdep = array();
     //新增时没有会议室ID,用社员ID进行筛选
     if ($id != "0" && isset($id)) {
         $listdep = $demo->table(C('DB_PREFIX') . "user a")->join("left join " . C('DB_PREFIX') . "meetroomauthgroup b ON (a.meetroomauthgroupid=b.id)")->join("left join " . C('DB_PREFIX') . "meetingreserv c ON (a.id=c.userid)")->field("b.rules")->where("c.id='" . $id . "'")->select();
     } else {
         $listdep = $demo->table(C('DB_PREFIX') . "user a")->join("left join " . C('DB_PREFIX') . "meetroomauthgroup b ON (a.meetroomauthgroupid=b.id)")->field("b.rules")->where("a.id='" . session('uid') . "'")->select();
     }
     //       var_dump($demo->getLastSql());
     //       die();
     if (isset($listdep) && count($listdep) > 0) {
         $result = $listdep[0]["rules"];
     } else {
         $result = "";
     }
     $demo = M('meeting');
     if (authsuperadmin(session('uid'))) {
         $listz = $demo->where(array('status' => 1))->select();
     } else {
         if ($result != "") {
             $listz = $demo->where("status='1' and id in (" . $result . ")")->select();
         }
     }
     //var_dump($demo->getLastSql());
     //die();
     //var_dump($list[0]);
     //          die();
     //工厂长,部长,副总,总经理,秘书 可以预约 5#和接待室
     $this->assign('orgName', $this->getOrgNameByUid($id));
     $this->assign('id', $id);
     $this->assign('builtindeviceslist', $listbuiltindevices);
     $this->assign('beforlist', $list[0]);
     $this->assign('maxDate', $maxDate);
     $this->assign('listz', $listz);
 }