/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  *
  * @return void
  */
 public function actionCreate()
 {
     $model = new ContentBlock();
     if (($data = Yii::app()->getRequest()->getPost('ContentBlock')) !== null) {
         $model->setAttributes($data);
         if ($model->save()) {
             Yii::app()->getUser()->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('ContentBlockModule.contentblock', 'New content block was added!'));
             $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['create']));
         }
     }
     $this->render('create', ['model' => $model]);
 }
示例#2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new ContentBlock();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['ContentBlock'])) {
         $model->attributes = $_POST['ContentBlock'];
         if ($model->save()) {
             Yii::app()->user->setFlash(YFlashMessages::NOTICE_MESSAGE, Yii::t('contentblock', 'Новый контент блок добавлен!'));
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  *
  * @return void
  */
 public function actionCreate()
 {
     $model = new ContentBlock();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (($data = Yii::app()->getRequest()->getPost('ContentBlock')) !== null) {
         $model->setAttributes($data);
         if ($model->save()) {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('ContentBlockModule.contentblock', 'New content block was added!'));
             $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', array('create')));
         }
     }
     $this->render('create', array('model' => $model));
 }