protected function beforeAction($action) { $actions = array('create', 'update'); if (in_array($action->id, $actions)) { $this->hideSidebar = true; } return parent::beforeAction($action); }
protected function beforeAction($action) { $actions = array('index', 'create'); if (in_array($action->id, $actions)) { $this->table_id = (int) Yii::app()->getRequest()->getParam('table_id'); } return parent::beforeAction($action); }
protected function beforeAction($action) { $actions = array('index', 'create'); if (in_array($action->id, $actions)) { $this->course_id = (int) Yii::app()->getRequest()->getParam('course_id'); $this->course = Course::model()->findByPk($this->course_id); } return parent::beforeAction($action); }
protected function beforeAction($action) { $actions = array('index', 'create'); if (in_array($action->id, $actions)) { $this->employee_id = (int) Yii::app()->getRequest()->getParam('employee_id'); if (!$this->employee_id) { throw new CHttpException(400, 'Не установлен ID сотрудника'); } } return parent::beforeAction($action); }
protected function beforeAction($action) { $actions = ['index', 'create']; if (in_array($action->id, $actions)) { $this->item_id = (int) Yii::app()->getRequest()->getParam('item_id'); if (!$this->item_id) { throw new CHttpException(400, 'Не установлен ID объекта'); } } return parent::beforeAction($action); }
protected function beforeAction($action) { $actions = array('index', 'create'); if (in_array($action->id, $actions)) { $this->poll_id = Yii::app()->getRequest()->getParam('poll_id'); if (!$this->poll_id) { throw new CHttpException(400, 'Не установлен ID опроса'); } } return parent::beforeAction($action); }
protected function beforeAction($action) { $actions = array('index', 'create'); if (in_array($action->id, $actions)) { $this->item_id = (int) Yii::app()->getRequest()->getParam('item_id'); if (!$this->item_id) { throw new CHttpException(400, 'Не установлен ID категории'); } if (($this->item = PortfolioCategory::model()->findByPk($this->item_id)) === null) { throw new CHttpException(404, 'Кталогия не найдена'); } } return parent::beforeAction($action); }
protected function beforeAction($action) { $actions = array('index', 'create'); if (in_array($action->id, $actions)) { $this->item_id = (int) Yii::app()->getRequest()->getParam('item_id'); if (!$this->item_id) { throw new CHttpException(400, 'Не установлен ID товара'); } if (($this->item = Product::model()->findByPk($this->item_id)) === null) { throw new CHttpException(404, 'Товар не найден'); } } return parent::beforeAction($action); }
protected function beforeAction($action) { $actions = array('index'); if (in_array($action->id, $actions)) { $this->package_id = (int) Yii::app()->getRequest()->getParam('package_id'); if (!$this->package_id) { throw new CHttpException(400, 'Не установлен ID пакета'); } if (($this->package = Package::model()->findByPk($this->package_id)) === null) { throw new CHttpException(404, 'Пакет не найден'); } } return parent::beforeAction($action); }
public function beforeAction($action) { switch ($action->id) { case 'updateBase': header("Content-Type: text/event-stream"); header("Cache-Control: no-cache"); header("Connection: keep-alive"); set_time_limit(0); break; default: break; } return parent::beforeAction($action); }
protected function beforeAction($action) { $actions = array('index', 'create', 'paste'); if (in_array($action->id, $actions)) { $this->entity_type = Yii::app()->getRequest()->getParam('entity_type'); $this->entity_id = Yii::app()->getRequest()->getParam('entity_id'); if (!$this->entity_id) { throw new CHttpException(400, 'Не установлен ID записи'); } if (!$this->entity_type) { throw new CHttpException(400, 'Не установлен тип блоков'); } } return parent::beforeAction($action); }
protected function beforeAction($action) { $actions = array('index', 'create'); if (in_array($action->id, $actions)) { $this->question_id = (int) Yii::app()->getRequest()->getParam('question_id'); if (!$this->question_id) { throw new CHttpException(400, 'Не установлен ID ыопроса'); } if (($this->question = Question::model()->findByPk($this->question_id)) === null) { throw new CHttpException(404, 'Вопрос не найден'); } if (!in_array($this->question->type, array(Question::TYPE_VARIANT, Question::TYPE_MULTIPLE))) { throw new CHttpException(400, 'Для данного типа вопросов не предусмотрено добавление вариантов ответа'); } } return parent::beforeAction($action); }