本文整理汇总了PHP中yii\bootstrap\NavBar::begin方法的典型用法代码示例。如果您正苦于以下问题:PHP NavBar::begin方法的具体用法?PHP NavBar::begin怎么用?PHP NavBar::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\NavBar
的用法示例。
在下文中一共展示了NavBar::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: elseif
<title><?php
echo Html::encode($this->title);
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['brandLabel' => 'Order Processing', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
if (Yii::$app->user->isGuest) {
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'Login', 'url' => ['/site/login']]]]);
} elseif (Yii::$app->user->identity->user_role_id === 1) {
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'User Roles', 'url' => ['/admin/userroles']], ['label' => 'Users', 'url' => ['/admin/users']], ['label' => 'Companies', 'url' => ['/admin/companies']], ['label' => 'Affiliates', 'url' => ['/admin/affiliates']], ['label' => 'Order Statuses', 'url' => ['/admin/orderstatuses']], ['label' => 'Orders', 'url' => ['/admin/orders']], ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]]);
} else {
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'Orders', 'url' => ['/orders']], ['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
示例6: isset
<title><?php
echo Html::encode($this->title);
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['brandLabel' => \Yii::t('app', 'My Goals'), 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => Yii::$app->user->isGuest ? [] : [['label' => \Yii::t('dashboard', 'Dashboard'), 'url' => ['/dashboard/index']], ['label' => \Yii::t('task', 'Tasks'), 'url' => Task::urlToAll()], ['label' => \Yii::t('status', 'Statuses'), 'url' => ['/settings/status/index']], ['label' => \Yii::t('type', 'Types'), 'url' => ['/settings/type/index']], ['label' => \Yii::t('priority', 'Priorities'), 'url' => ['/settings/priority/index']], ['label' => \Yii::t('app', 'Logout ({0})', [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">
示例7: getenv
?>
<title><?php
echo Html::encode($this->title);
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['brandLabel' => getenv('APP_NAME'), 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar navbar-fixed-top navbar-bold']]);
echo Nav::widget(['options' => ['class' => 'navbar-nav'], 'encodeLabels' => false, 'items' => \dmstr\modules\pages\models\Tree::getMenuItems('root_' . Yii::$app->language)]);
$menuItems = [];
if (Yii::$app->hasModule('user')) {
if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Signup', 'url' => ['/user/registration/register']];
$menuItems[] = ['label' => 'Login', 'url' => ['/user/security/login']];
} else {
$menuItems[] = ['label' => '<i class="glyphicon glyphicon-user"></i> ' . Yii::$app->user->identity->username, 'options' => ['id' => 'link-user-menu'], 'items' => [['label' => '<i class="glyphicon glyphicon-user"></i> Profile', 'url' => ['/user/profile/show', 'id' => \Yii::$app->user->id]], '<li class="divider"></li>', ['label' => '<i class="glyphicon glyphicon-log-out"></i> Logout', 'url' => ['/user/security/logout'], 'linkOptions' => ['data-method' => 'post', 'id' => 'link-logout']]]];
$menuItems[] = ['label' => '<i class="glyphicon glyphicon-cog"></i>', 'url' => ['/backend'], 'visible' => Yii::$app->user->can('backend_default') || isset(Yii::$app->user->identity) && Yii::$app->user->identity->isAdmin];
}
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'encodeLabels' => false, 'items' => $menuItems]);
NavBar::end();
?>
示例8: isset
<title><?php
echo Html::encode($this->title);
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['brandLabel' => 'Yii 2 Advanced Template', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItems = [['label' => 'Home', 'url' => ['/site/index']]];
if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
} else {
$menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
NavBar::end();
?>
<div class="container">
<?php
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
<?php
示例9:
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php
echo Html::csrfMetaTags();
?>
<title><?php
echo Html::encode($this->title);
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
NavBar::begin(['brandLabel' => 'ivi Extension', 'brandUrl' => ['user/login'], 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
echo Nav::widget(['options' => ['class' => 'nav navbar-nav navbar-right'], 'items' => [['label' => 'Home', 'url' => ['user/login']]]]);
NavBar::end();
?>
<div class="container">
<?php
echo $content;
?>
</div>
<footer class="footer">
<div class="container">
<p class="pull-left">Open Source Project</p>
<p class="pull-right">ivi Extension</p>
</div>
</footer>
<?php
示例10:
use yii\widgets\ActiveForm;
use yii\bootstrap\NavBar;
use yii\bootstrap\Carousel;
use kartik\widgets\Select2;
use yii\helpers\Html;
use yii\helpers\Url;
use evgeniyrru\yii2slick\Slick;
/* @var $this yii\web\View */
$this->title = 'EMTOL - бронирование экскурсий';
$this->params['fluid'] = true;
?>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="false" data-pause="false">
<div class="container">
<div class="tour-form">
<?php
NavBar::begin();
$form = ActiveForm::begin(['method' => 'post', 'action' => ['/tour/index'], 'options' => ['class' => 'form-inline']]);
?>
<?php
echo $form->field($model, 'search_data', ['options' => ['class' => 'search-data form-group']])->widget(Select2::classname(), ['data' => $data, 'options' => ['placeholder' => 'Введите ключевые слова...'], 'pluginOptions' => ['allowClear' => true]]);
?>
<!-- /.search-data -->
<?php
echo $form->field($model, 'date_begin')->widget(\yii\jui\DatePicker::classname(), ['language' => 'ru', 'dateFormat' => 'yyyy-MM-dd']);
?>
<div class="form-group btn-search">
<?php
echo Html::submitButton('Вперед!', ['class' => 'btn btn-success']);
?>
示例11:
<?php
use yii\bootstrap\NavBar;
use yii\bootstrap\Nav;
use yii\bootstrap\ActiveForm;
NavBar::begin(['brandLabel' => Yii::$app->params['name'], 'brandUrl' => '/', 'options' => ['class' => 'navbar-inverse']]);
if (Yii::$app->user->isGuest) {
$items = [['label' => 'Login', 'url' => ['/site/login']]];
} else {
$items = [['label' => 'Main', 'url' => ['/']], ['label' => 'Sources', 'url' => ['/sources']], ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', 'url' => ['/logout'], 'linkOptions' => ['data-method' => 'post']]];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $items]);
$disabled = Yii::$app->user->isGuest;
$form = ActiveForm::begin(['id' => 'list-form', 'action' => \yii\helpers\Url::to(['default/change-source']), 'layout' => 'inline', 'options' => ['class' => 'navbar-form navbar-left']]);
if (!Yii::$app->user->isGuest) {
echo '<a href="#" class="navbar-form navbar-left" id="toggle_menu_control" style="font-size: 16px;">[ Hide / Show menu ]</a>';
echo $form->field($model, 'version')->dropDownList($versions, ['id' => 'list-version', 'style' => 'margin-right: 3px', 'disabled' => $disabled]);
}
ActiveForm::end();
NavBar::end();
示例12:
<title><?php
echo Html::encode($this->title);
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['options' => ['class' => 'navbar-inverse navbar-top']]);
if (Yii::$app->user->isGuest) {
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-top'], 'items' => [['label' => 'Login', 'url' => ['/admin/default/login']]]]);
} else {
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-top'], 'items' => [['label' => 'Logout (' . Yii::$app->user->identity->username . ')', 'url' => ['/admin/default/logout'], 'linkOptions' => ['data-method' => 'post']], ['label' => 'Керування користувачами', 'url' => ['/admin/admins/index']], ['label' => 'Керування контентом', 'url' => ['/admin/content/index']], ['label' => 'Керування учасниками та компаніями', 'url' => ['/admin/company/index']], ['label' => 'Керування подіями', 'url' => ['/admin/events/index']], ['label' => 'Керування розсилками', 'url' => ['/admin/mail/index']]]]);
}
NavBar::end();
?>
<div class="container">
<?php
echo Breadcrumbs::widget([]);
?>
<?php
echo $content;
?>
示例13:
<title><?php
echo Html::encode($this->title);
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['brandLabel' => "LOGO's", 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar navbar-default navbar-fixed-top']]);
$menu_items = [['label' => 'Home', 'url' => ['/site/index']], ['label' => 'Аbout', 'url' => ['/site/about']]];
if (Yii::$app->user->isGuest) {
$menu_items[] = ['label' => 'Регистрация', 'url' => ['/site/userform']];
$menu_items[] = ['label' => 'Войти', 'url' => ['/site/login']];
} else {
$menu_items[] = ['label' => 'New album', 'url' => ['/site/new-album', 'id_user' => Yii::$app->user->id]];
$menu_items[] = ['label' => 'Albums', 'url' => ['/site/albums', 'id_user' => Yii::$app->user->id]];
$menu_items[] = ['label' => 'Log out "' . Yii::$app->user->identity->name . '"', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menu_items]);
NavBar::end();
?>
<div class="container">
<?php
示例14: isset
<title><?php
echo Html::encode($this->title);
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['brandLabel' => 'Тестовое задание «Ronik edition»', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItems = [['label' => 'Приветствие', 'url' => ['/site/index']], ['label' => 'Структура сайта', 'url' => ['/structure']]];
if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Войти', 'url' => ['/site/login']];
} else {
$menuItems[] = ['label' => 'Выйти (' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
NavBar::end();
?>
<div class="container">
<?php
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
<?php
示例15: isset
<title><?php
echo Html::encode($this->title);
?>
</title>
<?php
$this->head();
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['brandLabel' => 'Коллаж генератор', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'Головна', 'url' => ['/college/index']], ['label' => 'Про сервіс', 'url' => ['/site/about']], Yii::$app->user->isGuest ? ['label' => 'Login', 'url' => ['/site/login']] : ['label' => 'Вийти (' . 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">