Esempio n. 1
0
 /**
  * @Title: metulefttree
  * @Description: todo(菜单分组下的左侧2-3级子菜单数组)   
  * @author 谢友志 
  * @date 2014-12-1 上午11:57:42 
  * @throws
  */
 function menuLeftTree($groupid)
 {
     $mode4 = M("node");
     $where['group_id'] = $groupid;
     $where['status'] = 1;
     $where['showmenu'] = 1;
     //模板显示
     $where['level'] = array("neq", 4);
     //除操作节点外
     $nodelist = $mode4->field("id,title,pid,name,level")->where($where)->order('sort asc')->select();
     //获取系统授权模板
     $model_syspwd = D('SerialNumber');
     $modules_sys = $model_syspwd->checkModule();
     $m_list = explode(",", $modules_sys);
     //获取当前用户授权
     $access = getAuthAccess();
     //存储授权的数组信息
     $accessNode = array();
     foreach ($nodelist as $key => $val) {
         if ($val['level'] == 2) {
             $levelthreeNode = array();
             foreach ($nodelist as $key1 => $val1) {
                 if ($val1['level'] == 3 && $val['id'] == $val1['pid']) {
                     //校验系统模块授权   如果是以MisDynamic开头的控制器,一律不显示在菜单上面
                     if (substr($val1['name'], 0, 10) != "MisDynamic") {
                         if (!in_array($val1['name'], $m_list)) {
                             continue;
                         }
                     }
                     //显示有权限的模块
                     if (isset($access[strtoupper(APP_NAME)][strtoupper($val1['name'])]["INDEX"]) || $_SESSION[C('ADMIN_AUTH_KEY')]) {
                         $levelthreeNode[] = $val1;
                     }
                 }
             }
             //判断当前是否存在3级控制器,否组2级面板将不显示出来
             if ($levelthreeNode) {
                 $val['levelthree'] = $levelthreeNode;
                 $accessNode[$key] = $val;
             }
         }
     }
     return $accessNode;
 }
