/** * Управление Предметами. * * @return void */ public function actionIndex() { $model = new Subject('search'); $model->unsetAttributes(); // clear any default values if (Yii::app()->getRequest()->getParam('Subject') !== null) { $model->setAttributes(Yii::app()->getRequest()->getParam('Subject')); } $this->render('index', ['model' => $model]); }
/** * Manages all models. */ public function actionAdmin() { $model = new Subject('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Subject'])) { $model->attributes = $_GET['Subject']; } $this->render('admin', array('model' => $model)); }
/** * Управление Предметами. * * @return void */ public function actionIndex() { $roles = ['1', '5', '4', '3']; $role = \Yii::app()->user->role; if (array_intersect($role, $roles)) { $model = new Subject('search'); $model->unsetAttributes(); // clear any default values if (Yii::app()->getRequest()->getParam('Subject') !== null) { $model->setAttributes(Yii::app()->getRequest()->getParam('Subject')); } $this->render('index', ['model' => $model]); } else { throw new CHttpException(403, 'Ошибка прав доступа.'); } }