Ejemplo n.º 1
0
 /**
  * Render a view script (optionally to a named response segment)
  *
  * Sets the noRender flag to true when called.
  *
  * @param  string $script
  * @param  string $name
  * @return void
  */
 public function renderScript($script, $name = null)
 {
     if (null === $name) {
         $name = $this->getResponseSegment();
     }
     $this->getResponse()->appendBody($this->view->render($script), $name);
     $this->setNoRender();
 }
Ejemplo n.º 2
0
 /**
  * Retrieve view object
  *
  * @return IfwPsn_Vendor_Zend_View
  */
 public function getView()
 {
     if (null === $this->_view) {
         $options = $this->getOptions();
         $this->_view = new IfwPsn_Vendor_Zend_View($options);
         if (isset($options['doctype'])) {
             $this->_view->doctype()->setDoctype(strtoupper($options['doctype']));
             if (isset($options['charset']) && $this->_view->doctype()->isHtml5()) {
                 $this->_view->headMeta()->setCharset($options['charset']);
             }
         }
         if (isset($options['contentType'])) {
             $this->_view->headMeta()->appendHttpEquiv('Content-Type', $options['contentType']);
         }
         if (isset($options['assign']) && is_array($options['assign'])) {
             $this->_view->assign($options['assign']);
         }
     }
     return $this->_view;
 }
Ejemplo n.º 3
0
 /**
  * Recurse through a form object, rendering errors
  *
  * @param  IfwPsn_Vendor_Zend_Form $form
  * @param  IfwPsn_Vendor_Zend_View_Interface $view
  * @return string
  */
 protected function _recurseForm(IfwPsn_Vendor_Zend_Form $form, IfwPsn_Vendor_Zend_View_Interface $view)
 {
     $content = '';
     $custom = $form->getCustomMessages();
     if ($this->getShowCustomFormErrors() && count($custom)) {
         $content .= $this->getMarkupListItemStart() . $view->formErrors($custom, $this->getOptions()) . $this->getMarkupListItemEnd();
     }
     foreach ($form->getElementsAndSubFormsOrdered() as $subitem) {
         if ($subitem instanceof IfwPsn_Vendor_Zend_Form_Element && !$this->getOnlyCustomFormErrors()) {
             $messages = $subitem->getMessages();
             if (count($messages)) {
                 $subitem->setView($view);
                 $content .= $this->getMarkupListItemStart() . $this->renderLabel($subitem, $view) . $view->formErrors($messages, $this->getOptions()) . $this->getMarkupListItemEnd();
             }
         } else {
             if ($subitem instanceof IfwPsn_Vendor_Zend_Form && !$this->ignoreSubForms()) {
                 $markup = $this->_recurseForm($subitem, $view);
                 if (!empty($markup)) {
                     $content .= $this->getMarkupListStart() . $markup . $this->getMarkupListEnd();
                 }
             }
         }
     }
     return $content;
 }