Exemplo n.º 1
0
 public function actionView($catslug, $slug)
 {
     $categoryModel = ContentCategory::find()->published()->joinWith(['translations'])->andWhere(['{{%content_category_lang}}.slug' => $catslug])->one();
     $model = ContentArticles::find()->published()->joinWith(['translations'])->andWhere(['{{%content_articles_lang}}.slug' => $slug])->one();
     if ($model === null and $categoryModel === null) {
         throw new NotFoundHttpException(\Yii::t('system', 'The requested page does not exist.'));
     }
     $breadcrumbs = Menu::getBreadcrumbs('content/' . $catslug . '/' . $slug);
     if (count($breadcrumbs) == 0) {
         $breadcrumbs = [['label' => $categoryModel->title, 'url' => Url::to(['/content/category/view', 'slug' => $categoryModel->slug])], ['label' => $model->title]];
     }
     return $this->render('view', ['breadcrumbs' => $breadcrumbs, 'model' => $model, 'categoryModel' => $categoryModel]);
 }
Exemplo n.º 2
0
 public function actionView($slug)
 {
     $model = ContentCategory::find()->joinWith(['translations'])->where(['{{%content_category_lang}}.slug' => $slug])->one();
     if ($model === null) {
         throw new NotFoundHttpException(\Yii::t('system', 'The requested page does not exist.'));
     }
     $breadcrumbs = Menu::getBreadcrumbs('content/' . $slug);
     if (count($breadcrumbs) == 0) {
         $breadcrumbs = ['label' => $model->title];
     }
     $dataProvider = new ActiveDataProvider(['query' => ContentArticles::find()->andWhere(['category_id' => $model->id])->orderBy(['published_at' => SORT_DESC])->published(), 'pagination' => ['defaultPageSize' => 10, 'forcePageParam' => false, 'pageSizeParam' => false]]);
     return $this->render('view', ['breadcrumbs' => $breadcrumbs, 'model' => $model, 'dataProvider' => $dataProvider]);
 }
Exemplo n.º 3
0
 public function actionView($slug, $slugMenu = null)
 {
     $model = $this->findModel($slug);
     if ($menu = MenuItems::find()->joinWith(['translations'])->andWhere(['{{%menu_items}}.disable_breadcrumbs' => 0])->andWhere(['or', ['{{%menu_items_lang}}.url' => 'page/' . $slug], ['{{%menu_items_lang}}.url' => '/page/' . $slug], ['{{%menu_items_lang}}.url' => \yii\helpers\Url::to(['/system/default']) . 'page/' . $slug]])->one()) {
         /*if(($mParent = $menu->parents(1)->one())) {
               $arr = explode('/', $mParent->url);
               var_dump($arr);
               if(end($arr) != $slugMenu)
                   throw new NotFoundHttpException('The requested page does not exist.');
           }*/
         $breadcrumbs = Menu::getBreadcrumbsById($menu->id);
     } else {
         $breadcrumbs = Menu::getBreadcrumbs('page/' . $slug);
     }
     return $this->render('view', ['breadcrumbs' => $breadcrumbs, 'model' => $model]);
 }
Exemplo n.º 4
0
        <div class="container logo-nav clearfix">
            <div class="col-md-12 col-lg-3 text-center logo-cont">
                <a <?php 
echo $isHome ? '' : 'href="' . \yii\helpers\Url::to(['/system/default']) . '"';
?>
 class="logo">
                    <img src="img/logo2.svg" alt="" width="212" height="62">
                </a>
            </div>

            <div class="col-md-12 col-lg-9 nav-all">
                <nav>
                    <h6 class="brgmenu">&nbsp;</h6>
                    <?php 
echo Menu::widget(['items' => ApiMenu::getMenuLvl(1, 0, 0), 'activeCssClass' => 'current', 'options' => ['class' => 'mainmenu text-center pull-right']]);
?>
                </nav>
            </div>
        </div>

        <div class="container back-link-numb clearfix">
            <div class="col-md-3 col-md-push-9">
                <a href="#" class="btn call">Заказать звонок</a>
                <div class="call-wrapp">
                    <p class="hidden js-thank-you">Спасибо, мы вас вот-вот наберем!</p>
                    <form action="#" method="get">
                        <label for="c-name">Имя</label>
                        <input type="text" name="name" id="c-name">
                        <label for="c-tel">Телефон</label>
                        <input type="tel" name="tel" id="c-tel">