cate.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <?php
  2. $type = array
  3. (
  4. 1 => '展示',
  5. 2 => '不展示',
  6. );
  7. $comment = array
  8. (
  9. 1 => '允许评论',
  10. 2 => '不允许评论',
  11. );
  12. $cate = function()
  13. {
  14. $array = array(-1 => array('name' => '父级栏目'));
  15. $cate = Dever::load('forum/cate-mainAll');
  16. if($cate)
  17. {
  18. $array += $cate;
  19. }
  20. return $array;
  21. };
  22. return array
  23. (
  24. # 表名
  25. 'name' => 'cate',
  26. # 显示给用户看的名称
  27. 'lang' => '栏目',
  28. 'order' => 10,
  29. # 数据结构
  30. 'struct' => array
  31. (
  32. 'id' => array
  33. (
  34. 'type' => 'int-11',
  35. 'name' => '栏目ID',
  36. 'default' => '',
  37. 'desc' => '',
  38. 'match' => 'is_numeric',
  39. //'search' => 'order',
  40. 'order' => 'desc',
  41. 'list' => true,
  42. ),
  43. 'name' => array
  44. (
  45. 'type' => 'varchar-60',
  46. 'name' => '栏目名称',
  47. 'default' => '',
  48. 'desc' => '请输入栏目名称',
  49. 'match' => 'is_string',
  50. 'update' => 'text',
  51. 'search' => 'fulltext',
  52. 'list' => true,
  53. ),
  54. 'cate_id' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => '上级栏目',
  58. 'default' => Dever::input('option_cate_id', -1),
  59. 'desc' => '请选择上级栏目',
  60. 'match' => 'is_numeric',
  61. 'update' => 'select',
  62. 'search' => 'order,select',
  63. //'list' => '{cate_id} > 0 ? Dever::load("forum/cate-one#name", {cate_id}) : "父级栏目"',
  64. 'option' => $cate,
  65. ),
  66. 'pic' => array
  67. (
  68. 'type' => 'varchar-150',
  69. 'name' => '栏目图片-选填,大小为150X150px',
  70. 'default' => '',
  71. 'desc' => '请选择栏目图片',
  72. 'match' => 'option',
  73. 'update' => 'image',
  74. 'key' => '1',
  75. 'place' => '150',
  76. ),
  77. 'info' => array
  78. (
  79. 'type' => 'varchar-500',
  80. 'name' => '栏目介绍-选填,字数不超过500字,出现栏目头部,如果想清空该介绍,请输入null。',
  81. 'default' => '',
  82. 'desc' => '请输入栏目介绍',
  83. 'match' => 'option',
  84. 'update' => 'editor',
  85. ),
  86. 'uid' => array
  87. (
  88. 'type' => 'varchar-255',
  89. 'name' => '用户ID-填写此值,代表本栏目下只能由这些用户发表主题,其他人只能阅读和评论。多个用逗号隔开',
  90. 'default' => '',
  91. 'desc' => '请选择用户ID',
  92. 'match' => 'option',
  93. 'update' => 'textarea',
  94. ),
  95. 'link' => array
  96. (
  97. 'type' => 'varchar-150',
  98. 'name' => '栏目链接-选填,如果填写了链接,则点击本栏目直接跳转至本链接。',
  99. 'default' => '',
  100. 'desc' => '请输入栏目链接',
  101. 'match' => 'option',
  102. 'update' => 'text',
  103. ),
  104. 'reorder' => array
  105. (
  106. 'type' => 'int-11',
  107. 'name' => '排序(数值越大越靠前)',
  108. 'default' => '1',
  109. 'desc' => '请输入排序',
  110. 'match' => 'option',
  111. 'update' => 'text',
  112. 'search' => 'order',
  113. 'list_name' => '排序',
  114. 'list' => true,
  115. 'order' => 'desc',
  116. 'edit' => true,
  117. ),
  118. 'type' => array
  119. (
  120. 'type' => 'tinyint-1',
  121. 'name' => '是否展示在列表中',
  122. 'default' => '1',
  123. 'desc' => '请选择是否展示在列表中',
  124. 'match' => 'is_numeric',
  125. 'option' => $type,
  126. 'update' => 'radio',
  127. 'list' => true,
  128. 'edit' => true,
  129. ),
  130. 'comment' => array
  131. (
  132. 'type' => 'tinyint-1',
  133. 'name' => '是否允许评论',
  134. 'default' => '1',
  135. 'desc' => '请选择是否允许评论',
  136. 'match' => 'is_numeric',
  137. 'option' => $comment,
  138. 'update' => 'radio',
  139. 'list' => true,
  140. 'edit' => true,
  141. ),
  142. 'state' => array
  143. (
  144. 'type' => 'tinyint-1',
  145. 'name' => '状态',
  146. 'default' => '1',
  147. 'desc' => '请选择状态',
  148. 'match' => 'is_numeric',
  149. ),
  150. 'cdate' => array
  151. (
  152. 'type' => 'int-11',
  153. 'name' => '录入时间',
  154. 'match' => array('is_numeric', time()),
  155. 'desc' => '',
  156. # 只有insert时才生效
  157. 'insert' => true,
  158. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  159. ),
  160. ),
  161. 'manage' => array
  162. (
  163. # 列表页的类型
  164. 'list_type' => 'parent',
  165. 'list_button' => array
  166. (
  167. 'add' => array('新增子栏目', '"cate&option_cate_id={id}"', '{cate_id}<=0'),
  168. //6 => '删除'
  169. ),
  170. ),
  171. # request 请求接口定义
  172. 'request' => array
  173. (
  174. # info 取一条正常的数据
  175. 'info' => array
  176. (
  177. 'where' => array
  178. (
  179. 'id' => 'is_numeric',
  180. 'state' => 1,
  181. ),
  182. 'type' => 'one',
  183. ),
  184. 'link' => array
  185. (
  186. 'where' => array
  187. (
  188. 'link' => 'is_string',
  189. 'state' => 1,
  190. ),
  191. 'type' => 'one',
  192. ),
  193. # main 取所有主栏目
  194. 'main' => array
  195. (
  196. 'where' => array
  197. (
  198. 'cate_id' => -1,
  199. 'state' => 1,
  200. 'type' => 1,
  201. ),
  202. 'type' => 'all',
  203. 'order' => array('reorder` desc,`id', 'desc'),
  204. 'col' => '*|id',
  205. ),
  206. # 取所有下级栏目
  207. 'child' => array
  208. (
  209. 'where' => array
  210. (
  211. 'cate_id' => array('1', '>='),
  212. 'state' => 1,
  213. 'type' => 1,
  214. ),
  215. 'type' => 'all',
  216. 'order' => array('reorder` desc,`id', 'desc'),
  217. 'col' => '*|cate_id|id|',
  218. ),
  219. # main 取所有主栏目
  220. 'mainAll' => array
  221. (
  222. 'where' => array
  223. (
  224. 'cate_id' => -1,
  225. 'state' => 1,
  226. ),
  227. 'type' => 'all',
  228. 'order' => array('reorder` desc,`id', 'desc'),
  229. 'col' => '*|id',
  230. ),
  231. # 取所有下级栏目
  232. 'childAll' => array
  233. (
  234. 'where' => array
  235. (
  236. 'cate_id' => array('1', '>='),
  237. 'state' => 1,
  238. ),
  239. 'type' => 'all',
  240. 'order' => array('reorder` desc,`id', 'desc'),
  241. 'col' => '*|cate_id|id|',
  242. ),
  243. ),
  244. );