本文整理汇总了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;
}
示例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]);
}
示例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]);
}
示例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']]]];
}
示例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";
}
}
示例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]);
}
示例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]);
}
}
示例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
示例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
示例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);
}]]]];
}
示例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">
示例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">
示例13: behaviors
public function behaviors()
{
return ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
return User::isUserAdmin();
}]]]];
}
示例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'] : []]);
示例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">