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

110 lines
3.7KB

  1. <?php
  2. /**
  3. * 单表模型发布器
  4. *
  5. * @version $Id: archives_sg_add.php 1 13:52 2010年7月9日Z tianya $
  6. * @package DedeBIZ.Member
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. if (!defined('DEDEMEMBER')) exit("dedebiz");
  12. /**
  13. * 获取选项列表
  14. *
  15. * @param string $selid 当前选择ID
  16. * @param string $channeltype 频道类型
  17. * @return string
  18. */
  19. function GetOptionList($selid = 0, $channeltype = 0)
  20. {
  21. global $OptionArrayList, $channels, $dsql;
  22. $dsql->SetQuery("SELECT id,typename FROM `#@__channeltype` ");
  23. $dsql->Execute();
  24. $channels = array();
  25. while ($row = $dsql->GetObject()) {
  26. $channels[$row->id] = $row->typename;
  27. }
  28. $OptionArrayList = "";
  29. $query = "SELECT id,typename,ispart,channeltype,issend FROM `#@__arctype` WHERE ispart<2 AND reid=0 ORDER BY sortrank ASC ";
  30. $dsql->SetQuery($query);
  31. $dsql->Execute();
  32. $selected = '';
  33. while ($row = $dsql->GetObject()) {
  34. if ($selid == $row->id) {
  35. $selected = " selected='$selected'";
  36. }
  37. if ($row->channeltype == $channeltype && $row->issend == 1) {
  38. if ($row->ispart == 0) {
  39. $OptionArrayList .= "<option value='" . $row->id . "' class='option3'{$selected}>" . $row->typename . "</option>\r\n";
  40. } else if ($row->ispart == 1) {
  41. $OptionArrayList .= "<option value='" . $row->id . "' class='option2'{$selected}>" . $row->typename . "</option>\r\n";
  42. }
  43. }
  44. $selected = '';
  45. LogicGetOptionArray($row->id, "─", $channeltype, $selid);
  46. }
  47. return $OptionArrayList;
  48. }
  49. /**
  50. * 逻辑递归
  51. *
  52. * @access public
  53. * @param int $id
  54. * @param string $step
  55. * @param string $channeltype
  56. * @param int $selid
  57. * @return string
  58. */
  59. function LogicGetOptionArray($id, $step, $channeltype, $selid = 0)
  60. {
  61. global $OptionArrayList, $channels, $dsql;
  62. $selected = '';
  63. $dsql->SetQuery("Select id,typename,ispart,channeltype,issend From `#@__arctype` where reid='" . $id . "' And ispart<2 order by sortrank asc");
  64. $dsql->Execute($id);
  65. while ($row = $dsql->GetObject($id)) {
  66. if ($selid == $row->id) {
  67. $selected = " selected='$selected'";
  68. }
  69. if ($row->channeltype == $channeltype && $row->issend == 1) {
  70. if ($row->ispart == 0) {
  71. $OptionArrayList .= "<option value='" . $row->id . "' class='option3'{$selected}>$step" . $row->typename . "</option>\r\n";
  72. } else if ($row->ispart == 1) {
  73. $OptionArrayList .= "<option value='" . $row->id . "' class='option2'{$selected}>$step" . $row->typename . "</option>\r\n";
  74. }
  75. }
  76. $selected = '';
  77. LogicGetOptionArray($row->id, $step . "─", $channeltype, $selid);
  78. }
  79. }
  80. /**
  81. * 自定义类型
  82. *
  83. * @param int $mid 会员ID
  84. * @param int $mtypeid 自定义类别ID
  85. * @param int $channelid 频道ID
  86. * @return string
  87. */
  88. function classification($mid, $mtypeid = 0, $channelid = 1)
  89. {
  90. global $dsql;
  91. $list = $selected = '';
  92. $quey = "SELECT * FROM `#@__mtypes` WHERE mid = '$mid' And channelid='$channelid' ;";
  93. $dsql->SetQuery($quey);
  94. $dsql->Execute();
  95. while ($row = $dsql->GetArray()) {
  96. if ($mtypeid != 0) {
  97. if ($mtypeid == $row['mtypeid']) {
  98. $selected = " selected";
  99. }
  100. }
  101. $list .= "<option value='" . $row['mtypeid'] . "' class='option3'{$selected}>" . $row['mtypename'] . "</option>\r\n";
  102. $selected = '';
  103. }
  104. return $list;
  105. }