s(@classstr, $parentid, $name, [其他字段]);
分类管理(不完整设计-权限管理)(4)
权限管理
chkpower 功能
0 功能简述
根据 管理模式 判断当前用户 是否可以通过本模块。
1 接口参数
1.1 入口
session(user['id'])
<$id> //需要判断权限的分类的 id
session(user['power']) //user['power'] = 'id,id,id'
1.2 出口
errno //没有权限
user['power'] .= ',id' //认证通过
2 实现
判断 id 是否在 session(user['power']) 中
是:通过
否:管理模式 0:
select @classstr:=classstr from class where id = $id
//判断当前类的 分类字符串 是否包含 user[id] 所管理的任何一个分类 是 则通过 说明当前分类是子分类
select <任何字段> from class where @classstr like concat('%',id,'%') and masterid = session(user[id])
如果返回的记录集不为空 则通过。
并 user['power'] .= $id;
管理模式 1:
//判断 当前用户是否在 当前类管理员列表中 是 则通过。
select <任何字段> from class where masterid like concat('%',user['id'],'%') and id = $id
如果没有通过:
errno = n;
include(error.php)
分类管理(不完整设计-显示分类)(5)
显示分类(listclass)
0 功能描述
1 接口参数
1.1 入口
$rootid 要显示分类的根节点的 id 即显示所有 rootid 的子节点
$tree 是否全部展开
//默认的模版变量
1.2 出口
errno
2 变量声明
var $result; //记录集
var $nodenum; //节点数量
var $allnodearray; //所有节点数组
var $html; //模板变量
3 函数声明
function getresult(rootid,tree)
//得到一个需要的记录集
function pallnode1(level,rootnodeid,
分类管理(不完整设计-权限管理)(4)
权限管理
chkpower 功能
0 功能简述
根据 管理模式 判断当前用户 是否可以通过本模块。
1 接口参数
1.1 入口
session(user['id'])
<$id> //需要判断权限的分类的 id
session(user['power']) //user['power'] = 'id,id,id'
1.2 出口
errno //没有权限
user['power'] .= ',id' //认证通过
2 实现
判断 id 是否在 session(user['power']) 中
是:通过
否:管理模式 0:
select @classstr:=classstr from class where id = $id
//判断当前类的 分类字符串 是否包含 user[id] 所管理的任何一个分类 是 则通过 说明当前分类是子分类
select <任何字段> from class where @classstr like concat('%',id,'%') and masterid = session(user[id])
如果返回的记录集不为空 则通过。
并 user['power'] .= $id;
管理模式 1:
//判断 当前用户是否在 当前类管理员列表中 是 则通过。
select <任何字段> from class where masterid like concat('%',user['id'],'%') and id = $id
如果没有通过:
errno = n;
include(error.php)
分类管理(不完整设计-显示分类)(5)
显示分类(listclass)
0 功能描述
1 接口参数
1.1 入口
$rootid 要显示分类的根节点的 id 即显示所有 rootid 的子节点
$tree 是否全部展开
//默认的模版变量
1.2 出口
errno
2 变量声明
var $result; //记录集
var $nodenum; //节点数量
var $allnodearray; //所有节点数组
var $html; //模板变量
3 函数声明
function getresult(rootid,tree)
//得到一个需要的记录集
function pallnode1(level,rootnodeid,
| 对此文章发表了评论 |
