Public Member Functions | |
_prepareLayout () | |
setMessages (Mage_Core_Model_Message_Collection $messages) | |
addMessages (Mage_Core_Model_Message_Collection $messages) | |
getMessageCollection () | |
addMessage (Mage_Core_Model_Message_Abstract $message) | |
addError ($message) | |
addWarning ($message) | |
addNotice ($message) | |
addSuccess ($message) | |
getMessages ($type=null) | |
getHtml ($type=null) | |
getGroupedHtml () | |
Protected Member Functions | |
_toHtml () | |
Protected Attributes | |
$_messages |
Definition at line 34 of file Messages.php.
_prepareLayout | ( | ) |
Preparing global layout
You can redefine this method in child classes for changin layout
Reimplemented from Mage_Core_Block_Abstract.
Reimplemented in Mage_Adminhtml_Block_Sales_Order_Create_Messages, and Mage_Adminhtml_Block_Sales_Order_View_Messages.
Definition at line 43 of file Messages.php.
00044 { 00045 $this->addMessages(Mage::getSingleton('core/session')->getMessages(true)); 00046 00047 parent::_prepareLayout(); 00048 }
_toHtml | ( | ) | [protected] |
Render block HTML
Reimplemented from Mage_Core_Block_Template.
Definition at line 208 of file Messages.php.
00209 { 00210 return $this->getGroupedHtml(); 00211 }
addError | ( | $ | message | ) |
Adding new error message
string | $message |
Definition at line 101 of file Messages.php.
00102 { 00103 $this->addMessage(Mage::getSingleton('core/message')->error($message)); 00104 return $this; 00105 }
addMessage | ( | Mage_Core_Model_Message_Abstract $ | message | ) |
Adding new message to message collection
Mage_Core_Model_Message_Abstract | $message |
Definition at line 89 of file Messages.php.
00090 { 00091 $this->getMessageCollection()->add($message); 00092 return $this; 00093 }
addMessages | ( | Mage_Core_Model_Message_Collection $ | messages | ) |
Definition at line 62 of file Messages.php.
00063 { 00064 foreach ($messages->getItems() as $message) { 00065 $this->getMessageCollection()->add($message); 00066 } 00067 return $this; 00068 }
addNotice | ( | $ | message | ) |
Adding new nitice message
string | $message |
Definition at line 125 of file Messages.php.
00126 { 00127 $this->addMessage(Mage::getSingleton('core/message')->notice($message)); 00128 return $this; 00129 }
addSuccess | ( | $ | message | ) |
Adding new success message
string | $message |
Definition at line 137 of file Messages.php.
00138 { 00139 $this->addMessage(Mage::getSingleton('core/message')->success($message)); 00140 return $this; 00141 }
addWarning | ( | $ | message | ) |
Adding new warning message
string | $message |
Definition at line 113 of file Messages.php.
00114 { 00115 $this->addMessage(Mage::getSingleton('core/message')->warning($message)); 00116 return $this; 00117 }
getGroupedHtml | ( | ) |
Retrieve messages in HTML format grouped by type
string | $type |
Definition at line 176 of file Messages.php.
00177 { 00178 $types = array( 00179 Mage_Core_Model_Message::ERROR, 00180 Mage_Core_Model_Message::WARNING, 00181 Mage_Core_Model_Message::NOTICE, 00182 Mage_Core_Model_Message::SUCCESS 00183 ); 00184 $html = ''; 00185 foreach ($types as $type) { 00186 if ( $messages = $this->getMessages($type) ) { 00187 if ( !$html ) { 00188 $html .= '<ul class="messages">'; 00189 } 00190 $html .= '<li class="' . $type . '-msg">'; 00191 $html .= '<ul>'; 00192 00193 foreach ( $messages as $message ) { 00194 $html.= '<li>'; 00195 $html.= $message->getText(); 00196 $html.= '</li>'; 00197 } 00198 $html .= '</ul>'; 00199 $html .= '</li>'; 00200 } 00201 } 00202 if ( $html) { 00203 $html .= '</ul>'; 00204 } 00205 return $html; 00206 }
getHtml | ( | $ | type = null |
) |
Retrieve messages in HTML format
string | $type |
Definition at line 160 of file Messages.php.
00161 { 00162 $html = '<ul id="admin_messages">'; 00163 foreach ($this->getMessages($type) as $message) { 00164 $html.= '<li class="'.$message->getType().'-msg">'.$message->getText().'</li>'; 00165 } 00166 $html .= '</ul>'; 00167 return $html; 00168 }
getMessageCollection | ( | ) |
Retrieve messages collection
Definition at line 75 of file Messages.php.
00076 { 00077 if (!($this->_messages instanceof Mage_Core_Model_Message_Collection)) { 00078 $this->_messages = Mage::getModel('core/message_collection'); 00079 } 00080 return $this->_messages; 00081 }
getMessages | ( | $ | type = null |
) |
Retrieve messages array by message type
string | $type |
Definition at line 149 of file Messages.php.
00150 { 00151 return $this->getMessageCollection()->getItems($type); 00152 }
setMessages | ( | Mage_Core_Model_Message_Collection $ | messages | ) |
Set messages collection
Mage_Core_Model_Message_Collection | $messages |
Definition at line 56 of file Messages.php.
$_messages [protected] |
Definition at line 41 of file Messages.php.