Exemplo n.º 1
0
 public function run()
 {
     $this->controller->pageTitle = "Private";
     $proxy = new CHub();
     $result = $proxy->getHubList();
     $type = MemberType::model()->findAll();
     if (Yii::app()->request->isAjaxRequest) {
         $name = Yii::app()->request->getParam('name');
         $phone = Yii::app()->request->getParam('phone');
         $email = Yii::app()->request->getParam('email');
         $number = Yii::app()->request->getParam('number');
         $membertype = Yii::app()->request->getParam('membertype');
         $hub = Yii::app()->request->getParam('hub');
         $proxy = new PrivateOrder();
         $proxy->name = $name;
         $proxy->phone = $phone;
         $proxy->email = $email;
         $proxy->number = $number;
         $proxy->membertype = $membertype;
         $proxy->hub = $hub;
         $proxy->save();
         echo CJSON::encode(array('code' => 200, 'message' => 'success'));
     } else {
         $this->controller->render('private', array('data' => $result['data'], 'type' => $type));
     }
 }
Exemplo n.º 2
0
 public function run($id, $date)
 {
     $this->controller->pageTitle = "Workspaces";
     $date = str_replace('$', '-', $date);
     $proxy = new CHub();
     $result = $proxy->getHubInfo($id);
     $this->controller->render('workspaceconfirm', array('data' => $result['data'], 'date' => $date));
 }
Exemplo n.º 3
0
 public function run()
 {
     $this->controller->pageTitle = 'Book a Workspace';
     $now = date('Y-m-d', time());
     $date = Yii::app()->request->getParam('date');
     $date = $date == '' ? $now : $date;
     $proxy = new CHub();
     $result = $proxy->getHubList();
     if (Yii::app()->request->isAjaxRequest) {
         $id = Yii::app()->request->getParam('id');
         $hub = Yii::app()->request->getParam('hub');
         $date = Yii::app()->request->getParam('date');
         if ($id) {
             $date = date('Ymd', strtotime($date));
             $record = Reservations::model()->findAll('startTime =' . date('Ymd', strtotime($date)) . '100000' . ' and userId=' . Yii::app()->user->id . ' and type=1 and status=1');
             $orderid = Order::model()->findAllByAttributes(array('status' => 1, 'userId' => Yii::app()->user->id, 'type' => 1));
             if ($orderid) {
                 foreach ($orderid as $list) {
                     $order = OrderProduct::model()->find('endDate>=' . $date . ' and orderId=' . $list['id'] . ' and startDate<=' . $date);
                     if ($order) {
                         break;
                     }
                 }
                 if ($order) {
                     echo CJSON::encode(array('code' => 200, 'data' => array('num' => $order['totalTimes'] - $order['usedTimes'], 'count' => count($record))));
                 } else {
                     echo CJSON::encode(array('code' => 200, 'data' => array('num' => 0)));
                 }
             } else {
                 $code = CodeUsed::model()->findAll('userId=' . Yii::app()->user->id);
                 if ($code) {
                     foreach ($code as $list) {
                         $value = Code::model()->find('endDate>=' . $date . ' and id=' . $list['codeId'] . ' and startDate<=' . $date);
                         if ($value) {
                             break;
                         }
                     }
                     if ($value) {
                         echo CJSON::encode(array('code' => 200, 'data' => array('num' => 1, 'count' => count($record))));
                     } else {
                         echo CJSON::encode(array('code' => 200, 'data' => array('num' => 0)));
                     }
                 } else {
                     echo CJSON::encode(array('code' => 200, 'data' => array('num' => 0)));
                 }
             }
         } else {
             $proxy = new CReservation();
             $result = $proxy->getNumber($date);
             if ($result['code'] == 200) {
                 $data = array('code' => 200, 'data' => $result);
                 echo CJSON::encode($data);
             }
         }
     } else {
         $this->controller->render('workspacelist', array('data' => $result['data'], 'date' => $date));
     }
 }
Exemplo n.º 4
0
 public function run()
 {
     $this->controller->pageTitle = "Profile";
     if (Yii::app()->request->isAjaxRequest) {
         $id = Yii::app()->user->id;
         $user = User::model()->findByAttributes(array('id' => $id));
         $user->nickName = Yii::app()->request->getParam('nickName');
         $user->portrait = Yii::app()->request->getParam('portrait');
         Yii::app()->user->setState('portrait', Yii::app()->request->getParam('portrait'));
         $user->background = Yii::app()->request->getParam('background');
         $user->title = Yii::app()->request->getParam('title');
         $user->website = Yii::app()->request->getParam('website');
         $user->description = Assist::removeXSS(Yii::app()->request->getParam('description'));
         $user->birthday = Yii::app()->request->getParam('birthday');
         $user->gender = Yii::app()->request->getParam('gender');
         $user->location = Yii::app()->request->getParam('hub');
         $skills = preg_replace('/,+/', ',', Yii::app()->request->getParam('skills'));
         $skills = preg_replace('/,+/', ',', $skills);
         $user->skills = trim($skills, ',');
         $interests = preg_replace('/,+/', ',', Yii::app()->request->getParam('interests'));
         $interests = preg_replace('/,+/', ',', $interests);
         $user->interests = trim($interests, ',');
         //$user->wechatid = Yii::app()->request->getParam('wechatid');
         $user->facebookid = Yii::app()->request->getParam('facebookid');
         $user->twitterid = Yii::app()->request->getParam('twitterid');
         $user->linkedinid = Yii::app()->request->getParam('linkedinid');
         $user->instagramid = Yii::app()->request->getParam('instagramid');
         $status = Yii::app()->request->getParam('status');
         $code = Code::model()->findByAttributes(array('userId' => $id));
         if ($status == 1) {
             $user->status = 2;
         }
         $havecode = empty($code) ? 0 : 1;
         if ($user->save()) {
             echo CJSON::encode(array('code' => 200, 'message' => 'success', 'data' => $havecode));
         }
     } else {
         $id = Yii::app()->user->id;
         $user = User::model()->findByAttributes(array('id' => $id));
         $proxy = new CHub();
         $hub = $proxy->getHubList();
         $this->controller->render('updateProfile', array('user' => $user, 'hub' => $hub['data']));
     }
 }
Exemplo n.º 5
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));
     }
 }