當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserGroup::getGroupById方法代碼示例

本文整理匯總了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);
 }
開發者ID:hongweipeng,項目名稱:screen,代碼行數:20,代碼來源:UserSession.class.php

示例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);
開發者ID:hongweipeng,項目名稱:screen,代碼行數:31,代碼來源:group.php

示例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);
 }
開發者ID:ZhHong,項目名稱:OSAdmin,代碼行數:24,代碼來源:User.class.php


注:本文中的UserGroup::getGroupById方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。