array('left','top'), 'topCenter' => array('center','top'), 'topRight' => array('right','top'), 'middleLeft' => array('left','center'), 'middleCenter' => array('center','center'), 'middleRight' => array('right','center'), 'bottomLeft' => array('left','bottom'), 'bottomCenter' => array('center','bottom'), 'bottomRight' => array('right','bottom'), ); /** * returns the instance of this view helper. * * @return Zend_View_Helper_PopUpMessage */ public function popUpMessage() { return $this; } /** * Adds a new message to the stack. * * @param string $messageId Dom-Id of the dialog * @param string $title Title for the dialog * @param string|array $message Message to display * @param array $options Additional options for the dialog box * * @return void */ public function addMessage($messageId, $title, $message, $options = array()) { $lang = Msd_Language::getInstance(); $translator = $lang->getTranslator(); $optionKeys = array_keys($options); if (!in_array('buttons', $optionKeys)) { $options['buttons'] = array( 'L_OK' => 'function() {$(this).dialog(\'close\');}' ); } $translatedButtons = array(); foreach ($options['buttons'] as $key => $value) { $translatedButtons[ucfirst($translator->_($key))] = $value; } $options['buttons'] = $translatedButtons; if (!in_array('dialogClass', $optionKeys)) { $options['dialogClass'] = 'info'; } if (!in_array('position', $optionKeys)) { $options['position'] = $this->_getDefaultPosition(); } $options['title'] = $translator->_($title); if (!empty($message)) { if (is_array($message)) { $message[0] = $translator->_($message[0]); $message = call_user_func_array('sprintf', $message); } else { $message = $translator->_($message); } } $this->_messages[$messageId] = array( 'message' => $message, 'params' => $options, 'attribs' => array( 'id' => $messageId, ), ); } /** * Renders the dialogs. * * Add "OnLoad" scripts to jQuery and create the HTML-Output. * * @return string */ public function __toString() { $messages = array(); foreach ($this->_messages as $messageInfo) { $html = '