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


PHP User::isUserAdmin方法代码示例

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


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

示例1: loginAdmin

 public function loginAdmin()
 {
     if ($this->validate() && User::isUserAdmin($this->username)) {
         return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
     }
     return false;
 }
开发者ID:vagrant200192,项目名称:traning,代码行数:7,代码来源:LoginForm.php

示例2: actionIndex

 /**
  * Lists all Order models.
  * @return mixed
  */
 public function actionIndex()
 {
     if (User::isUserAdmin(Yii::$app->user->identity->username)) {
         $query = Order::find()->joinWith(['orderLocationName']);
     } else {
         $query = Order::find()->joinWith(['orderLocationName'])->where(['order_user_id' => Yii::$app->user->id]);
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
开发者ID:verget,项目名称:catering,代码行数:14,代码来源:OrderController.php

示例3: actionIndex

 /**
  * Lists all Tasks models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new TasksSearch();
     if (User::isUserAdmin(Yii::$app->user->identity->username) or User::isUserModer(Yii::$app->user->identity->username)) {
     } else {
         $searchModel->user_ispol = Yii::$app->user->identity->id;
     }
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
开发者ID:GT-Volk,项目名称:ManagerOrganizer,代码行数:14,代码来源:TasksController.php

示例4: behaviors

 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'only' => ['crear', 'modificar', 'buscar'], 'rules' => [['actions' => ['crear', 'modificar', 'buscar'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return User::isUserAdmin(Yii::$app->user->identity->id);
     }], ['actions' => ['buscar'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return User::isUserProfe(Yii::$app->user->identity->id);
     }], ['actions' => ['buscar'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return User::isUserSubcomision(Yii::$app->user->identity->id);
     }]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['logout' => ['post']]]];
 }
开发者ID:lucho314,项目名称:cae,代码行数:10,代码来源:DeportistaController.php

示例5: menu

 private function menu()
 {
     if (User::isUserAdmin(Yii::$app->user->identity->id)) {
         $this->layout = "mainadmin";
     }
     if (User::isUserProfe(Yii::$app->user->identity->id)) {
         $this->layout = "mainprofe";
     }
     if (User::isUserSubcomision(Yii::$app->user->identity->id)) {
         $this->layout = "mainsubcomision";
     }
 }
开发者ID:emiherber,项目名称:sgdcae,代码行数:12,代码来源:EventoController.php

示例6: actionIndex

 public function actionIndex()
 {
     if (User::isUserAdmin(Yii::$app->user->identity->username) or User::isUserModer(Yii::$app->user->identity->username)) {
         $tasks = Tasks::findAll(['active' => Tasks::STATUS_ACTIVE]);
     } else {
         $tasks = Tasks::findAll(['active' => Tasks::STATUS_ACTIVE, 'user_ispol' => Yii::$app->user->identity->id]);
     }
     $events = array();
     foreach ($tasks as $task) {
         $Event = new \yii2fullcalendar\models\Event();
         $Event->id = $task->id;
         $Event->title = $task->clientName->name;
         $Event->start = $task->plan_date;
         $events[] = $Event;
     }
     return $this->render('index', ['events' => $events]);
 }
开发者ID:GT-Volk,项目名称:ManagerOrganizer,代码行数:17,代码来源:SiteController.php

示例7: actionLogin

 public function actionLogin()
 {
     if (!\Yii::$app->user->isGuest) {
         if (User::isUserAdmin(Yii::$app->user->identity->id)) {
             return $this->redirect(["site/admin"]);
         } elseif (User::isUserMaestro(Yii::$app->user->identity->id)) {
             return $this->redirect(["site/maestro"]);
         } else {
             return $this->redirect(["site/estudiante"]);
         }
     }
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         if (User::isUserAdmin(Yii::$app->user->identity->id)) {
             return $this->redirect(["site/admin"]);
         } elseif (User::isUserMaestro(Yii::$app->user->identity->id)) {
             return $this->redirect(["site/maestro"]);
         } else {
             return $this->redirect(["site/estudiante"]);
         }
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }
开发者ID:erpachecomo,项目名称:TuPortalPersonal,代码行数:24,代码来源:SiteController.php

示例8:

/* @var $this yii\web\View */
/* @var $model app\models\Tasks */
$this->title = 'Задача №' . $model->id . ' от ' . Yii::$app->formatter->asDate($model->created);
$this->params['breadcrumbs'][] = ['label' => 'Задачи', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="tasks-view">

    <h2><?php 
echo Html::encode($this->title);
?>
</h2>

    <p>
        <?php 
if (User::isUserAdmin(Yii::$app->user->identity->username) or User::isUserModer(Yii::$app->user->identity->username) or Yii::$app->user->id == $model->user_ispol) {
    ?>

            <?php 
    if ($model->active == Tasks::STATUS_ACTIVE) {
        echo Html::a('Завершить', ['end', 'id' => $model->id], ['class' => 'btn btn-success']);
    }
    ?>
            <?php 
    echo Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
    ?>
            <?php 
    echo Html::a('Удалить', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
    ?>

        <?php 
开发者ID:GT-Volk,项目名称:ManagerOrganizer,代码行数:31,代码来源:view.php

示例9:

//= $form->field($model, 'task')->textInput(['maxlength' => true])
?>

                <?php 
echo $form->field($model, 'priority')->dropDownList($model->getPrioritysArray());
?>
                <?php 
//= $form->field($model, 'priority')->textInput(['maxlength' => true])
?>

                <?php 
//= $form->field($model, 'user_created')->textInput(['maxlength' => true])
?>

                <?php 
if (User::isUserAdmin(Yii::$app->user->identity->username) or User::isUserModer(Yii::$app->user->identity->username)) {
    echo $form->field($model, 'user_ispol')->dropDownList(User::getUsers());
    //echo $form->field($model, 'user_ispol')->textInput(['maxlength' => true]);
}
?>
                <?php 
//= $form->field($model, 'fakt_date')->textInput()
?>
            </td>
        </tr>
    </table>




    <?php 
开发者ID:GT-Volk,项目名称:ManagerOrganizer,代码行数:31,代码来源:_form.php

示例10: behaviors

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

示例11: isset

echo Html::encode($this->title);
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>
<?php 
$this->beginBody();
?>

<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => 'Manager Organizer', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => array_filter([['label' => 'Главная', 'url' => ['/site/index']], ['label' => 'Компании', 'url' => ['/clients/index']], ['label' => 'Задачи', 'url' => ['/tasks/index']], User::isUserAdmin(Yii::$app->user->identity->username) ? ['label' => 'Пользователи', 'url' => ['/user/index']] : null, Yii::$app->user->isGuest ? ['label' => 'Вход', '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">
    <div class="container">
开发者ID:GT-Volk,项目名称:ManagerOrganizer,代码行数:31,代码来源:main.php

示例12: isset

echo Html::encode($this->title);
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>
<?php 
$this->beginBody();
?>

<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => 'Books', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => Yii::t('app', 'NAV_HOME'), 'url' => ['/site/index']], ['label' => Yii::t('app', 'NAV_REGISTRATION'), 'url' => ['/user/create'], 'visible' => Yii::$app->user->isGuest], ['label' => 'Users', 'url' => ['/user/index'], 'visible' => Yii::$app->user->isGuest ? false : User::isUserAdmin(Yii::$app->user->identity->email)], ['label' => 'Comments', 'url' => ['/comment/index'], 'visible' => Yii::$app->user->isGuest ? false : User::isUserAdmin(Yii::$app->user->identity->email)], ['label' => Yii::t('app', 'NAV_LANG'), 'url' => ['/language/index'], 'visible' => !Yii::$app->user->isGuest], ['label' => Yii::t('app', 'NAV_NEWS'), 'url' => ['/news/index'], 'visible' => !Yii::$app->user->isGuest], ['label' => Yii::t('app', 'NAV_GENRE'), 'url' => ['/genre/index'], 'visible' => !Yii::$app->user->isGuest], ['label' => Yii::t('app', 'NAV_BOOKS'), 'url' => ['/book/index'], 'visible' => !Yii::$app->user->isGuest], Yii::$app->user->isGuest ? ['label' => Yii::t('app', 'NAV_LOGIN'), 'url' => ['/site/login']] : ['label' => Yii::t('app', 'NAV_LOGOUT') . '(' . Yii::$app->user->identity->email . ')', '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">
开发者ID:vagrant200192,项目名称:traning,代码行数:31,代码来源:main.php

示例13: behaviors

 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return User::isUserAdmin();
     }]]]];
 }
开发者ID:Akelcehg,项目名称:psycho,代码行数:6,代码来源:Module.php

示例14: isset

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

<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => 'My Company', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuitems = [['label' => 'Главная', 'url' => ['/site/index']], ['label' => 'Обратная связь', 'url' => ['/site/contact']]];
if (User::isUserAdmin(Yii::$app->user->identity->usersname)) {
    $menuitems[] = ['label' => 'Admin', 'url' => ['/admin/ ']];
}
if (Yii::$app->user->isGuest) {
    $menuitems[] = ['label' => 'Вход', 'url' => ['/site/login']];
}
if (!Yii::$app->user->isGuest) {
    $menuitems[] = ['label' => 'Выход (' . Yii::$app->user->identity->usersname . ')', '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'] : []]);
开发者ID:Evkazolinium,项目名称:yiiBasicTest,代码行数:31,代码来源:main.php

示例15: isset

echo Html::encode($this->title);
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>
<?php 
$this->beginBody();
?>

<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => 'Proyecto', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'Home', 'url' => ['/site/index']], ['label' => "Online User's", 'url' => ['/chat/index']], ['label' => 'About', 'url' => ['/site/about'], 'visible' => Yii::$app->user->isGuest], ['label' => 'Contact', 'url' => ['/site/contact'], 'visible' => Yii::$app->user->isGuest], ['label' => 'Register', 'url' => ['/site/register'], 'visible' => Yii::$app->user->isGuest], ['label' => 'Gestion Usuarios', 'url' => ['/users'], 'visible' => User::isUserAdmin(Yii::$app->user->getId())], 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">
开发者ID:raulinho,项目名称:yii,代码行数:31,代码来源:main.php


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