<?php

# 定义几个常用的选项
$option = array
(
	1 => '已赞',
	2 => '取消赞',
);

$table = array
(
	1 => '主题',
	2 => '评论',
);

return array
(
	# 表名
	'name' => 'vote',
	# 显示给用户看的名称
	'lang' => '用户点赞管理',
	'menu' => false,
	# 数据结构
	'struct' => array
	(
	
		'id' 		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> 'ID',
			'default' 	=> '',
			'desc' 		=> '',
			'match' 	=> 'is_numeric',
			//'search'	=> 'order',
			//'list'		=> true,
		),

		'uid' 		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '用户',
			'default' 	=> '',
			'desc' 		=> '用户ID',
			'match' 	=> 'is_numeric',
			'search'	=> 'order',
			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
		),
		
		'source_table' 		=> array
		(
			'type' 		=> 'tinyint-1',
			'name' 		=> '来源表',
			'default' 	=> '',
			'desc' 		=> '来源表',
			'match' 	=> 'option',
			'option' 	=> $table,
		),
		
		'source_id' 		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '主题',
			'default' 	=> '',
			'desc' 		=> '主题',
			'match' 	=> 'option',
			//'list'		=> '{source_table} == 1 ? Dever::load("main/jade-one#name", {source_id}) : Dever::load("main/master-one#name", {source_id})',
		),
		
		'ip'		=> array
		(
			'type' 		=> 'varchar-32',
			'name' 		=> 'IP',
			'default' 	=> '',
			'desc' 		=> '请输入IP',
			'match' 	=> 'option',
			'update'	=> 'text',
			'search'	=> 'fulltext',
			'list'		=> true,
		),

		'state'		=> array
		(
			'type' 		=> 'tinyint-1',
			'name' 		=> '状态',
			'default' 	=> '1',
			'desc' 		=> '请选择状态',
			'match' 	=> 'is_numeric',
			'option' 	=> $option,
			//'update'	=> 'radio',
			'list'		=> true,
			'show'		=> 'yes',
		),
		
		'cdate'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '点赞时间',
			'match' 	=> array('is_numeric', time()),
			'desc' 		=> '',
			# 只有insert时才生效
			'insert'	=> true,
			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
		),
	),
	
	'manage' => array
	(
		'insert' => false,
	),
);
