<?php

/********** Hock **********/

function form_tab(){
	global $Modules;
	return '<li>'.$Modules["form"]["name"].'</li>';
}

function form_box(){
	global $db;
	global $mysql;
	global $Modules;

	$sql="SELECT * FROM ".VI_DBMODPRE."forms where appid = 'form' order BY id desc";

	//统计总数
	$count = $db -> getValue(str_replace("*","count(id) as count",$sql));
	

	$sql="SELECT * FROM ".VI_DBMODPRE."forms where appid = 'form' and aid=".$_SESSION["Manager"]["id"]." order BY id desc";

	//统计个人
	$users = $db -> getValue(str_replace("*","count(id) as count",$sql));

	$result = '<p>共有表单 <strong class="text-key">'.$count.'</strong> 个，其中由我创建的有 <strong class="text-key">'.$users.'</strong> 个</p>';


	//输出最近
	$db -> query($sql);
	$array = $db -> fetchAll();

	for( $i=0; $i<count($array); $i++ ){
		if( $i>10 ) break;
		$result .= '<p>'.($i+1).'. <a href="module/form/form.list.php?s=id&q='.$array[$i]["id"].'" onclick="parent.Mo.Window(\'window\',\''.$Modules["form"]["name"].'\' ,this.href ,\'90%\',\'85%\',{}); return false;">'.$array[$i]["name"].'</a> - '.date("Y-m-d",$array[$i]["expire"]).' 到期</p>';
	}

	return '<li>'.$result.'</li>';
}

/********** Func **********/

//处理数据扩展
function parseValue($fied,$row,$config){
	switch($fied){
		case "MODIFY":		
			return '<a href="../form/form.value.php?id='.$row["id"].'" target="_blank" onclick="parent.Mo.Window(\'dialog\',\'修改用户提交数据\' ,this.href ,\'850\',\'80%\',{}); return false;">编辑</a>';
		break;
	}
}

?>