本文整理汇总了PHP中UserGroup::getGroupById方法的典型用法代码示例。如果您正苦于以下问题:PHP UserGroup::getGroupById方法的具体用法?PHP UserGroup::getGroupById怎么用?PHP UserGroup::getGroupById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserGroup
的用法示例。
在下文中一共展示了UserGroup::getGroupById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reload
public static function reload()
{
$current_user_info = self::getSessionInfo();
$user_info = User::getUserById($current_user_info['user_id']);
if ($user_info['status'] != 1) {
Common::jumpUrl("login.php");
return;
}
//读取该用户所属用户组将该组的权限保存在$_SESSION中
$user_group = UserGroup::getGroupById($user_info['user_group']);
$user_info['group_id'] = $user_group['group_id'];
$user_info['user_role'] = $user_group['group_role'];
$user_info['shortcuts_arr'] = explode(',', $user_info['shortcuts']);
$menu = MenuUrl::getMenuByUrl('/admin/setting.php');
if (strpos($user_group['group_role'], $menu['menu_id'])) {
$user_info['setting'] = 1;
}
$user_info['login_time'] = Common::getDateTime($user_info['login_time']);
UserSession::setSessionInfo($user_info);
}
示例2: extract
<?php
require '../include/init.inc.php';
$group_id = $method = $user_ids = $user_group = '';
extract($_REQUEST, EXTR_IF_EXISTS);
Common::checkParam($group_id);
$group = UserGroup::getGroupById($group_id);
if (empty($group)) {
Common::exitWithError(ErrorMessage::GROUP_NOT_EXIST, "panel/groups.php");
}
if (Common::isPost()) {
if (empty($user_ids) || empty($user_group)) {
OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
} else {
if (in_array(1, $user_ids)) {
Common::exitWithError('不可更改初始管理员的账号组', 'panel/groups.php');
}
$user_ids = implode(',', $user_ids);
$update_data = array('user_group' => $user_group);
$result = User::batchUpdateUsers($user_ids, $update_data);
if ($result >= 0) {
SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'User', $user_ids, json_encode($update_data));
Common::exitWithSuccess('更新完成', 'panel/groups.php');
} else {
OSAdmin::alert("error");
}
}
}
$user_infos = User::getUsersByGroup($group_id);
$groupOptions = UserGroup::getGroupForOptions();
Template::assign('group', $group);
示例3: loginDoSomething
public static function loginDoSomething($user_id)
{
$user_info = User::getUserById($user_id);
if ($user_info['status'] != 1) {
Common::jumpUrl("login.php");
return;
}
//读取该用户所属用户组将该组的权限保存在$_SESSION中
$user_group = UserGroup::getGroupById($user_info['user_group']);
$user_info['group_id'] = $user_group['group_id'];
$user_info['user_role'] = $user_group['group_role'];
$user_info['shortcuts_arr'] = explode(',', $user_info['shortcuts']);
$menu = MenuUrl::getMenuByUrl('/admin/setting.php');
if (strpos($user_group['group_role'], $menu['menu_id'])) {
$user_info['setting'] = 1;
}
$login_time = time();
$login_ip = Common::getIp();
$update_data = array('login_ip' => $login_ip, 'login_time' => $login_time);
User::updateUser($user_info['user_id'], $update_data);
$user_info['login_ip'] = $login_ip;
$user_info['login_time'] = Common::getDateTime($login_time);
UserSession::setSessionInfo($user_info);
}