page.php 7.6 KB

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