Ejemplo n.º 1
0
 public function run()
 {
     parent::run();
     $limit_ad = FConfigParam::find()->where(['name' => 'NUMBER_AD_IN_BODY'])->one();
     if ($limit_ad) {
         $limit = $limit_ad->value;
     } else {
         $limit = 3;
     }
     $query = FAdvertise::find()->where(['is_show' => 1, 'position' => 'body', 'show_in' => $this->lan_center])->andwhere(['<=', 'start_at', new Expression('NOW()')])->andwhere(['>=', 'end_at', new Expression('NOW()')]);
     $advertise = $query->limit($limit)->all();
     return $this->render('@frontend/views/widgets/banner', ['advertises' => $advertise]);
 }
Ejemplo n.º 2
0
 public function run()
 {
     parent::run();
     $limit_ad = FConfigParam::find()->where(['name' => 'NUMBER_IMAGE_TOP'])->one();
     if ($limit_ad) {
         $limit = $limit_ad->value;
     } else {
         $limit = 3;
     }
     $query = FAdvertise::find()->where(['is_show' => 1, 'position' => 'top', 'type' => 'image', 'show_in' => $this->lan_center]);
     $advertise = $query->limit($limit)->all();
     $banner = null;
     if (!$advertise) {
         $query1 = FAdvertise::find()->where(['is_show' => 1, 'position' => 'top', 'type' => 'image', 'show_in' => null]);
         $banner = $query1->one();
         //print_r($banner);
         //die('hello');
     }
     return $this->render('@frontend/views/widgets/bannertop', ['advertises' => $advertise, 'banner' => $banner]);
 }