本文整理汇总了PHP中yii\bootstrap\NavBar类的典型用法代码示例。如果您正苦于以下问题:PHP NavBar类的具体用法?PHP NavBar怎么用?PHP NavBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NavBar类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
NavBar::begin(['brandLabel' => false, 'options' => ['class' => 'tor-nav']]);
echo Html::tag('div', $this->torMenu(), ['class' => 'container']);
NavBar::end();
$view = $this->view;
NavAsset::register($view);
}
示例2: run
public function run()
{
NavBar::begin(['brandLabel' => false, 'options' => ['class' => 'top-nav']]);
echo NavX::widget(['items' => $this->topMenu(), 'options' => ['class' => 'nav navbar-nav navbar-left nav-pills main-nav'], 'encodeLabels' => false]);
echo NavX::widget(['items' => $this->accountMenu(), 'options' => ['class' => 'nav navbar-nav navbar-right nav-pills account-top-nav'], 'encodeLabels' => false]);
NavBar::end();
$view = $this->view;
NavAsset::register($view);
}
示例3: 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();
}
示例4: getMenu
public function getMenu()
{
$isAdmin = !Yii::$app->user->isGuest ? Yii::$app->user->identity->can('editor') : false;
$canAdmin = !Yii::$app->user->isGuest ? Yii::$app->user->identity->can('editor') : false;
$networksVisible = count(Yii::$app->authClientCollection->clients) > 0;
$menuItems = [['label' => 'Home', 'url' => ['/site/index']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'Contact', 'url' => ['/site/contact']]];
if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => Yii::t('user', 'Sign up'), 'url' => ['/user/registration/register']];
$menuItems[] = ['label' => Yii::t('user', 'Sign in'), 'url' => ['/user/security/login']];
} else {
$menuItems['user'] = ['label' => $isAdmin ? Yii::$app->user->identity->profile->fullname . ' (admin)' : Yii::$app->user->identity->profile->fullname, 'items' => [['label' => Yii::t('user', 'Profile'), 'url' => ['/user/settings/profile']], ['label' => Yii::t('user', 'Account'), 'url' => ['/user/settings/account']], ['label' => Yii::t('user', 'Networks'), 'url' => ['/user/settings/networks'], 'visible' => $networksVisible], '<li class="divider"></li>', ['label' => Yii::t('user', 'Logout'), 'url' => ['/user/security/logout'], 'linkOptions' => ['data-method' => 'post']]]];
}
if ($canAdmin) {
$menuItems['user']['items'][] = '<li class="divider"></li>';
$menuItems['user']['items'][] = ['label' => Yii::t('user', 'Admin Panel'), 'url' => Yii::$app->urlManagerBackEnd->createUrl('')];
}
NavBar::begin(['brandLabel' => Yii::$app->params['companyName'], 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
NavBar::end();
}
示例5: isset
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['brandLabel' => \Yii::$app->name, 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse']]);
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'События', 'items' => [['label' => 'Категории', 'url' => ['/article/category']], ['label' => 'Список', 'url' => ['/article/events']]]], ['label' => 'Каталог', 'items' => [['url' => ['/catalog/category'], 'label' => 'Категории'], ['url' => ['/catalog/brand'], 'label' => 'Бренды']]], ['label' => 'Настройки', 'url' => ['/settings/settings']], Yii::$app->user->isGuest ? ['label' => 'Login', 'url' => ['/site/login']] : ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]]);
NavBar::end();
?>
<div class="container">
<?php
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
<?php
echo $content;
?>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-left">© <?php
示例6: isset
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
\yii\bootstrap\NavBar::begin(['brandLabel' => Yii::$app->siteName, 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$items = [['label' => '<i class="glyphicon glyphicon-home"></i> ' . Yii::t('gromver.platform', 'Home'), 'url' => Yii::$app->homeUrl]];
if (Yii::$app->user->can('administrate')) {
$items[] = ['label' => '<i class="glyphicon glyphicon-cog"></i> ' . Yii::t('gromver.platform', 'Admin Panel'), 'url' => ['/main/backend/default/index']];
}
if (Yii::$app->request->referrer) {
$items[] = ['label' => '<i class="glyphicon glyphicon-step-backward"></i> ' . Yii::t('gromver.platform', 'Back'), 'url' => Yii::$app->request->referrer];
}
echo \yii\bootstrap\Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'encodeLabels' => false, 'items' => $items]);
\yii\bootstrap\NavBar::end();
?>
<div class="wrap">
<div class="container">
<?php
echo \yii\widgets\Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
<?php
foreach (Yii::$app->session->getAllFlashes() as $type => $body) {
echo \kartik\widgets\Alert::widget(['type' => $type, 'body' => $body]);
}
?>
<?php
echo $content;
?>
示例7:
?>
<title><?php
echo Html::encode($this->title);
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['brandLabel' => 'Woo Soft', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
?>
<div class="main-content">
<?php
echo $content;
示例8: actionMenu
public function actionMenu()
{
NavBar::begin(['brandLabel' => Yii::$app->name, 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse', 'style' => 'z-index: 9999;']]);
echo MenuWidget::widget(['direction' => 'left', 'options' => ['class' => 'navbar-nav navbar-right']]);
NavBar::end();
}
示例9: init
public function init()
{
if ($this->brandGlyphicon) {
$this->brandLabel = Html::glyphicon($this->brandGlyphicon) . $this->brandLabel;
}
parent::init();
}