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


PHP Users::getAll方法代码示例

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


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

示例1: actionList

 public function actionList()
 {
     $data = Users::getAll();
     return $this->render('list', $data);
 }
开发者ID:huynt57,项目名称:bluebee-ng,代码行数:5,代码来源:UserController.php

示例2: actionIndex

 public function actionIndex($status)
 {
     $model = Users::getAll((int) $status);
     return $this->render('All', ['model' => $model, 'status' => $status]);
 }
开发者ID:pumi11,项目名称:aau,代码行数:5,代码来源:UserController.php

示例3: actionCreate

 /**
  * Creates a new MessagesUsers model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new MessagesUsers();
     $type = Yii::$app->request->get('type');
     if (Yii::$app->request->isPost) {
         $param = Yii::$app->request->post();
         if ($param['user_type'] == 'user_name') {
             $userId = Users::getIdByName($param['MessagesUsers']['users_id']);
             if (empty($userId)) {
                 throw new ServerErrorHttpException('不存在的用户姓名!');
             }
             $model->messages_id = $param['MessagesUsers']['messages_id'];
             $model->type = $param['MessagesUsers']['type'];
             $model->users_id = $userId;
             $model->content = $param['MessagesUsers']['content'];
             if ($model->save()) {
                 return $this->redirect(['view', 'id' => $model->id]);
             }
         } elseif ($param['user_type'] == 'user_level') {
             $levelId = Level::getIdByName($param['MessagesUsers']['users_id']);
             if (empty($levelId)) {
                 throw new ServerErrorHttpException('不存在的级别名称!');
             }
             $usersList = Users::findAll(['level_id' => $levelId, 'status' => 1]);
             if (!empty($usersList)) {
                 foreach ($usersList as $key => $val) {
                     $messagesUsersInfo['messages_id'] = $param['MessagesUsers']['messages_id'];
                     $messagesUsersInfo['type'] = $param['MessagesUsers']['type'];
                     $messagesUsersInfo['users_id'] = $val['id'];
                     $messagesUsersInfo['content'] = $param['MessagesUsers']['content'];
                     $messagesUsersInfo['create_time'] = date('Y-m-d H:i:s', time());
                     $messagesUsersInfo['create_user'] = 'admin';
                     $messagesUsersInfo['update_time'] = date('Y-m-d H:i:s', time());
                     $messagesUsersInfo['update_user'] = 'admin';
                     MessagesUsers::addInfo($messagesUsersInfo);
                 }
                 return $this->redirect('index');
             }
         } elseif ($param['user_type'] == 'all_user') {
             $usersList = Users::getAll();
             if (!empty($usersList)) {
                 foreach ($usersList as $key => $val) {
                     $messagesUsersInfo['messages_id'] = $param['MessagesUsers']['messages_id'];
                     $messagesUsersInfo['type'] = $param['MessagesUsers']['type'];
                     $messagesUsersInfo['users_id'] = $val['id'];
                     $messagesUsersInfo['content'] = $param['MessagesUsers']['content'];
                     $messagesUsersInfo['create_time'] = date('Y-m-d H:i:s', time());
                     $messagesUsersInfo['create_user'] = admin;
                     $messagesUsersInfo['update_time'] = date('Y-m-d H:i:s', time());
                     $messagesUsersInfo['update_user'] = 'admin';
                     MessagesUsers::addInfo($messagesUsersInfo);
                     return $this->redirect('index');
                 }
             }
         } else {
             throw new ServerErrorHttpException('参数错误!');
         }
     } else {
         return $this->render('create', ['model' => $model, 'type' => empty($type) ? '1' : $type]);
     }
 }
开发者ID:hanxiao84322,项目名称:coach_system,代码行数:66,代码来源:MessagesUsersController.php

示例4:

/* @var $model app\models\ActivityUsersSearch */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="activity-users-search">

    <?php 
$form = ActiveForm::begin(['action' => ['index'], 'method' => 'get']);
?>

    <?php 
echo $form->field($model, 'activity_id')->dropDownList(ArrayHelper::merge(['' => '选择活动'], ArrayHelper::map(\app\models\Activity::getAll(), 'id', 'name')), ['style' => 'width:100px']);
?>

    <?php 
echo $form->field($model, 'user_id')->dropDownList(ArrayHelper::merge(['' => '选择用户'], ArrayHelper::map(\app\models\Users::getAll(), 'id', 'username')), ['style' => 'width:100px']);
?>

    <?php 
echo $form->field($model, 'status')->dropDownList(ArrayHelper::merge(['' => '选择状态'], \app\models\ActivityUsers::$statusList), ['style' => 'width:100px']);
?>

    <?php 
// echo $form->field($model, 'theory_score')
?>

    <?php 
// echo $form->field($model, 'rule_score')
?>

    <?php 
开发者ID:hanxiao84322,项目名称:coach_system,代码行数:31,代码来源:_search.php


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