channel.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?php
  2. $channel = function()
  3. {
  4. $array = array(-1 => array('name' => '父级栏目'));
  5. $channel = Dever::db('atom/channel')->parent();
  6. if ($channel) {
  7. $array += $channel;
  8. }
  9. return $array;
  10. };
  11. return array
  12. (
  13. # 表名
  14. 'name' => 'channel',
  15. # 显示给用户看的名称
  16. 'lang' => '栏目',
  17. 'order' => 19,
  18. # 数据结构
  19. 'struct' => array
  20. (
  21. 'id' => array
  22. (
  23. 'type' => 'int-11',
  24. 'name' => '栏目ID',
  25. 'default' => '',
  26. 'desc' => '',
  27. 'match' => 'is_numeric',
  28. //'search' => 'order',
  29. 'order' => 'desc',
  30. 'list' => true,
  31. ),
  32. 'name' => array
  33. (
  34. 'type' => 'varchar-60',
  35. 'name' => '栏目名称',
  36. 'default' => '',
  37. 'desc' => '请输入栏目名称',
  38. 'match' => 'is_string',
  39. 'update' => 'text',
  40. 'search' => 'fulltext',
  41. 'list' => true,
  42. ),
  43. 'channel_id' => array
  44. (
  45. 'type' => 'int-11',
  46. 'name' => '上级栏目',
  47. 'default' => Dever::input('option_channel_id', -1),
  48. 'desc' => '请选择上级栏目',
  49. 'match' => 'is_numeric',
  50. 'update' => 'select',
  51. 'search' => 'order,select',
  52. //'list' => '{channel_id} > 0 ? Dever::load("atom/channel-one#name", {channel_id}) : "父级栏目"',
  53. 'option' => $channel,
  54. ),
  55. 'pic' => array
  56. (
  57. 'type' => 'varchar-150',
  58. 'name' => '栏目图片-选填,大小为150X150px',
  59. 'default' => '',
  60. 'desc' => '请选择栏目图片',
  61. 'match' => 'option',
  62. 'update' => 'image',
  63. 'key' => '1',
  64. 'place' => '150',
  65. ),
  66. 'info' => array
  67. (
  68. 'type' => 'varchar-500',
  69. 'name' => '栏目介绍-选填,字数不超过500字,出现栏目头部,如果想清空该介绍,请输入null。',
  70. 'default' => '',
  71. 'desc' => '请输入栏目介绍',
  72. 'match' => 'option',
  73. 'update' => 'textarea',
  74. ),
  75. 'link' => array
  76. (
  77. 'type' => 'varchar-150',
  78. 'name' => '栏目链接-选填,如果填写了链接,则点击本栏目直接跳转至本链接。',
  79. 'default' => '',
  80. 'desc' => '请输入栏目链接',
  81. 'match' => 'option',
  82. 'update' => 'text',
  83. ),
  84. 'reorder' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '排序(数值越大越靠前)',
  88. 'default' => '1',
  89. 'desc' => '请输入排序',
  90. 'match' => 'option',
  91. 'update' => 'text',
  92. 'search' => 'order',
  93. 'list_name' => '排序',
  94. 'list' => true,
  95. 'order' => 'desc',
  96. 'edit' => true,
  97. ),
  98. 'state' => array
  99. (
  100. 'type' => 'tinyint-1',
  101. 'name' => '状态',
  102. 'default' => '1',
  103. 'desc' => '请选择状态',
  104. 'match' => 'is_numeric',
  105. ),
  106. 'cdate' => array
  107. (
  108. 'type' => 'int-11',
  109. 'name' => '录入时间',
  110. 'match' => array('is_numeric', time()),
  111. 'desc' => '',
  112. # 只有insert时才生效
  113. 'insert' => true,
  114. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  115. ),
  116. ),
  117. # 权限精细控制 加入到该项目的详细权限中,注意与top的不同
  118. /*
  119. 'auth' => array
  120. (
  121. # 类型 1为单一类型,只将表里的数据作为单一权限,2为复杂类型,可以根据获取到的数据分父级子级处理。此处数据来源很重要,这也是和top的区别。
  122. 'type' => 2,
  123. # 数据来源
  124. 'data' => 'atom/channel.get',
  125. # 菜单名
  126. 'name' => '栏目',
  127. # 默认值
  128. 'value' => 1,
  129. # 对应的字段值,设置这个之后,所有设置auth等于这个值的字段,都要遵循这个权限的控制
  130. 'key' => 'channel',
  131. # 本表中代表名称的字段
  132. 'col' => 'name',
  133. ),
  134. */
  135. 'manage' => array
  136. (
  137. # 列表页的类型
  138. 'list_type' => 'parent',
  139. 'list_button' => array
  140. (
  141. 21 => array('新增子栏目', '"channel&option_channel_id={id}&oper_parent=channel"', '{channel_id}<=0'),
  142. ),
  143. ),
  144. # request 请求接口定义
  145. 'request' => array
  146. (
  147. # main 取所有主栏目
  148. 'parent' => array
  149. (
  150. 'where' => array
  151. (
  152. 'channel_id' => -1,
  153. 'state' => 1,
  154. ),
  155. 'type' => 'all',
  156. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  157. 'col' => '*|id',
  158. ),
  159. # 取所有下级栏目
  160. 'child' => array
  161. (
  162. 'where' => array
  163. (
  164. 'channel_id' => array('1', '>='),
  165. 'state' => 1,
  166. ),
  167. 'type' => 'all',
  168. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  169. 'col' => '*|channel_id|id|',
  170. ),
  171. ),
  172. );