Пример #1
0
 public function run($id, $date = '', $hub = '')
 {
     $this->controller->pageTitle = "Room";
     // $now = str_replace('$','-',$date);
     if ($date) {
         $hub = substr($date, -1);
         $date = str_replace('$', '-', $date);
         $date = substr($date, 0, 10);
     } else {
         $hub = Yii::app()->request->getParam('hub');
         $date = Yii::app()->request->getParam('date');
     }
     $userId = Yii::app()->user->id;
     $proxy = new MeetingRoom($date, $userId, $id, $hub);
     $result = $proxy->getInfo();
     $my = $result['data']['my'];
     $other = $result['data']['other'];
     if (Yii::app()->request->isAjaxRequest) {
         $data = array('code' => 200, 'data' => array('my' => CJSON::encode($my), 'other' => CJSON::encode($other)));
         echo CJSON::encode($data);
     } else {
         $this->controller->render('roomshow', array('data' => $result['data']['info'], 'my' => CJSON::encode($my), 'other' => CJSON::encode($other), 'date' => $date, 'hub' => $hub));
     }
 }
Пример #2
0
 public function run($id = '')
 {
     $this->controller->pageTitle = "Rooms";
     $id = $id == '' ? 1 : $id;
     $now = date('Y-m-d', time());
     $date = Yii::app()->request->getParam('date');
     $date = $date == '' ? $now : $date;
     $room = new MeetingRoom($date, Yii::app()->user->id, '', $id);
     $result = $room->listroom();
     if ($result['data']) {
         foreach ($result['data'] as &$list) {
             $list['my'] = CJSON::encode($list['my']);
             $list['other'] = CJSON::encode($list['other']);
         }
     }
     if (Yii::app()->request->isAjaxRequest) {
         $data = array('data' => $result['data'], 'code' => 200);
         echo CJSON::encode($data);
     } else {
         $proxy = new CHub();
         $hub = $proxy->getHubList();
         $this->controller->render('roomlist', array('data' => $result['data'], 'date' => $date, 'hub' => $hub['data'], 'hubid' => $id));
     }
 }