Example #1
0
 public function isValid($data)
 {
     if (!is_array($data)) {
         require_once 'Zend/Form/Exception.php';
         throw new \Zend_Form_Exception(__METHOD__ . ' expects an array');
     }
     return parent::isValid($data);
 }
Example #2
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('class', 'form-horizontal');
     VAR_fields;
     // add display group
     $this->addDisplayGroup(VAR_fieldNames, 'VAR_tablePhpName');
     $this->getDisplayGroup('VAR_tablePhpName')->setLegend('Add VAR_tablePhpName');
     EasyBib_Form_Decorator::setFormDecorator($this, EasyBib_Form_Decorator::BOOTSTRAP, 'submit', 'cancel');
     parent::init();
 }
Example #3
0
 /** The form constructor
  * @access public
  */
 public function __construct()
 {
     $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element', 'element');
     $this->addElementPrefixPath('Pas_Filter', 'Pas/Filter/', 'filter');
     $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate');
     $this->setAttrib('class', 'form-horizontal');
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->clearDecorators();
     $person = new Pas_User_Details();
     $details = $person->getPerson();
     if ($details) {
         $this->_role = $details->role;
     } else {
         $this->_role = 'public';
     }
     parent::__construct();
 }
 /**
  * Validate the form
  *
  * @param  array $data
  * @return boolean
  */
 public function isValid($data)
 {
     if (!is_array($data)) {
         require_once 'Zend/Form/Exception.php';
         throw new Zend_Form_Exception(__METHOD__ . ' expects an array');
     }
     if ($data['name'] == 'xyz') {
         $this->getElement('name')->addError('Wrong name provided!');
     }
     return parent::isValid($data);
 }
Example #5
0
 /** Construct the form
  * @access public
  */
 public function __construct()
 {
     $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element', 'element');
     $this->addElementPrefixPath('Pas_Filter', 'Pas/Filter/', 'filter');
     $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate');
     $this->setAttrib('class', 'form-horizontal');
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->clearDecorators();
     $this->_view = Zend_Layout::getMvcInstance()->getView();
     $this->_view->jQuery()->addJavascriptFile($this->_view->baseUrl() . '/js/select2.min.js', $type = 'text/javascript');
     $this->_view->jQuery()->addJavascriptFile($this->_view->baseUrl() . '/js/selectPrettify.js', $type = 'text/javascript');
     $this->_view->headLink()->appendStylesheet($this->_view->baseUrl() . '/css/select2.css', $type = 'screen');
     $this->_view->headLink()->appendStylesheet($this->_view->baseUrl() . '/css/bootstrap-multiselect.css', $type = 'screen');
     $person = new Pas_User_Details();
     $details = $person->getPerson();
     if ($details) {
         $this->_role = $details->role;
     } else {
         $this->_role = 'public';
     }
     parent::__construct();
 }