Esempio n. 1
0
 public function actionPreview($id, $category_id)
 {
     $model = $this->findModel($id);
     $category = CmsFaqCategories::findOne(['id' => $category_id]);
     $this->layout = 'preview';
     return $this->render('@frontend/views/faq/view', ['model' => $model, 'category' => $category]);
 }
Esempio n. 2
0
 /**
  * Updates an existing CmsFaq model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id, $category_id)
 {
     $model = $this->findModel($id);
     $categoryModel = CmsFaqCategories::findOne($category_id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->getSession()->setFlash('success', 'Successfully updated.');
         return $this->redirect(['cms-faq/update', 'id' => $model->id, 'category_id' => $category_id]);
     }
     $languages = Lang::find()->all();
     $languageDefault = Lang::findOne(['default' => 1]);
     return $this->render('update', ['model' => $model, 'languages' => $languages, 'languageDefault' => $languageDefault, 'categoryModel' => $categoryModel]);
 }