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

142 lines
4.0KB

  1. <?php
  2. /**
  3. * 圈子分类设置
  4. *
  5. * @version $Id: group_store.php 1 15:34 2011-1-21 tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2007 - 2020, DesDev, Inc.
  8. * @license http://help.dedecms.com/usersguide/license.html
  9. * @link http://www.dedecms.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. CheckPurview('group_Store');
  13. require_once(DEDEINC.'/datalistcp.class.php');
  14. setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/");
  15. $id = isset($id) && is_numeric($id) ? $id : 0;
  16. $action = isset($action) ? trim($action) : '';
  17. if($action=="add")
  18. {
  19. $storename = cn_substrR(HtmlReplace($storename, 2),20);
  20. $tops = preg_replace("#[^0-9]#","",$tops);
  21. $orders = preg_replace("#[^0-9]#","",$orders);
  22. if($tops < 1)
  23. {
  24. $tops = 0;
  25. }
  26. if($orders < 1)
  27. {
  28. $orders = 0;
  29. }
  30. if(empty($storename))
  31. {
  32. $msg = "错误,分类名不能为空!";
  33. }
  34. else
  35. {
  36. $db->ExecuteNoneQuery("INSERT INTO #@__store_groups(storename,tops,orders) VALUES('".$storename."','".$tops."','".$orders."');");
  37. $msg = "成功添加分类";
  38. }
  39. }
  40. else if($action=="del"&&isset($id))
  41. {
  42. $db->ExecuteNoneQuery("DELETE FROM #@__store_groups WHERE storeid='$id'");
  43. $msg = "删除分类:{$id} !";
  44. }
  45. $btypes = array();
  46. $db->SetQuery("SELECT * FROM #@__store_groups WHERE tops=0");
  47. $db->Execute();
  48. $options = '';
  49. while($rs = $db->GetArray())
  50. {
  51. array_push ($btypes,$rs);
  52. }
  53. foreach($btypes as $k=>$v)
  54. {
  55. $options .= "<option value='".$v['storeid']."'>".$v['storename']."</option>\r\n";
  56. }
  57. /*
  58. function LoadEdit();
  59. */
  60. if($action=='editload')
  61. {
  62. $row = $db->GetOne("Select * From #@__store_groups where storeid='$catid'");
  63. AjaxHead();
  64. ?>
  65. <form name='editform' action='group_store.php' method='get'>
  66. <input type='hidden' name='action' value='editsave' />
  67. <input type='hidden' name='catid' value='<?php echo $catid; ?>' />
  68. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  69. <tr>
  70. <td width="90" height="28">栏目名称:</td>
  71. <td width="101"><input name="storename" type="text" id="storename" value="<?php echo $row['storename']; ?>" /></td>
  72. <td width="20" align="right" valign="top"></td>
  73. </tr>
  74. <tr>
  75. <td height="28">隶属栏目:</td>
  76. <td colspan="2">
  77. <select name="tops" id="tops">
  78. <option value="0">顶级栏目</option>
  79. <?php
  80. foreach($btypes as $k=>$v)
  81. {
  82. if($row['tops']==$v['storeid'])
  83. {
  84. echo "<option value='".$v['storeid']."' selected>".$v['storename']."</option>\r\n";
  85. }
  86. else
  87. {
  88. echo "<option value='".$v['storeid']."'>".$v['storename']."</option>\r\n";
  89. }
  90. }
  91. ?>
  92. </select>
  93. </td>
  94. </tr>
  95. <tr>
  96. <td height="28">排序级别:</td>
  97. <td colspan="2"><input name="orders" type="text" id="orders" size="5" value="<?php echo $row['orders']; ?>" />
  98. (数值小靠前)</td>
  99. </tr>
  100. <tr>
  101. <td height="43">&nbsp;</td>
  102. <td colspan="2"><input type="submit" name="Submit" value="保存更改" class="np coolbg" style="width:80px"/></td>
  103. </tr>
  104. </table>
  105. </form>
  106. <?php
  107. exit();
  108. }
  109. else if($action=='editsave')
  110. {
  111. $db->ExecuteNoneQuery("UPDATE #@__store_groups SET storename='$storename',tops='$tops',orders='$orders' WHERE storeid='$catid'");
  112. $msg = "成功修改栏目:{$catid} = {$storename} !";
  113. }
  114. else if($action=='uprank')
  115. {
  116. foreach($_POST as $rk=>$rv)
  117. {
  118. if(preg_match('#rank#i',$rk))
  119. {
  120. $catid = str_replace('rank_','',$rk);
  121. $db->ExecuteNoneQuery("UPDATE #@__store_groups SET orders='{$rv}' WHERE storeid='{$catid}'");
  122. }
  123. }
  124. $msg = "成功更改排序 !";
  125. }
  126. $sql = "SELECT storeid,storename,tops,orders FROM #@__store_groups WHERE tops=0 ORDER BY orders ASC";
  127. $dl = new DataListCP();
  128. $dl->pageSize = 20;
  129. //这两句的顺序不能更换
  130. $dl->SetTemplate(DEDEADMIN."/templets/group_store.htm"); //载入模板
  131. $dl->SetSource($sql); //设定查询SQL
  132. $dl->Display(); //显示
  133. ?>