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

175 lines
6.3KB

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