info.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <?php
  2. $curPage = Dever::input('search_option_page_id');
  3. # 显示的页面
  4. $page = function()
  5. {
  6. $parent = Dever::db('module/page')->getParent();
  7. $child = Dever::db('module/page')->getChild();
  8. foreach ($parent as $k => $v) {
  9. $parent[$k]['child'] = $child[$v['id']];
  10. }
  11. $array = array(-1 => array('id' => -1, 'name' => '无'));
  12. if ($parent) {
  13. $array += $parent;
  14. }
  15. return $array;
  16. };
  17. $type = array
  18. (
  19. 1 => '手动输入',
  20. 2 => '调取其他模块',
  21. 3 => '预定义方法',
  22. 4 => '自定义方法',
  23. 5 => '自定义SQL',
  24. 6 => '自定义接口',
  25. );
  26. $define = Dever::config('base')->module;
  27. $col = array
  28. (
  29. 1 => '标题',
  30. 2 => '链接',
  31. 3 => '图片',
  32. 4 => '内容',
  33. );
  34. $sqlMethod = array
  35. (
  36. 1 => '取多列数据',
  37. 2 => '取单列数据',
  38. 3 => '取影响行数',
  39. 4 => '取生成的ID',
  40. 5 => '仅执行',
  41. );
  42. return array
  43. (
  44. # 表名
  45. 'name' => 'info',
  46. # 显示给用户看的名称
  47. 'lang' => '模块管理',
  48. 'order' => 10,
  49. 'check' => 'page_id,key',
  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. //'search' => 'order',
  61. 'order' => 'desc',
  62. //'list' => true,
  63. ),
  64. 'name' => array
  65. (
  66. 'type' => 'varchar-60',
  67. 'name' => '模块标题',
  68. 'default' => '',
  69. 'desc' => '请输入模块标题',
  70. 'match' => 'is_string',
  71. 'update' => 'text',
  72. 'search' => 'fulltext',
  73. 'list' => true,
  74. 'edit' => true,
  75. ),
  76. 'key' => array
  77. (
  78. 'type' => 'varchar-60',
  79. 'name' => '模块标识',
  80. 'default' => '',
  81. 'desc' => '模块标识',
  82. 'match' => 'is_string',
  83. 'update' => 'text',
  84. 'search' => 'fulltext',
  85. 'list' => true,
  86. ),
  87. 'page_id' => array
  88. (
  89. 'type' => 'tinyint-1',
  90. 'name' => '所属的页面',
  91. 'default' => Dever::input('search_option_page_id', '1'),
  92. 'desc' => '请选择所属的页面',
  93. 'match' => 'is_numeric',
  94. 'option' => $page,
  95. 'update' => 'group',
  96. 'search' => 'group',
  97. 'list' => 'Dever::load("module/page-one#name", {page_id})',
  98. //'edit' => true,
  99. ),
  100. 'num' => array
  101. (
  102. 'type' => 'int-11',
  103. 'name' => '数据总条数-为空或小于0则不限制,只对前台有效',
  104. 'default' => '5',
  105. 'desc' => '请输入数据总条数',
  106. 'match' => 'is_numeric',
  107. 'update' => 'text',
  108. 'list' => true,
  109. 'edit' => true,
  110. ),
  111. 'type' => array
  112. (
  113. 'type' => 'tinyint-1',
  114. 'name' => '模块类型',
  115. 'default' => '1',
  116. 'desc' => '请选择模块类型',
  117. 'match' => 'is_numeric',
  118. 'option' => $type,
  119. 'update' => 'radio',
  120. 'search' => 'select',
  121. //'list' => true,
  122. 'control' => 'type',
  123. ),
  124. 'data_type' => array
  125. (
  126. 'type' => 'varchar-50',
  127. 'name' => '数据类型定义-多个用换行隔开,必须有一个值,主要用于该模块有多种不同类型的值',
  128. 'default' => '默认类型',
  129. 'desc' => '请选择模块类型',
  130. 'match' => 'is_string',
  131. //'update' => 'textarea',
  132. //'show' => array('type_1'),
  133. ),
  134. 'code' => array
  135. (
  136. 'type' => 'varchar-500',
  137. 'name' => '自定义内容',
  138. 'default' => '',
  139. 'desc' => '请输入自定义内容',
  140. 'match' => 'is_string',
  141. 'update' => 'textarea',
  142. 'show' => 'type=4,5,6',
  143. ),
  144. 'sql_method' => array
  145. (
  146. 'type' => 'tinyint-1',
  147. 'name' => '选择sql执行之后的方法',
  148. 'default' => '1',
  149. 'desc' => '选择sql执行之后的方法',
  150. 'match' => 'is_numeric',
  151. 'update' => 'radio',
  152. 'option' => $sqlMethod,
  153. 'show' => 'type=5',
  154. ),
  155. 'define' => array
  156. (
  157. 'type' => 'varchar-100',
  158. 'name' => '选择预定义方法',
  159. 'default' => '',
  160. 'desc' => '请选择预定义方法',
  161. 'match' => 'is_string',
  162. 'update' => 'select',
  163. 'option' => $define,
  164. 'show' => 'type=3'
  165. ),
  166. 'col' => array
  167. (
  168. 'type' => 'varchar-30',
  169. 'name' => '启用的字段',
  170. 'default' => '1',
  171. 'desc' => '请选择启用的字段',
  172. 'match' => 'is_string',
  173. 'option' => $col,
  174. 'update' => 'checkbox',
  175. 'show' => 'type=1',
  176. 'control' => 'col',
  177. ),
  178. 'col_pic' => array
  179. (
  180. 'type' => 'varchar-20',
  181. 'name' => '图片尺寸提醒-请直接输入提醒的文字即可,如100X100',
  182. 'default' => '100X100',
  183. 'desc' => '图片尺寸提醒',
  184. 'match' => 'is_string',
  185. 'update' => 'text',
  186. 'show' => 'col=3',
  187. ),
  188. 'col_content' => array
  189. (
  190. 'type' => 'int-11',
  191. 'name' => '内容长度限制-必须是数字',
  192. 'default' => '30',
  193. 'desc' => '内容长度限制',
  194. 'match' => 'is_numeric',
  195. 'update' => 'text',
  196. 'show' => 'col=4',
  197. ),
  198. 'relate_id' => array
  199. (
  200. 'type' => 'int-11',
  201. 'name' => '请输入模块id',
  202. 'default' => '',
  203. 'desc' => '请输入模块id',
  204. 'match' => 'is_numeric',
  205. 'update' => 'text',
  206. 'show' => 'type=2',
  207. ),
  208. 'preview' => array
  209. (
  210. 'type' => 'varchar-200',
  211. 'name' => '模块预览地址',
  212. 'default' => '',
  213. 'desc' => '模块预览地址',
  214. 'match' => 'option',
  215. 'update' => 'text',
  216. ),
  217. 'preview_height' => array
  218. (
  219. 'type' => 'int-11',
  220. 'name' => '模块预览的高度',
  221. 'default' => '500',
  222. 'desc' => '模块预览的高度',
  223. 'match' => 'option',
  224. 'update' => 'text',
  225. ),
  226. 'reorder' => array
  227. (
  228. 'type' => 'int-11',
  229. 'name' => '排序(数值越大越靠前)',
  230. 'default' => '1',
  231. 'desc' => '请输入排序',
  232. 'match' => 'option',
  233. 'update' => 'text',
  234. 'search' => 'order',
  235. 'list_name' => '排序',
  236. 'list' => true,
  237. 'order' => 'desc',
  238. //'edit' => true,
  239. ),
  240. 'state' => array
  241. (
  242. 'type' => 'tinyint-1',
  243. 'name' => '状态',
  244. 'default' => '1',
  245. 'desc' => '请选择状态',
  246. 'match' => 'is_numeric',
  247. ),
  248. 'cdate' => array
  249. (
  250. 'type' => 'int-11',
  251. 'name' => '录入时间',
  252. 'match' => array('is_numeric', time()),
  253. 'desc' => '',
  254. # 只有insert时才生效
  255. 'insert' => true,
  256. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  257. ),
  258. ),
  259. # 权限精细控制 加入到该项目的详细权限中,注意与top的不同
  260. /*
  261. 'auth' => array
  262. (
  263. # 数据来源
  264. 'data' => 'all',
  265. # 所属项目
  266. 'project' => 'module',
  267. # 项目名称
  268. 'project_name' => '模块管理',
  269. ),
  270. */
  271. 'manage' => array
  272. (
  273. 'insert' => $curPage ? true : false,
  274. 'list_button' => array
  275. (
  276. 'add' => array('新增数据', '"data&search_option_info_id={id}&oper_parent=info"', '{type} == 1'),
  277. 'list' => array('数据列表', '"data&search_option_info_id={id}&oper_parent=info"'),
  278. ),
  279. ),
  280. # request 请求接口定义
  281. 'request' => array
  282. (
  283. # 获取列表页
  284. 'getAll' => array
  285. (
  286. # 匹配的正则或函数 选填项
  287. 'option' => array
  288. (
  289. 'type' => 'yes',
  290. 'page_id' => 'yes',
  291. 'state' => 1,
  292. ),
  293. 'type' => 'all',
  294. 'order' => array('reorder' => 'desc'),
  295. 'col' => '*',
  296. ),
  297. ),
  298. );