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

168 lines
6.1KB

  1. <?php
  2. if (!defined('DEDEINC')) exit ('dedebiz');
  3. /**
  4. * 后台栏目管理
  5. *
  6. * @version $id:typeunit.class.menu.php 15:21 2010年7月5日 tianya $
  7. * @package DedeBIZ.Libraries
  8. * @copyright Copyright (c) 2022 DedeBIZ.COM
  9. * @license GNU GPL v2 (https://www.dedebiz.com/license)
  10. * @link https://www.dedebiz.com
  11. */
  12. require_once(DEDEDATA."/cache/inc_catalog_base.inc");
  13. class TypeUnit
  14. {
  15. var $dsql;
  16. var $aChannels;
  17. var $isAdminAll;
  18. //php5构造函数
  19. function __construct($catlogs = '')
  20. {
  21. global $cfg_Cs;
  22. $this->dsql = $GLOBALS['dsql'];
  23. $this->aChannels = array();
  24. $this->isAdminAll = false;
  25. if (!empty($catlogs) && $catlogs != '-1') {
  26. $this->aChannels = explode(',', $catlogs);
  27. foreach ($this->aChannels as $cid) {
  28. if ($cfg_Cs[$cid][0] == 0) {
  29. $this->dsql->SetQuery("SELECT id,ispart FROM `#@__arctype` WHERE reid=$cid");
  30. $this->dsql->Execute();
  31. while ($row = $this->dsql->GetObject()) {
  32. //if ($row->ispart==1)
  33. $this->aChannels[] = $row->id;
  34. }
  35. }
  36. }
  37. } else {
  38. $this->isAdminAll = true;
  39. }
  40. }
  41. function TypeUnit($catlogs = '')
  42. {
  43. $this->__construct($catlogs);
  44. }
  45. //清理类
  46. function Close()
  47. {
  48. }
  49. /**
  50. * 读出所有分类,在栏目管理页list_type中使用
  51. *
  52. * @access public
  53. * @param int $channel 栏目id
  54. * @param int $nowdir 当前操作ID
  55. * @return string
  56. */
  57. function ListAllType($channel = 0, $nowdir = 0)
  58. {
  59. global $cfg_admin_channel, $admin_catalogs;
  60. //检测会员有权限的顶级栏目
  61. if ($cfg_admin_channel == 'array') {
  62. $admin_catalog = join(',', $admin_catalogs);
  63. $this->dsql->SetQuery("SELECT reid FROM `#@__arctype` WHERE id IN($admin_catalog) GROUP BY reid ");
  64. $this->dsql->Execute();
  65. $topidstr = '';
  66. while ($row = $this->dsql->GetObject()) {
  67. if ($row->reid == 0) continue;
  68. $topidstr .= ($topidstr == '' ? $row->reid : ','.$row->reid);
  69. }
  70. $admin_catalog .= ','.$topidstr;
  71. $admin_catalogs = explode(',', $admin_catalog);
  72. $admin_catalogs = array_unique($admin_catalogs);
  73. }
  74. $this->dsql->SetQuery("SELECT id,typedir,typename,ispart,channeltype FROM `#@__arctype` WHERE reid=0 ORDER BY sortrank");
  75. $this->dsql->Execute(0);
  76. $lastid = GetCookie('lastCidMenu');
  77. while ($row = $this->dsql->GetObject(0)) {
  78. if ($cfg_admin_channel == 'array' && !in_array($row->id, $admin_catalogs)) {
  79. continue;
  80. }
  81. $typeDir = $row->typedir;
  82. $typeName = $row->typename;
  83. $ispart = $row->ispart;
  84. $id = $row->id;
  85. $channeltype = $row->channeltype;
  86. //普通栏目
  87. if ($ispart == 0) {
  88. }
  89. //封面栏目
  90. else if ($ispart == 1) {
  91. }
  92. //独立页面
  93. else if ($ispart==2) {
  94. }
  95. //跳转网址
  96. else {
  97. continue;
  98. }
  99. echo "<dl>\r\n";
  100. echo "<dd><img onclick=\"LoadSuns('suns{$id}',{$id});\" style='cursor:pointer'></dd>\r\n";
  101. echo "<dd><a href='catalog_do.php?cid=".$id."&dopost=listArchives'>".$typeName."</a></dd>\r\n";
  102. echo "</dl>\r\n";
  103. echo "<div id='suns".$id."'>";
  104. if ($lastid == $id || $cfg_admin_channel == 'array') {
  105. $this->LogicListAllSunType($id, " ");
  106. }
  107. echo "</div>\r\n";
  108. }
  109. }
  110. /**
  111. * 获得子栏目的递归调用
  112. *
  113. * @access public
  114. * @param int $id 栏目id
  115. * @param string $step 层级标志
  116. * @param bool $needcheck 权限
  117. * @return string
  118. */
  119. function LogicListAllSunType($id, $step, $needcheck = true)
  120. {
  121. global $cfg_admin_channel, $admin_catalogs;
  122. $fid = $id;
  123. $this->dsql->SetQuery("SELECT id,reid,typedir,typename,ispart,channeltype FROM `#@__arctype` WHERE reid='".$id."' ORDER BY sortrank");
  124. $this->dsql->Execute($fid);
  125. if ($this->dsql->GetTotalRow($fid) > 0) {
  126. while ($row = $this->dsql->GetObject($fid)) {
  127. if ($cfg_admin_channel == 'array' && !in_array($row->id, $admin_catalogs)) {
  128. continue;
  129. }
  130. $typeDir = $row->typedir;
  131. $typeName = $row->typename;
  132. $reid = $row->reid;
  133. $id = $row->id;
  134. $ispart = $row->ispart;
  135. $channeltype = $row->channeltype;
  136. if ($step == " ") {
  137. $stepdd = 2;
  138. } else {
  139. $stepdd = 3;
  140. }
  141. //有权限栏目
  142. if (in_array($id, $this->aChannels) || $needcheck === false || $this->isAdminAll === true) {
  143. //普通列表
  144. if ($ispart == 0 || empty($ispart)) {
  145. }
  146. //封面栏目
  147. else if ($ispart == 1) {
  148. }
  149. //独立页面
  150. else if ($ispart==2) {
  151. }
  152. //跳转网址
  153. else {
  154. continue;
  155. }
  156. echo "<table>\r\n";
  157. echo "<tr>\r\n";
  158. echo "<td align='left'>".$step."<a href='catalog_do.php?cid=".$id."&dopost=listArchives'>".$typeName."</a></td>\r\n";
  159. echo "</tr>\r\n";
  160. echo "</table>\r\n";
  161. $this->LogicListAllSunType($id, $step." ", false);
  162. }
  163. }
  164. }
  165. }
  166. }//End Class
  167. ?>