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)); }
/** * 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'); }
/** * 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; }