/** * Manages all models. */ public function actionAdmin() { if (isset(Yii::app()->user->type) && Yii::app()->user->type == 1) { $dataProvider = new CActiveDataProvider('Maps', array('pagination' => array('pageSize' => 20))); } else { $dataProvider = new CActiveDataProvider('Maps', array('criteria' => array('condition' => 'id IN (SELECT map_id FROM tbl_map_account WHERE account_id=:account_id)', 'params' => array(':account_id' => Yii::app()->user->id)), 'pagination' => array('pageSize' => 20))); } $model = new Maps('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Maps'])) { $model->attributes = $_GET['Maps']; } $this->render('admin', array('model' => $model, 'dataProvider' => $dataProvider)); }