<?
function add_to_inform_history($module,$to_name,$id)
{
	mysql_query("insert into ecminform_history(id,module,parent_id,from,to,date) values('".create_guid()."','".$module."','".$id."','".$_SESSION['authenticated_user_id']."','".$to_name."','".date("Y-m-d H:m:s")."')");
}
function display_inform_history($module,$id)
{
	$html="";
	$z="select * from ecminform_history where ecminform_history.module='".$module."' and ecminform_history.parent_id='".$id."' order by ecminform_history.date asc";
	$w=mysql_query($z);
	while($r=mysql_fetch_array($w))
	{
		$rr=mysql_fetch_array(mysql_query("select user_name from users where id='".$r['from']."'"));
		if($rr['user_name'])$from=$rr['user_name'];
		$html.="<div style='height:15px;'>".$r['date'].": ".$from." to ".str_replace("||",", ",$r['to'])."<br></div>";
	}
	return $html;
}
?>
