国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
4.2KB

  1. <?php
  2. /**
  3. * 管理菜单函数
  4. *
  5. * @version $Id: inc_menu_func.php 1 10:32 2010年7月21日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/../config.php");
  12. require_once(DEDEINC."/dedetag.class.php");
  13. $headTemplet = "<dl class='bitem' id='sunitems~cc~'><dt onClick='showHide(\"items~cc~\")'><b>~channelname~</b></dt>
  14. <dd style='display:~display~' class='sitem' id='items~cc~'>
  15. <ul class='sitemu'>\r\n";
  16. $footTemplet = "</ul>\r\n</dd>\r\n</dl>\r\n";
  17. $itemTemplet = "<li>~link~</li>\r\n";
  18. function GetMenus($userrank,$topos='main')
  19. {
  20. global $openitem,$headTemplet,$footTemplet,$itemTemplet;
  21. if($topos=='main')
  22. {
  23. $openitem = (empty($openitem) ? 1 : $openitem);
  24. $menus = $GLOBALS['menusMain'];
  25. }
  26. else if($topos=='module')
  27. {
  28. $openitem = 100;
  29. $menus = $GLOBALS['menusMoudle'];
  30. }
  31. $dtp = new DedeTagParse();
  32. $dtp->SetNameSpace('m','<','>');
  33. $dtp->LoadSource($menus);
  34. $dtp2 = new DedeTagParse();
  35. $dtp2->SetNameSpace('m','<','>');
  36. $m = 0;
  37. foreach($dtp->CTags as $i=>$ctag)
  38. {
  39. if($ctag->GetName()=='top' && ($ctag->GetAtt('rank')=='' || TestPurview($ctag->GetAtt('rank')) ))
  40. {
  41. if($openitem!=999 && !preg_match("#".$openitem.'_'."#", $ctag->GetAtt('item')) && $openitem!=100) continue;
  42. $m++;
  43. echo "<!-- Item ".($m+1)." Strat -->\r\n";
  44. $htmp = str_replace("~channelname~",$ctag->GetAtt("name"),$headTemplet);
  45. if(empty($openitem) || $openitem==100)
  46. {
  47. if($ctag->GetAtt('notshowall')=='1') continue;
  48. $htmp = str_replace('~display~',$ctag->GetAtt('display'),$htmp);
  49. }
  50. else
  51. {
  52. if($openitem==$ctag->GetAtt('item') || preg_match("#".$openitem.'_'."#", $ctag->GetAtt('item')) || $openitem=='-1')
  53. $htmp = str_replace('~display~','block',$htmp);
  54. else
  55. $htmp = str_replace('~display~','none',$htmp);
  56. }
  57. $htmp = str_replace('~cc~',$m.'_'.$openitem,$htmp);
  58. echo $htmp;
  59. $dtp2->LoadSource($ctag->InnerText);
  60. foreach($dtp2->CTags as $j=>$ctag2)
  61. {
  62. $ischannel = trim($ctag2->GetAtt('ischannel'));
  63. if($ctag2->GetName()=='item' && ($ctag2->GetAtt('rank')=='' || TestPurview($ctag2->GetAtt('rank')) ) )
  64. {
  65. $link = "<a href='".$ctag2->GetAtt('link')."' target='".$ctag2->GetAtt('target')."'>".$ctag2->GetAtt('name')."</a>";
  66. if($ischannel=='1')
  67. {
  68. if($ctag2->GetAtt('addalt')!='') {
  69. $addalt = $ctag2->GetAtt('addalt');
  70. }
  71. else {
  72. $addalt = '录入新内容';
  73. }
  74. if($ctag2->GetAtt('addico')!='') {
  75. $addico = $ctag2->GetAtt('addico');
  76. }
  77. else {
  78. $addico = 'images/gtk-sadd.png';
  79. }
  80. //an add icos , small items use att ischannel='1' addico='ico' addalt='msg' linkadd=''
  81. $link = " <div class='items'>
  82. <div class='fllct'>$link</div>\r\n
  83. <div class='flrct'>
  84. <a href='".$ctag2->GetAtt('linkadd')."' target='".$ctag2->GetAtt('target')."'><img src='$addico' alt='$addalt' title='$addalt'/></a>
  85. </div>
  86. </div>\r\n";
  87. }
  88. else
  89. {
  90. $link .= "\r\n";
  91. }
  92. $itemtmp = str_replace('~link~',$link,$itemTemplet);
  93. echo $itemtmp;
  94. }
  95. }
  96. echo $footTemplet;
  97. echo "<!-- Item ".($m+1)." End -->\r\n";
  98. }
  99. }
  100. }
  101. //End Function