/** The form constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $reeces = new Reeces(); $reeces_options = $reeces->getOptions(); $rulers = new Rulers(); $rulers_options = $rulers->getOptions(); $dynasties = new Dynasties(); $dynasties_options = $dynasties->getOptions(); parent::__construct($options); $this->setName('EmperorDetails'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Emperor\'s name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('Enter an emperor name!'); $reeceID = new Zend_Form_Element_Select('reeceID'); $reeceID->setLabel('Reece period assigned: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a Reece period', 'Available periods' => $reeces_options))->addValidator('InArray', false, array(array_keys($reeces_options)))->addValidator('Int'); $pasID = new Zend_Form_Element_Select('pasID'); $pasID->setLabel('Database ID: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($rulers_options)))->addMultiOptions(array(null => 'Choose a database id', 'Available ids' => $rulers_options))->addValidator('Int')->addErrorMessage('You must assign the bio to an existing entry'); $date_from = new Zend_Form_Element_Text('date_from'); $date_from->setLabel('Issued coins from: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a date for the start of reign'); $date_to = new Zend_Form_Element_Text('date_to'); $date_to->setLabel('Issued coins until: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a date for the end of reign'); $biography = new Pas_Form_Element_CKEditor('biography'); $biography->setLabel('Biography: ')->setRequired(true)->addFilters(array('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10, 'cols' => 40, 'Height' => 400))->setAttrib('ToolbarSet', 'Finds')->addErrorMessage('You must enter a biography'); $dynasty = new Zend_Form_Element_Select('dynasty'); $dynasty->setLabel('Dynastic grouping: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($dynasties_options)))->addMultiOptions(array(null => 'Choose a dynasty', 'Available dynasties' => $dynasties_options))->addErrorMessage('You must select a dynastic grouping'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(4800); $submit = new Zend_Form_Element_Submit('submit'); $this->addElements(array($name, $reeceID, $pasID, $date_from, $date_to, $biography, $dynasty, $submit, $hash)); $this->addDisplayGroup(array('name', 'reeceID', 'pasID', 'date_from', 'date_to', 'biography', 'dynasty', 'submit'), 'details'); parent::init(); }
public function __construct($options = null) { $rulers = new Rulers(); $rulers_options = $rulers->getAllMedRulers(); $dynasties = new Dynasties(); $dynasties_options = $dynasties->getOptions(); parent::__construct($options); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('MonarchDetails'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Monarch\'s name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setAttrib('size', '50')->addErrorMessage('You must enter a Monarch\'s name')->setDecorators($decorators); $styled = new Zend_Form_Element_Text('styled'); $styled->setLabel('Styled as: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators); $alias = new Zend_Form_Element_Text('alias'); $alias->setLabel('Monarch\'s alias: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators); $dbaseID = new Zend_Form_Element_Select('dbaseID'); $dbaseID->setLabel('Database ID: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($rulers_options)))->addMultiOptions(array(NULL => NULL, 'Choose Database ID' => $rulers_options))->setDecorators($decorators); $date_from = new Zend_Form_Element_Text('date_from'); $date_from->setLabel('Issued coins from: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators); $date_to = new Zend_Form_Element_Text('date_to'); $date_to->setLabel('Issued coins until: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators); $born = new Zend_Form_Element_Text('born'); $born->setLabel('Born: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators); $died = new Zend_Form_Element_Text('died'); $died->setLabel('Died: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators); $biography = new Pas_Form_Element_RTE('biography'); $biography->setLabel('Biography: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); $dynasty = new Zend_Form_Element_Select('dynasty'); $dynasty->setLabel('Dynastic grouping: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators); $publishState = new Zend_Form_Element_Select('publishState'); $publishState->setLabel('Publication status: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->addMultiOptions(array(NULL => NULL, 'Set status' => array('1' => 'Draft', '2' => 'Published')))->setValue(1)->setDecorators($decorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($name, $styled, $alias, $dbaseID, $date_from, $date_to, $born, $died, $biography, $dynasty, $publishState, $submit)); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $this->addElement($hash); $this->addDisplayGroup(array('name', 'styled', 'alias'), 'names'); $this->names->setLegend('Nomenclature'); $this->names->removeDecorator('DtDdWrapper'); $this->names->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('dbaseID', 'date_from', 'date_to', 'born', 'died'), 'periods'); $this->periods->setLegend('Dates'); $this->periods->removeDecorator('DtDdWrapper'); $this->periods->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('biography', 'dynasty', 'publishState'), 'details'); $this->details->setLegend('Biographical details'); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('submit'), 'submit'); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $rulers = new Rulers(); $rulers_options = $rulers->getAllMedRulers(); $dynasties = new Dynasties(); $dynasties_options = $dynasties->getOptions(); parent::__construct($options); $this->setName('MonarchDetails'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Monarch\'s name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('size', '50')->addErrorMessage('You must enter a Monarch\'s name'); $styled = new Zend_Form_Element_Text('styled'); $styled->setLabel('Styled as: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'Purifier')); $alias = new Zend_Form_Element_Text('alias'); $alias->setLabel('Monarch\'s alias: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'Purifier')); $dbaseID = new Zend_Form_Element_Select('dbaseID'); $dbaseID->setLabel('Database ID: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($rulers_options)))->addMultiOptions(array(null => 'Choose Database ID', 'Available rulers' => $rulers_options)); $date_from = new Zend_Form_Element_Text('date_from'); $date_from->setLabel('Issued coins from: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits'); $date_to = new Zend_Form_Element_Text('date_to'); $date_to->setLabel('Issued coins until: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits'); $born = new Zend_Form_Element_Text('born'); $born->setLabel('Born: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits'); $died = new Zend_Form_Element_Text('died'); $died->setLabel('Died: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits'); $biography = new Pas_Form_Element_CKEditor('biography'); $biography->setLabel('Biography: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); $dynasty = new Zend_Form_Element_Select('dynasty'); $dynasty->setLabel('Dynastic grouping: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits'); $publishState = new Zend_Form_Element_Select('publishState'); $publishState->setLabel('Publication status: ')->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->addMultiOptions(array(null => 'Set status', 'Available status options' => array('1' => 'Draft', '2' => 'Published')))->setValue(1); $submit = new Zend_Form_Element_Submit('submit'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(4800); $this->addElements(array($name, $styled, $alias, $dbaseID, $date_from, $date_to, $born, $died, $biography, $dynasty, $publishState, $submit, $hash)); $this->addDisplayGroup(array('name', 'styled', 'alias'), 'names'); $this->names->setLegend('Nomenclature'); $this->addDisplayGroup(array('dbaseID', 'date_from', 'date_to', 'born', 'died'), 'periods'); $this->periods->setLegend('Dates'); $this->addDisplayGroup(array('biography', 'dynasty', 'publishState'), 'details'); $this->details->setLegend('Biographical details'); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
public function __construct($options = null) { $reeces = new Reeces(); $reeces_options = $reeces->getOptions(); $rulers = new Rulers(); $rulers_options = $rulers->getOptions(); $dynasties = new Dynasties(); $dynasties_options = $dynasties->getOptions(); parent::__construct($options); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('EmperorDetails'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Emperor\'s name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('Come on it\'s not that hard, enter a firstname!')->setDecorators($decorators); $reeceID = new Zend_Form_Element_Select('reeceID'); $reeceID->setLabel('Reece period assigned: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => NULL, 'Choose a Reece period' => $reeces_options))->addValidator('InArray', false, array(array_keys($reeces_options)))->addValidator('Int')->setDecorators($decorators); $pasID = new Zend_Form_Element_Select('pasID'); $pasID->setLabel('Database ID: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($rulers_options)))->addMultiOptions(array(NULL => NULL, 'Choose a database id' => $rulers_options))->addValidator('Int')->addErrorMessage('You must assign the bio to an existing entry')->setDecorators($decorators); $date_from = new Zend_Form_Element_Text('date_from'); $date_from->setLabel('Issued coins from: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a date for the start of reign')->setDecorators($decorators); $date_to = new Zend_Form_Element_Text('date_to'); $date_to->setLabel('Issued coins until: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a date for the end of reign')->setDecorators($decorators); $biography = new Pas_Form_Element_RTE('biography'); $biography->setLabel('Biography: ')->setRequired(true)->addFilters('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addErrorMessage('You must enter a biography')->addDecorator('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')); $dynasty = new Zend_Form_Element_Select('dynasty'); $dynasty->setLabel('Dynastic grouping: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($dynasties_options)))->addMultiOptions(array(NULL => NULL, 'Choose a dynasty' => $dynasties_options))->addErrorMessage('You must select a dynastic grouping')->setDecorators($decorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $this->addElements(array($name, $reeceID, $pasID, $date_from, $date_to, $biography, $dynasty, $submit)); $this->addDisplayGroup(array('name', 'reeceID', 'pasID', 'date_from', 'date_to', 'biography', 'dynasty', 'submit'), 'details'); $this->details->addDecorators(array(array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('HtmlTag'); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); }