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


PHP UserGroup::model方法代码示例

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


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

示例1: actionChangeStatus

 public function actionChangeStatus(array $ids, $value = 0)
 {
     $value = $value == 1 ? true : false;
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     UserGroup::model()->updateAll(array('status' => $value), $criteria);
 }
开发者ID:hung5s,项目名称:yap,代码行数:7,代码来源:UserGroupApi.php

示例2: getUserRole

 public function getUserRole($id)
 {
     $model = User::model()->findByPk($id);
     $group_id = $model->user_group_id;
     $menu = UserGroup::model()->findByPk($group_id);
     return $menu->role;
 }
开发者ID:ultr4h4ck,项目名称:project_gspa,代码行数:7,代码来源:AdminController.php

示例3: get_group_title

 public static function get_group_title($id)
 {
     $value = UserGroup::model()->findByAttributes(array('id' => $id));
     if (empty($value->title)) {
         return null;
     } else {
         return $value->title;
     }
 }
开发者ID:optimosolution,项目名称:jasorbd,代码行数:9,代码来源:UserGroup.php

示例4: init

 public function init()
 {
     parent::init();
     //用户组
     $group_list = UserGroup::model()->findAll();
     if ($group_list) {
         foreach ($group_list as $g) {
             $this->group_list[$g['id']] = $g->attributes;
         }
     }
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:11,代码来源:UserController.php

示例5: getGroupText

 public function getGroupText()
 {
     if (class_exists('BUser', false) && method_exists('BUser', 'getGroupTextExt')) {
         return $this->getGroupTextExt();
     }
     $group = UserGroup::model()->findByPk($this->user_group_id);
     if (!is_null($group)) {
         return $group->name;
     }
     return '';
 }
开发者ID:hung5s,项目名称:yap,代码行数:11,代码来源:User.php

示例6: handleUserGroup

 public function handleUserGroup($event)
 {
     $usergroup = array();
     $records = UserGroup::model()->findAll(array("order" => "creditslower ASC"));
     if (!empty($records)) {
         foreach ($records as $record) {
             $group = $record->attributes;
             $usergroup[$group["gid"]] = $group;
         }
     }
     Syscache::model()->modify("usergroup", $usergroup);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:12,代码来源:UserGroupCacheProvider.php

示例7: loadModel

 /**
  * 判断数据是否存在
  * 
  * return \$this->model
  */
 public function loadModel()
 {
     if ($this->model === null) {
         if (isset($_GET['id'])) {
             $this->model = UserGroup::model()->findbyPk($_GET['id']);
         }
         if ($this->model === null) {
             throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
         }
     }
     return $this->model;
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:17,代码来源:UserGroupController.php

示例8: UserGroupSave

 /**
  * 保存用户到用户组
  */
 static function UserGroupSave($user_id, $group)
 {
     \Yii::app()->db->createCommand()->update('users', array('yourself' => $_POST['self'] ? 1 : 0), 'id=:id', array('id' => $user_id));
     if ($group) {
         UserGroup::model()->deleteAllByAttributes(array('user_id' => $user_id));
         foreach ($group as $group_id) {
             $model = new UserGroup();
             $model->group_id = $group_id;
             $model->user_id = $user_id;
             $model->save();
         }
     }
 }
开发者ID:hiproz,项目名称:mincms,代码行数:16,代码来源:UserGroup.php

示例9: checkGroupNameFree

 /**
  *   This validator method checks if provided usergroup name is free (not existing) or not.
  *   @return boolean true if user doesn't exist, otherwise false.
  */
 public function checkGroupNameFree($attribute, $params)
 {
     // Do not perform this check on update
     if (!$this->isNewRecord) {
         return true;
     }
     // Find group with such name
     $group = UserGroup::model()->find('name=:name', array(':name' => $this->name));
     if ($group == Null) {
         return true;
     }
     // Such a group name already exists.
     $this->addError('name', 'Such a group name already exists.');
     return false;
 }
开发者ID:xyzz,项目名称:CrashFix,代码行数:19,代码来源:UserGroup.php

示例10: run

 public function run($id)
 {
     $controller = $this->getController();
     $this->_setting = $controller->_setting;
     $this->_stylePath = $controller->_stylePath;
     $this->_static_public = $controller->_static_public;
     $myself = false;
     //加载css,js
     Yii::app()->clientScript->registerCssFile($this->_stylePath . "/css/user.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.js");
     //用户信息
     $user = User::model()->findByPk($id);
     //当前登录用户
     $uid = Yii::app()->user->id;
     if (!$user) {
         throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
         exit;
     } else {
         $data = array();
         $group = UserGroup::model()->findByPk($user->groupid);
         $data['uid'] = $user->uid;
         $data['username'] = $user->username;
         $data['email'] = $user->email;
         $data['register_ip'] = $user->register_ip;
         $data['last_login_ip'] = $user->last_login_ip;
         $data['group_name'] = $group->group_name;
         $data['mobile'] = $user->mobile;
         $data['web'] = $user->web;
         $data['qq'] = $user->qq;
         $data['addtime'] = $user->addtime;
         $data['avatar'] = $user->avatar;
         $data['sign'] = $user->sign;
         //SEO
         $controller->_seoTitle = $user->username . ' - ' . Yii::t('common', 'User Space') . ' - ' . $this->_setting['site_name'];
         //判断是否是自己
         if ($uid == $user->uid) {
             $myself = true;
         }
         //判断是否是好友
         $friend_mod = new Friend();
         $friend = $friend_mod->find('uid1=:uid AND uid2=:friendid', array(':uid' => $uid, ':friendid' => $user->uid));
         if (!$friend) {
             $friend = $friend_mod->find('uid1=:uid AND uid2=:friendid', array(':uid' => $user->uid, ':friendid' => $uid));
         }
     }
     $controller->render('user_space', array('user' => $data, 'myself' => $myself, 'friend' => $friend));
 }
开发者ID:redtreelchao,项目名称:wander-moon,代码行数:47,代码来源:SpaceAction.php

示例11: actionUpdate

 public function actionUpdate($id)
 {
     $model = User::model()->findByPk($id);
     if (!is_object($model)) {
         throw new CException("Specified user doesn't exists.");
         return;
     }
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         if ($model->validate() && $model->save()) {
             $this->redirect(array('index'));
         }
     }
     $statusOptions = array(0 => Yii::t('common', 'Disabled'), 1 => Yii::t('common', 'Enabled'));
     $userGroups = CHtml::listData(UserGroup::model()->findAll(), "user_group_id", "name");
     $this->render('update', array('model' => $model, 'statusOptions' => $statusOptions, 'userGroups' => $userGroups));
 }
开发者ID:damnpoet,项目名称:yiicart,代码行数:17,代码来源:UsersController.php

示例12: isInUserGroup

 /**
  * Test if a user is in a group
  * @param int $gid
  * @return boolean
  */
 public function isInUserGroup($gid)
 {
     $oUsergroup = UserGroup::model()->findByPk($gid);
     // The group doesn't exist anymore
     if (!is_object($oUsergroup)) {
         return false;
     }
     $users = $oUsergroup->users;
     foreach ($users as $user) {
         $aUids[] = $user->uid;
     }
     if (in_array($this->id, $aUids)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:CSCI-462-01-2016,项目名称:LimeSurvey,代码行数:22,代码来源:LSWebUser.php

示例13: checkAcl

 /**
  * 校验权限
  * 
  * @param string $acl
  * @return boolean
  */
 public function checkAcl($acl = '')
 {
     $bool = false;
     $groupid = Yii::app()->user->groupid;
     if ($groupid && $acl) {
         $group = UserGroup::model()->findByPk($groupid);
         if ($group->acl) {
             if ($groupid == User::AdminGroupID && $group->acl == 'Administrator') {
                 $bool = true;
             } else {
                 $acl = str_replace('/', '|', $acl);
                 $bool = strstr($group->acl, $acl) ? true : false;
             }
         }
     }
     return $bool;
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:23,代码来源:Backend.php

示例14: checkAcl

 /**
  * 校验登录权限
  * @param string $groupid
  * @param string $acl
  * @return boolean
  */
 public function checkAcl($groupid = '', $acl = '')
 {
     $bool = false;
     if ($groupid && $acl) {
         $group = UserGroup::model()->findByPk($groupid);
         if ($group->acl) {
             if ($groupid == $this->_adminGroupID && $group->acl == 'Administrator') {
                 $bool = true;
             } else {
                 $acl = str_replace('/', '|', $acl);
                 if (strstr($group->acl, $acl)) {
                     $bool = true;
                 }
             }
         }
     }
     return $bool;
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:24,代码来源:LoginForm.php

示例15: actionEdit

 public function actionEdit($id)
 {
     $user_groups = UserGroup::model()->findAll();
     $user_group_data = array();
     foreach ($user_groups as $user_group) {
         $user_group_data[$user_group->user_group_id] = $user_group->name;
     }
     $user = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['User'])) {
         $_POST['User']['last_login'] = date('Y-m-d H:i:s');
         $user->attributes = $_POST['User'];
         if ($user->save()) {
             $this->redirect(array('site/index'));
         }
     }
     $this->render('edit', array('user' => $user, 'user_group_data' => $user_group_data));
 }
开发者ID:ultr4h4ck,项目名称:project_gspa,代码行数:19,代码来源:UserController.php


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