public function actionPlace() { $this->_seoTitle = '名师 - 场地订单'; $criteria = new CDbCriteria(); //$placeBookings = PlaceBooking::Model()->findAllByAttributes(array('teacher_id' => $this->_user['masterId']), new CDbCriteria(array('order'=>'date DESC'))); $criteria->order = 'date DESC'; //分页 $count = PlaceBooking::model()->count($criteria->addCondition("teacher_id = " . $this->_user['masterId'])); $pager = new CPagination($count); $pager->pageSize = 5; $pager->applyLimit($criteria); $placeBookings = PlaceBooking::model()->findAll($criteria); $this->render('place', array('placeBookings' => $placeBookings, 'count' => $count, 'pager' => $pager)); }
<?php echo $form->dropDownList($model, 'city', array('1' => '北京', '2' => '上海', '3' => '深圳', '4' => '广州'), array('id' => 'inputCity', 'class' => 'form-control selectpicker show-menu-arrow', 'data-size' => '12', 'title' => '请选择您所在的地区')); ?> <?php echo $form->error($model, 'city'); ?> </div> </div> <div class="form-group"> <label for="inputPlace" class="col-xs-2 control-label">授课场地:</label> <div class="col-xs-6"> <?php $placeBooking = PlaceBooking::model()->findAllByAttributes(array('teacher_id' => $this->_user['masterId'])); if ($placeBooking == null) { echo $form->textField($model, 'place_id', array('class' => 'form-control', 'placeholder' => '您暂未预定场地', 'value' => '', 'readonly' => 'readonly')); echo $form->error($model, 'place_id'); } else { foreach ($placeBooking as $pbs) { $place = Place::model()->findAllByAttributes(array('id' => $pbs->place_id)); foreach ($place as $ps) { $value = (int) $ps->id; $text = $ps->name; $placeList[$value] = (string) $text; } } echo $form->dropDownList($model, 'place_id', $placeList, array('id' => 'inputPlace', 'class' => 'form-control selectpicker show-menu-arrow', 'data-size' => '12', 'title' => '请选择您所预订的场地')); echo $form->error($model, 'place_id'); }