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


PHP Users::getRole方法代码示例

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


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

示例1: actionIndex

 /**
  * Lists all Record models.
  * @return mixed
  */
 public function actionIndex()
 {
     $teClass = new teClass();
     $admin = new Users();
     $searchModel = new RecordSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $id = $searchModel->searchID();
     // var_dump($id);
     // die;
     $academy = $searchModel->searchacademy();
     $te_id = $searchModel->searchte_id();
     $array = $admin->getRole($te_id);
     //根据不同角色返回不同的查看权限
     $classArray = $teClass->getRoleClass($id, $te_id, $academy);
     $major = $teClass->getClass($id, $te_id, $academy);
     // var_dump($major);die;
     return $this->render('index', ['te_id' => $te_id, 'array' => $array, 'academy' => $academy, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'classArray' => $classArray, 'major' => $major]);
 }
开发者ID:PichurChill,项目名称:sues_print,代码行数:22,代码来源:RecordController.php

示例2: json_encode

/* @var $this yii\web\View */
/* @var $searchModel app\models\UsersSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Users');
?>
<div class="user-index">
    <br>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'email', 'format' => 'raw', 'value' => function ($data) {
    return Html::a($data->email, Url::to(['update', 'id' => $data->id]));
}], ['class' => \dosamigos\grid\EditableColumn::className(), 'filter' => Users::$statuses, 'format' => 'raw', 'attribute' => 'status', 'url' => ['ajax-update'], 'type' => 'select', 'display' => 'colors', 'value' => function ($data) {
    return Users::getStatus($data->status);
}, 'editableOptions' => function ($model) {
    return ['source' => Users::$statuses, 'value' => $model->status];
}], ['class' => \dosamigos\grid\EditableColumn::className(), 'filter' => Users::roles(), 'format' => 'raw', 'attribute' => 'role', 'url' => ['ajax-update'], 'value' => function ($data) {
    return Users::getRole($data->role);
}, 'type' => 'select', 'editableOptions' => function ($model) {
    return ['source' => Yii::$app->user->identity->getEditableRoles($model->id), 'sourceCache' => false];
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
<script>
    function colors(value, sourceData) {
        var selected = $.grep(sourceData, function (o) {
                return value == o.value;
            }),
            colors = <?php 
echo json_encode(Users::$status_colors);
?>
;
开发者ID:DezMonT765,项目名称:beacon-cms,代码行数:31,代码来源:user-list.php


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