page.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '显示',
  6. 2 => '不显示',
  7. );
  8. $parent = function()
  9. {
  10. $param['option_page_id'] = -1;
  11. $info = Dever::db('module/page')->all($param);
  12. $array = array(-1 => array('name' => '无'));
  13. if ($info) {
  14. $array += $info;
  15. }
  16. return $array;
  17. };
  18. $time = time();
  19. return array
  20. (
  21. # 表名
  22. 'name' => 'page',
  23. # 显示给用户看的名称
  24. 'lang' => '页面管理',
  25. # 后台菜单排序
  26. 'order' => 9,
  27. 'check' => 'key',
  28. # 数据结构
  29. 'struct' => array
  30. (
  31. 'id' => array
  32. (
  33. 'type' => 'int-11',
  34. 'name' => '页面ID',
  35. 'default' => '',
  36. 'desc' => '',
  37. 'match' => 'is_numeric',
  38. 'search' => 'order',
  39. 'list' => true,
  40. 'order' => 'desc',
  41. ),
  42. 'name' => array
  43. (
  44. 'type' => 'varchar-32',
  45. 'name' => '页面名称',
  46. 'default' => '',
  47. 'desc' => '请输入页面名称',
  48. 'match' => 'is_string',
  49. 'update' => 'text',
  50. 'search' => 'order,fulltext',
  51. 'list' => true,
  52. //'list' => '"<a href=\"".Dever::load("main/data.page", {id})."\" target=\"_blank\">{name}</a>"',
  53. ),
  54. 'key' => array
  55. (
  56. 'type' => 'varchar-60',
  57. 'name' => '页面标识',
  58. 'default' => '',
  59. 'desc' => '页面标识',
  60. 'match' => 'is_string',
  61. 'update' => 'text',
  62. 'search' => 'fulltext',
  63. 'list' => true,
  64. ),
  65. 'page_id' => array
  66. (
  67. 'type' => 'int-11',
  68. 'name' => '父级页面',
  69. 'default' => Dever::input('page_id', '-1'),
  70. 'desc' => '请选择父级页面id',
  71. 'match' => 'is_numeric',
  72. 'option' => $parent,
  73. 'update' => 'select',
  74. 'search' => 'select',
  75. //'list' => true,
  76. ),
  77. 'reorder' => array
  78. (
  79. 'type' => 'int-11',
  80. 'name' => '排序(数值越大越靠前)',
  81. 'default' => '1',
  82. 'desc' => '请输入排序',
  83. 'match' => 'option',
  84. 'update' => 'text',
  85. 'search' => 'order',
  86. 'list_name' => '排序',
  87. 'list' => true,
  88. 'order' => 'desc',
  89. 'edit' => true,
  90. ),
  91. 'state' => array
  92. (
  93. 'type' => 'tinyint-1',
  94. 'name' => '状态',
  95. 'default' => '1',
  96. 'desc' => '请选择状态',
  97. 'match' => 'is_numeric',
  98. ),
  99. 'cdate' => array
  100. (
  101. 'type' => 'int-11',
  102. 'name' => '录入时间',
  103. 'match' => array('is_numeric', $time),
  104. 'desc' => '',
  105. # 只有insert时才生效
  106. 'insert' => true,
  107. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  108. ),
  109. ),
  110. 'manage' => array
  111. (
  112. 'list_type' => 'parent',
  113. 'list_button' => array
  114. (
  115. 'addPage' => array('新增子页面', '"page&page_id={id}"', '{page_id} == -1'),
  116. 'add' => array('新增模块', '"info&project=module&search_option_page_id={id}&oper_parent=page&oper_project=module"', '{page_id} > -1'),
  117. 'list' => array('模块列表', '"info&project=module&search_option_page_id={id}&oper_parent=page&oper_project=module"', '{page_id} > -1'),
  118. ),
  119. ),
  120. # 默认值
  121. 'default' => array
  122. (
  123. 'col' => 'id,name,state,cdate',
  124. 'value' => array
  125. (
  126. '1,"首页",1,' . $time,
  127. ),
  128. ),
  129. # request 请求接口定义
  130. 'request' => array
  131. (
  132. # 获取列表页
  133. 'getParent' => array
  134. (
  135. # 匹配的正则或函数 选填项
  136. 'where' => array
  137. (
  138. 'page_id' => -1,
  139. 'state' => 1,
  140. ),
  141. 'type' => 'all',
  142. 'order' => array('reorder' => 'desc'),
  143. 'col' => '*',
  144. ),
  145. 'getChild' => array
  146. (
  147. # 匹配的正则或函数 选填项
  148. 'where' => array
  149. (
  150. 'page_id' => array(-1, '>'),
  151. 'state' => 1,
  152. ),
  153. 'type' => 'all',
  154. 'order' => array('reorder' => 'desc'),
  155. 'col' => '*|page_id|id|',
  156. ),
  157. ),
  158. );