protected function calenderRoom($cal_id) { $tempArr = array(); $orders = Order::model()->findAll(array('select'=>'id,name','condition'=>"cal_id=$cal_id and status=1")); if($orders){ foreach($orders as $order){ $roomModel = ORderRoom::model()->findAll(array('condition'=>"oid=$order->id")); foreach($roomModel as $room){ $tempArr[] = array($room->id,$room->oid,$order->name,$room->aduit,$room->child,$room->type,$room->price); } } } return $tempArr; }
public function actionRoomList($cid) { $cal_id = intval($cid); $arr = $this->orderStatistics($cal_id); /* $tempArr = $this->calenderRoom($cal_id); */ $OModel = new Order; $criteria=new CDbCriteria; $criteria->select = 'id,name'; $criteria->condition = "cal_id=$cal_id and status=1"; $count=$OModel->count($criteria); $pages=new CPagination($count); $pages->pageSize=5; $pages->applyLimit($criteria); $orders = $OModel->findAll($criteria); $tempArr = array(); if($orders){ foreach($orders as $order){ $roomModel = ORderRoom::model()->findAll(array('condition'=>"oid=$order->id")); foreach($roomModel as $room){ $tempArr[] = array($room->id,$room->oid,$order->name,$room->aduit,$room->child,$room->type,$room->price); } } } $this->render('roomList',array( 'arr'=>$arr, 'cal_id'=>$cal_id, 'tempArr'=>$tempArr, 'pages'=>$pages, )); }