<?php
class Message {
var $msgs = array(); # the array of messages
var $styles = array();
var $nummsgs = 0;
var $msgs_sent = FALSE;
function add($msg,$style='') {
$this->msgs[$this->nummsgs] = $msg;
$this->style[$this->nummsgs] = $style;
$this->nummsgs++;
return $this->nummsgs;
}
function show($header='',$table_params="border=0 cellspacing=0 cellpadding=2") {
if ($this->nummsgs > 0) {
echo "<table $table_params>\n";
if (strlen($header)) {
echo "<tr bgcolor='#DDDDDD'><td>$header</td></tr>\n";
}
for($i = 0;$i < $this->nummsgs;$i++) {
echo "<tr bgcolor='#FFFFFF'><td";
if ($style) {
echo "class=\"" . $this->style[$i] . "\"";
}
echo ">" . $this->msgs[$i] .
"</td></tr>\n";
}
echo "</table>\n<br>\n";
$this->msgs_sent = TRUE;
return TRUE;
}
}
function howmany () {
return $this->nummsgs;
}
function sent() {
return $this->msgs_sent;
}
}