国内流行的内容管理系统(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.

93 lines
4.1KB

  1. <?php
  2. /**
  3. * 管理菜单函数
  4. *
  5. * @version $Id: inc_menu_func.php 1 10:32 2010年7月21日Z tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2021, 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. $openitem = (empty($openitem) ? 1 : $openitem);
  23. $menus = $GLOBALS['menusMain'];
  24. } else if ($topos == 'module') {
  25. $openitem = 100;
  26. $menus = $GLOBALS['menusMoudle'];
  27. }
  28. $dtp = new DedeTagParse();
  29. $dtp->SetNameSpace('m', '<', '>');
  30. $dtp->LoadSource($menus);
  31. $dtp2 = new DedeTagParse();
  32. $dtp2->SetNameSpace('m', '<', '>');
  33. $m = 0;
  34. foreach ($dtp->CTags as $i => $ctag) {
  35. if ($ctag->GetName() == 'top' && ($ctag->GetAtt('rank') == '' || TestPurview($ctag->GetAtt('rank')))) {
  36. if ($openitem != 999 && !preg_match("#" . $openitem . '_' . "#", $ctag->GetAtt('item')) && $openitem != 100) continue;
  37. $m++;
  38. echo "<!-- Item " . ($m + 1) . " Strat -->\r\n";
  39. $htmp = str_replace("~channelname~", $ctag->GetAtt("name"), $headTemplet);
  40. if (empty($openitem) || $openitem == 100) {
  41. if ($ctag->GetAtt('notshowall') == '1') continue;
  42. $htmp = str_replace('~display~', $ctag->GetAtt('display'), $htmp);
  43. } else {
  44. if ($openitem == $ctag->GetAtt('item') || preg_match("#" . $openitem . '_' . "#", $ctag->GetAtt('item')) || $openitem == '-1')
  45. $htmp = str_replace('~display~', 'block', $htmp);
  46. else
  47. $htmp = str_replace('~display~', 'none', $htmp);
  48. }
  49. $htmp = str_replace('~cc~', $m . '_' . $openitem, $htmp);
  50. echo $htmp;
  51. $dtp2->LoadSource($ctag->InnerText);
  52. foreach ($dtp2->CTags as $j => $ctag2) {
  53. $ischannel = trim($ctag2->GetAtt('ischannel'));
  54. if ($ctag2->GetName() == 'item' && ($ctag2->GetAtt('rank') == '' || TestPurview($ctag2->GetAtt('rank')))) {
  55. $link = "<a href='" . $ctag2->GetAtt('link') . "' target='" . $ctag2->GetAtt('target') . "'>" . $ctag2->GetAtt('name') . "</a>";
  56. if ($ischannel == '1') {
  57. if ($ctag2->GetAtt('addalt') != '') {
  58. $addalt = $ctag2->GetAtt('addalt');
  59. } else {
  60. $addalt = '录入新内容';
  61. }
  62. if ($ctag2->GetAtt('addico') != '') {
  63. $addico = $ctag2->GetAtt('addico');
  64. } else {
  65. $addico = 'images/gtk-sadd.png';
  66. }
  67. //an add icos , small items use att ischannel='1' addico='ico' addalt='msg' linkadd=''
  68. $link = " <div class='items'>
  69. <div class='fllct'>$link</div>\r\n
  70. <div class='flrct'>
  71. <a href='" . $ctag2->GetAtt('linkadd') . "' target='" . $ctag2->GetAtt('target') . "'><img src='$addico' alt='$addalt' title='$addalt'/></a>
  72. </div>
  73. </div>\r\n";
  74. } else {
  75. $link .= "\r\n";
  76. }
  77. $itemtmp = str_replace('~link~', $link, $itemTemplet);
  78. echo $itemtmp;
  79. }
  80. }
  81. echo $footTemplet;
  82. echo "<!-- Item " . ($m + 1) . " End -->\r\n";
  83. }
  84. }
  85. }
  86. //End Function