messageStack Class Reference

List of all members.

Public Member Functions

  • __construct ()
  • add ($class, $message, $type= 'error')
  • add_session ($class, $message, $type= 'error')
  • reset ()
  • size ($class)
    Calcul présence des erreurs.
  • _add ($class, $message, $type='error')
    Alias public.
  • _draw ($type)
    Draw erreur.
  • _draw_inline ($type, $markup='')
    Draw erreur inline.
  • _draw_nbr ($type)
    Draw number error.

Private Member Functions

Private Attributes


Detailed Description

Definition at line 24 of file messageStack.php.


Constructor & Destructor Documentation

messageStack::__construct (  ) 

Definition at line 31 of file messageStack.php.

00031                          {
00032     global $messageToStack;
00033 
00034     $this->messages = array();
00035 
00036     if (tep_session_is_registered('messageToStack')) {
00037       for ($i=0, $n=sizeof($messageToStack); $i<$n; $i++) {
00038         $this->add($messageToStack[$i]['class'], $messageToStack[$i]['text'], $messageToStack[$i]['type']);
00039       }
00040       tep_session_unregister('messageToStack');
00041     }
00042   }


Member Function Documentation

messageStack::_add ( class,
message,
type = 'error' 
)

Alias public.

Definition at line 116 of file messageStack.php.

00116                                                        {
00117     return $this->add($class, $message, $type);
00118   }

messageStack::_draw ( type  ) 

Draw erreur.

Definition at line 123 of file messageStack.php.

00123                               {
00124     if ($this->size($type) > 0)
00125       echo '<div id="retour_erreur" class="messageStack">'. $this->output($type) . '</div>';
00126   }

messageStack::_draw_inline ( type,
markup = '' 
)

Draw erreur inline.

Definition at line 131 of file messageStack.php.

00131                                                  {
00132     if (empty($markup)) {$markup = 'span';}
00133     if ($this->size($type) > 0)
00134       echo $this->output_inline($type, $markup);
00135   }

messageStack::_draw_nbr ( type  ) 

Draw number error.

Definition at line 140 of file messageStack.php.

00140                                   {
00141     print $this->size($type);
00142   }

messageStack::add ( class,
message,
type = 'error' 
)

Definition at line 45 of file messageStack.php.

Referenced by __construct(), and _add().

00045                                                   {
00046     if ($type == 'error') {
00047       $this->messages[] = array('params' => 'class="messageStackError"', 'class' => $class, 'text' => $message);
00048     } elseif ($type == 'warning') {
00049       $this->messages[] = array('params' => 'class="messageStackWarning"', 'class' => $class, 'text' => $message);
00050     } elseif ($type == 'success') {
00051       $this->messages[] = array('params' => 'class="messageStackSuccess"', 'class' => $class, 'text' => $message);
00052     } else {
00053       $this->messages[] = array('params' => 'class="messageStackError"', 'class' => $class, 'text' => $message);
00054     }
00055   }

messageStack::add_session ( class,
message,
type = 'error' 
)

Definition at line 57 of file messageStack.php.

00057                                                           {
00058     global $messageToStack;
00059 
00060     if (!tep_session_is_registered('messageToStack')) {
00061       tep_session_register('messageToStack');
00062       $messageToStack = array();
00063     }
00064 
00065     $messageToStack[] = array('class' => $class, 'text' => $message, 'type' => $type);
00066   }

messageStack::output ( class  )  [private]

Sortie des erreur.

Definition at line 75 of file messageStack.php.

Referenced by _draw().

00075                                   {
00076     $output = '<ul>';
00077     for ($i=0, $n=sizeof($this->messages); $i<$n; $i++) {
00078       if ($this->messages[$i]['class'] == $class) {
00079         $output .='<li '.$this->messages[$i]['params'].' >'. $this->messages[$i]['text'] .'</li>'."\n";
00080       }
00081     }
00082     $output .= '</ul>';
00083     return $output;
00084   }

messageStack::output_inline ( class,
markup 
) [private]

Sortie des erreur inline.

Definition at line 89 of file messageStack.php.

Referenced by _draw_inline().

00089                                                   {
00090     for ($i=0, $n=sizeof($this->messages); $i<$n; $i++) {
00091       if ($this->messages[$i]['class'] == $class) {
00092         $output ='<'.$markup.' '.$this->messages[$i]['params'].' >'. $this->messages[$i]['text'] .'</'.$markup.'>'."\n";
00093       }
00094     }
00095     return $output;
00096   }

messageStack::reset (  ) 

Definition at line 68 of file messageStack.php.

00068                    {
00069     $this->messages = array();
00070   }

messageStack::size ( class  ) 

Calcul présence des erreurs.

Definition at line 101 of file messageStack.php.

Referenced by _draw(), _draw_inline(), and _draw_nbr().

00101                                     {
00102     $count = 0;
00103 
00104     for ($i=0, $n=sizeof($this->messages); $i<$n; $i++) {
00105       if ($this->messages[$i]['class'] == $class) {
00106         $count++;
00107       }
00108     }
00109 
00110     return $count;
00111   }


Member Data Documentation

messageStack::$message [private]

Definition at line 28 of file messageStack.php.

Referenced by _add(), add(), and add_session().


The documentation for this class was generated from the following file: