/** * @return array list of menu items for each levels */ protected function prepareRawTree() { if (!$this->_tableRows) { $this->_tableRows = StructureRecord::find()->orderBy(['level' => SORT_ASC, 'sort' => SORT_ASC])->all(); } return $this; }
protected function _getArrayForArticle(ArticleRecord $modelArticle) { $arBreadcrumbs = $this->_arrayInit(); // assume that two-level menu is actual structure, only this case! $firstLevelStructure = StructureRecord::find()->where(['id' => $modelArticle->parent_id])->one(); if (!$firstLevelStructure) { throw new \Exception("Breadcrumbs error, article must have parent structure item"); } $parent_id = (int) $firstLevelStructure->parent_id; if (!$parent_id) { $arBreadcrumbs[] = ['label' => $firstLevelStructure->label, 'url' => '/' . $firstLevelStructure->seourl]; } else { $secondLevelStructure = StructureRecord::find()->where(['id' => $firstLevelStructure->parent_id])->one(); if (!$secondLevelStructure) { throw new \Exception("Breadcrumbs error, no structure item with id = " . $firstLevelStructure->parent_id); } $arBreadcrumbs[] = ['label' => $secondLevelStructure->label, 'url' => '/' . $secondLevelStructure->seourl]; $arBreadcrumbs[] = ['label' => $firstLevelStructure->label, 'url' => '/' . $firstLevelStructure->seourl]; } $arBreadcrumbs[] = ['label' => $modelArticle->name, 'url' => false]; return $arBreadcrumbs; }
protected function _tryToGetContent($seourl) { $seourl = htmlspecialchars($seourl); if (!$seourl) { return ['type' => 'homepage', 'model' => null]; } // find in static pages $structureModel = new StructureRecord(); $page = $structureModel->find()->where(['seourl' => $seourl])->one(); if ($page) { $allowed = Yii::$app->mainMenu->checkContentPageCode($page->code); if ($allowed) { return ['type' => 'page', 'model' => $page]; } } // find in static articles $articleModel = new ArticleRecord(); $article = $articleModel->find()->where(['seourl' => $seourl, 'active' => ArticleRecord::STATUS_IS_ACTIVE])->andWhere('active_from < ' . time())->one(); if ($article) { return ['type' => 'article', 'model' => $article]; } return false; }
<div class="clear"></div> <div class="tab1_body tab_body"> <?php echo EventsWidget::widget(['mode' => 'all']); ?> <div class="clear" style="height:18px;"></div> <!-- buttons --> <a href="/Zarabotok-na-sobytijah" class="btn_red">Как заработать на событии</a> <a href="https://iqoption.com/ru" class="btn_red" rel="nofollow" target="_blank" style="margin-left:20px;">Открыть счет</a> <!-- end buttons --> </div> <div class="tab2_body tab_body"> <?php $binpage = StructureRecord::find()->where(['code' => 'content_bin'])->one(); if ($binpage) { echo $binpage->content; } ?> </div> </div> </div> <?php /* <h1 class="caption blue"><span>Торговая стратегия бинарных опционов 60 секунд (h1)</span></h1> <div class="padding37"> <div id="breadcrumbs"> <a href="#">Главная</a> / <a href="#">Стратегии</a> /