function index() { import('@.Rover.Tree'); $tree = new Tree(); $map['user_id'] = $this->uid; $list = $this->categories->where($map)->order('listorder')->select(); $tree->init($list); $_linkAddType = pdm_ux('add?typeid='); $_linkViewType = pdm_ux('collect?typeid='); $leaf = "<span><i class='glyphicon glyphicon-leaf'></i> \$title (\$sum)</span> <a href='{$_linkAddType}\$id'>添加密码</a> | <a href='{$_linkViewType}\$id'>查看密码</a>"; $folder = "<span><i class='glyphicon glyphicon-minus-sign'></i> \$title (\$sum)</span> <a href='{$_linkAddType}\$id'>添加密码</a> | <a href='{$_linkViewType}\$id'>查看密码</a>"; $html = $tree->get_treeview(0, 'myTree', $leaf, $folder); $this->assign('html', $html); $this->display(); }
function index() { import('@.Rover.Tree'); $tree = new Tree(); $map['user_id'] = $this->uid; $list = $this->categories->where($map)->order('listorder')->select(); $tree->init($list); $_linkAddType = pdm_ux('add?parent='); $_linkEditType = pdm_ux('edit?id='); $_linkDeleteType = pdm_ux('delete?id='); $lanmu = "<span><i class='glyphicon glyphicon-leaf'></i> \$title (\$sum)</span> <a href='{$_linkAddType}\$id'>添加子类</a> | <a href='{$_linkEditType}\$id'>修改</a> | <a href='{$_linkDeleteType}\$id'>删除</a>"; $moji = "<span><i class='glyphicon glyphicon-minus-sign'></i> \$title (\$sum)</span> <a href='{$_linkAddType}\$id'>添加子类</a> | <a href='{$_linkEditType}\$id'>修改</a> | <a href='{$_linkDeleteType}\$id'>删除</a>"; $html = $tree->get_treeview(0, 'myTree', $lanmu, $moji); $this->assign('html', $html); $this->display(); }
/** * 显示栏目菜单列表 */ public function public_categorys() { //管理员uid $uid = AppframeAction::$Cache['uid']; $cache_class_list = S("cache_class_list_{$uid}"); if (!$cache_class_list) { import('Tree'); $tree = new Tree(); //栏目权限 超级管理员例外 if (session(C("ADMIN_AUTH_KEY")) == "") { $role_id = AppframeAction::$Cache['User']['role_id']; $priv_result = M("Category_priv")->where(array("roleid" => $role_id, 'action' => 'init'))->select(); $priv_catids = array(); foreach ($priv_result as $_v) { $priv_catids[] = $_v['catid']; } } if (!empty($this->categorys)) { foreach ($this->categorys as $r) { if ($r['type'] == 2 && $r['child'] == 0) { continue; } //只显示有init权限的,超级管理员除外 if (session(C("ADMIN_AUTH_KEY")) == "" && !in_array($r['catid'], $priv_catids)) { $arrchildid = explode(',', $r['arrchildid']); $array_intersect = array_intersect($priv_catids, $arrchildid); if (empty($array_intersect)) { continue; } } $r['icon_type'] = $r['vs_show'] = ''; $r['type'] = 'classlist'; $r['add_icon'] = "<a target='right' href='" . U("Contents/Content/classlist", array("catid" => $r['catid'])) . "' onclick=javascript:openwinx('" . U("Contents/Content/add", array("catid" => $r['catid'])) . "','')><img src='" . AppframeAction::$Cache['Config']['siteurl'] . "statics/images/add_content.gif' alt='添加'></a> "; $r['add_lists'] = "<a href='" . U("Contents/Content/classlist", array("catid" => $r['catid'])) . "' target='right' >" . $r['catname'] . "</a>"; $categorys[$r['catid']] = $r; } } if (!empty($categorys)) { $tree->init($categorys); $strs = "<span class='\$icon_type'>\$add_icon\$add_lists</span>"; $strs2 = "<span class='folder'>\$catname</span>"; $categorys = $tree->get_treeview(0, 'category_tree', $strs, $strs2, $ajax_show); } else { $categorys = "该站点下面还没有栏目,请先添加栏目"; } //缓存 S("cache_class_list_{$uid}", $categorys, 300); } else { $categorys = $cache_class_list; } $this->assign("categorys", $categorys); $this->display(); }