page.php 6.7 KB

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