Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Menu::find()->joinWith('translations');
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => -1], 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
Beispiel #2
0
    $menuItems[] = ['label' => Yii::$app->user->identity->username, 'url' => ['/auth/default/profile']];
    $menuItems[] = ['label' => Yii::t('yee/auth', 'Logout'), 'url' => ['/auth/default/logout', 'language' => false], 'linkOptions' => ['data-method' => 'post']];
}
echo Nav::widget(['encodeLabels' => false, 'options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
echo LanguageSelector::widget(['display' => 'label', 'view' => 'pills']);
NavBar::end();
?>

    <div class="container">
        <div class="row">
            <div class="col-md-3">
                <div class="hidden-xs">
                    <?php 
$menuItemsKey = '__mainMenuItems' . Yii::$app->language;
if (!($menuItems = Yii::$app->cache->get($menuItemsKey))) {
    $menuItems = Menu::getMenuItems('main-menu');
    Yii::$app->cache->set($menuItemsKey, $menuItems, 3600);
}
echo Navigation::widget(['encodeLabels' => false, 'items' => $menuItems, 'options' => [['class' => 'nav nav-pills nav-stacked'], ['class' => 'nav nav-second-level'], ['class' => 'nav nav-third-level']]]);
?>
                </div>
                
                <div>
                    <?php 
echo RecentComments::widget();
?>
                </div>
            </div>
            <div class="col-md-9">
                <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
Beispiel #3
0
} else {
    $menuItems[] = ['label' => Yii::$app->user->identity->username, 'url' => ['/auth/default/profile']];
    $menuItems[] = ['label' => Yii::t('yee/auth', 'Logout'), 'url' => ['/auth/default/logout', 'language' => false], 'linkOptions' => ['data-method' => 'post']];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
echo LanguageSelector::widget(['display' => 'label', 'view' => 'pills']);
NavBar::end();
?>

    <div class="container">
        <div class="row">
            <div class="col-md-3">
                <div class="hidden-xs">
                    <?php 
if ($this->beginCache('main-menu', ['duration' => 3600])) {
    echo Navigation::widget(['encodeLabels' => false, 'items' => Menu::getMenuItems('main-menu'), 'options' => [['class' => 'nav nav-pills nav-stacked'], ['class' => 'nav nav-second-level'], ['class' => 'nav nav-third-level']]]);
    $this->endCache();
}
?>
                </div>
            </div>
            <div class="col-md-9">
                <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
                <?php 
echo Alert::widget();
?>
                <?php 
echo $content;
?>
Beispiel #4
0
    ?>
</span>
                            </div>
                        <?php 
}
?>
                        
                        <?php 
echo $form->field($model, 'alwaysVisible')->checkbox();
?>

                        <?php 
if ($model->isNewRecord) {
    ?>
                            <?php 
    echo $form->field($model, 'menu_id')->dropDownList(Menu::getMenus(), ['class' => 'clearfix form-control']);
    ?>
                        <?php 
}
?>
                        
                        <?php 
echo $form->field($model, 'image')->dropDownList(FA::getIconsList(), ['class' => 'clearfix form-control fa-font-family', 'encode' => false]);
?>

                        <div class="form-group">
                            <?php 
if ($model->isNewRecord) {
    ?>
                                <?php 
    echo Html::submitButton(Yii::t('yee', 'Create'), ['class' => 'btn btn-primary']);
Beispiel #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMenu()
 {
     return $this->hasOne(Menu::className(), ['id' => 'menu_id'])->joinWith('translations');
 }
Beispiel #6
0
            <div class="row">
                <div class="col-sm-12 text-right">
                    <?php 
echo GridPageSize::widget(['pjaxId' => 'menu-link-grid-pjax']);
?>
                </div>
            </div>

            <?php 
Pjax::begin(['id' => 'menu-link-grid-pjax']);
?>

            <?php 
echo GridView::widget(['id' => 'menu-link-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'bulkActionOptions' => ['gridId' => 'menu-link-grid', 'actions' => [Url::to(['bulk-delete']) => Yii::t('yee', 'Delete')]], 'columns' => [['class' => 'yeesoft\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['attribute' => 'image', 'value' => function (MenuLink $model) {
    return FA::icon($model->image)->fixedWidth();
}, 'format' => 'raw', 'contentOptions' => ['style' => 'width:20px; text-align:center;']], ['class' => 'yeesoft\\grid\\columns\\TitleActionColumn', 'controller' => '/menu/link', 'attribute' => 'id', 'title' => function (MenuLink $model) {
    return Html::a($model->label, ['/menu/link/update', 'id' => $model->id], ['data-pjax' => 0]);
}, 'format' => 'raw', 'buttonsTemplate' => '{update} {delete}', 'options' => ['style' => 'width:220px']], ['attribute' => 'menu_id', 'filter' => ArrayHelper::merge(['' => Yii::t('yee', 'Not Selected')], Menu::getMenus()), 'value' => function (MenuLink $model) {
    return $model->menu instanceof Menu ? $model->menu->title : Yii::t('yii', '(not set)');
}, 'format' => 'raw'], 'link', 'parent_id', 'order']]);
?>

            <?php 
Pjax::end();
?>
        </div>
    </div>
</div>


Beispiel #7
0
NavBar::begin(['brandLabel' => Html::img($logo, ['class' => 'yee-logo', 'alt' => 'YeeCMS']) . '<b>Yee</b> ' . Yii::t('yee', 'Control Panel'), 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-static-top', 'style' => 'margin-bottom: 0'], 'innerContainerOptions' => ['class' => 'container-fluid']]);
$menuItems = [['label' => str_replace('http://', '', Yii::$app->urlManager->hostInfo), 'url' => Yii::$app->urlManager->hostInfo]];
if (Yii::$app->user->isGuest) {
    $menuItems[] = ['label' => Yii::t('yee', 'Login'), 'url' => ['/auth/login']];
} else {
    $menuItems[] = ['label' => Yii::t('yee', 'Logout {username}', ['username' => Yii::$app->user->identity->username]), 'url' => Yii::$app->urlManager->hostInfo . '/auth/logout', 'linkOptions' => ['data-method' => 'post']];
}
echo Nav::widget(['encodeLabels' => false, 'options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
echo LanguageSelector::widget(['display' => 'label', 'view' => 'pills']);
NavBar::end();
?>

        <!-- SIDEBAR NAV -->
        <div class="navbar-default sidebar metismenu" role="navigation">
            <?php 
echo Nav::widget(['encodeLabels' => false, 'dropDownCaret' => '<span class="arrow"></span>', 'options' => [['class' => 'nav side-menu'], ['class' => 'nav nav-second-level'], ['class' => 'nav nav-third-level']], 'items' => Menu::getMenuItems('admin-menu')]);
?>
        </div>
        <!-- !SIDEBAR NAV -->
    </nav>

    <div id="page-wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12">
                    <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>

                    <?php 
if (Yii::$app->session->hasFlash('crudMessage')) {