public function run()
 {
     parent::run();
     // TODO: Change the autogenerated stub
     $advertingModel = new Advertising();
     $nodes = $advertingModel->find()->where(['position' => 'home_product'])->limit(10)->all();
     return $this->render('FrontProductWidget', ['nodes' => $nodes]);
 }
 public function run()
 {
     parent::run();
     // TODO: Change the autogenerated stub
     $advertingModel = new Advertising();
     $nodes = $advertingModel->find()->where(['position' => 'slideshow'])->all();
     return $this->render('SlideshowWidget', ['nodes' => $nodes]);
 }
 public function run()
 {
     parent::run();
     // TODO: Change the autogenerated stub
     $nodes = Advertising::find()->where(['position' => 'top_center_left', 'status' => 10])->all();
     return $this->render('AdsTopCenterLeftWidget', ['nodes' => $nodes]);
 }
 public function run()
 {
     parent::run();
     // TODO: Change the autogenerated stub
     $nodes = Advertising::findOne(['position' => 'right_top']);
     return $this->render('AdsRightTopWidget', ['nodes' => $nodes]);
 }
 public function run()
 {
     parent::run();
     // TODO: Change the autogenerated stub
     $nodes = Advertising::find()->where(['position' => 'middle_center'])->limit(4)->all();
     return $this->render('AdsMiddleCenterWidget', ['nodes' => $nodes]);
 }
 /**
  * Finds the Page model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Page the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Advertising::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Advertising::find();
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'position', $this->position])->andFilterWhere(['like', 'image', $this->image])->andFilterWhere(['like', 'link', $this->link]);
     return $dataProvider;
 }