国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

123 行
3.8KB

  1. <?php
  2. /**
  3. * 单表模型发布器
  4. *
  5. * @version $Id: archives_sg_add.php 1 13:52 2010年7月9日Z tianya $
  6. * @package DedeCMS.Member
  7. * @copyright Copyright (c) 2007 - 2018, DesDev, Inc.
  8. * @license http://help.dedecms.com/usersguide/license.html
  9. * @link http://www.dedecms.com
  10. */
  11. if(!defined('DEDEMEMBER')) exit("dedecms");
  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. {
  27. $channels[$row->id] = $row->typename;
  28. }
  29. $OptionArrayList = "";
  30. $query = "SELECT id,typename,ispart,channeltype,issend FROM `#@__arctype` WHERE ispart<2 AND reid=0 ORDER BY sortrank ASC ";
  31. $dsql->SetQuery($query);
  32. $dsql->Execute();
  33. $selected = '';
  34. while($row=$dsql->GetObject())
  35. {
  36. if($selid==$row->id)
  37. {
  38. $selected = " selected='$selected'";
  39. }
  40. if($row->channeltype==$channeltype && $row->issend==1)
  41. {
  42. if($row->ispart==0)
  43. {
  44. $OptionArrayList .= "<option value='".$row->id."' class='option3'{$selected}>".$row->typename."</option>\r\n";
  45. }
  46. else if($row->ispart==1)
  47. {
  48. $OptionArrayList .= "<option value='".$row->id."' class='option2'{$selected}>".$row->typename."</option>\r\n";
  49. }
  50. }
  51. $selected = '';
  52. LogicGetOptionArray($row->id,"─",$channeltype,$selid);
  53. }
  54. return $OptionArrayList;
  55. }
  56. /**
  57. * 逻辑递归
  58. *
  59. * @access public
  60. * @param int $id
  61. * @param string $step
  62. * @param string $channeltype
  63. * @param int $selid
  64. * @return string
  65. */
  66. function LogicGetOptionArray($id,$step,$channeltype,$selid=0)
  67. {
  68. global $OptionArrayList,$channels,$dsql;
  69. $selected = '';
  70. $dsql->SetQuery("Select id,typename,ispart,channeltype,issend From `#@__arctype` where reid='".$id."' And ispart<2 order by sortrank asc");
  71. $dsql->Execute($id);
  72. while($row=$dsql->GetObject($id))
  73. {
  74. if($selid==$row->id)
  75. {
  76. $selected = " selected='$selected'";
  77. }
  78. if($row->channeltype==$channeltype && $row->issend==1)
  79. {
  80. if($row->ispart==0)
  81. {
  82. $OptionArrayList .= "<option value='".$row->id."' class='option3'{$selected}>$step".$row->typename."</option>\r\n";
  83. }
  84. else if($row->ispart==1)
  85. {
  86. $OptionArrayList .= "<option value='".$row->id."' class='option2'{$selected}>$step".$row->typename."</option>\r\n";
  87. }
  88. }
  89. $selected = '';
  90. LogicGetOptionArray($row->id,$step."─",$channeltype,$selid);
  91. }
  92. }
  93. /**
  94. * 自定义类型
  95. *
  96. * @param int $mid 会员ID
  97. * @param int $mtypeid 自定义类别ID
  98. * @param int $channelid 频道ID
  99. * @return string
  100. */
  101. function classification($mid, $mtypeid = 0, $channelid=1)
  102. {
  103. global $dsql;
  104. $list = $selected = '';
  105. $quey = "SELECT * FROM `#@__mtypes` WHERE mid = '$mid' And channelid='$channelid' ;";
  106. $dsql->SetQuery($quey);
  107. $dsql->Execute();
  108. while ($row = $dsql->GetArray())
  109. {
  110. if($mtypeid != 0){
  111. if($mtypeid == $row['mtypeid'])
  112. {
  113. $selected = " selected";
  114. }
  115. }
  116. $list .= "<option value='".$row['mtypeid']."' class='option3'{$selected}>".$row['mtypename']."</option>\r\n";
  117. $selected = '';
  118. }
  119. return $list;
  120. }