123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <?php
- # 定义几个常用的选项
- $option = array
- (
- 1 => '显示',
- 2 => '不显示',
- );
- $col = function()
- {
- $col = Dever::db('forum/posts')->config['struct'];
- $html = '';
- if($col)
- {
- foreach($col as $k => $v)
- {
- if(isset($v['option']) && is_array($v['option']))
- {
- foreach($v['option'] as $k1 => $v1)
- {
- //$k1 = (isset($v1['id']) && $v1['id']) ? $v1['id'] : $k1;
- //print_r($v1['id']);die;
- $table[$k][$k1] = $v1;
- }
- }
- else
- {
- $table[$k] = $v['name'];
- }
- }
- $html = Dever::table($table);
- }
- return $html;
- };
- $time = time();
- return array
- (
- # 表名
- 'name' => 'type',
- # 显示给用户看的名称
- 'lang' => '主题列表读取规则',
- 'order' => 8,
- # 数据结构
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => '列表ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- 'order' => 'desc',
- //'list' => true,
- ),
- 'hr1' => array
- (
- 'name' => $col(),
- 'class' => '',//本项必须填写
- 'attr' => '',
- ),
-
- 'name' => array
- (
- 'type' => 'varchar-80',
- 'name' => '列表名称',
- 'default' => '',
- 'desc' => '请输入列表名称',
- 'match' => 'is_string',
- 'update' => 'text',
- 'search' => 'fulltext',
- 'list' => true,
- ),
- /*
- 'col' => array
- (
- 'type' => 'varchar-255',
- 'name' => '可选的字段',
- 'default' => '',
- 'desc' => '请选择上级栏目',
- 'match' => 'is_numeric',
- 'update' => 'select',
- 'list' => true,
- 'option' => $col,
- ),
- */
- 'where' => array
- (
- 'type' => 'varchar-255',
- 'name' => '限制条件-请用如essence=1&top=1类型的字符串定义',
- 'default' => '',
- 'desc' => '请输入限制条件',
- 'match' => 'option',
- 'update' => 'text',
- ),
-
- 'order' => array
- (
- 'type' => 'varchar-255',
- 'name' => '列表排序-请用如top=desc&id=desc类型的字符串定义,id和top等字段请参考上面的横栏说明',
- 'default' => 'top=desc&id=desc',
- 'desc' => '请输入列表排序',
- 'match' => 'option',
- 'update' => 'text',
- ),
-
- 'pagenum' => array
- (
- 'type' => 'int-11',
- 'name' => '每页展示数量-直接填入数字即可,默认为16条数据',
- 'default' => '16',
- 'desc' => '请输入数量',
- 'match' => 'option',
- 'update' => 'text',
- ),
- 'icon' => array
- (
- 'type' => 'varchar-32',
- 'name' => '列表图标-请在<a href="http://v3.bootcss.com/components/" target="_blank">图标列表</a>中查找想用的图标,只在此输入后缀即可。',
- 'default' => 'time',
- 'desc' => '请输入列表图标',
- 'match' => 'option',
- 'update' => 'text',
- ),
-
- 'reorder' => array
- (
- 'type' => 'int-11',
- 'name' => '排序(数值越大越靠前)',
- 'default' => '1',
- 'desc' => '请输入排序',
- 'match' => 'option',
- 'update' => 'text',
- 'search' => 'order',
- 'list_name' => '排序',
- 'list' => true,
- 'order' => 'desc',
- 'edit' => true,
- ),
- 'state' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '状态',
- 'default' => '1',
- 'desc' => '请选择状态',
- 'match' => 'is_numeric',
- 'option' => $option,
- 'update' => 'radio',
- 'list' => true,
- ),
-
- 'cdate' => array
- (
- 'type' => 'int-11',
- 'name' => '录入时间',
- 'match' => array('is_numeric', time()),
- 'desc' => '',
- # 只有insert时才生效
- 'insert' => true,
- 'list' => 'date("Y-m-d H:i:s", {cdate})',
- ),
- ),
- # 默认值
- 'default' => array
- (
- 'col' => 'name,state,cdate',
- 'value' => array
- (
- '"默认列表",1,' . $time,
- ),
- ),
- );
|