Esempio n. 2
0
 public function oftenaddtree($group_id = 1, $m_list)
 {
     $access = getAuthAccess();
     $umap['uid'] = $_SESSION[C('USER_AUTH_KEY')];
     $umap['status'] = 1;
     $oftenList = $this->where($umap)->getField('url', true);
     $node = D("Node");
     $map['status'] = 1;
     $map['showmenu'] = 1;
     $map['type'] = 3;
     $map['group_id'] = $group_id;
     $list = $node->where($map)->order('sort asc')->select();
     $tree = array();
     foreach ($list as $k => $v) {
         if ($v['name'] != "Index") {
             if (substr($v['name'], 0, 10) != "MisDynamic") {
                 if (!in_array($v['name'], $m_list)) {
                     continue;
                 }
             }
             if (!isset($access[strtoupper(APP_NAME)][strtoupper($v['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                 continue;
             }
             if (in_array($v['name'] . "/index", $oftenList)) {
                 continue;
             }
             $tree[] = $v;
         }
     }
     // 		//查询功能盒子  --暂无发现用处
     // 		$FunctionalBoxmodel=D("MisSystemFunctionalBox");
     // 		$Functionalarr=$FunctionalBoxmodel->where("status=1 and groupid=".$group_id)->select();
     // 		$this->assign("Functionalarr",$Functionalarr);
     return $tree;
 }
Esempio n. 3
0
 /**
  * @Title: getIndexTree
  * @Description: todo(构造首页菜单)
  * @param $group_id 分组ID
  * @param $nodedata 节点数据
  * @param $pid 父节点
  * @param $pname 父节点名称
  * @param $ptitle 父节点标题
  * @param $m_list 授权验证
  * @return Ambigous <string, unknown> 首页菜单
  * @author 杨东
  * @date 2013-4-2 下午4:16:48
  * @throws
  */
 private function getIndexTree($group_id, $nodedata, $pid = 0, $pname = "", $ptitle = "", $m_list)
 {
     $html = "";
     $html2 = "";
     $node = D("Node");
     $access = getAuthAccess();
     $Skip_System_Out_List = (require DConfig_PATH . "/System/SkipSystemOutListConfig.inc.php");
     foreach ($nodedata as $k => $v) {
         if ($v['group_id'] != $group_id) {
             continue;
         }
         if (!$v["icon"]) {
             $v["icon"] = "appbtn_61.png";
         }
         if ($pid) {
             if ($pid != $v['pid']) {
                 continue;
             }
         }
         if ($v['name'] != 'Public' && $v['name'] != 'Index') {
             if ($v['type'] == 3) {
                 if ($v["pid"] == $pid) {
                     unset($nodedata[$k]);
                     //校验系统模块授权
                     if (substr($v['name'], 0, 10) != "MisDynamic") {
                         if (!in_array($v['name'], $m_list)) {
                             continue;
                         }
                     }
                     if (!isset($access[strtoupper(APP_NAME)][strtoupper($v['name'])]["INDEX"]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                         continue;
                     }
                     //yuansl 2014 06 20替换掉跳转 ,目的跳出系统外部
                     foreach ($Skip_System_Out_List as $cofli) {
                         if ($v['name'] == $cofli['model']) {
                             $html .= "<li><a target= \"{$cofli['target']}\" href=\"__APP__" . $Skip_System_Out_List[0]['url'] . "/>";
                             break;
                         } else {
                             $html .= "<li><a target=\"navTab\" rel=\"" . $v['name'] . "\" href=\"__APP__/" . $v['name'] . "/index\">";
                             break;
                         }
                     }
                     $html .= '<img alt="' . $v["title"] . '" height="32" src="__PUBLIC__/Images/xyicon/' . $v["icon"] . '" width="32" />';
                     $html .= "<span>" . $v["title"] . "</span>";
                     $html2 .= '<li><a href="__APP__/' . $v['name'] . '/index" target="navTab" rel="' . $v['name'] . '" title="' . $v['title'] . '"><img alt="' . $v['title'] . '" height="64" src="__PUBLIC__/Images/xyicon/' . $v['icon'] . '" width="64" /><span>' . $v['title'] . '</span></a>';
                     $map['status'] = 1;
                     $map['level'] = 4;
                     $map['pid'] = $v['id'];
                     $map['group_id'] = $group_id;
                     $nodedata2 = $node->where($map)->select();
                     if ($nodedata2) {
                         $sys_str3 = $this->getIndexTree($group_id, $nodedata2, $v['id'], $v['name'], $v['title'], $m_list);
                         $s3_1 = $sys_str3[0];
                         if ($s3_1) {
                             $html .= "<span class=\"xytriangel\"></span></a><ul class=\"xystartmenu_s_ul clearfix\">";
                             $html .= $s3_1;
                             $html .= "</ul>";
                         }
                         $syss3_1 = $sys_str3[1];
                         if ($syss3_1) {
                             $html2 .= "<ul class=\"xytriapp clearfix\">";
                             $html2 .= $syss3_1;
                             $html2 .= "</ul>";
                         }
                     }
                     $html .= "</a></li>";
                     $html2 .= "</a></li>";
                 }
             } else {
                 if ($v['type'] == 4) {
                     unset($nodedata[$k]);
                     if (!isset($access[strtoupper(APP_NAME)][strtoupper($pname)][strtoupper($v['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                         continue;
                     }
                     if ($v["toolshow"]) {
                         $url_parem = $v['name'];
                         $title = $v['title'];
                         $rel = $pname . $v['name'];
                         if ($v['name'] == "waitAudit") {
                             $title = $ptitle;
                             $rel = $pname;
                             $url_parem = "index/ntdata/1";
                         } else {
                             if ($v['name'] == "alreadyAudit") {
                                 $title = $ptitle;
                                 $rel = $pname;
                                 $url_parem = "index/ntdata/2";
                             }
                         }
                         $html .= "<li><a title=" . $title . " target=\"navTab\" rel=\"" . $rel . "\" href=\"__APP__/" . $pname . "/" . $url_parem . "\">";
                         $html .= '<img alt="' . $v["title"] . '" height="32" src="__PUBLIC__/Images/xyicon/' . $v["icon"] . '" width="32" />';
                         $html .= "<span>" . $v["title"] . "</span>" . "</a></li>";
                         $html2 .= '<li><a href="__APP__/' . $pname . '/' . $url_parem . '\\" target="navTab" rel="' . $rel . '" title="' . $v['title'] . '"><img alt="' . $v['title'] . '" height="64" src="__PUBLIC__/Images/xyicon/' . $v['icon'] . '" width="64" /><span>' . $v['title'] . '</span></a></li>';
                     }
                 } else {
                     if ($v['type'] == 1) {
                         if ($v["toolshow"] == 1) {
                             $s1_1 = "<li><a href=\"#\">";
                             $s1_1 .= '<img alt="' . $v["title"] . '" height="32" src="__PUBLIC__/Images/xyicon/' . $v["icon"] . '" width="32" />';
                             $s1_1 .= "<span>" . $v["title"] . "</span>" . "<span class=\"xytriangel\"></span></a>";
                             $syss1_1 = '<li class="sublist"><a class="suba" href="#" title="' . $v['title'] . '"><img alt="' . $v['title'] . '" height="64" src="__PUBLIC__/Images/xyicon/' . $v['icon'] . '" width="64" /><span>' . $v['title'] . '</span></a>';
                         }
                         unset($nodedata[$k]);
                         $sys_str = $this->getIndexTree($group_id, $nodedata, $v['id'], "", "", $m_list);
                         $s1_2 = $sys_str[0];
                         $syss1_2 = $sys_str[1];
                         if ($s1_2) {
                             if ($v["toolshow"] == 1) {
                                 $html .= $s1_1 . "<ul class=\"xystartmenu_s_ul clearfix\">" . $s1_2 . "</ul></li>";
                             } else {
                                 $html .= $s1_2;
                             }
                         } else {
                             if ($_SESSION[C('ADMIN_AUTH_KEY')] && $s1_1) {
                                 if ($v["toolshow"] == 1) {
                                     $html .= $s1_1 . "</li>";
                                 }
                             }
                         }
                         if ($syss1_2) {
                             if ($v["toolshow"] == 1) {
                                 $html2 .= $syss1_1 . "<ul class=\"xytriapp clearfix\">" . $syss1_2 . "</ul></li>";
                             } else {
                                 $html2 .= $syss1_2;
                             }
                         } else {
                             if ($_SESSION[C('ADMIN_AUTH_KEY')] && $syss1_1) {
                                 if ($v["toolshow"] == 1) {
                                     $html2 .= $syss1_1 . "</li>";
                                 }
                             }
                         }
                     } else {
                         if ($v['type'] == 2) {
                             if ($v["pid"] == $pid) {
                                 unset($nodedata[$k]);
                                 if ($v["toolshow"] == 1) {
                                     $s2_1 = "<li><a href=\"#\">";
                                     $s2_1 .= '<img alt="' . $v["title"] . '" height="32" src="__PUBLIC__/Images/xyicon/' . $v["icon"] . '" width="32" />';
                                     $s2_1 .= "<span>" . $v["title"] . "</span>" . "<span class=\"xytriangel\"></span></a>";
                                     /*$models = M('mis_report_center');
                                     		 $lists = $models->where('type='.$v['id'].' and status = 1')->select();
                                     		if ($lists)  $s2_1.="<ul>";
                                     		foreach ($lists as $ks => $vs) {
                                     		$s2_1 .= "<li><a rel='ReportCenter".$vs[id]."' target='navTab' href='__APP__/ReportCenter/index/reporttype/".$vs[id]."'>".$vs['name']."</a></li>";
                                     		}
                                     		if ($lists)  $s2_1.="</ul>";*/
                                     $syss2_1 = '<li class="sublist"><a class="suba" href="#" title="' . $v['title'] . '"><img alt="' . $v['title'] . '" height="64" src="__PUBLIC__/Images/xyicon/' . $v['icon'] . '" width="64" /><span>' . $v['title'] . '</span></a>';
                                 }
                                 $sys_str2 = $this->getIndexTree($group_id, $nodedata, $v['id'], "", "", $m_list);
                                 $s2_2 = $sys_str2[0];
                                 $syss2_2 = $sys_str2[1];
                                 if ($s2_2) {
                                     if ($v["toolshow"] == 1) {
                                         $html .= $s2_1 . "<ul class=\"xystartmenu_s_ul clearfix\">" . $s2_2 . "</ul></li>";
                                     } else {
                                         $html .= $s2_2;
                                     }
                                 } else {
                                     if ($_SESSION[C('ADMIN_AUTH_KEY')] && $s2_1) {
                                         if ($v["toolshow"] == 1) {
                                             $html .= $s2_1 . "</li>";
                                         }
                                     }
                                 }
                                 if ($syss2_2) {
                                     if ($v["toolshow"] == 1) {
                                         $html2 .= $syss2_1 . "<ul class=\"xytriapp clearfix\">" . $syss2_2 . "</ul></li>";
                                     } else {
                                         $html2 .= $syss2_2;
                                     }
                                 } else {
                                     if ($_SESSION[C('ADMIN_AUTH_KEY')] && $syss2_1) {
                                         if ($v["toolshow"] == 1) {
                                             $html2 .= $syss2_1 . "</li>";
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return array($html, $html2);
 }
 /**
  * @Title: getRoleTree
  * @Description: todo(菜单树)
  * @author 杨东
  * @date 2013-5-28 上午10:41:15
  * @throws
  */
 public function getRoleTree()
 {
     // 组
     $model = M("group");
     $list = $model->where("status=1")->order("sorts asc")->select();
     //获取系统授权
     $model_syspwd = D('SerialNumber');
     $modules_sys = $model_syspwd->checkModule();
     $m_list = explode(",", $modules_sys);
     //需过滤的model
     $model = D('SystemConfigDetail');
     $filter = $model->getDCFilter();
     // 查询菜单节点
     $node = M("Node");
     $map['status'] = 1;
     //$map['showmenu'] = 1;
     $map['name'] = array('not in', $filter);
     $map['type'] = array('lt', 4);
     $data = $node->where($map)->order('sort asc')->select();
     // 获取授权节点
     $accessList = getAuthAccess();
     $returnarr = array();
     // 第一个循环构造分组节点
     foreach ($list as $k2 => $v2) {
         $newv1 = array();
         $newv1['id'] = -$v2['id'];
         $newv1['pId'] = 0;
         $newv1['title'] = $v2['name'];
         //光标提示信息
         $newv1['name'] = missubstr($v2['name'], 20, true);
         //结点名字,太多会被截取
         $newv1['open'] = 'true';
         $returnarr2 = array();
         // 第二个循环构造组分类节点
         foreach ($data as $k => $v) {
             $newv2 = array();
             // 过来权限
             if (substr($v['name'], 0, 10) != "MisDynamic") {
                 if (!in_array($v['name'], $m_list)) {
                     continue;
                 }
             }
             if (!isset($access[strtoupper(APP_NAME)][strtoupper($v['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                 continue;
             }
             if ($v['name'] != 'Public' && $v['name'] != 'Index') {
                 if ($v['type'] == 1 && $v['group_id'] == $v2['id']) {
                     $newv2['id'] = $v['id'];
                     $newv2['pId'] = -$v2['id'];
                     $newv2['title'] = $v['title'];
                     //光标提示信息
                     $newv2['name'] = missubstr($v['title'], 20, true);
                     //结点名字,太多会被截取
                     $newv2['open'] = 'true';
                     $returnarr3 = array();
                     // 判断当前节点是否显示1显示0不显示
                     if ($v["toolshow"] == 1) {
                         // 第三个循环判断模块节点
                         foreach ($data as $k3 => $v3) {
                             // 过来权限
                             if (substr($v3['name'], 0, 10) != "MisDynamic") {
                                 if (!in_array($v3['name'], $m_list)) {
                                     continue;
                                 }
                             }
                             if (!isset($access[strtoupper(APP_NAME)][strtoupper($v3['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                                 continue;
                             }
                             $newv3 = array();
                             if ($v3['type'] == 3 && $v3['pid'] == $v['id']) {
                                 if (!$this->firstDetail) {
                                     $this->firstDetail['name'] = $v3['name'];
                                     $this->firstDetail['title'] = $v3['title'];
                                     $this->firstDetail['check'] = $v3['id'];
                                 }
                                 $newv3['id'] = $v3['id'];
                                 $newv3['pId'] = $v['id'];
                                 $newv3['title'] = $v3['title'];
                                 //光标提示信息
                                 $newv3['name'] = missubstr($v3['title'], 20, true);
                                 //结点名字,太多会被截取
                                 $newv3['url'] = "__URL__/index/jump/1/type/" . $v3['id'];
                                 $newv3['target'] = 'ajax';
                                 $newv3['rel'] = "nodeactionconfig";
                                 $newv3['open'] = 'true';
                                 $returnarr3[] = $newv3;
                             }
                         }
                         if ($returnarr3) {
                             $returnarr3[] = $newv2;
                         }
                     } else {
                         // 第三个循环判断模块节点
                         foreach ($data as $k3 => $v3) {
                             if (substr($v3['name'], 0, 10) != "MisDynamic") {
                                 if (!in_array($v3['name'], $m_list)) {
                                     continue;
                                 }
                             }
                             if (!isset($access[strtoupper(APP_NAME)][strtoupper($v3['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                                 continue;
                             }
                             $newv3 = array();
                             if ($v3['type'] == 3 && $v3['pid'] == $v['id']) {
                                 if (!$this->firstDetail) {
                                     $this->firstDetail['name'] = $v3['name'];
                                     $this->firstDetail['title'] = $v3['title'];
                                     $this->firstDetail['check'] = $v3['id'];
                                 }
                                 $newv3['id'] = $v3['id'];
                                 $newv3['pId'] = -$v2['id'];
                                 $newv3['title'] = $v3['title'];
                                 //光标提示信息
                                 $newv3['name'] = missubstr($v3['title'], 20, true);
                                 //结点名字,太多会被截取
                                 $newv3['url'] = "__URL__/index/jump/1/type/" . $v3['id'];
                                 $newv3['target'] = 'ajax';
                                 $newv3['rel'] = "nodeactionconfig";
                                 $newv3['open'] = 'true';
                                 $returnarr3[] = $newv3;
                             }
                         }
                     }
                     if ($returnarr3) {
                         $returnarr2 = array_merge($returnarr2, $returnarr3);
                     }
                 }
             }
         }
         if ($returnarr2) {
             $returnarr[] = $newv1;
             $returnarr = array_merge($returnarr, $returnarr2);
         }
     }
     $this->assign('typeTree', json_encode($returnarr));
 }
Esempio n. 5
0
 /**
  * @Title: getIndexPanels
  * @Description: todo(这里用一句话描述这个方法的作用)
  * @param $group_id 组
  * @param $nodedata 节点数据
  * @param $pid 父节点
  * @param $pname 父名称
  * @param $ptitle 父标题
  * @param $m_list 系统授权数据
  * @return string
  * @author 杨东
  * @date 2013-3-11 下午1:49:42
  * @throws
  */
 private function getIndexPanels($group_id, $nodedata, $pid = 0, $pname = "", $ptitle = "", $m_list)
 {
     $html = "";
     $node = D("Node");
     $access = getAuthAccess();
     foreach ($nodedata as $k => $v) {
         if ($v['group_id'] != $group_id) {
             continue;
         }
         if (!$v["icon"]) {
             $v["icon"] = "appbtn_61.png";
         }
         if ($pid) {
             if ($pid != $v['pid']) {
                 continue;
             }
         }
         if ($v['name'] != 'Public' && $v['name'] != 'Index') {
             switch ($v['type']) {
                 case 1:
                     if ($v["toolshow"] == 1) {
                         $s1_1 = '<li class="sublist"><a class="suba" href="#" title="' . $v['title'] . '"><img alt="' . $v['title'] . '" height="64" src="__PUBLIC__/Images/xyicon/' . $v['icon'] . '" width="64" /><span>' . $v['title'] . '</span></a>';
                     }
                     unset($nodedata[$k]);
                     $s1_2 = $this->getIndexPanels($group_id, $nodedata, $v['id'], "", "", $m_list);
                     if ($s1_2) {
                         if ($v["toolshow"] == 1) {
                             $html .= $s1_1 . "<ul class=\"xytriapp clearfix\">" . $s1_2 . "</ul></li>";
                         } else {
                             $html .= $s1_2;
                         }
                     } else {
                         if ($_SESSION[C('ADMIN_AUTH_KEY')] && $s1_1) {
                             if ($v["toolshow"] == 1) {
                                 $html .= $s1_1 . "</li>";
                             }
                         }
                     }
                     break;
                 case 2:
                     if ($v["pid"] == $pid) {
                         unset($nodedata[$k]);
                         if ($v["toolshow"] == 1) {
                             $s2_1 = '<li class="sublist"><a class="suba" href="#" title="' . $v['title'] . '"><img alt="' . $v['title'] . '" height="64" src="__PUBLIC__/Images/xyicon/' . $v['icon'] . '" width="64" /><span>' . $v['title'] . '</span></a>';
                         }
                         $s2_2 = $this->getIndexPanels($group_id, $nodedata, $v['id'], "", "", $m_list);
                         if ($s2_2) {
                             if ($v["toolshow"] == 1) {
                                 $html .= $s2_1 . "<ul class=\"xytriapp clearfix\">" . $s2_2 . "</ul></li>";
                             } else {
                                 $html .= $s2_2;
                             }
                         } else {
                             if ($_SESSION[C('ADMIN_AUTH_KEY')] && $s2_1) {
                                 if ($v["toolshow"] == 1) {
                                     $html .= $s2_1 . "</li>";
                                 }
                             }
                         }
                     }
                     break;
                 case 3:
                     if ($v["pid"] == $pid) {
                         unset($nodedata[$k]);
                         //校验系统模块授权
                         if (substr($v['name'], 0, 10) != "MisDynamic") {
                             if (!in_array($v['name'], $m_list)) {
                                 continue;
                             }
                         }
                         if (!isset($access[strtoupper(APP_NAME)][strtoupper($v['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                             continue;
                         }
                         $html .= '<li><a href="__APP__/' . $v['name'] . '/index" target="navTab" rel="' . $v['name'] . '" title="' . $v['title'] . '"><img alt="' . $v['title'] . '" height="64" src="__PUBLIC__/Images/xyicon/' . $v['icon'] . '" width="64" /><span>' . $v['title'] . '</span></a>';
                         //$html.= "<li><a class=\"add_new\" target=\"navTab\" rel=\"".$v['name']."\" href=\"__APP__/".$v['name']."/index\"><span class=\"left\">".$v['title']."</span>";
                         $map['status'] = 1;
                         $map['level'] = 4;
                         $map['pid'] = $v['id'];
                         $map['group_id'] = $group_id;
                         $nodedata2 = $node->where($map)->select();
                         if ($nodedata2) {
                             $s3_1 = $this->getIndexPanels($group_id, $nodedata2, $v['id'], $v['name'], $v['title'], $m_list);
                             if ($s3_1) {
                                 $html .= "<ul class=\"xytriapp clearfix\">";
                                 $html .= $s3_1;
                                 $html .= "</ul>";
                             }
                         }
                         $html .= "</a></li>";
                     }
                     break;
                 case 4:
                     unset($nodedata[$k]);
                     if (!isset($access[strtoupper(APP_NAME)][strtoupper($pname)][strtoupper($v['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                         continue;
                     }
                     if ($v["toolshow"]) {
                         $url_parem = $v['name'];
                         $title = $v['title'];
                         $rel = $pname . $v['name'];
                         if ($v['name'] == "waitAudit") {
                             $title = $ptitle;
                             $rel = $pname;
                             $url_parem = "index/ntdata/1";
                         } else {
                             if ($v['name'] == "alreadyAudit") {
                                 $title = $ptitle;
                                 $rel = $pname;
                                 $url_parem = "index/ntdata/2";
                             }
                         }
                         $html .= '<li><a href="__APP__/' . $pname . '/' . $url_parem . '\\" target="navTab" rel="' . $rel . '" title="' . $v['title'] . '"><img alt="' . $v['title'] . '" height="64" src="__PUBLIC__/Images/xyicon/' . $v['icon'] . '" width="64" /><span>' . $v['title'] . '</span></a></li>';
                         //$html.= "<li><a class=\"add_new\" title=".$title." target=\"navTab\" rel=\"".$rel."\" href=\"__APP__/".$pname."/".$url_parem."\"><span class='left'>".$v['title']."</span></a></li>";
                     }
                     break;
             }
         }
     }
     return $html;
 }
 /**
  * @Title: getRoleTree
  * @Description: todo(菜单树)
  * @param rel str 连接(html标签里的id值)
  * @param url str 显示的页面
  * @param map2 array 额外条件
  * @author 杨东
  * @date 2013-5-28 上午10:41:15
  * @throws
  */
 public function getRoleTree($rel, $url = '__URL__/index', $map2 = array(), $modelname = false, $target = 'ajax', $title = '')
 {
     if (empty($url)) {
         $url = '__URL__/index';
     }
     // 组
     $model = M("group");
     $list = $model->where("status=1")->order("sorts asc")->select();
     //获取系统授权
     $model_syspwd = D('SerialNumber');
     $modules_sys = $model_syspwd->checkModule();
     $m_list = explode(",", $modules_sys);
     // 查询菜单节点
     $map['status'] = 1;
     $map['showmenu'] = 1;
     $map['type'] = array('lt', 4);
     $node = M("Node");
     //$map['name'] = array('not in',$filter);
     $data = $node->where($map)->order('sort asc')->field("id,pid,name,level,isprojectwork,type,group_id,title,toolshow")->select();
     if ($map2) {
         $map['level'] = array('eq', 3);
         $map = array_merge($map, $map2);
         $data2 = $node->where($map)->field("id,pid,name,level,isprojectwork,type,group_id,title,toolshow")->select();
         $cond = $data2;
         $top = array();
         foreach ($data as $k => $v) {
             foreach ($data2 as $k1 => $v1) {
                 if ($v['id'] == $v1['pid']) {
                     $top[] = $v['id'];
                 }
             }
         }
         $top = array_unique($top);
         foreach ($data as $k => $v) {
             if (in_array($v['id'], $top)) {
                 $data2[] = $v;
             }
         }
         $data = $data2;
     }
     // 获取授权节点
     $access = getAuthAccess();
     $returnarr = array();
     // 第一个循环构造分组节点
     foreach ($list as $k2 => $v2) {
         $newv1 = array();
         $newv1['id'] = -$v2['id'];
         $newv1['pId'] = 0;
         $newv1['title'] = $v2['name'];
         //光标提示信息
         $newv1['name'] = missubstr($v2['name'], 20, true);
         //结点名字,太多会被截取
         $newv1['open'] = 'false';
         $returnarr2 = array();
         // 第二个循环构造组分类节点
         foreach ($data as $k => $v) {
             //if($v['isproject']==1) unset($data[$k]);
             $newv2 = array();
             // 过来权限
             if (substr($v['name'], 0, 10) != "MisDynamic") {
                 if (!in_array($v['name'], $m_list)) {
                     continue;
                 }
             }
             //     			if (!isset ($access[strtoupper( APP_NAME )][strtoupper ($v ['name'])]) && !$_SESSION [C('ADMIN_AUTH_KEY')]) {
             //     				continue;
             //     			}
             if ($v['name'] != 'Public' && $v['name'] != 'Index') {
                 if ($v['type'] == 1 && $v['group_id'] == $v2['id']) {
                     $newv2['id'] = $v['id'];
                     $newv2['pId'] = -$v2['id'];
                     $newv2['title'] = $v['title'];
                     //光标提示信息
                     $newv2['name'] = missubstr($v['title'], 20, true);
                     //结点名字,太多会被截取
                     $newv2['open'] = 'false';
                     $returnarr3 = array();
                     // 判断当前节点是否显示1显示0不显示
                     if ($v["toolshow"] == 1) {
                         // 第三个循环判断模块节点
                         foreach ($data as $k3 => $v3) {
                             // 过来权限
                             if (substr($v3['name'], 0, 10) != "MisDynamic") {
                                 if (!in_array($v3['name'], $m_list)) {
                                     continue;
                                 }
                             }
                             //     							if (!isset ($access[strtoupper( APP_NAME )][strtoupper ($v3 ['name'])]) && !$_SESSION [C('ADMIN_AUTH_KEY')]) {
                             //     								continue;
                             //     							}
                             $newv3 = array();
                             if ($v3['level'] == 3 && $v3['pid'] == $v['id']) {
                                 if (!$this->firstDetail) {
                                     $this->firstDetail['name'] = $v3['name'];
                                     $this->firstDetail['title'] = $v3['title'];
                                     $this->firstDetail['check'] = $v3['id'];
                                 }
                                 $newv3['id'] = $v3['id'];
                                 $newv3['pId'] = $v['id'];
                                 $newv3['title'] = $target == 'ajax' ? $v3['title'] : $title;
                                 //光标提示信息
                                 $newv3['name'] = missubstr($v3['title'], 20, true);
                                 //结点名字,太多会被截取
                                 $newv3['url'] = $target == 'ajax' ? $url . "/jump/jump/model/" . $v3['name'] : $url . "/model/" . $v3['name'];
                                 //"__URL__/index/jump/1/model/".$v3[name];
                                 $newv3['target'] = $target == 'ajax' ? 'ajax' : 'navTab';
                                 $newv3['rel'] = $rel;
                                 //"SystemConfigNumberBox";
                                 $newv3['open'] = 'false';
                                 $returnarr3[] = $newv3;
                             }
                         }
                         if ($returnarr3) {
                             $returnarr3[] = $newv2;
                         }
                     } else {
                         // 第三个循环判断模块节点
                         foreach ($data as $k3 => $v3) {
                             if (substr($v3['name'], 0, 10) != "MisDynamic") {
                                 if (!in_array($v3['name'], $m_list)) {
                                     continue;
                                 }
                             }
                             //     							if (!isset ($access[strtoupper( APP_NAME )][strtoupper ($v3 ['name'])]) && !$_SESSION [C('ADMIN_AUTH_KEY')]) {
                             //     								continue;
                             //     							}
                             $newv3 = array();
                             if ($v3['name'] === $modelname) {
                                 $this->firstDetail['name'] = $v3['name'];
                                 $this->firstDetail['title'] = $v3['title'];
                                 $this->firstDetail['check'] = $v3['id'];
                             }
                             if ($v3['level'] == 3 && $v3['pid'] == $v['id']) {
                                 if (!$this->firstDetail) {
                                     $this->firstDetail['name'] = $v3['name'];
                                     $this->firstDetail['title'] = $v3['title'];
                                     $this->firstDetail['check'] = $v3['id'];
                                 }
                                 $newv3['id'] = $v3['id'];
                                 $newv3['pId'] = -$v2['id'];
                                 $newv3['title'] = $target == 'ajax' ? $v3['title'] : $title;
                                 //光标提示信息
                                 $newv3['name'] = missubstr($v3['title'], 20, true);
                                 //结点名字,太多会被截取
                                 $newv3['url'] = $target == 'ajax' ? $url . "/jump/jump/model/" . $v3['name'] : $url . "/model/" . $v3['name'];
                                 //"__URL__/index/jump/1/model/".$v3[name];
                                 $newv3['target'] = $target == 'ajax' ? 'ajax' : 'navTab';
                                 $newv3['rel'] = $rel;
                                 //"SystemConfigNumberBox";
                                 $newv3['open'] = 'false';
                                 $returnarr3[] = $newv3;
                             }
                         }
                     }
                     if ($returnarr3) {
                         $returnarr2 = array_merge($returnarr2, $returnarr3);
                     }
                 }
             }
         }
         if ($returnarr2) {
             $returnarr[] = $newv1;
             $returnarr = array_merge($returnarr, $returnarr2);
         }
     }
     return json_encode($returnarr);
 }
Esempio n. 7
0
 protected function getIndexTree_old($group_id, $nodedata, $pid = 0, $pname = "", $ptitle = "", $m_list)
 {
     $html = "";
     $node = D("Node");
     $access = getAuthAccess();
     foreach ($nodedata as $k => $v) {
         if ($v['group_id'] != $group_id) {
             continue;
         }
         if ($pid) {
             if ($pid != $v['pid']) {
                 continue;
             }
         }
         if ($v['name'] != 'Public' && $v['name'] != 'Index') {
             if ($v['type'] == 3) {
                 if ($v["pid"] == $pid) {
                     unset($nodedata[$k]);
                     //校验系统模块授权
                     if (substr($v['name'], 0, 10) != "MisDynamic") {
                         if (!in_array($v['name'], $m_list)) {
                             continue;
                         }
                     }
                     if (!isset($access[strtoupper(APP_NAME)][strtoupper($v['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                         continue;
                     }
                     $html .= "<li><a class=\"add_new\" target=\"navTab\" rel=\"" . $v['name'] . "\" href=\"__APP__/" . $v['name'] . "/index\"><span class=\"left\">" . $v['title'] . "</span>";
                     $map['status'] = 1;
                     $map['level'] = 4;
                     $map['pid'] = $v['id'];
                     $map['group_id'] = $group_id;
                     $nodedata2 = $node->where($map)->select();
                     if ($nodedata2) {
                         $s3_1 = $this->getIndexTree($group_id, $nodedata2, $v['id'], $v['name'], $v['title'], $m_list);
                         if ($s3_1) {
                             $html .= "<span class=\"sf_sub_indicator right\"></span></a><ul>";
                             $html .= $s3_1;
                             $html .= "</ul>";
                         }
                     }
                     $html .= "</a></li>";
                 }
             } else {
                 if ($v['type'] == 4) {
                     unset($nodedata[$k]);
                     if (!isset($access[strtoupper(APP_NAME)][strtoupper($pname)][strtoupper($v['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                         continue;
                     }
                     if ($v["toolshow"]) {
                         $url_parem = $v['name'];
                         $title = $v['title'];
                         $rel = $pname . $v['name'];
                         if ($v['name'] == "waitAudit") {
                             $title = $ptitle;
                             $rel = $pname;
                             $url_parem = "index/ntdata/1";
                         } else {
                             if ($v['name'] == "alreadyAudit") {
                                 $title = $ptitle;
                                 $rel = $pname;
                                 $url_parem = "index/ntdata/2";
                             }
                         }
                         $html .= "<li><a class=\"add_new\" title=" . $title . " target=\"navTab\" rel=\"" . $rel . "\" href=\"__APP__/" . $pname . "/" . $url_parem . "\"><span class='left'>" . $v['title'] . "</span></a></li>";
                     }
                 } else {
                     if ($v['type'] == 1) {
                         if ($v["toolshow"] == 1) {
                             $s1_1 = "<li><a class='add_new'><span class=\"left\">" . $v['title'] . "</span><span class=\"sf_sub_indicator right\"></span></a>";
                         }
                         unset($nodedata[$k]);
                         $s1_2 = $this->getIndexTree($group_id, $nodedata, $v['id'], "", "", $m_list);
                         if ($s1_2) {
                             if ($v["toolshow"] == 1) {
                                 $html .= $s1_1 . "<ul>" . $s1_2 . "</ul></li>";
                             } else {
                                 $html .= $s1_2;
                             }
                         } else {
                             if ($_SESSION[C('ADMIN_AUTH_KEY')] && $s1_1) {
                                 if ($v["toolshow"] == 1) {
                                     $html .= $s1_1 . "</li>";
                                 }
                             }
                         }
                     } else {
                         if ($v['type'] == 2) {
                             if ($v["pid"] == $pid) {
                                 unset($nodedata[$k]);
                                 if ($v["toolshow"] == 1) {
                                     $s2_1 = "<li><a class='add_new'><span class=\"left\">" . $v['title'] . "</span><span class=\"sf_sub_indicator right\"></span></a>";
                                     /*$models = M('mis_report_center');
                                     		 $lists = $models->where('type='.$v['id'].' and status = 1')->select();
                                     		if ($lists)  $s2_1.="<ul>";
                                     		foreach ($lists as $ks => $vs) {
                                     		$s2_1 .= "<li><a rel='ReportCenter".$vs[id]."' target='navTab' href='__APP__/ReportCenter/index/reporttype/".$vs[id]."'>".$vs['name']."</a></li>";
                                     		}
                                     		if ($lists)  $s2_1.="</ul>";*/
                                 }
                                 $s2_2 = $this->getIndexTree($group_id, $nodedata, $v['id'], "", "", $m_list);
                                 if ($s2_2) {
                                     if ($v["toolshow"] == 1) {
                                         $html .= $s2_1 . "<ul>" . $s2_2 . "</ul></li>";
                                     } else {
                                         $html .= $s2_2;
                                     }
                                 } else {
                                     if ($_SESSION[C('ADMIN_AUTH_KEY')] && $s2_1) {
                                         if ($v["toolshow"] == 1) {
                                             $html .= $s2_1 . "</li>";
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $html;
 }