public function run() { $route = explode('/', Yii::app()->controller->route); $controller = array_shift($route); if ($controller == 'xe-tim-khach') { $this->url = Yii::app()->request->baseUrl . '/xe-tim-khach/loc-theo-xe/'; } else { $this->url = Yii::app()->request->baseUrl . '/khach-tim-xe/loc-theo-xe/'; } $loaiXeGhep = Loaixeghep::model()->findAll(); $this->render('filter', array('loaiXeGhep' => $loaiXeGhep)); }
<p class="la">Tỉnh/Thành phố</p> </td> <td><?php echo $form->dropDownList($khachTimXe, 'noi_den_tinh', Province::listProvinces(), array('class' => 'form-control ma')); ?> <?php echo $form->error($khachTimXe, 'noi_den_tinh'); ?> </td> </tr> <tr> <td> <p class="la">Loại xe ghép</p> </td> <td><?php echo $form->dropDownList($khachTimXe, 'ma_loai_xe_ghep', Loaixeghep::optionLoaiXeGhep(), array('class' => 'form-control ma')); ?> <?php echo $form->error($khachTimXe, 'ma_loai_xe_ghep'); ?> </td> <td> <p class="la">Ngày khởi hành</p> </td> <td><?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'ngay_khoi_hanh', 'options' => array('showAnim' => 'slideDown', 'changeMonth' => true, 'changeYear' => true, 'minDate' => '2015-01-01', 'dateFormat' => 'yy-mm-dd'), 'htmlOptions' => array('class' => 'form-control ma'))); ?> </td> </tr> <tr> <td>
<?php return array('elements' => array('tinkhachhang' => array('type' => 'form', 'title' => 'Sửa tin đăng:', 'elements' => array('<div class="col-xs-12 col-sm-6 col-md-6">', 'nguoi_lien_lac' => array('type' => 'text', 'class' => 'form-control'), '</div>' . '<div class="col-xs-12 col-sm-5 col-md-5 pull-right">', 'so_dien_thoai' => array('type' => 'text', 'class' => 'form-control'), '</div>' . '<div class="clearfix"></div>' . '<div class="col-xs-12 col-sm-6 col-md-6">', 'tieu_de_tin' => array('type' => 'text', 'class' => 'form-control'), '</div>' . '<div class="col-xs-12 col-sm-5 col-md-5 pull-right">', 'tinh_thanh' => array('type' => 'dropdownlist', 'items' => Province::listProvinces(), 'class' => 'form-control'), '</div>' . '<div class="clearfix"></div>' . '<div class="col-xs-12 col-sm-6 col-md-6">', 'trang_thai' => array('type' => 'dropdownlist', 'items' => Tinghepxe::getStatusTinDang(), 'class' => 'form-control'), '</div>' . '<div class="col-md-12">', 'noi_dung_tin' => array('type' => 'textarea', 'rows' => '10', 'class' => 'form-control', 'id' => 'noi-dung-tin'), '</div>')), 'tinghepxe' => array('type' => 'form', 'elements' => array('<div class ="col-md-6">', 'dia_chi_di' => ['type' => 'text', 'class' => 'form-control'], '</div>' . '<div class ="col-md-5 pull-right">', 'dia_chi_den' => ['type' => 'text', 'class' => 'form-control'], '</div>' . '<div class="clearfix"></div>' . '<div class ="col-md-6">', 'noi_den_tinh' => ['type' => 'dropdownlist', 'items' => Province::listProvinces(), 'class' => 'form-control'], '</div>' . '<div class ="col-md-5 pull-right">', 'ma_loai_xe_ghep' => ['type' => 'dropdownlist', 'items' => Loaixeghep::optionLoaiXeGhep(), 'class' => 'form-control'], '</div>' . '<div class="clearfix"></div>' . '<div class ="col-md-3">', 'ngay_khoi_hanh' => ['type' => 'date', 'class' => 'form-control'], '</div>'))), 'buttons' => array('<div class="col-md-12 text-center">', 'dangtin' => array('type' => 'submit', 'label' => 'Đăng tin', 'class' => 'btn-success'), '</div>'));
/** * Lấy ra danh sách loại xe ghép theo kiểu mảng với ma_loai_xe_ghep là key, * loai_xe_ghep là value * @return array */ public static function optionLoaiXeGhep() { return CHtml::listData(Loaixeghep::model()->findAll(), 'ma_loai_xe_ghep', 'loai_xe_ghep'); }
<?php return array('elements' => array('tinkhachhang' => array('type' => 'form', 'title' => 'Đăng tin khách tìm xe:', 'elements' => array('ma_khach_hang' => array('type' => 'hidden', 'value' => Yii::app()->user->userId), '<div class="col-xs-12 col-sm-6 col-md-6">', 'nguoi_lien_lac' => array('type' => 'text', 'class' => 'form-control'), '</div>' . '<div class="col-xs-12 col-sm-5 col-md-5 pull-right">', 'so_dien_thoai' => array('type' => 'text', 'class' => 'form-control'), '</div>' . '<div class="clearfix"></div>' . '<div class="col-xs-12 col-sm-6 col-md-6">', 'tieu_de_tin' => array('type' => 'text', 'class' => 'form-control'), '</div>' . '<div class="col-xs-12 col-sm-5 col-md-5 pull-right">', 'tinh_thanh' => array('type' => 'dropdownlist', 'items' => Province::listProvinces(), 'class' => 'form-control'), '</div>' . '<div class="col-md-12">', 'noi_dung_tin' => array('type' => 'textarea', 'rows' => '10', 'class' => 'form-control', 'id' => 'noi-dung-tin'), '</div>')), 'tinghepxe' => array('type' => 'form', 'elements' => array('<div class ="col-md-6">', 'dia_chi_di' => ['type' => 'text', 'class' => 'form-control'], '</div>' . '<div class ="col-md-5 pull-right">', 'dia_chi_den' => ['type' => 'text', 'class' => 'form-control'], '</div>' . '<div class="clearfix"></div>' . '<div class ="col-md-6">', 'noi_den_tinh' => ['type' => 'dropdownlist', 'items' => Province::listProvinces(), 'class' => 'form-control'], '</div>' . '<div class ="col-md-5 pull-right">', 'ma_loai_xe_ghep' => ['type' => 'dropdownlist', 'items' => Loaixeghep::optionLoaiXeGhep(), 'class' => 'form-control'], '</div>' . '<div class="clearfix"></div>' . '<div class ="col-md-3">', 'ngay_khoi_hanh' => ['type' => 'zii.widgets.jui.CJuiDatePicker', 'options' => array('showAnim' => 'slideDown', 'changeMonth' => true, 'changeYear' => true, 'minDate' => '2015-01-01', 'dateFormat' => 'yy-mm-dd'), 'htmlOptions' => array('class' => 'form-control')], '</div>'))), 'buttons' => array('<div class="col-md-12 text-center">', 'dangtin' => array('type' => 'submit', 'label' => 'Đăng tin', 'class' => 'btn-success'), '</div>'));
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Loaixeghep the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Loaixeghep::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }