国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

131 lines
5.2KB

  1. <?php
  2. if (!defined('DEDEINC')) exit ('dedebiz');
  3. /**
  4. * 后台栏目管理
  5. *
  6. * @version $id:typeunit.class.selector.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 TypeUnitSelector
  14. {
  15. var $dsql;
  16. //php5构造函数
  17. function __construct()
  18. {
  19. global $cfg_Cs;
  20. $this->dsql = $GLOBALS['dsql'];
  21. }
  22. function TypeUnitSelector()
  23. {
  24. $this->__construct();
  25. }
  26. //清理类
  27. function Close()
  28. {
  29. }
  30. /**
  31. * 列出某一栏目下的所有栏目
  32. *
  33. * @access public
  34. * @param string $channel 栏目id
  35. * @return void
  36. */
  37. function ListAllType($channel = 0)
  38. {
  39. global $cfg_admin_channel, $admin_catalogs, $targetid, $oldvalue;
  40. $oldvalues = array();
  41. if (!empty($oldvalue)) $oldvalues = explode(',', $oldvalue);
  42. //检测会员有权限的顶级栏目
  43. if ($cfg_admin_channel == 'array') {
  44. $admin_catalog = join(',', $admin_catalogs);
  45. $this->dsql->SetQuery("SELECT reid FROM `#@__arctype` WHERE id IN($admin_catalog) GROUP BY reid ");
  46. $this->dsql->Execute();
  47. $topidstr = '';
  48. while ($row = $this->dsql->GetObject()) {
  49. if ($row->reid == 0) continue;
  50. $topidstr .= ($topidstr == '' ? $row->reid : ','.$row->reid);
  51. }
  52. $admin_catalog .= ','.$topidstr;
  53. $admin_catalogs = explode(',', $admin_catalog);
  54. $admin_catalogs = array_unique($admin_catalogs);
  55. }
  56. $this->dsql->SetQuery("SELECT id,typedir,typename,ispart,channeltype FROM `#@__arctype` WHERE reid=0 ORDER BY sortrank");
  57. $this->dsql->Execute(0);
  58. $lastid = GetCookie('lastCidMenu');
  59. while ($row = $this->dsql->GetObject(0)) {
  60. if ($cfg_admin_channel == 'array' && !in_array($row->id, $admin_catalogs)) {
  61. continue;
  62. }
  63. $typeDir = $row->typedir;
  64. $typeName = $row->typename;
  65. $ispart = $row->ispart;
  66. $id = $row->id;
  67. $channeltype = $row->channeltype;
  68. $ischeck = in_array($id, $oldvalues) ? ' checked' : '';
  69. $chackRadio = "<input type='radio' name='seltypeid' value='{$id}' $ischeck>";
  70. if ($targetid == 'typeid2') $chackRadio = "<input type='checkbox' name='seltypeid' id='seltypeid{$id}' value='{$id}' $ischeck>";
  71. if ((!empty($channel) && $channeltype != $channel) || $ispart != 0) {
  72. $chackRadio = '';
  73. }
  74. $soncat = '';
  75. $this->LogicListAllSunType($id, $channel, $soncat);
  76. if ($chackRadio == '' && $soncat == '') continue;
  77. echo "<div class='quickselitem'>\r\n";
  78. echo "<div class='topcat'><label>{$chackRadio} {$typeName}</label></div>\r\n";
  79. if ($soncat != '') echo "<div class='soncat'>{$soncat}</div>\r\n";
  80. echo "</div>\r\n";
  81. }
  82. }
  83. /**
  84. * 获得子栏目的递归调用
  85. *
  86. * @access public
  87. * @param int $id 栏目id
  88. * @param int $channel 栏目id
  89. * @param int $soncat 子级分类
  90. * @return string
  91. */
  92. function LogicListAllSunType($id, $channel = 0, &$soncat=0)
  93. {
  94. global $cfg_admin_channel, $admin_catalogs, $targetid, $oldvalue;
  95. $fid = $id;
  96. $oldvalues = array();
  97. if (!empty($oldvalue)) $oldvalues = explode(',', $oldvalue);
  98. $this->dsql->SetQuery("SELECT id,reid,typedir,typename,ispart,channeltype FROM `#@__arctype` WHERE reid='".$id."' ORDER BY sortrank");
  99. $this->dsql->Execute($fid);
  100. while ($row = $this->dsql->GetObject($fid)) {
  101. if ($cfg_admin_channel == 'array' && !in_array($row->id, $admin_catalogs)) {
  102. continue;
  103. }
  104. $typeDir = $row->typedir;
  105. $typeName = $row->typename;
  106. $reid = $row->reid;
  107. $id = $row->id;
  108. $ispart = $row->ispart;
  109. $channeltype = $row->channeltype;
  110. $ischeck = in_array($id, $oldvalues) ? ' checked' : '';
  111. $chackRadio = "<input type='radio' name='seltypeid' value='{$row->id}' $ischeck>";
  112. if ($targetid == 'typeid2') $chackRadio = "<input type='checkbox' name='seltypeid' id='seltypeid{$id}' value='{$id}' $ischeck>";
  113. if ($ispart != 0) {
  114. $chackRadio = '';
  115. }
  116. if ($channeltype != $channel && !empty($channel)) {
  117. continue;
  118. }
  119. if ($chackRadio != '') {
  120. $soncat .= "<div class='list'><label>".$chackRadio .' '. $typeName."</label></div>\r\n";
  121. $this->LogicListAllSunType($id, $channel, $soncat);
  122. } else {
  123. $soncat .= "<div class='list'>".$typeName."</div>\r\n";
  124. $this->LogicListAllSunType($id, $channel, $soncat);
  125. }
  126. }
  127. }
  128. }//End Class
  129. ?>