Esempio n. 1
0
 /**
  * Render form element
  *
  * @param  IfwPsn_Vendor_Zend_View_Interface $view
  * @return string
  */
 public function render(IfwPsn_Vendor_Zend_View_Interface $view = null)
 {
     $captcha = $this->getCaptcha();
     $captcha->setName($this->getFullyQualifiedName());
     if (!$this->loadDefaultDecoratorsIsDisabled()) {
         $decorators = $this->getDecorators();
         $decorator = $captcha->getDecorator();
         $key = get_class($this->_getDecorator($decorator, null));
         if (!empty($decorator) && !array_key_exists($key, $decorators)) {
             array_unshift($decorators, $decorator);
         }
         $decorator = array('Captcha', array('captcha' => $captcha));
         $key = get_class($this->_getDecorator($decorator[0], $decorator[1]));
         if ($captcha instanceof IfwPsn_Vendor_Zend_Captcha_Word && !array_key_exists($key, $decorators)) {
             array_unshift($decorators, $decorator);
         }
         $this->setDecorators($decorators);
     }
     $this->setValue($this->getCaptcha()->generate());
     return parent::render($view);
 }
Esempio n. 2
0
 /**
  * Render CSRF token in form
  *
  * @param  IfwPsn_Vendor_Zend_View_Interface $view
  * @return string
  */
 public function render(IfwPsn_Vendor_Zend_View_Interface $view = null)
 {
     $this->initCsrfToken();
     return parent::render($view);
 }
Esempio n. 3
0
 /**
  * Render form element
  * Checks for decorator interface to prevent errors
  *
  * @param  IfwPsn_Vendor_Zend_View_Interface $view
  * @return string
  * @throws IfwPsn_Vendor_Zend_Form_Element_Exception
  */
 public function render(IfwPsn_Vendor_Zend_View_Interface $view = null)
 {
     $marker = false;
     foreach ($this->getDecorators() as $decorator) {
         if ($decorator instanceof IfwPsn_Vendor_Zend_Form_Decorator_Marker_File_Interface) {
             $marker = true;
         }
     }
     if (!$marker) {
         require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Form/Element/Exception.php';
         throw new IfwPsn_Vendor_Zend_Form_Element_Exception('No file decorator found... unable to render file element');
     }
     return parent::render($view);
 }