コード例 #1
0
ファイル: TreeMenu.php プロジェクト: kashirin/kscms
 /**
  * @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;
 }
コード例 #2
0
ファイル: SiteController.php プロジェクト: kashirin/kscms
 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;
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 /**
  * Finds the StructureRecord model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return StructureRecord the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = StructureRecord::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #5
0
ファイル: SiteController.php プロジェクト: kashirin/kscms
 public function actionDashboard($parent_id = 0)
 {
     return $this->render('dashboard', ['menu_items' => StructureRecord::findAll(['parent_id' => $parent_id])]);
 }
コード例 #6
0
ファイル: index.php プロジェクト: kashirin/kscms
                <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> /
コード例 #7
0
ファイル: index.php プロジェクト: kashirin/kscms
<?php

use yii\helpers\Html;
use backend\models\structure\StructureRecord;
$this->title = StructureRecord::findOne(\yii::$app->getRequest()->getQueryParam('parent_id'))->label;
$this->params['breadcrumbs'][] = $this->title;
?>


<?php 
echo $searchModel->getList($searchModel, $dataProvider);
コード例 #8
0
ファイル: ArticleRecord.php プロジェクト: kashirin/kscms
 public function getStructure()
 {
     return $this->hasOne(StructureRecord::className(), ['id' => 'parent_id']);
 }