0)
{
if (self::$numErrors > 1)
{
$error = "ERRORS";
}
else
{
$error = "ERROR";
}
// Loop through Error Messages
for ($i = 0; $i < sizeof(self::$title); $i++)
{
if (self::$type[$i] == "ERROR")
{
// Output each individual Error
$output .= "
\r\n" .
" " . self::$title[$i] . "\r\n" .
" at " . self::$datetime[$i] . "\r\n" .
"
\r\n" .
" " . self::$description[$i] . "
\r\n";
}
}
// Write Error Template Output
$output = "\r\n" .
"
{$error}:
\r\n" .
"
\r\n" . $output . "\r\n
\r\n" .
"
\r\n";
}
// Return the Error Message Output
return $output;
}
// Retrieve Last Error
// Returns the title and description of the last error in an array
public static function RetrieveLastError()
{
$output = array();
// Check to see if 1 error occurred or more than one.
if (self::$numErrors > 0)
{
for ($i = sizeof(self::$title) - 1; $i >= 0; $i++)
{
if (self::$type[$i] == "ERROR")
{
array_push($output, self::$title[$i]);
array_push($output, self::$description[$i]);
break;
}
}
}
return $output;
}
// Clear Errors
// Returns nothing
public static function ClearErrors()
{
self::$numErrors = 0;
for ($i = 0; $i < sizeof(self::$type); $i++)
{
if (self::$type[$i] == "ERROR")
{
self::$title[$i] = null;
self::$type[$i] = null;
self::$description[$i] = null;
self::$datetime[$i] = null;
}
}
}
// Has Errors
// Returns true or false on whether errors exist
public static function HasErrors()
{
if (self::$numErrors > 0)
{
return true;
}
return false;
}
// Log Warning Method (receives Name and Description)
// Returns true or false depending on if logging the warning was successful
public static function LogWarning($varTitle, $varDescription)
{
// Check Parameters
if (strlen(trim($varTitle)) != 0 && strlen(trim($varDescription)) != 0)
{
array_push(self::$title, $varTitle);
array_push(self::$type, "WARNING");
array_push(self::$description, $varDescription);
array_push(self::$datetime, date("m/d/Y H:i:s"));
self::$numWarnings++;
return true;
}
return false;
}
// Show Warning Messages
// Returns the Warning Message Output (in HTML format)
public static function ShowWarningMessages()
{
$output = "";
// Check to see if 1 warning occurred or more than one.
if (self::$numWarnings > 0)
{
if (self::$numWarnings > 1)
{
$warning = "WARNINGS";
}
else
{
$warning = "WARNING";
}
// Loop through Warning Messages
for ($i = 0; $i < sizeof(self::$title); $i++)
{
if (self::$type[$i] == "WARNING")
{
// Output each individual Warning
$output .= " \r\n" .
" " . self::$title[$i] . "\r\n" .
" at " . self::$datetime[$i] . "\r\n" .
"
\r\n" .
" " . self::$description[$i] . "
\r\n";
}
}
// Write Warning Template Output
$output = "\r\n" .
"
{$warning}:
\r\n" .
"
\r\n" . $output . "\r\n
\r\n" .
"
\r\n";
}
// Return the Warning Message Output
return $output;
}
// Has Warnings
// Returns true or false on whether there are any Warnings
public static function HasWarnings()
{
if (self::$numWarnings > 0)
{
return true;
}
return false;
}
## END PUBLIC METHODS
## PRIVATE METHODS
## END PRIVATE METHODS
## PROTECTED METHODS
## END PROTECTED METHODS
}
?>