當前位置: 首頁>>代碼示例>>PHP>>正文


PHP bootstrap\Nav類代碼示例

本文整理匯總了PHP中yii\bootstrap\Nav的典型用法代碼示例。如果您正苦於以下問題:PHP Nav類的具體用法?PHP Nav怎麽用?PHP Nav使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Nav類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 public function run()
 {
     $user = User::findOne(Yii::$app->user->id);
     echo Nav::widget(['items' => [['label' => 'Контактная информация', 'url' => ['/tor/profile']], ['label' => 'Добавить лот на продажу', 'url' => ['/tor/mng-ad']], ['label' => 'Мои объявления <span class="badge">' . TorAds::find()->count() . '</span>', 'url' => ['/tor/my-ads']], ['label' => 'Пополнить баланс ', 'url' => ['/']], ['label' => 'История платежей', 'url' => ['/']], ['label' => 'Реферальная ссылка', 'url' => ['/']]], 'options' => ['class' => 'account-nav'], 'encodeLabels' => false]);
     $view = $this->view;
     NavAsset::register($view);
 }
開發者ID:mark38,項目名稱:yii2-tor,代碼行數:7,代碼來源:Account.php

示例2: run

    public function run()
    {
        $chatModel = new \nitm\widgets\models\Replies(['constrain' => ['type' => 'chat']]);
        $notificationModel = new \nitm\widgets\models\Notification(['constrain' => ['user_id' => \Yii::$app->user->getId()], 'queryOptions' => ['read' => 0]]);
        $uniqid = uniqid();
        $chatWidget = Nav::widget(['encodeLabels' => false, 'options' => ['id' => 'communication-center-messages-wrapper' . $uniqid, 'class' => 'nav navbar-right navbar-nav'], 'items' => [['label' => Icon::show('comment') . Html::tag('span', $chatModel->hasNew(), ['class' => 'badge']), 'options' => ['class' => !$chatModel->hasNew() ? 'text-disabled' : 'text-success'], 'linkOptions' => ['id' => 'communication-center-messages-button' . $uniqid, 'title' => 'Click here again to refresh the info', 'role' => 'dynamicValue', 'data-run-once' => 1, 'data-animation-target' => '#chat' . $uniqid, 'data-animation-start-only' => 1, 'data-type' => 'html', 'data-id' => '#chat' . $uniqid, 'data-url' => \Yii::$app->urlManager->createUrl(['/reply/index/chat/0', '__format' => 'html', \nitm\widgets\models\Replies::FORM_PARAM => true])], 'items' => [['label' => Html::tag('div', Html::tag('h2', 'Loading Messages...', ['class' => 'text-center']) . Html::script('$("#communication-center-messages-button' . $uniqid . '").one("mouseover", function (event) {
								$(this).trigger("click");
							})', ['type' => 'text/javascript']), ['role' => 'chatParent', 'id' => 'chat' . $uniqid, 'class' => '']), 'options' => $this->contentOptions]]]]]);
        $alertWidget = Nav::widget(['encodeLabels' => false, 'options' => ['id' => 'communication-center-notifications-wrapper' . $uniqid, 'class' => 'nav navbar-right navbar-nav'], 'items' => [['label' => Icon::show('bell') . Html::tag('span', $notificationModel->count(), ['class' => 'badge']), 'options' => ['class' => !$notificationModel->count() ? 'bg-disabled' : 'bg-success'], 'linkOptions' => ['id' => 'communication-center-notifications-button' . $uniqid, 'title' => 'Click here again to refresh the info', 'role' => 'dynamicValue', 'data-run-once' => 1, 'data-animation-target' => '#communication-center-notifications' . $uniqid, 'data-animation-start-only' => 1, 'data-type' => 'html', 'data-id' => '#communication-center-notifications' . $uniqid, 'data-url' => \Yii::$app->urlManager->createUrl(['/alerts/notifications', '__format' => 'html'])], 'items' => [['label' => Html::tag('div', Html::tag('h2', 'Loading Alerts...', ['class' => 'text-center']) . Html::script('$("#communication-center-notifications-button' . $uniqid . '").one("mouseover", function (event) {
								$(this).trigger("click");
							})', ['type' => 'text/javascript']), ['id' => 'communication-center-notifications' . $uniqid, 'class' => '']), 'options' => $this->contentOptions]]]]]);
        $widget = $alertWidget . $chatWidget;
        //$js = "\$nitm.onModuleLoad('communication-center', function (module) {
        //	module.initChatTabs('#".$this->options['id']."');
        //});";
        $js = "";
        if ($this->chatUpdateOptions['enabled']) {
            $js .= "\$nitm.onModuleLoad('polling', function (module) {\r\n\t\t\t\tmodule.initPolling('chat', {\r\n\t\t\t\t\tenabled: true,\r\n\t\t\t\t\turl: '" . $this->chatUpdateOptions['url'] . "', \r\n\t\t\t\t\tinterval: " . $this->chatUpdateOptions['interval'] . ",\r\n\t\t\t\t\tcontainer: '#nitm-communication-center-widget" . $uniqid . "'\r\n\t\t\t\t}, {object: \$nitm.module('replies'), method: 'chatStatus'});\r\n\t\t\t});";
        }
        if ($this->notificationUpdateOptions['enabled']) {
            $js .= "\r\n\t\t\t\$nitm.onModuleLoad('polling', function (module) {\r\n\t\t\t\tmodule.initPolling('notifications', {\r\n\t\t\t\t\tenabled: true,\r\n\t\t\t\t\tinterval: " . $this->notificationUpdateOptions['interval'] . ",\r\n\t\t\t\t\turl: '" . $this->notificationUpdateOptions['url'] . "',\r\n\t\t\t\t\tcontainer: '#nitm-communication-center-widget" . $uniqid . "'\r\n\t\t\t\t}, {object: \$nitm.module('notifications'), method: 'notificationStatus'});\r\n\t\t\t});";
        }
        if ($js) {
            $js = Html::script($js, ['type' => 'text/javascript']);
        }
        return $widget . $js;
    }
開發者ID:nhatvuvan,項目名稱:yii2-widgets,代碼行數:27,代碼來源:CommunicationCenter.php

示例3: init

 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     if (!class_exists($this->dropdownClass)) {
         throw new InvalidConfigException("The dropdownClass '{$this->dropdownClass}' does not exist or is not accessible.");
     }
     NavXAsset::register($this->getView());
     parent::init();
 }
開發者ID:jatuponp,項目名稱:iweb,代碼行數:12,代碼來源:NavX.php

示例4: testIds

    public function testIds()
    {
        Nav::$counter = 0;
        $out = Nav::widget(['items' => [['label' => 'Page1', 'content' => 'Page1'], ['label' => 'Dropdown1', 'items' => [['label' => 'Page2', 'content' => 'Page2'], ['label' => 'Page3', 'content' => 'Page3']]], ['label' => 'Dropdown2', 'visible' => false, 'items' => [['label' => 'Page4', 'content' => 'Page4'], ['label' => 'Page5', 'content' => 'Page5']]]]]);
        $expected = <<<EXPECTED
<ul id="w0" class="nav"><li><a href="#">Page1</a></li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Dropdown1 <b class="caret"></b></a><ul id="w1" class="dropdown-menu"><li class="dropdown-header">Page2</li>
<li class="dropdown-header">Page3</li></ul></li></ul>
EXPECTED;
        $this->assertEqualsWithoutLE($expected, $out);
    }
開發者ID:glcode,項目名稱:yii2-2.0.3-annotated,代碼行數:11,代碼來源:NavTest.php

示例5: run

 /**
  * @return string
  */
 public function run()
 {
     $list = [];
     list($route, $params) = Yii::$app->getUrlManager()->parseRequest(Yii::$app->getRequest());
     $params = ArrayHelper::merge($_GET, $params);
     $url = isset($params['route']) ? $params['route'] : $route;
     foreach ($this->languages as $row) {
         $list = ArrayHelper::merge($list, [['label' => $row['title'], 'url' => Yii::$app->urlManager->createUrl(ArrayHelper::merge($params, [$url, 'language' => $row['iso']]))]]);
     }
     return Nav::widget(['options' => $this->options, 'items' => [['label' => Language::getCurrentRecord()->title, 'items' => $list]]]);
 }
開發者ID:apurey,項目名稱:cmf,代碼行數:14,代碼來源:LanguageWidget.php

示例6: renderToolbar

 /**
  * Renders mini-toolbar at the end of page body.
  *
  * @param \yii\base\Event $event
  */
 public function renderToolbar($event)
 {
     /* @var $view View */
     /* @var $urlManagerBack \yii\web\UrlManager */
     $urlManagerBack = Yii::$app->urlManagerBack;
     $view = $event->sender;
     $view->registerCss($view->renderPhpFile(__DIR__ . '/assets/toolbar.min.css'));
     NavBar::begin(['id' => 'wd-frontend-toolbar', 'brandLabel' => Html::img('@web/img/logo-mini.png'), 'brandUrl' => $urlManagerBack->baseUrl, 'innerContainerOptions' => ['class' => 'container-fluid'], 'options' => ['class' => 'navbar navbar-inverse navbar-fixed-top']]);
     echo Nav::widget(['encodeLabels' => false, 'options' => ['class' => 'navbar-nav'], 'items' => [['label' => '<span aria-hidden="true" class="glyphicon glyphicon-dashboard"></span> ' . Option::get('sitetitle'), 'items' => [['label' => Yii::t('toolbar', 'Dashboard'), 'url' => $urlManagerBack->baseUrl], ['label' => Yii::t('toolbar', 'Themes'), 'url' => $urlManagerBack->createUrl(['/theme']), 'visible' => Yii::$app->user->can('administrator')], ['label' => Yii::t('toolbar', 'Menus'), 'url' => $urlManagerBack->createUrl(['/menu']), 'visible' => Yii::$app->user->can('administrator')], ['label' => Yii::t('toolbar', 'Modules'), 'url' => $urlManagerBack->createUrl(['/module']), 'visible' => Yii::$app->user->can('administrator')], ['label' => Yii::t('toolbar', 'Widgets'), 'url' => $urlManagerBack->createUrl(['/widget']), 'visible' => Yii::$app->user->can('administrator')]]], ['label' => '<span aria-hidden="true" class="glyphicon glyphicon-plus"></span> ' . Yii::t('toolbar', 'New'), 'items' => $this->getAddNewMenu() ? $this->getAddNewMenu() : null]]]);
     echo Nav::widget(['encodeLabels' => false, 'options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => '<span aria-hidden="true" class="glyphicon glyphicon-user"></span> ' . Yii::$app->user->identity->username, 'items' => [['label' => 'Profile', 'url' => $urlManagerBack->createUrl(['/user/profile'])], ['label' => 'Logout', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]]]]);
     NavBar::end();
 }
開發者ID:ochiem,項目名稱:app-cms,代碼行數:17,代碼來源:Module.php

示例7: isItemActive

 protected function isItemActive($item)
 {
     if (isset($item['url']) && is_string($item['url']) && $item['url'] === Url::current()) {
         return true;
     }
     return parent::isItemActive($item);
 }
開發者ID:andreyvaslv,項目名稱:crb,代碼行數:7,代碼來源:Nav.php

示例8: init

 /**
  * Initialize the widget
  * @throws InvalidConfigException
  */
 public function init()
 {
     if (!class_exists($this->dropdownClass)) {
         throw new InvalidConfigException("The dropdownClass '{$this->dropdownClass}' does not exist or is not accessible.");
     }
     parent::init();
 }
開發者ID:orcsis,項目名稱:yii2-orcsis,代碼行數:11,代碼來源:NavX.php

示例9: renderDropdown

 protected function renderDropdown($items, $parentItem)
 {
     foreach ($items as &$item) {
         $this->changeItem($item);
     }
     return parent::renderDropdown($items, $parentItem);
 }
開發者ID:semnt,項目名稱:tp01,代碼行數:7,代碼來源:Nav.php

示例10: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $userModuleClass = 'dektrium\\user\\Module';
     $isUserModuleInstalled = \Yii::$app->getModule('user') instanceof $userModuleClass;
     $this->items = [['label' => \Yii::t('rbac', 'Users'), 'url' => ['/user/admin/index'], 'visible' => $isUserModuleInstalled], ['label' => \Yii::t('rbac', 'Roles'), 'url' => ['/rbac/role/index']], ['label' => \Yii::t('rbac', 'Permissions'), 'url' => ['/rbac/permission/index']], ['label' => \Yii::t('rbac', 'Rules'), 'url' => ['/rbac/rule/index']], ['label' => \Yii::t('rbac', 'Create'), 'items' => [['label' => \Yii::t('rbac', 'New user'), 'url' => ['/user/admin/create'], 'visible' => $isUserModuleInstalled], ['label' => \Yii::t('rbac', 'New role'), 'url' => ['/rbac/role/create']], ['label' => \Yii::t('rbac', 'New permission'), 'url' => ['/rbac/permission/create']], ['label' => \Yii::t('rbac', 'New rule'), 'url' => ['/rbac/rule/create']]]]];
 }
開發者ID:dektrium,項目名稱:yii2-rbac,代碼行數:10,代碼來源:Menu.php

示例11: init

 public function init()
 {
     parent::init();
     try {
         $tableSchema = Yii::$app->db->schema->getTableSchema(MenuItem::tableName());
     } catch (\yii\db\Exception $e) {
     }
     if (empty($tableSchema)) {
         return;
     }
     $models = MenuItem::find()->where(['menu_id' => $this->menu])->orderBy(['order_id' => SORT_ASC])->all();
     $items = [];
     // top menu items
     foreach ($models as $model) {
         if ($model->parent_id == 0) {
             $items[$model->id] = ['label' => $model->title, 'url' => $this->parseRoute($model->route)];
         }
     }
     foreach ($models as $model) {
         if (isset($items[$model->parent_id])) {
             $items[$model->parent_id]['items'][] = ['label' => $model->title, 'url' => $this->parseRoute($model->route)];
         }
     }
     $this->items = ArrayHelper::merge($items, $this->items);
     if (Yii::$app->user->identity && Yii::$app->user->identity->getIsAdmin()) {
         $this->items[] = ['label' => 'Admin Panel', 'url' => '/admin'];
     }
 }
開發者ID:chabberwock,項目名稱:halo-dev,代碼行數:28,代碼來源:Nav.php

示例12: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!$this->authUser instanceof User) {
         throw new InvalidParamException('AuthUser must be an instance of ' . User::className());
     }
     $this->items = [['url' => ['/user/profile/index'], 'label' => Yii::t('user', 'Common settings')], ['url' => ['/user/profile/vcs-bindings'], 'label' => Yii::t('user', 'VCS bindings')]];
     parent::init();
 }
開發者ID:kalyabin,項目名稱:comitka,代碼行數:11,代碼來源:ProfileMenu.php

示例13: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!$this->model instanceof User) {
         throw new InvalidParamException('Model must be an instance of ' . User::className());
     }
     $this->items = [['url' => ['/user/user-manager/update', 'id' => $this->model->id], 'label' => Yii::t('user', 'Common settings')], ['url' => ['/user/user-manager/vcs-bindings', 'id' => $this->model->id], 'label' => Yii::t('user', 'VCS bindings')]];
     parent::init();
 }
開發者ID:kalyabin,項目名稱:comitka,代碼行數:11,代碼來源:UserMenu.php

示例14: init

 public function init()
 {
     parent::init();
     $items = [];
     if (Yii::$app->user->can(User::ROLE_ADMIN)) {
         $items = Yii::$app->params['menuItems'];
     }
     $this->items = $items;
 }
開發者ID:tolik505,項目名稱:bl,代碼行數:9,代碼來源:MainMenu.php

示例15: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->direction == 'left') {
         $this->options['class'] .= ' drop-left';
     }
     $itemTree = $this->generateItemsTree($this->items);
     $this->items = $this->createItems($itemTree);
     return parent::run();
 }
開發者ID:bariew,項目名稱:yii2-dropdown-x,代碼行數:12,代碼來源:Nav.php


注:本文中的yii\bootstrap\Nav類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。