/** * Lists all Nav models. * @return mixed */ public function actionIndex($type = 'all') { if (!$this->is_access('navigator/index')) { Yii::$app->session->setFlash('error', $this->errorInfo); return $this->redirect($this->redirectUrl); } // 位置搜索 switch (strtolower($type)) { case 'top': $query = Nav::find()->where(['type' => 'top']); break; case 'middle': $query = Nav::find()->where(['type' => 'middle']); break; case 'bottom': $query = Nav::find()->where(['type' => 'bottom']); break; default: $query = Nav::find(); } $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 40]]); Yii::$app->view->params['meta_title'] = '自定义导航栏'; return $this->render('index', ['dataProvider' => $dataProvider]); }
public function actionIndex() { $nav = Nav::find()->orderBy('order asc')->all(); return $this->render('index', ['nav' => $nav]); }
//'cacheSettings' => ['enableCache' => true] // normally not needed to change 'rootOptions' => ['label'=>'<span class="text-primary">计生系统</span>'], 'softDelete' => true, 'cacheSettings' => ['enableCache' => true], 'iconEditSettings'=> [ 'show' => 'list', 'listData' => [ 'folder' => 'Folder', 'file' => 'File', 'star' => 'Star', 'bell' => 'Bell', ] ], ]);*/ echo \kartik\tree\TreeView::widget(['query' => \common\models\PreferencesTree::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => '<span class="text-info">系统参数配置</span>'], 'fontAwesome' => true, 'isAdmin' => true, 'displayValue' => 1, 'softDelete' => true, 'cacheSettings' => ['enableCache' => true], 'iconEditSettings' => ['show' => 'list', 'listData' => ['folder' => 'Folder', 'file' => 'File', 'star' => 'Star', 'bell' => 'Bell']], 'nodeAddlViews' => [\kartik\tree\Module::VIEW_PART_2 => '@common/views/treemanager/_preferencesTree']]); echo \kartik\tree\TreeView::widget(['query' => \common\models\Nav::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => '<span class="text-info">系统参数配置</span>'], 'fontAwesome' => true, 'isAdmin' => true, 'displayValue' => 1, 'softDelete' => true, 'cacheSettings' => ['enableCache' => true], 'iconEditSettings' => ['show' => 'list', 'listData' => ['folder' => 'Folder', 'file' => 'File', 'star' => 'Star', 'bell' => 'Bell']], 'nodeAddlViews' => [\kartik\tree\Module::VIEW_PART_2 => '@common/views/treemanager/_nav']]); \common\widgets\JsBlock::begin(); ?> <script type="text/javascript"> $(document).ready(function() { var switcher1 = $('#switchCheck1').switcher(); var switcher2 = $('.switch').switcher(); $('#switchCheck1').switcher().on('change', function() { console.log(1111); }); $('#calendar').fullCalendar({ theme: true, header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay'
public function actionDelete() { $id = (int) \Yii::$app->request->post('id', 0); $row = Nav::find()->select('ctype,cid,type')->where($id)->one(); if ($row['type'] == 'middle' && $row['ctype'] && $row['cid']) { Nav::setShowInNav($row['ctype'], $row['cid'], 0); } if (!Nav::deleteAll('id=:id', [':id' => $id])) { exit(Json::encode(['success' => false])); } exit(Json::encode(['success' => true])); }
/** * Lists all Nav models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Nav::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }