[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/Horde/Notification/Listener/ -> status.php (source)

   1  <?php
   2  
   3  require_once 'Horde/Notification/Listener.php';
   4  
   5  /**
   6   * The Notification_Listener_status:: class provides functionality for
   7   * displaying messages from the message stack as a status line.
   8   *
   9   * $Horde: framework/Notification/Notification/Listener/status.php,v 1.29.2.5 2006/01/01 21:28:30 jan Exp $
  10   *
  11   * Copyright 2001-2006 Jan Schneider <jan@horde.org>
  12   *
  13   * See the enclosed file COPYING for license information (LGPL). If you
  14   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  15   *
  16   * @author  Jan Schneider <jan@horde.org>
  17   * @since   Horde 2.1
  18   * @package Horde_Notification
  19   */
  20  class Notification_Listener_status extends Notification_Listener {
  21  
  22      /**
  23       * Constructor
  24       */
  25      function Notification_Listener_status()
  26      {
  27          $this->_handles = array('horde.error'   => array('alerts/error.png', _("Error")),
  28                                  'horde.success' => array('alerts/success.png', _("Success")),
  29                                  'horde.warning' => array('alerts/warning.png', _("Warning")),
  30                                  'horde.message' => array('alerts/message.png', _("Message")));
  31      }
  32  
  33      /**
  34       * Return a unique identifier for this listener.
  35       *
  36       * @return string  Unique id.
  37       */
  38      function getName()
  39      {
  40          return 'status';
  41      }
  42  
  43      /**
  44       * Outputs the status line if there are any messages on the 'status'
  45       * message stack.
  46       *
  47       * @param array &$messageStack  The stack of messages.
  48       * @param array $options        An array of options.
  49       */
  50      function notify(&$messageStack, $options = array())
  51      {
  52          if (count($messageStack)) {
  53              while ($message = array_shift($messageStack)) {
  54                  echo $this->getMessage($message);
  55              }
  56              echo '<br class="spacer" />';
  57          }
  58      }
  59  
  60      /**
  61       * Outputs one message.
  62       *
  63       * @param array $message  One message hash from the stack.
  64       */
  65      function getMessage($message)
  66      {
  67          global $registry;
  68  
  69          $event = $this->getEvent($message);
  70          $text = $event->getMessage();
  71  
  72          if (!in_array('content.raw', $this->getFlags($message))) {
  73              $text = htmlspecialchars($text);
  74          }
  75  
  76          return '<p class="notice">' . Horde::img($this->_handles[$message['type']][0], $this->_handles[$message['type']][1], '', $registry->getImageDir('horde')) . '&nbsp;&nbsp;' . $text . '</p>';
  77      }
  78  
  79  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7