1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
<?php
// $Horde: horde/lib/Notification/status.php,v 1.7.2.7 2003/09/15 03:01:02 chuck Exp $
/**
* The Notification_status:: class provides functionality for displaying
* messages from the message stack as a status line.
*
* @author Jan Schneider <jan@horde.org>
* @version $Revision: 1.7.2.7 $
* @since Horde 2.1
* @package horde.notification
*/
class Notification_status {
/**
* Return a unique identifier for this listener.
*
* @access public
*
* @return string Unique id.
*/
function getName()
{
return 'status';
}
/**
* Outputs the status line if there are any messages on the
* 'status' message stack.
*/
function notify(&$messageStacks)
{
if (count($messageStacks['status'])) {
echo '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td class="item"><table border="0" cellspacing="2" cellpadding="2" width="100%">';
while ($message = array_shift($messageStacks['status'])) {
$this->getMessage($message);
}
echo "</table></td></tr></table>\n<br />\n";
}
}
/**
* Outputs one message.
*
* @param array $message One message hash from the stack.
*/
function getMessage($message)
{
global $registry;
switch ($message['type']) {
case 'horde.error':
echo '<tr><td class="control">' . Horde::img('alerts/error.gif', 'alt="' . _("Error") . '" class="control"', $registry->getParam('graphics', 'horde')) . ' <b>' . htmlspecialchars($message['message']) . '</b></td></tr>';
break;
case 'horde.success':
echo '<tr><td class="control">' . Horde::img('alerts/success.gif', 'alt="' . _("Success") . '" class="control"', $registry->getParam('graphics', 'horde')) . ' <b>' . htmlspecialchars($message['message']) . '</b></td></tr>';
break;
case 'horde.warning':
echo '<tr><td class="control">' . Horde::img('alerts/warning.gif', 'alt="' . _("Warning") . '" class="control"', $registry->getParam('graphics', 'horde')) . ' <b>' . htmlspecialchars($message['message']) . '</b></td></tr>';
break;
case 'horde.message':
default:
echo '<tr><td class="control">' . Horde::img('alerts/message.gif', 'alt="' . _("Message") . '" class="control"', $registry->getParam('graphics', 'horde')) . ' <b>' . htmlspecialchars($message['message']) . '</b></td></tr>';
break;
}
}
}
|