type.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '显示',
  6. 2 => '不显示',
  7. );
  8. $col = function()
  9. {
  10. $col = Dever::db('forum/posts')->config['struct'];
  11. $html = '';
  12. if($col)
  13. {
  14. foreach($col as $k => $v)
  15. {
  16. if(isset($v['option']) && is_array($v['option']))
  17. {
  18. foreach($v['option'] as $k1 => $v1)
  19. {
  20. //$k1 = (isset($v1['id']) && $v1['id']) ? $v1['id'] : $k1;
  21. //print_r($v1['id']);die;
  22. $table[$k][$k1] = $v1;
  23. }
  24. }
  25. else
  26. {
  27. $table[$k] = $v['name'];
  28. }
  29. }
  30. $html = Dever::table($table);
  31. }
  32. return $html;
  33. };
  34. $time = time();
  35. return array
  36. (
  37. # 表名
  38. 'name' => 'type',
  39. # 显示给用户看的名称
  40. 'lang' => '主题列表读取规则',
  41. 'order' => 8,
  42. # 数据结构
  43. 'struct' => array
  44. (
  45. 'id' => array
  46. (
  47. 'type' => 'int-11',
  48. 'name' => '列表ID',
  49. 'default' => '',
  50. 'desc' => '',
  51. 'match' => 'is_numeric',
  52. 'order' => 'desc',
  53. //'list' => true,
  54. ),
  55. 'hr1' => array
  56. (
  57. 'name' => $col(),
  58. 'class' => '',//本项必须填写
  59. 'attr' => '',
  60. ),
  61. 'name' => array
  62. (
  63. 'type' => 'varchar-80',
  64. 'name' => '列表名称',
  65. 'default' => '',
  66. 'desc' => '请输入列表名称',
  67. 'match' => 'is_string',
  68. 'update' => 'text',
  69. 'search' => 'fulltext',
  70. 'list' => true,
  71. ),
  72. /*
  73. 'col' => array
  74. (
  75. 'type' => 'varchar-255',
  76. 'name' => '可选的字段',
  77. 'default' => '',
  78. 'desc' => '请选择上级栏目',
  79. 'match' => 'is_numeric',
  80. 'update' => 'select',
  81. 'list' => true,
  82. 'option' => $col,
  83. ),
  84. */
  85. 'where' => array
  86. (
  87. 'type' => 'varchar-255',
  88. 'name' => '限制条件-请用如essence=1&top=1类型的字符串定义',
  89. 'default' => '',
  90. 'desc' => '请输入限制条件',
  91. 'match' => 'option',
  92. 'update' => 'text',
  93. ),
  94. 'order' => array
  95. (
  96. 'type' => 'varchar-255',
  97. 'name' => '列表排序-请用如top=desc&id=desc类型的字符串定义,id和top等字段请参考上面的横栏说明',
  98. 'default' => 'top=desc&id=desc',
  99. 'desc' => '请输入列表排序',
  100. 'match' => 'option',
  101. 'update' => 'text',
  102. ),
  103. 'pagenum' => array
  104. (
  105. 'type' => 'int-11',
  106. 'name' => '每页展示数量-直接填入数字即可,默认为16条数据',
  107. 'default' => '16',
  108. 'desc' => '请输入数量',
  109. 'match' => 'option',
  110. 'update' => 'text',
  111. ),
  112. 'icon' => array
  113. (
  114. 'type' => 'varchar-32',
  115. 'name' => '列表图标-请在<a href="http://v3.bootcss.com/components/" target="_blank">图标列表</a>中查找想用的图标,只在此输入后缀即可。',
  116. 'default' => 'time',
  117. 'desc' => '请输入列表图标',
  118. 'match' => 'option',
  119. 'update' => 'text',
  120. ),
  121. 'reorder' => array
  122. (
  123. 'type' => 'int-11',
  124. 'name' => '排序(数值越大越靠前)',
  125. 'default' => '1',
  126. 'desc' => '请输入排序',
  127. 'match' => 'option',
  128. 'update' => 'text',
  129. 'search' => 'order',
  130. 'list_name' => '排序',
  131. 'list' => true,
  132. 'order' => 'desc',
  133. 'edit' => true,
  134. ),
  135. 'state' => array
  136. (
  137. 'type' => 'tinyint-1',
  138. 'name' => '状态',
  139. 'default' => '1',
  140. 'desc' => '请选择状态',
  141. 'match' => 'is_numeric',
  142. 'option' => $option,
  143. 'update' => 'radio',
  144. 'list' => true,
  145. ),
  146. 'cdate' => array
  147. (
  148. 'type' => 'int-11',
  149. 'name' => '录入时间',
  150. 'match' => array('is_numeric', time()),
  151. 'desc' => '',
  152. # 只有insert时才生效
  153. 'insert' => true,
  154. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  155. ),
  156. ),
  157. # 默认值
  158. 'default' => array
  159. (
  160. 'col' => 'name,state,cdate',
  161. 'value' => array
  162. (
  163. '"默认列表",1,' . $time,
  164. ),
  165. ),
  166. );