Exemple #1
0
 public function actionCatchDef($url = null)
 {
     /////////////////////////
     $links = Links::find()->where(['categories_id' => 3])->all();
     $ads = TorAds::find()->all();
     /////////////////////////
     $link = Links::findOne(['url' => '/' . $url]);
     if (!$link) {
         return $this->render('/site/develop', ['links' => $links, 'ads' => $ads]);
     }
     $link = Links::findOne(['url' => '/' . $url]);
     if (!$link) {
         return $this->render('/site/develop');
     }
     $this->layout = $link->layout->name;
     Yii::$app->view->registerMetaTag(['description' => $link->description]);
     Yii::$app->view->registerMetaTag(['keywords' => $link->keywords]);
     $parent = Links::findOne($link->parent);
     if (isset($link->id)) {
         $content = false;
         for ($c = 0; $c < count($link->contents); $c++) {
             $reg = '/\\{\\{(.*)\\}\\}/';
             $content = preg_replace_callback('/(\\{{)(\\S+)(}})/', "self::getModule", $link->contents[0]->content);
             $content = preg_replace_callback('/(\\[\\[)(\\S+)(]])/', "self::getWidget", $content);
         }
     }
     return $this->render($link->view->name, ['link' => $link, 'content' => $content]);
 }
Exemple #2
0
 public function run()
 {
     $user = User::findOne(Yii::$app->user->id);
     echo Nav::widget(['items' => [['label' => 'Контактная информация', 'url' => ['/tor/profile']], ['label' => 'Добавить лот на продажу', 'url' => ['/tor/mng-ad']], ['label' => 'Мои объявления <span class="badge">' . TorAds::find()->count() . '</span>', 'url' => ['/tor/my-ads']], ['label' => 'Пополнить баланс ', 'url' => ['/']], ['label' => 'История платежей', 'url' => ['/']], ['label' => 'Реферальная ссылка', 'url' => ['/']]], 'options' => ['class' => 'account-nav'], 'encodeLabels' => false]);
     $view = $this->view;
     NavAsset::register($view);
 }
Exemple #3
0
 public function run()
 {
     $ads = TorAds::find()->orderBy(['created_at' => SORT_ASC, 'price' => SORT_ASC])->limit(20)->all();
     $ads_promo = TorAds::find()->limit(5)->orderBy(['created_at' => rand()])->all();
     if ($ads) {
         echo $this->render('preview', ['ads' => $ads, 'ads_promo' => $ads_promo]);
     }
     $view = $this->view;
     TorAdsAsset::register($view);
 }
Exemple #4
0
 public function run()
 {
     $link = Links::findOne(['url' => '/' . $this->url]);
     $this->links_id[] = $link->id;
     if ($link->child_exist == 1) {
         $this->getLinksId($link->id);
     }
     $ads = TorAds::find()->where(['links_id' => $this->links_id])->orderBy(['created_at' => SORT_ASC, 'price' => SORT_ASC])->limit(20)->all();
     $ads_promo = TorAds::find()->where(['links_id' => $this->links_id])->limit(5)->orderBy(['created_at' => rand()])->all();
     if ($ads) {
         echo $this->render('preview', ['ads' => $ads, 'ads_promo' => $ads_promo]);
     } else {
         echo Html::tag('div', '<em>Для заданных параметров товар не найден</em>', ['class' => 'text-center text-muted']);
     }
     $view = $this->view;
     TorAdsAsset::register($view);
 }
Exemple #5
0
 public function actionMyAds()
 {
     $ads = TorAds::find()->where(['user_id' => Yii::$app->user->id])->orderBy(['created_at' => SORT_ASC])->all();
     return $this->render('/tor/myAds', ['ads' => $ads]);
 }
Exemple #6
0
 public function init()
 {
     $this->torAd = TorAds::findOne($this->adId);
     parent::init();
 }