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


PHP CGlobal::permit方法代码示例

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


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

示例1: draw

 function draw()
 {
     $this->beginForm();
     global $display;
     $acc_groups = CGlobal::$group;
     if (!User::is_root()) {
         unset($acc_groups[9]);
     }
     $user_permits = array();
     $all_users = array();
     $allist_users = array();
     $gids = '';
     foreach ($acc_groups as $group) {
         $acc_groups[$group['id']]['users'] = array();
         $acc_groups[$group['id']]['pids'] = array();
         $acc_groups[$group['id']]['pid_str'] = '';
         if (!in_array($group['id'], array(1, 9))) {
             $gids .= ($gids ? ',' : '') . $group['id'];
         }
     }
     $re = DB::query("SELECT * FROM user_groups");
     if ($re) {
         while ($group = mysql_fetch_assoc($re)) {
             if (!in_array($group['id'], array(1, 9))) {
                 CGlobal::$group[$group['id']] = $group;
                 $group['users'] = array();
                 $group['pids'] = array();
                 $group['pid_str'] = '';
                 $group['del_link'] = Url::build_current(array('cmd' => 'del_group', 'id' => $group['id']));
                 $group['edit_link'] = Url::build_current(array('cmd' => 'edit_group', 'id' => $group['id']));
                 $gids .= ($gids ? ',' : '') . $group['id'];
                 $acc_groups[$group['id']] = $group;
             }
         }
     }
     EClassApi::get_config();
     if (isset(CGlobal::$configs['site_permission'])) {
         CGlobal::$permit = unserialize(CGlobal::$configs['site_permission']['conf_val']);
         foreach (CGlobal::$permit as $permit) {
             if ($permit && is_array($permit)) {
                 foreach ($permit as $pm => $des) {
                     CGlobal::$all_permit[$pm] = $des;
                 }
             }
         }
     }
     if ($gids) {
         //$sql = "SELECT pids,ref_id FROM user_permit WHERE ref_id IN(".$gids.") AND type=0";//lấy quyền của nhóm
         $sql = "SELECT type, ref_id, pids FROM user_permit";
         //lấy quyền của nhóm
         $result = DB::query($sql);
         if ($result) {
             while ($row = mysql_fetch_assoc($result)) {
                 if ($row['type'] == 0) {
                     // $acc_groups[$row['ref_id']]['pid_str'].=($acc_groups[$row['ref_id']]['pid_str']?'|':'').$row['pids'];
                     $acc_groups[$row['ref_id']]['pids'] = array();
                     if ($row['pids']) {
                         $pids = explode('|', $row['pids']);
                         if ($pids) {
                             foreach ($pids as $pid) {
                                 if ($pid && isset(CGlobal::$all_permit[$pid])) {
                                     $acc_groups[$row['ref_id']]['pids'][$pid] = CGlobal::$all_permit[$pid];
                                 }
                             }
                         }
                     }
                 } else {
                     $user_permits[$row['ref_id']] = $row['pids'];
                 }
             }
         }
     }
     ############################################################################################################
     $sql = 'SELECT id,user_name, full_name, gids FROM account AS a WHERE a.gids != "0" AND  a.gids != ""';
     $result = DB::query($sql);
     if ($result) {
         while ($user = mysql_fetch_assoc($result)) {
             $user['full_name'] = String::trimSpace($user['full_name']);
             $all_users[$user['id']] = $user;
             $user['pid_str'] = isset($user_permits[$user['id']]) ? $user_permits[$user['id']] : '';
             $groups = explode('|', $user['gids']);
             foreach ($groups as $gid) {
                 if (isset($acc_groups[$gid])) {
                     if (!User::is_root() && $gid == 9) {
                         $user['del_enable'] = 0;
                     } else {
                         $user['del_enable'] = 1;
                     }
                     $acc_groups[$gid]['users'][] = $user;
                 }
             }
             $pid_str = isset($user_permits[$user['id']]) ? $user_permits[$user['id']] : '';
             $pid_arr = explode('|', $pid_str);
             $user['pids'] = array();
             if ($pid_arr) {
                 foreach ($pid_arr as $pid) {
                     if ($pid && isset(CGlobal::$all_permit[$pid])) {
                         $user['pids'][$pid] = CGlobal::$all_permit[$pid];
                     }
                 }
//.........这里部分代码省略.........
开发者ID:hqd276,项目名称:bigs,代码行数:101,代码来源:ListAdmin.php


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