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

80 lines
3.9KB

  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) 2022, 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><dd style='display:~display~' class='sitem' id='items~cc~'><ul class='sitemu'>";
  14. $footTemplet = "</ul></dd></dl>";
  15. $itemTemplet = "<li>~link~</li>";
  16. function GetMenus($userrank, $topos = 'main')
  17. {
  18. global $openitem, $headTemplet, $footTemplet, $itemTemplet;
  19. if ($topos == 'main') {
  20. $openitem = (empty($openitem) ? 1 : $openitem);
  21. $menus = $GLOBALS['menusMain'];
  22. } else if ($topos == 'module') {
  23. $openitem = 100;
  24. $menus = $GLOBALS['menusMoudle'];
  25. }
  26. $dtp = new DedeTagParse();
  27. $dtp->SetNameSpace('m', '<', '>');
  28. $dtp->LoadSource($menus);
  29. $dtp2 = new DedeTagParse();
  30. $dtp2->SetNameSpace('m', '<', '>');
  31. $m = 0;
  32. foreach ($dtp->CTags as $i => $ctag) {
  33. if ($ctag->GetName() == 'top' && ($ctag->GetAtt('rank') == '' || TestPurview($ctag->GetAtt('rank')))) {
  34. if ($openitem != 999 && !preg_match("#".$openitem.'_'."#", $ctag->GetAtt('item')) && $openitem != 100) continue;
  35. $m++;
  36. echo "<!-- Item ".($m + 1)." Strat -->";
  37. $htmp = str_replace("~channelname~", $ctag->GetAtt("name"), $headTemplet);
  38. if (empty($openitem) || $openitem == 100) {
  39. if ($ctag->GetAtt('notshowall') == '1') continue;
  40. $htmp = str_replace('~display~', $ctag->GetAtt('display'), $htmp);
  41. } else {
  42. if ($openitem == $ctag->GetAtt('item') || preg_match("#".$openitem.'_'."#", $ctag->GetAtt('item')) || $openitem == '-1')
  43. $htmp = str_replace('~display~', 'block', $htmp);
  44. else
  45. $htmp = str_replace('~display~', 'none', $htmp);
  46. }
  47. $htmp = str_replace('~cc~', $m.'_'.$openitem, $htmp);
  48. echo $htmp;
  49. $dtp2->LoadSource($ctag->InnerText);
  50. foreach ($dtp2->CTags as $j => $ctag2) {
  51. $ischannel = trim($ctag2->GetAtt('ischannel'));
  52. if ($ctag2->GetName() == 'item' && ($ctag2->GetAtt('rank') == '' || TestPurview($ctag2->GetAtt('rank')))) {
  53. $link = "<a href='".$ctag2->GetAtt('link')."' target='".$ctag2->GetAtt('target')."'>".$ctag2->GetAtt('name')."</a>";
  54. if ($ischannel == '1') {
  55. if ($ctag2->GetAtt('addalt') != '') {
  56. $addalt = $ctag2->GetAtt('addalt');
  57. } else {
  58. $addalt = '录入新内容';
  59. }
  60. if ($ctag2->GetAtt('addico') != '') {
  61. $addico = $ctag2->GetAtt('addico');
  62. } else {
  63. $addico = 'fa-plus-circle';
  64. }
  65. $link = "<div class='items'>
  66. <div class='fllct'>$link</div>
  67. <div class='flrct'><a href='".$ctag2->GetAtt('linkadd')."' target='".$ctag2->GetAtt('target')."'><i class='fa $addico' alt='$addalt' title='$addalt'></i></a></div>
  68. </div>";
  69. } else {
  70. $link .= "";
  71. }
  72. $itemtmp = str_replace('~link~', $link, $itemTemplet);
  73. echo $itemtmp;
  74. }
  75. }
  76. echo $footTemplet;
  77. echo "<!--Item".($m + 1)."End-->";
  78. }
  79. }
  80. }//End Function