Ejemplo n.º 1
0
 /**
  * Finds the Theme model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Theme the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($themeModel = Theme::findOne($id)) !== null) {
         return $themeModel;
     } else {
         throw new NotFoundHttpException(Yii::t("app", "The requested page does not exist."));
     }
 }
Ejemplo n.º 2
0
 /**
  * Displays a single Form Data model for preview
  *
  * @param $id
  * @param null $theme_id
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionPreview($id, $theme_id = null)
 {
     $this->layout = "public";
     $formModel = $this->findFormModel($id);
     $formDataModel = $formModel->formData;
     $themeModel = null;
     if (isset($theme_id) && $theme_id > 0) {
         $themeModel = Theme::findOne($theme_id);
     }
     return $this->render('preview', ['formModel' => $formModel, 'formDataModel' => $formDataModel, 'themeModel' => $themeModel]);
 }