[ Index ]
 

Code source de osCommerce 2.2ms2-060817

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/catalog/admin/includes/classes/ -> message_stack.php (source)

   1  <?php
   2  /*
   3    $Id: message_stack.php,v 1.6 2003/06/20 16:23:08 hpdl Exp $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2003 osCommerce
   9  
  10    Released under the GNU General Public License
  11  
  12    Example usage:
  13  
  14    $messageStack = new messageStack();
  15    $messageStack->add('Error: Error 1', 'error');
  16    $messageStack->add('Error: Error 2', 'warning');
  17    if ($messageStack->size > 0) echo $messageStack->output();
  18  */
  19  
  20    class messageStack extends tableBlock {
  21      var $size = 0;
  22  
  23      function messageStack() {
  24        global $messageToStack;
  25  
  26        $this->errors = array();
  27  
  28        if (tep_session_is_registered('messageToStack')) {
  29          for ($i = 0, $n = sizeof($messageToStack); $i < $n; $i++) {
  30            $this->add($messageToStack[$i]['text'], $messageToStack[$i]['type']);
  31          }
  32          tep_session_unregister('messageToStack');
  33        }
  34      }
  35  
  36      function add($message, $type = 'error') {
  37        if ($type == 'error') {
  38          $this->errors[] = array('params' => 'class="messageStackError"', 'text' => tep_image(DIR_WS_ICONS . 'error.gif', ICON_ERROR) . '&nbsp;' . $message);
  39        } elseif ($type == 'warning') {
  40          $this->errors[] = array('params' => 'class="messageStackWarning"', 'text' => tep_image(DIR_WS_ICONS . 'warning.gif', ICON_WARNING) . '&nbsp;' . $message);
  41        } elseif ($type == 'success') {
  42          $this->errors[] = array('params' => 'class="messageStackSuccess"', 'text' => tep_image(DIR_WS_ICONS . 'success.gif', ICON_SUCCESS) . '&nbsp;' . $message);
  43        } else {
  44          $this->errors[] = array('params' => 'class="messageStackError"', 'text' => $message);
  45        }
  46  
  47        $this->size++;
  48      }
  49  
  50      function add_session($message, $type = 'error') {
  51        global $messageToStack;
  52  
  53        if (!tep_session_is_registered('messageToStack')) {
  54          tep_session_register('messageToStack');
  55          $messageToStack = array();
  56        }
  57  
  58        $messageToStack[] = array('text' => $message, 'type' => $type);
  59      }
  60  
  61      function reset() {
  62        $this->errors = array();
  63        $this->size = 0;
  64      }
  65  
  66      function output() {
  67        $this->table_data_parameters = 'class="messageBox"';
  68        return $this->tableBlock($this->errors);
  69      }
  70    }
  71  ?>


Généré le : Mon Nov 26 19:48:25 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics