page.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <?php
  2. $info_id = Dever::input('search_option_info_id');
  3. $times = function() use ($info_id)
  4. {
  5. $array = array
  6. (
  7. -1 => array('id' => '-1', 'name' => '不选择'),
  8. );
  9. $info = Dever::db('collection/times')->mainAll(array('info_id' => $info_id));
  10. if($info)
  11. {
  12. $array += $info;
  13. }
  14. return $array;
  15. };
  16. $times_child = function() use ($info_id)
  17. {
  18. $info = Dever::db('collection/times')->childAll(array('info_id' => $info_id));
  19. return $info;
  20. };
  21. # 搜索
  22. $search_times = function() use ($info_id)
  23. {
  24. $array = array
  25. (
  26. -1 => array('id' => '-1', 'name' => '所有时光'),
  27. );
  28. $info = Dever::load('collection/lib/times')->all();
  29. if($info)
  30. {
  31. $array += $info;
  32. }
  33. return $array;
  34. };
  35. return array
  36. (
  37. # 表名
  38. 'name' => 'page',
  39. # 显示给用户看的名称
  40. 'lang' => '章节管理',
  41. # 是否显示在后台菜单
  42. 'order' => 1,
  43. 'menu' => false,
  44. # 数据结构
  45. 'struct' => array
  46. (
  47. 'id' => array
  48. (
  49. 'type' => 'int-11',
  50. 'name' => 'ID',
  51. 'default' => '',
  52. 'desc' => '',
  53. 'match' => 'is_numeric',
  54. 'order' => 'asc',
  55. 'list' => true,
  56. ),
  57. 'info_id' => array
  58. (
  59. 'type' => 'int-11',
  60. 'name' => '合集',
  61. 'default' => '',
  62. 'desc' => '合集',
  63. 'match' => 'is_numeric',
  64. 'update' => 'hidden',
  65. 'value' => $info_id
  66. ),
  67. 'name' => array
  68. (
  69. 'type' => 'varchar-150',
  70. 'name' => '章节名称',
  71. 'default' => '',
  72. 'desc' => '章节名称',
  73. 'match' => 'is_string',
  74. 'update' => 'text',
  75. 'search' => 'fulltext',
  76. 'list' => true,
  77. 'edit' => true,
  78. ),
  79. 'times_id_parent' => array
  80. (
  81. 'type' => 'int-11',
  82. 'name' => '父级时光',
  83. 'default' => '0',
  84. 'desc' => '请选择父级时光',
  85. 'match' => 'is_numeric',
  86. 'update' => 'select',
  87. 'option' => $times,
  88. # 当值改变时,执行下一步操作
  89. 'child_name' => 'times_id',
  90. 'child' => $times_child,
  91. 'child_value' => '{times_id}',
  92. ),
  93. 'times_id' => array
  94. (
  95. 'type' => 'int-11',
  96. 'name' => '子时光',
  97. 'default' => '0',
  98. 'desc' => '请选择子时光',
  99. 'match' => 'is_numeric',
  100. 'search' => 'group',
  101. 'option' => $search_times,
  102. 'list_name' => '时光',
  103. 'list' => '{times_id} > 0 ? Dever::load("collection/lib/times.getName", {times_id}, {times_id_parent}) : "无"',
  104. ),
  105. 'page_id' => array
  106. (
  107. 'type' => 'int-11',
  108. 'name' => '上级章节',
  109. 'default' => '-1',
  110. 'desc' => '请选择上级章节',
  111. 'match' => 'is_numeric',
  112. 'update' => 'hidden',
  113. 'value' => Dever::input('option_page_id', -1),
  114. 'list' => '{page_id} > 0 ? Dever::load("collection/page-one#name", {page_id}) : "主章节"',
  115. ),
  116. 'pic' => array
  117. (
  118. 'type' => 'varchar-150',
  119. 'name' => '图片-章节图片,图片尺寸可随意,尽量为330*330px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  120. 'default' => '',
  121. 'desc' => '章节图片',
  122. 'match' => 'option',
  123. 'update' => 'image',
  124. 'key' => '1',
  125. 'place' => '330*330',
  126. ),
  127. 'desc' => array
  128. (
  129. 'type' => 'varchar-800',
  130. 'name' => '描述-添加描述将展示封面',
  131. 'default' => '',
  132. 'desc' => '描述',
  133. 'match' => 'option',
  134. 'update' => 'textarea',
  135. //'list' => true,
  136. ),
  137. 'desc_end' => array
  138. (
  139. 'type' => 'varchar-800',
  140. 'name' => '完结描述-添加完结描述将展示在本章节末尾',
  141. 'default' => '',
  142. 'desc' => '描述',
  143. 'match' => 'option',
  144. 'update' => 'textarea',
  145. //'list' => true,
  146. ),
  147. 'reorder' => array
  148. (
  149. 'type' => 'int-11',
  150. 'name' => '排序(数值越小越靠前)',
  151. 'default' => '1',
  152. 'desc' => '请输入排序',
  153. 'match' => 'option',
  154. 'update' => 'text',
  155. 'search' => 'order',
  156. 'list_name' => '排序',
  157. 'list' => true,
  158. 'order' => 'asc',
  159. 'edit' => true,
  160. ),
  161. 'state' => array
  162. (
  163. 'type' => 'tinyint-1',
  164. 'name' => '状态',
  165. 'default' => '1',
  166. 'desc' => '请选择状态',
  167. 'match' => 'is_numeric',
  168. ),
  169. 'cdate' => array
  170. (
  171. 'type' => 'int-11',
  172. 'name' => '录入时间',
  173. 'match' => array('is_numeric', time()),
  174. 'desc' => '',
  175. # 只有insert时才生效
  176. 'insert' => true,
  177. 'order' => 'asc',
  178. //'search' => 'date',
  179. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  180. ),
  181. ),
  182. 'manage' => array
  183. (
  184. 'button' => array
  185. (
  186. '时光配置' => array('location', 'manage/project/database/list&project=collection&oper_table=page&top_table=info&top_project=collection&table=times&search_option_info_id=' . $info_id),
  187. ),
  188. # 列表页的类型
  189. 'list_type' => 'tree',
  190. 'list_button' => array
  191. (
  192. 'update' => '编辑',
  193. 'add' => array('新增子章节', '"{page_id}" == -1 ? "page&option_page_id={id}" : "page&option_page_id={page_id},{id}"', '{page_id} == -1'),
  194. 'list' => array('内容管理', '"content&search_option_info_id={info_id}&send_page_id={id}&oper_table=page&top_table=info&top_project=collection&page_type=1"' , '{page_id} > 0'),
  195. 'delete' => '删除',
  196. ),
  197. ),
  198. 'request' => array
  199. (
  200. 'child' => array
  201. (
  202. 'option' => array
  203. (
  204. 'state' => 1,
  205. 'page_id' => array(1, '>='),
  206. 'info_id' => 'yes',
  207. 'times_id' => 'yes',
  208. ),
  209. 'type' => 'all',
  210. 'order' => array('reorder' => 'asc', 'id' => 'asc'),
  211. 'col' => '*',
  212. ),
  213. 'main' => array
  214. (
  215. 'option' => array
  216. (
  217. 'state' => 1,
  218. 'page_id' => -1,
  219. 'info_id' => 'yes',
  220. ),
  221. 'type' => 'all',
  222. 'order' => array('reorder' => 'asc', 'id' => 'asc'),
  223. 'col' => '*',
  224. ),
  225. 'getOne' => array
  226. (
  227. 'option' => array
  228. (
  229. 'state' => 1,
  230. 'page_id' => array(1, '>='),
  231. 'info_id' => 'yes',
  232. 'times_id' => 'yes',
  233. ),
  234. 'type' => 'one',
  235. 'order' => array('reorder' => 'asc', 'id' => 'asc'),
  236. 'col' => '*',
  237. ),
  238. )
  239. );