private static function _connect() { self::$db = pc_base::load_model('category_priv_model'); }
/** * 设置栏目权限 */ public function setting_cat_priv() { $roleid = isset($_GET['roleid']) && intval($_GET['roleid']) ? intval($_GET['roleid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); $op = isset($_GET['op']) && intval($_GET['op']) ? intval($_GET['op']) : ''; switch ($op) { case 1: $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); pc_base::load_app_class('role_cat', '', 0); $category = role_cat::get_category($siteid); //获取角色当前权限设置 $priv = role_cat::get_roleid($roleid, $siteid); //加载tree $tree = pc_base::load_sys_class('tree'); $categorys = array(); foreach ($category as $k => $v) { if ($v['type'] == 1) { $v['disabled'] = 'disabled'; $v['init_check'] = ''; $v['add_check'] = ''; $v['delete_check'] = ''; $v['listorder_check'] = ''; $v['push_check'] = ''; $v['move_check'] = ''; } else { $v['disabled'] = ''; $v['add_check'] = isset($priv[$v['catid']]['add']) ? 'checked' : ''; $v['delete_check'] = isset($priv[$v['catid']]['delete']) ? 'checked' : ''; $v['listorder_check'] = isset($priv[$v['catid']]['listorder']) ? 'checked' : ''; $v['push_check'] = isset($priv[$v['catid']]['push']) ? 'checked' : ''; $v['move_check'] = isset($priv[$v['catid']]['remove']) ? 'checked' : ''; $v['edit_check'] = isset($priv[$v['catid']]['edit']) ? 'checked' : ''; } $v['init_check'] = isset($priv[$v['catid']]['init']) ? 'checked' : ''; $category[$k] = $v; } $show_header = true; $str = "<tr>\n\t\t\t\t\t<td align='center'><input type='checkbox' value='1' onclick='select_all(\$catid, this)' ></td>\n\t\t\t\t <td>\$spacer\$catname</td>\n\t\t\t\t <td align='center'><input type='checkbox' name='priv[\$catid][]' \$init_check value='init' ></td>\n\t\t\t\t <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$add_check value='add' ></td>\n\t\t\t\t <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$edit_check value='edit' ></td>\n\t\t\t\t <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$delete_check value='delete' ></td>\n\t\t\t\t <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$listorder_check value='listorder' ></td>\n\t\t\t\t <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$push_check value='push' ></td>\n\t\t\t\t <td align='center'><input type='checkbox' name='priv[\$catid][]' \$disabled \$move_check value='remove' ></td>\n\t\t\t </tr>"; $tree->init($category); $categorys = $tree->get_tree(0, $str); include $this->admin_tpl('role_cat_priv_list'); break; case 2: $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); pc_base::load_app_class('role_cat', '', 0); role_cat::updata_priv($roleid, $siteid, $_POST['priv']); showmessage(L('operation_success'), '?m=admin&c=role&a=init', '', 'edit'); break; default: $sites = pc_base::load_app_class('sites', 'admin'); $sites_list = $sites->get_list(); include $this->admin_tpl('role_cat_priv'); break; } }
private static function _connect() { self::$db = Loader::model('category_priv_model'); }