Ejemplo n.º 1
0
 public function actionShow($id)
 {
     if (!$id) {
         $this->goHome();
     }
     //$this->layout = 'column2';
     $show = CmsShow::findOne($id);
     return $this->render($show->template_show, ['show' => $show, 'catalogId' => $show->catalog_id]);
 }
Ejemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CmsShow::find();
     $query->orderBy(['created_at' => SORT_DESC]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if ($this->load($params) && !$this->validate()) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'catalog_id' => $this->catalog_id, 'click' => $this->click, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'surname', $this->surname])->andFilterWhere(['like', 'brief', $this->brief])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'seo_title', $this->seo_title])->andFilterWhere(['like', 'seo_keywords', $this->seo_keywords])->andFilterWhere(['like', 'seo_description', $this->seo_description])->andFilterWhere(['like', 'banner', $this->banner])->andFilterWhere(['like', 'template_show', $this->template_show])->andFilterWhere(['like', 'author', $this->author]);
     return $dataProvider;
 }
Ejemplo n.º 3
0
 /**
  * Finds the CmsShow model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CmsShow the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CmsShow::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCmsShows()
 {
     return $this->hasMany(CmsShow::className(), ['catalog_id' => 'id']);
 }