formatting

This commit is contained in:
Miles Lott 2001-10-02 04:38:53 +00:00
parent f1a97f8b88
commit 8bc29b952f

View File

@ -17,30 +17,29 @@
/***************************\
* Instance Variables... *
\***************************/
var $errorstack = array();
var $public_functions = array('message',
'error',
'iserror',
'severity',
'commit',
'clearstack',
'astable',
);
var $errorstack = array();
var $public_functions = array(
'message',
'error',
'iserror',
'severity',
'commit',
'clearstack',
'astable'
);
function message($etext,$p0='',$p1='',$p2='',$p3='',$p4='',$p5='',$p6='',$p7='',$p8='',$p9='')
{
$parms = array($p0,$p1,$p2,$p3,$p4,$p5,$p6,$p7,$p8,$p9);
CreateObject('phpgwapi.error',$etext,$parms,1);
}
function error($etext,$p0='',$p1='',$p2='',$p3='',$p4='',$p5='',$p6='',$p7='',$p8='',$p9='')
{
$parms = array($p0,$p1,$p2,$p3,$p4,$p5,$p6,$p7,$p8,$p9);
CreateObject('phpgwapi.error',$etext,$parms,false);
}
function iserror($ecode)
{
$errorstack = $this->errorstack;
@ -54,8 +53,7 @@
}
return false;
}
function severity()
{
$max = 'I';
@ -65,54 +63,54 @@
{
switch($err->severity)
{
case 'F': return 'F'; break;
case 'E': $max = 'E'; break;
case 'W': if ($max == 'I')
{
$max = 'W';
}
break;
case 'F':
return 'F';
break;
case 'E':
$max = 'E';
break;
case 'W':
if ($max == 'I')
{
$max = 'W';
}
break;
}
}
return $max;
}
function commit()
{
global $phpgw, $phpgw_info;
$db = $phpgw->db;
$db->query ("insert into phpgw_log (log_date, log_user, log_app, log_severity) values "
."('". $phpgw->db->to_timestamp(time()
)
."','".$phpgw->session->account_id
."','".$phpgw_info['flags']['currentapp']."'"
.",'".$this->severity()."'"
.")"
,__LINE__,__FILE__);
$db = $GLOBALS['phpgw']->db;
$db->query("insert into phpgw_log (log_date, log_user, log_app, log_severity) values "
."('". $GLOBALS['phpgw']->db->to_timestamp(time())
."','".$GLOBALS['phpgw']->session->account_id
."','".$GLOBALS['phpgw_info']['flags']['currentapp']."'"
.",'".$this->severity()."'"
.")"
,__LINE__,__FILE__);
$errorstack = $this->errorstack;
for ($i = 0; $i < count($errorstack); $i++)
{
$err = $errorstack[$i];
$db->query ("insert into phpgw_log_msg "
."(log_msg_seq_no, log_msg_date, "
."log_msg_severity, log_msg_code, log_msg_msg, log_msg_parms) values "
."(" . $i
.", '" . $phpgw->db->to_timestamp($err->timestamp
)
."', '". $err->severity . "'"
.", '". $err->code . "'"
.", '". $err->msg . "'"
.", '". addslashes(implode('|',$err->parms)). "'"
.")"
,__LINE__,__FILE__);
};
$db->query("insert into phpgw_log_msg "
. "(log_msg_seq_no, log_msg_date, "
. "log_msg_severity, log_msg_code, log_msg_msg, log_msg_parms) values "
. "(" . $i
. ", '" . $GLOBALS['phpgw']->db->to_timestamp($err->timestamp)
. "', '". $err->severity . "'"
. ", '". $err->code . "'"
. ", '". $err->msg . "'"
. ", '". addslashes(implode('|',$err->parms)). "'"
. ")",__LINE__,__FILE__);
}
unset ($errorstack);
unset ($this->errorstack);
$this->errorstack = array();
}
function clearstack()
{
$new = array();
@ -123,16 +121,14 @@
if ($err->ismsg)
{
$new[] = $err;
};
}
}
unset ($this->errorstack);
$this->errorstack = $new;
}
}
function astable()
{
global $phpgw;
$html = "<center>\n";
$html .= "<table width=\"98%\">\n";
$html .= "\t<tr bgcolor=\"D3DCFF\">\n";
@ -143,31 +139,39 @@
$html .= "\t\t<td width=\"10%\">Error Code</td>\n";
$html .= "\t\t<td >Msg</td>\n";
$html .= "\t</tr>\n";
$errorstack = $this->errorstack;
for ($i = 0; $i < count($errorstack); $i++)
{
$err = $errorstack[$i];
switch ($err->severity)
{
case 'I': $color = 'C0FFC0'; break;
case 'W': $color = 'FFFFC0'; break;
case 'E': $color = 'FFC0C0'; break;
case 'F': $color = 'FF0909'; break;
case 'I':
$color = 'C0FFC0';
break;
case 'W':
$color = 'FFFFC0';
break;
case 'E':
$color = 'FFC0C0';
break;
case 'F':
$color = 'FF0909';
break;
}
$html .= "\t<tr bgcolor=".'"'.$color.'"'.">\n";
$html .= "\t\t<td align=center>".$i."</td>\n";
$html .= "\t\t<td>".$phpgw->common->show_date($err->timestamp)."</td>\n";
$html .= "\t\t<td>".$phpgw_info['flags']['currentapp']."&nbsp </td>\n";
$html .= "\t\t<td>".$GLOBALS['phpgw']->common->show_date($err->timestamp)."</td>\n";
$html .= "\t\t<td>".$GLOBALS['phpgw_info']['flags']['currentapp']."&nbsp </td>\n";
$html .= "\t\t<td align=center>".$err->severity."</td>\n";
$html .= "\t\t<td>".$err->code."</td>\n";
$html .= "\t\t<td>".$err->langmsg()."</td>\n";
$html .= "\t</tr>\n";
};
}
$html .= "</table>\n";
$html .= "</center>\n";
return $html;
}
}