model.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '显示',
  6. 2 => '不显示',
  7. );
  8. # 显示类型
  9. $type = array
  10. (
  11. # 固定的类型和数据
  12. 1 => '发布新主题',
  13. 2 => '主题列表-简约',
  14. 3 => '主题列表-详细',
  15. 4 => '栏目列表',
  16. 5 => '友情链接',
  17. 6 => '统计信息',
  18. //7 => '会员列表',
  19. //8 => '会员详情',
  20. # 自定义数据
  21. 31 => '固定描述',
  22. 32 => '随机描述',
  23. 33 => '提醒信息',
  24. # 自定义类型和数据
  25. //51 => '自定义列表',
  26. );
  27. # 是否显示模块标题
  28. $title = array
  29. (
  30. 1 => '显示标题',
  31. 2 => '不显示标题',
  32. );
  33. # 标题的位置
  34. $align = array
  35. (
  36. 1 => '左侧',
  37. 2 => '居中',
  38. 3 => '右侧',
  39. );
  40. # 显示的位置
  41. $position = array
  42. (
  43. 1 => '页面右侧',
  44. 2 => '页面底部',
  45. 3 => '页面顶部',
  46. );
  47. # 显示的页面
  48. $page = function()
  49. {
  50. $page = Dever::load('main/page-all');
  51. return $page;
  52. };
  53. # 栏目
  54. $cate = function()
  55. {
  56. $array = array
  57. (
  58. -1 => array('id' => '-1', 'name' => '所有栏目'),
  59. );
  60. $cate = Dever::load('forum/cate.all');
  61. if($cate)
  62. {
  63. $array += $cate;
  64. }
  65. return $array;
  66. };
  67. # 主题读取规则
  68. $rule = function()
  69. {
  70. $array = array
  71. (
  72. -1 => array('id' => '-1', 'name' => '根据参数变化'),
  73. );
  74. $data = Dever::load('forum/type-all');
  75. if($data)
  76. {
  77. $array += $data;
  78. }
  79. return $array;
  80. };
  81. return array
  82. (
  83. # 表名
  84. 'name' => 'model',
  85. # 显示给用户看的名称
  86. 'lang' => '模块管理',
  87. 'order' => 6,
  88. # 数据结构
  89. 'struct' => array
  90. (
  91. 'id' => array
  92. (
  93. 'type' => 'int-11',
  94. 'name' => '模块ID',
  95. 'default' => '',
  96. 'desc' => '',
  97. 'match' => 'is_numeric',
  98. //'search' => 'order',
  99. 'order' => 'desc',
  100. //'list' => true,
  101. ),
  102. 'name' => array
  103. (
  104. 'type' => 'varchar-60',
  105. 'name' => '模块标题',
  106. 'default' => '',
  107. 'desc' => '请输入模块标题',
  108. 'match' => 'is_string',
  109. 'update' => 'text',
  110. 'search' => 'fulltext',
  111. 'list' => true,
  112. 'edit' => true,
  113. ),
  114. 'page' => array
  115. (
  116. 'type' => 'tinyint-1',
  117. 'name' => '显示的页面',
  118. 'default' => Dever::input('search_option_page', '1'),
  119. 'desc' => '请选择显示的页面',
  120. 'match' => 'is_numeric',
  121. 'option' => $page,
  122. 'update' => 'radio',
  123. 'search' => 'select',
  124. 'list' => true,
  125. 'edit' => true,
  126. ),
  127. 'title' => array
  128. (
  129. 'type' => 'tinyint-1',
  130. 'name' => '是否显示模块标题',
  131. 'default' => '1',
  132. 'desc' => '请选择是否显示模块标题',
  133. 'match' => 'is_numeric',
  134. 'option' => $title,
  135. 'update' => 'radio',
  136. //'list' => true,
  137. ),
  138. 'align' => array
  139. (
  140. 'type' => 'tinyint-1',
  141. 'name' => '模块标题显示位置',
  142. 'default' => '1',
  143. 'desc' => '请选择模块标题显示位置',
  144. 'match' => 'is_numeric',
  145. 'option' => $align,
  146. 'update' => 'radio',
  147. //'list' => true,
  148. //'edit' => true,
  149. ),
  150. 'position' => array
  151. (
  152. 'type' => 'tinyint-1',
  153. 'name' => '显示位置',
  154. 'default' => '1',
  155. 'desc' => '请选择显示位置',
  156. 'match' => 'is_numeric',
  157. 'option' => $position,
  158. 'update' => 'radio',
  159. 'search' => 'select',
  160. 'list' => true,
  161. 'edit' => true,
  162. ),
  163. 'cate_id' => array
  164. (
  165. 'type' => 'int-11',
  166. 'name' => '栏目-如果选择了某个栏目,如果显示在列表页,则本模块只在该栏目中出现,如果是首页,则显示该栏目下的数据',
  167. 'default' => '-1',
  168. 'desc' => '请选择栏目',
  169. 'match' => 'is_numeric',
  170. 'search' => 'group',
  171. 'update' => 'group',
  172. 'option' => $cate,
  173. 'list' => true,
  174. 'edit' => true,
  175. ),
  176. 'type' => array
  177. (
  178. 'type' => 'tinyint-1',
  179. 'name' => '显示类型',
  180. 'default' => '1',
  181. 'desc' => '请选择显示类型',
  182. 'match' => 'is_numeric',
  183. 'option' => $type,
  184. 'update' => 'radio',
  185. 'show' => 'type',
  186. 'search' => 'select',
  187. 'list' => true,
  188. ),
  189. 'rule' => array
  190. (
  191. 'type' => 'int-11',
  192. 'name' => '读取规则',
  193. 'default' => '1',
  194. 'desc' => '请选择读取规则',
  195. 'match' => 'is_numeric',
  196. //'search' => 'select',
  197. 'update' => 'select',
  198. 'option' => $rule,
  199. //'list' => true,
  200. 'show' => array('type_2', 'type_3'),
  201. ),
  202. 'info' => array
  203. (
  204. 'type' => 'text-255',
  205. 'name' => '固定描述-可以是一段文字,或者是一张图片,超链接请自行添加,如果是随机描述,请用"||"隔开',
  206. 'default' => '',
  207. 'desc' => '请输入固定描述',
  208. 'match' => 'option',
  209. 'update' => 'editor',
  210. 'show' => array('type_31','type_32', 'type_33'),
  211. ),
  212. 'reorder' => array
  213. (
  214. 'type' => 'int-11',
  215. 'name' => '排序(数值越大越靠前)',
  216. 'default' => '1',
  217. 'desc' => '请输入排序',
  218. 'match' => 'option',
  219. 'update' => 'text',
  220. 'search' => 'order',
  221. 'list_name' => '排序',
  222. 'list' => true,
  223. 'order' => 'desc',
  224. 'edit' => true,
  225. ),
  226. 'state' => array
  227. (
  228. 'type' => 'tinyint-1',
  229. 'name' => '状态',
  230. 'default' => '1',
  231. 'desc' => '请选择状态',
  232. 'match' => 'is_numeric',
  233. 'option' => $option,
  234. 'update' => 'radio',
  235. 'list' => true,
  236. ),
  237. 'cdate' => array
  238. (
  239. 'type' => 'int-11',
  240. 'name' => '录入时间',
  241. 'match' => array('is_numeric', time()),
  242. 'desc' => '',
  243. # 只有insert时才生效
  244. 'insert' => true,
  245. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  246. ),
  247. ),
  248. );