cate.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <?php
  2. $cate = function()
  3. {
  4. $array = array(-1 => array('name' => '父级栏目'));
  5. $cate = Dever::load('content/cate-get');
  6. if($cate)
  7. {
  8. $array += $cate;
  9. }
  10. return $array;
  11. };
  12. $type = array
  13. (
  14. 1 => '文章',
  15. 2 => '相册',
  16. 3 => '视频',
  17. );
  18. $menu = array
  19. (
  20. 1 => '是',
  21. 2 => '否',
  22. );
  23. return array
  24. (
  25. # 表名
  26. 'name' => 'cate',
  27. # 显示给用户看的名称
  28. 'lang' => '栏目设置',
  29. # 后台菜单排序
  30. 'order' => 9,
  31. # 数据结构
  32. 'struct' => array
  33. (
  34. 'id' => array
  35. (
  36. 'type' => 'int-11',
  37. 'name' => 'ID',
  38. 'default' => '',
  39. 'desc' => '',
  40. 'match' => 'is_numeric',
  41. 'search' => 'order',
  42. 'list' => true,
  43. 'order' => 'desc',
  44. ),
  45. 'name' => array
  46. (
  47. 'type' => 'varchar-32',
  48. 'name' => '栏目名称',
  49. 'default' => '',
  50. 'desc' => '请输入名称',
  51. 'match' => 'is_string',
  52. 'update' => 'text',
  53. 'search' => 'fulltext',
  54. 'list' => true,
  55. ),
  56. 'cate_id' => array
  57. (
  58. 'type' => 'int-11',
  59. 'name' => '上级栏目',
  60. 'default' => '-1',
  61. 'desc' => '请选择上级栏目',
  62. 'match' => 'is_numeric',
  63. 'update' => 'select',
  64. 'search' => 'select',
  65. 'value' => Dever::input('add_cate', -1),
  66. 'list' => '{cate_id} > 0 ? Dever::load("content/cate-one#name", {cate_id}) : "父级菜单"',
  67. 'option' => $cate,
  68. //'edit' => true,
  69. ),
  70. 'type' => array
  71. (
  72. 'type' => 'tinyint-1',
  73. 'name' => '栏目分类',
  74. 'default' => '1',
  75. 'desc' => '栏目分类',
  76. 'match' => 'is_numeric',
  77. 'update' => 'select',
  78. 'option' => $type,
  79. 'search' => 'select',
  80. 'list' => true,
  81. ),
  82. 'menu' => array
  83. (
  84. 'type' => 'tinyint-1',
  85. 'name' => '是否显示在菜单',
  86. 'default' => '1',
  87. 'desc' => '是否显示在菜单',
  88. 'match' => 'is_numeric',
  89. 'update' => 'select',
  90. 'option' => $menu,
  91. ),
  92. 'link' => array
  93. (
  94. 'type' => 'varchar-150',
  95. 'name' => '链接-填写链接则跳转至该链接,为空则自动生成站内链接',
  96. 'default' => '',
  97. 'desc' => '链接',
  98. 'match' => 'option',
  99. 'update' => 'text',
  100. //'search' => 'fulltext',
  101. //'list' => true,
  102. ),
  103. 'reorder' => array
  104. (
  105. 'type' => 'int-11',
  106. 'name' => '排序(数值越大越靠前)',
  107. 'default' => '1',
  108. 'desc' => '请输入排序',
  109. 'match' => 'option',
  110. 'update' => 'text',
  111. 'search' => 'order',
  112. 'list' => true,
  113. 'order' => 'desc',
  114. 'edit' => true,
  115. ),
  116. 'state' => array
  117. (
  118. 'type' => 'tinyint-1',
  119. 'name' => '状态',
  120. 'default' => '1',
  121. 'desc' => '请选择状态',
  122. 'match' => 'is_numeric',
  123. ),
  124. 'cdate' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '录入时间',
  128. 'match' => array('is_numeric', time()),
  129. 'desc' => '',
  130. # 只有insert时才生效
  131. 'insert' => true,
  132. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  133. ),
  134. ),
  135. # 默认值
  136. 'default' => array
  137. (
  138. 'col' => 'name,reorder,cdate',
  139. 'value' => array
  140. (
  141. '"默认栏目",100,' . time(),
  142. ),
  143. ),
  144. 'manage' => array
  145. (
  146. 'list_type' => 'tree',
  147. 'insert' => false,
  148. 'edit' => false,
  149. # 自定义快捷新增和编辑
  150. 'button' => array
  151. (
  152. '新增' => array('fast'),
  153. ),
  154. # 快捷更新
  155. 'list_button' => array
  156. (
  157. 'edit' => array('编辑'),
  158. 'fast_add' => array('新增子菜单', '"cate&add_cate={id}"', '"{cate_id}" == -1'),
  159. ),
  160. ),
  161. 'request' => array
  162. (
  163. 'getAll' => array
  164. (
  165. # 匹配的正则或函数 选填项
  166. 'option' => array
  167. (
  168. 'state' => 1,
  169. ),
  170. 'type' => 'all',
  171. 'order' => array('reorder' => 'desc','id' => 'desc'),
  172. 'col' => '*',
  173. ),
  174. 'get' => array
  175. (
  176. 'option' => array
  177. (
  178. 'cate_id' => 'yes',
  179. 'menu' => 'yes',
  180. 'state' => 1,
  181. ),
  182. 'type' => 'all',
  183. 'order' => array('reorder' => 'desc','id' => 'desc'),
  184. 'col' => '*',
  185. ),
  186. ),
  187. );