Example #1
0
 /**
  * Creates a new Section model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Article();
     $model->scenario = 'create';
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if (Yii::$app->request->post('isPublish', 0) == 1) {
             $model->status = Section::STATUS_PUBLISH;
         }
         $model->create();
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         Yii::$app->session->set('KCFINDER', ['disabled' => false, 'uploadURL' => '/upload', 'uploadDir' => '../../../backend/web/upload']);
         return $this->render('create', ['model' => $model]);
     }
 }