<?


$SHOW[calendar][0]["object_template"]="appuntamento.tpl";
$SHOW[calendar][0]["sql_select"]="SELECT * FROM calendar  WHERE id=%[ID]%";
$SHOW[calendar][0]["options"]="perm::0";
$SHOW[calendar][0]["Fields"]["title"]=CALENDAR_ADESC;
$SHOW[calendar][0]["Fields"]["day"]=CALENDAR_ADATE."::date";
$SHOW[calendar][0]["Fields"]["time"]=CALENDAR_ATIME;
$SHOW[calendar][0]["Fields"]["codice"]=FW_CODE;
$SHOW[calendar][0]["Fields"]["priorita"]=CALENDAR_PRIORITY."::(0=>".CALENDAR_PRIORITY_LOW."||1=>".CALENDAR_PRIORITY_MED."||2=>".CALENDAR_PRIORITY_HIGH.")";
$SHOW[calendar][0]["Fields"]["type_app"]=CALENDAR_ATYPE."::[SELECT * FROM INT_calendar_tipo WHERE ttsid='%ID%';;tts_desc]";
$SHOW[calendar][0]["Fields"]["ref_prat"]=CALENDAR_REF_PRATICA."::[SELECT * FROM pratiche WHERE id='%ID%';;pr_codice]";
$SHOW[calendar][0]["Fields"]["operator"]=CALENDAR_OPER."::func=>calendar_operator_show";
$SHOW[calendar][0]["Fields"]["note"]=FW_NOTE;
if($_SESSION[history]==0)
{
	$SHOW[calendar][0]["Fields"]["button1"]=make_button("new_app.php?id=".$_GET[id],CALENDAR_UPD_APP);
} else $SHOW[calendar][0]["Fields"]["button1"]=CALENDAR_UPD_APP;

function calendar_operator_show($row)
{
	global $DB,$CONF;
	
	$cnt=0;
	
	foreach(explode(",,",$row[operator]) as $v)
	{
		if ($cnt > 0) $cur .= ", ";
		$rs=$DB->Execute("SELECT * FROM ".$CONF[auth_db_table]." WHERE id='".$v."'");
		$op=$rs->FetchRow();
		$cur .= $op[nome]." (".$op[codice].")";
		$cnt++;
	}
	return $cur;
}
	
?>