Source for file Message.php

Documentation is available at Message.php

  1. <?php
  2.     /**
  3.      * The miMessage class
  4.      * 
  5.      * @copyright Copyright (c) 2006-2007 Mirchev Ideas Ltd. All rights reserved.
  6.      * @package MIPHPF
  7.      */
  8.     
  9.     /**
  10.      * Handles the displaying of error/warning/info messages
  11.      * 
  12.      * @copyright Copyright (c) 2006-2007 Mirchev Ideas Ltd. All rights reserved.
  13.      * @package MIPHPF
  14.      */
  15.     class miMessage {
  16.         
  17.         const TMPL_VAR_MSG = '%%MSG%%';
  18.         const TMPL_VAR_MSG_TYPE_STYLE = '%%MSG_TYPE_STYLE%%';
  19.         
  20.         const PARAM_MESSAGE = 'msg';
  21.         const PARAM_MESSAGE_TYPE = 'msgType';
  22.         
  23.         const MSG_TYPE_HIDDEN = 0;
  24.         const MSG_TYPE_ERROR = 1;
  25.         const MSG_TYPE_WARNING = 2;
  26.         const MSG_TYPE_INFO = 3;
  27.         
  28.         static protected $_messageTypeStyles = array(
  29.             self::MSG_TYPE_HIDDEN => 'hidden',
  30.             self::MSG_TYPE_ERROR => 'error',
  31.             self::MSG_TYPE_WARNING => 'warning',
  32.             self::MSG_TYPE_INFO => 'info',
  33.         );
  34.         
  35.         /**
  36.          * Get the template variable values
  37.          * 
  38.          * @return array 
  39.          */
  40.         public function getMessageTemplateVars()
  41.         {
  42.             $msg = miGetParamDefault(self::PARAM_MESSAGE, '');
  43.             $messageType = miGetParamDefault(self::PARAM_MESSAGE_TYPE, self::MSG_TYPE_ERROR);
  44.             if (empty($msg))
  45.                 $messageType = self::MSG_TYPE_HIDDEN;
  46.             
  47.             $messageTypeStyle = isset(self::$_messageTypeStyles[$messageType]) ?
  48.                 self::$_messageTypeStyles[$messageType] :
  49.                 self::$_messageTypeStyles[self::MSG_TYPE_ERROR];
  50.             
  51.             return array(
  52.                 self::TMPL_VAR_MSG => miI18N::htmlEscape($msg),
  53.                 self::TMPL_VAR_MSG_TYPE_STYLE => $messageTypeStyle
  54.             );
  55.         }
  56.     }
  57. ?>

Documentation generated on Thu, 08 May 2008 16:57:29 +0300 by phpDocumentor 1.4.1