/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = InfoBlock::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'position' => $this->position, 'ordering' => $this->ordering]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'options', $this->options]); return $dataProvider; }
public function run() { $lang = Lang::getCurrent(); switch ($lang->local) { case 'en-EN': $info_block_id = 6; break; case 'ru-RU': default: $info_block_id = 5; break; } $info_block = InfoBlock::getInfo($info_block_id); return $this->render('about', ['info_block' => $info_block]); }
public function run() { $info_block_id = 0; switch ($this->position) { case 1: $tmpl = 'banner-top'; $info_block_id = 1; break; case 2: $tmpl = 'banner-left'; $info_block_id = 3; break; case 3: $tmpl = 'banner-right'; $info_block_id = 4; break; } $info_block = InfoBlock::getInfo($info_block_id); return $this->render($tmpl, ['info_block' => $info_block]); }
public function run() { $info_block_id = 2; $info_block = InfoBlock::getInfo($info_block_id); return $this->render('slider', ['info_block' => $info_block]); }
/** * Finds the InfoBlock model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return InfoBlock the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = InfoBlock::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }