当前位置: 首页>>代码示例>>PHP>>正文


PHP Users::isUserAdmin方法代码示例

本文整理汇总了PHP中app\models\Users::isUserAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::isUserAdmin方法的具体用法?PHP Users::isUserAdmin怎么用?PHP Users::isUserAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Users的用法示例。


在下文中一共展示了Users::isUserAdmin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: behaviors

 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'only' => ['index', 'view', 'create', 'delete', 'update'], 'rules' => [['actions' => ['index', 'view', 'create', 'delete', 'update'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return Users::isUserAdmin(Yii::$app->user->identity->login);
     }]]]];
 }
开发者ID:savers,项目名称:arenda,代码行数:6,代码来源:OborudController.php

示例2: isset

?>
</head>
<body>
<?php 
$this->beginBody();
?>

<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => 'Аренда залов', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItem = [['label' => '<span class="glyphicon glyphicon-home" aria-hidden="true"></span> Главная', 'url' => ['/site/index'], 'encode' => false]];
if (Yii::$app->user->isGuest) {
    $menuItem[] = ['label' => 'Регистрация', 'url' => ['/users/index']];
    $menuItem[] = ['label' => 'Войти', 'url' => ['/site/login']];
} else {
    if (Users::isUserAdmin(Yii::$app->user->identity->login)) {
        $menuItem[] = ['label' => ' <span class="glyphicon glyphicon-book" aria-hidden="true"></span> Справочники', 'encode' => false, 'items' => [['label' => '<span class="glyphicon glyphicon-book" aria-hidden="true"></span> Залы', 'url' => ['/zal/index'], 'encode' => false], ['label' => '<span class="glyphicon glyphicon-user" aria-hidden="true"></span> Оборудование', 'url' => ['/oborud/index'], 'encode' => false], ['label' => '<span class="glyphicon glyphicon-road" aria-hidden="true"></span> Клиенты', 'url' => ['/client/index'], 'encode' => false], ['label' => '<span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> Пользователи', 'url' => ['/users/index'], 'encode' => false], ['label' => '<span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> Аренда', 'url' => ['/event/index'], 'encode' => false]]];
    }
    $menuItem[] = ['label' => 'Выйти (' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItem]);
NavBar::end();
?>

    <div class="container">
        <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
        <?php 
echo $content;
?>
开发者ID:savers,项目名称:arenda,代码行数:31,代码来源:main.php


注:本文中的app\models\Users::isUserAdmin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。