public function __construct($options = null) { parent::__construct($options); $this->setAttrib('accept-charset', 'UTF-8'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('dieaxis'); $die_axis_name = new Zend_Form_Element_Text('die_axis_name'); $die_axis_name->setLabel('Die axis term: ')->setRequired(true)->setAttrib('size', 70)->addErrorMessage('Please enter a term.')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Die axis term is in use: ')->setRequired(true)->addValidator('Int')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->removeDecorator('DtDdWrapper'); $submit->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($die_axis_name, $valid, $submit)); $this->addDisplayGroup(array('die_axis_name', 'valid'), 'details'); $this->details->setLegend('Die axis details: '); $this->details->removeDecorator('HtmlTag'); $this->details->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('submit'), 'submit'); }
/** * (non-PHPdoc) * @see Zend_Form::init() */ public function init() { $this->_addClassNames('well'); $this->setMethod(Zend_Form::METHOD_POST); $this->setTranslator(); $txtTitle = $this->createElement('text', 'title')->setLabel('LBL_TITLE')->setRequired(TRUE)->addFilter('StripTags')->setAttrib('maxlength', 200); $this->addElement($txtTitle); $txtIntroContent = $this->createElement('textarea', 'introcontent')->setLabel('CONTENT_INTRO')->setRequired(true)->setAttrib('cols', 40)->setAttrib('rows', 5)->addValidator(new Zend_Validate_LessThan(1024)); $this->addElement($txtIntroContent); $txtContent = $this->createElement('textarea', 'content')->setLabel('LBL_CONTENT')->setRequired(true)->setAttrib('cols', 40)->setAttrib('rows', 5)->addValidator(new Zend_Validate_LessThan(1024)); $this->addElement($txtContent); $cbCategory = $this->createElement('select', 'category_id')->setLabel("LBL_CATEGORY")->setRequired(true); $this->addElement($cbCategory); $rbPublished = $this->createElement("radio", "published")->setLabel("LBL_PUBLISHED")->setValue(1)->setMultiOptions(array("LBL_NO", "LBL_YES")); $this->addElement($rbPublished); $id = $this->createElement('hidden', 'id'); $id->setDecorators(array('ViewHelper')); $this->addElement($id); $token = new Zend_Form_Element_Hash('token'); $token->setSalt(md5(uniqid(rand(), TRUE))); $token->setTimeout(300); $token->setDecorators(array('ViewHelper')); $this->addElement($token); $submitOptions = array('buttonType' => Twitter_Bootstrap_Form_Element_Button::BUTTON_LINK, 'type' => 'submit', 'buttonType' => 'default'); $btnSubmit = new Twitter_Bootstrap_Form_Element_Button('submit', $submitOptions); $btnSubmit->setLabel('LBL_SUBMIT'); $btnSubmit->removeDecorator('Label'); $btnSubmit->setDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'controls')), array('Wrapper'))); $btnSubmit->removeDecorator('Label'); $this->addElement($btnSubmit); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $periods = new Periods(); $period_options = $periods->getPeriodFrom(); parent::__construct($options); $this->setName('period'); $term = new Zend_Form_Element_Text('term'); $term->setLabel('Period name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToUpper'))->addValidator('Alpha', false, array('allowWhiteSpace' => true))->setAttrib('size', 60)->addErrorMessage('You must enter a period name'); $fromdate = new Zend_Form_Element_Text('fromdate'); $fromdate->setLabel('Date period starts: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a start date'); $todate = new Zend_Form_Element_Text('todate'); $todate->setLabel('Date period ends: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter an end date'); $notes = new Pas_Form_Element_CKEditor('notes'); $notes->setLabel('Period notes: ')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Period is currently in use: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a status'); $parent = new Zend_Form_Element_Select('parent'); $parent->setLabel('Period belongs to: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose period to', 'Available periods' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(4800); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $this->addElements(array($term, $fromdate, $todate, $valid, $notes, $parent, $submit, $hash)); $this->addDisplayGroup(array('term', 'fromdate', 'todate', 'parent', 'notes', 'valid'), 'details'); $this->details->setLegend('Period details: '); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
public function testConfigureThemeWithNoLogoFileAndNoPreviousLogoFile() { $themeName = self::THEME; $this->assertEquals('', (string) get_theme_option('logo', $themeName)); // specify the files array for the post $_FILES = array('logo' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0), 'header_background' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0)); // specify the theme options for the post $themeOptions = array('display_featured_item' => '1', 'display_featured_collection' => '1', 'display_featured_exhibit' => '1', 'homepage_recent_items' => '', 'homepage_text' => '', 'footer_text' => '', 'display_footer_copyright' => '0'); $csrf = new Zend_Form_Element_Hash('theme_config_csrf'); $csrf->initCsrfToken(); // specify other post data $otherPostData = array('hidden_file_logo' => '', 'hidden_file_header_background' => '', 'MAX_FILE_SIZE' => '33554432', 'submit' => 'Save Changes', 'theme_config_csrf' => $csrf->getHash()); // set the the post data $post = array_merge($themeOptions, $otherPostData); $this->getRequest()->setParam('name', $themeName); $this->getRequest()->setPost($post); $this->getRequest()->setMethod('POST'); // dispatch the controller action $this->dispatch('themes/config'); $actualOptions = Theme::getOptions(self::THEME); $this->assertArrayNotHasKey('theme_config_csrf', $actualOptions); foreach ($themeOptions as $name => $value) { $this->assertArrayHasKey($name, $actualOptions); $this->assertEquals($actualOptions[$name], $value, "Option '{$name}' was not correctly set."); } // verify that logo is empty $this->assertEmpty(get_theme_option('logo', $themeName)); }
public function __construct($options = null) { parent::__construct($options); $this->setName('Decmethods'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $term = new Zend_Form_Element_Text('term'); $term->setLabel('Decoration style term: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid title for this decorative method!')->setDecorators($decorators); $termdesc = new Pas_Form_Element_RTE('termdesc'); $termdesc->setLabel('Description of decoration style: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('BasicHtml', 'EmptyParagraph'))->addFilter('WordChars'); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Is this term valid?: ')->setRequired(true)->setDecorators($decorators); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($term, $termdesc, $valid, $submit)); $this->addDisplayGroup(array('term', 'termdesc', 'valid'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); $this->details->setLegend('Decoration method details: '); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $periods = new Periods(); $period_options = $periods->getPeriodFrom(); parent::__construct($options); $this->setName('suggested'); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array(null => 'Please choose a level', 'Research levels' => $projectype_list))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StringTrim', 'StripTags')); $period = new Zend_Form_Element_Select('period'); $period->setLabel('Broad research period: ')->setRequired(true)->addMultiOptions(array(null => 'Please choose a period', 'Periods available' => $period_options))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StringTrim', 'StripTags')); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Choose title for the project.'); $description = new Pas_Form_Element_CKEditor('description'); $description->setLabel('Short description of project: ')->setRequired(false)->setAttribs(array('cols' => 80, 'rows' => 10))->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph')); $valid = new Zend_Form_Element_Checkbox('taken'); $valid->setLabel('Is the topic taken: ')->setRequired(true)->addValidator('Int'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(4800); $submit = new Zend_Form_Element_Submit('submit'); $this->addElements(array($title, $level, $period, $description, $valid, $submit, $hash)); $this->addDisplayGroup(array('title', 'level', 'period', 'description', 'taken'), 'details'); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
public function __construct($options = null) { parent::__construct($options); $levels = new ProjectTypes(); $levelsListed = $levels->getDegrees(); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('education'); ZendX_JQuery::enableForm($this); $school = new Zend_Form_Element_Text('school'); $school->setLabel('Institution name: ')->setRequired(true)->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 30)->addErrorMessage('Please enter a valid institutional name!')->setDecorators($decorators); $schoolUrl = new Zend_Form_Element_Text('schoolUrl'); $schoolUrl->setLabel('Institution web address: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addValidator('Uri')->setAttrib('size', 30)->addErrorMessage('Please enter a valid url!')->setDecorators($decorators); $subject = new Zend_Form_Element_Text('subject'); $subject->setLabel('Subject studied: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setAttrib('size', 30)->addErrorMessage('Please enter a valid string!')->setDecorators($decorators); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Adademic level of study: ')->addMultiOptions(array(NULL => 'Choose an academic level', 'Valid levels' => $levelsListed))->setDecorators($decorators); $dateFrom = new ZendX_JQuery_Form_Element_DatePicker('dateFrom'); $dateFrom->setLabel('Commenced programme: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Date')->addValidator('NotEmpty')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->setJQueryParams(array('yearRange' => '-20:+10')); $dateTo = new ZendX_JQuery_Form_Element_DatePicker('dateTo'); $dateTo->setLabel('Finished programme: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Date')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper')->setJQueryParams(array('yearRange' => '-20:+10')); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($school, $schoolUrl, $subject, $level, $dateFrom, $dateTo, $submit)); $this->addDisplayGroup(array('school', 'schoolUrl', 'subject', 'level', 'dateFrom', 'dateTo'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Educational background'); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $periods = new Periods(); $period_options = $periods->getPeriodFromWords(); $counties = new OsCounties(); $counties_options = $counties->getCountiesID(); parent::__construct($options); $this->setName('whatwherewhen'); $old_findID = new Zend_Form_Element_Text('old_findID'); $old_findID->setLabel('Find number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 20)->addErrorMessage('Please enter a valid string!'); //Objecttype - autocomplete from thesaurus $objecttype = new Zend_Form_Element_Text('objecttype'); $objecttype->setLabel('What: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 20)->addErrorMessage('Please enter a valid string!'); $broadperiod = new Zend_Form_Element_Select('broadperiod'); $broadperiod->setLabel('When: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose period from', 'Available periods' => $period_options))->addValidator('InArray', false, array($period_options)); $county = new Zend_Form_Element_Select('county'); $county->setLabel('Where: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose county', 'Available counties' => $counties_options))->addValidator('InArray', false, array($counties_options)); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Search!'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(4800); $this->addElements(array($old_findID, $objecttype, $county, $broadperiod, $submit, $hash)); $this->addDisplayGroup(array('old_findID', 'objecttype', 'broadperiod', 'county', 'submit'), 'Search'); $this->Search->setLegend('What/Where/When search'); parent::init(); }
public function __construct($options = null) { parent::__construct($options); $this->setName('MintToRuler'); $reverseID = new Zend_Form_Element_Select('reverseID'); $reverseID->setLabel('Reverse type: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->setAttribs(array('class' => 'textInput')); $rulerID = new Zend_Form_Element_Hidden('rulerID'); $rulerID->removeDecorator('label')->removeDecorator('HtmlTag')->addValidator('Int'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Add a reverse type for this ruler')->setAttribs(array('class' => 'large')); $this->addElements(array($reverseID, $rulerID, $submit)); $this->addDisplayGroup(array('reverseID'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Add an active Mint'); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); $this->details->setLegend('Add an active reverse type'); }
public function __construct($options = null) { $periods = new Periods(); $periodword_options = $periods->getPeriodFromWords(); $counties = new Counties(); $county_options = $counties->getCountyName2(); parent::__construct($options); $this->setAttrib('accept-charset', 'UTF-8'); $this->setMethod('post'); $this->setName('filterfinds'); $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate'); $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element'); $this->addPrefixPath('Pas_Form_Decorator', 'Pas/Form/Decorator/', 'decorator'); $decorator = array('TableDecInput'); $objecttype = new Zend_Form_Element_Text('objecttype'); $objecttype->setLabel('Filter by object type')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alpha', false, array('allowWhiteSpace' => true))->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 10)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $oldfindID = new Zend_Form_Element_Text('old_findID'); $oldfindID->setLabel('Filter by find ID #')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 11)->addValidator('stringLength', false, array(1, 200))->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $broadperiod = new Zend_Form_Element_Select('broadperiod'); $broadperiod->setLabel('Filter by broadperiod')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('stringLength', false, array(1, 200))->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->addMultiOptions(array(NULL => NULL, 'Choose period from' => $periodword_options))->addValidator('InArray', false, array(array_keys($periodword_options))); $county = new Zend_Form_Element_Select('county'); $county->setLabel('Filter by county')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('stringLength', false, array(1, 200))->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->addMultiOptions(array(NULL => NULL, 'Choose county' => $county_options))->addValidator('InArray', false, array(array_keys($county_options))); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setLabel('Filter:')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'largefilter'); $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($objecttype, $oldfindID, $broadperiod, $county, $submit)); }
public function __construct($options = null) { $periods = new Periods(); $period_options = $periods->getPeriodFromWords(); $counties = new Counties(); $counties_options = $counties->getCountyname2(); parent::__construct($options); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('whatwherewhen'); $this->removeDecorator('HtmlTag'); $old_findID = new Zend_Form_Element_Text('old_findID'); $old_findID->setLabel('Find number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 20)->addErrorMessage('Please enter a valid string!')->setDecorators($decorators); //Objecttype - autocomplete from thesaurus $objecttype = new Zend_Form_Element_Text('objecttype'); $objecttype->setLabel('What: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 20)->addErrorMessage('Please enter a valid string!')->setDecorators($decorators); $broadperiod = new Zend_Form_Element_Select('broadperiod'); $broadperiod->setLabel('When: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => NULL, 'Choose period from' => $period_options))->addValidator('InArray', false, array($period_options))->setDecorators($decorators); $county = new Zend_Form_Element_Select('county'); $county->setLabel('Where: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => NULL, 'Choose county' => $counties_options))->addValidator('InArray', false, array($counties_options))->setDecorators($decorators); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Search!')->setAttribs(array('class' => 'large'))->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($old_findID, $objecttype, $county, $broadperiod, $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('old_findID', 'objecttype', 'broadperiod', 'county', 'submit'), 'Search'); $this->Search->removeDecorator('DtDdWrapper'); $this->Search->removeDecorator('HtmlTag'); $this->Search->addDecorators(array(array('HtmlTag', array('tag' => 'ul', 'id' => 'www'))))->setLegend('What/Where/When search')->addDecorator('FieldSet'); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { parent::__construct($options); $roles = new Roles(); $role_options = $roles->getRoles(); $inst = new Institutions(); $inst_options = $inst->getInsts(); $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $this->setName('emailsearch'); ZendX_JQuery::enableForm($this); $message = new Zend_Form_Element_Textarea('messageToUser'); $message->setLabel('Message to user: '******'StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10))->addFilter('BasicHtml')->addErrorMessage('You must enter a message to your recipient.'); $fullname = new Zend_Form_Element_Text('fullname'); $fullname->setLabel('Send this to: ')->addFilters(array('StringTrim', 'StripTags', 'Purifier'))->setAttrib('size', 30); $email = $this->addElement('text', 'email', array('label' => 'Their email Address', 'size' => '30'))->email; $email->addValidator('EmailAddress')->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->setRequired(true)->addErrorMessage('Please enter a valid address!'); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(60); $this->addElement($hash); $this->addElements(array($fullname, $submit, $message)); $this->addDisplayGroup(array('fullname', 'email', 'messageToUser'), 'details'); $this->details->setLegend('Details: '); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
function indexAction() { $perpage = 25; $page = $this->getRequest()->getParam('page', 1); if ($page < 1) { $page = 1; } $counts = Application_Model_FsThumbsMapper::i()->getCount(); X_Debug::i("Thumbnails count: {$counts}"); $totalSize = Application_Model_FsThumbsMapper::i()->getTotalSize(); X_Debug::i("Thumbnails size: {$totalSize}"); $pages = $counts / $perpage; X_Debug::i("Current page: {$page}"); if ($counts % $perpage > 0 || $pages == 0) { $pages = (int) $pages + 1; } // add an extra page X_Debug::i("Total pages: {$pages}"); if ($page > $pages) { throw new Exception(X_Env::_('p_fsthumbs_invalidpage', $page, $pages)); } $csrf = new Zend_Form_Element_Hash('csrf'); $csrf->setSalt(__CLASS__)->initCsrfToken(); $thumbs = Application_Model_FsThumbsMapper::i()->fetchPage($page - 1, $perpage); $this->view->thumbs = $thumbs; $this->view->counts = $counts; $this->view->page = $page; $this->view->pages = $pages; $this->view->perpage = $perpage; $this->view->totalSize = $totalSize; $this->view->csrf = $csrf->getHash(); $this->view->messages = $this->_helper->flashMessenger->getMessages(); }
public function __construct($options = null) { $curators = new Peoples(); $assigned = $curators->getCurators(); ZendX_JQuery::enableForm($this); 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('actionsForTreasure'); $curatorID = new Zend_Form_Element_Select('curatorID'); $curatorID->setLabel('Curator assigned: ')->setRequired(true)->addValidator('InArray', false, array(array_keys($assigned)))->addMultiOptions($assigned)->setDecorators($decorators); $chaseDate = new ZendX_JQuery_Form_Element_DatePicker('chaseDate'); $chaseDate->setLabel('Chase date assigned: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must enter a chase date')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($curatorID, $chaseDate, $submit, $hash)); $this->addDisplayGroup(array('curatorID', 'chaseDate'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $staffregions = new StaffRegions(); $staffregions_options = $staffregions->getOptions(); ZendX_JQuery::enableForm($this); parent::__construct($options); $this->setName('vacancies'); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Role title: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must enter a title for this vacancy.')->setAttrib('size', 60); $salary = new Zend_Form_Element_Text('salary'); $salary->setLabel('Salary: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('size', 20)->addErrorMessage('You must enter a salary.'); $specification = new Pas_Form_Element_CKEditor('specification'); $specification->setLabel('Job specification: ')->setRequired(true)->addFilters(array('BasicHtml', 'StringTrim'))->setAttribs(array('cols' => 50, 'rows' => 10, 'Height' => 400))->addErrorMessage('You must enter a job description.'); $regionID = new Zend_Form_Element_Select('regionID'); $regionID->setLabel('Location of role: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addValidator('InArray', false, array(array_keys($staffregions_options)))->addMultiOptions(array(null => 'Choose region', 'Available regions' => $staffregions_options))->addErrorMessage('You must choose a region'); $live = new ZendX_JQuery_Form_Element_DatePicker('live'); $live->setLabel('Date for advert to go live: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->setJQueryParam('maxDate', '+1y')->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20); $expire = new ZendX_JQuery_Form_Element_DatePicker('expire'); $expire->setLabel('Date for advert to expire: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->setJQueryParam('maxDate', '+1y')->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20); $status = new Zend_Form_Element_Select('status'); $status->SetLabel('Publish status: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a status', 2 => 'Publish', 1 => 'Draft'))->setValue(2)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must choose a status'); $submit = new Zend_Form_Element_Submit('submit'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(4800); $this->addElements(array($title, $salary, $specification, $regionID, $live, $expire, $status, $submit, $hash)); $this->addDisplayGroup(array('title', 'salary', 'specification', 'regionID'), 'details'); $this->details->setLegend('Vacancy details'); $this->addDisplayGroup(array('live', 'expire', 'status'), 'dates'); $this->dates->setLegend('Publication details'); $this->setLegend('Vacancy details'); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
public function __construct($options = null) { $periods = new Periods(); $periodword_options = $periods->getPeriodFromWords(); $activities = new PrimaryActivities(); $activities_options = $activities->getTerms(); $counties = new Counties(); $county_options = $counties->getCountyName2(); parent::__construct($options); $this->setName('filterpeople'); $decorator = array('TableDecInput'); $name = new Zend_Form_Element_Text('organisation'); $name->setLabel('Filter by name')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 40)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $contact = new Zend_Form_Element_Text('contact'); $contact->setLabel('Filter by contact person: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Enter a valid organisation')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $contactpersonID = new Zend_Form_Element_Hidden('contactpersonID'); $contactpersonID->removeDecorator('Label')->removeDecorator('DtDdWrapper')->addFilters(array('StripTags', 'StringTrim'))->removeDecorator('HtmlTag')->addValidator('Alnum'); $county = new Zend_Form_Element_Select('county'); $county->setLabel('Filter by county')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->addMultiOptions(array(NULL => NULL, 'Choose county' => $county_options))->addValidator('InArray', false, array(array_keys($county_options))); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setLabel('Filter')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $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->addElements(array($name, $county, $contact, $contactpersonID, $submit)); }
public function __construct($options = null) { $periods = new Periods(); $period_options = $periods->getCoinsPeriod(); parent::__construct($options); $this->setName('ruler'); $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'))); $issuer = new Zend_Form_Element_Text('issuer'); $issuer->setLabel('Ruler or issuer name: ')->setRequired(true)->addErrorMessage('Please enter a name for this issuer or ruler.')->setDecorators($decorators)->setAttrib('size', 70)->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addFilters(array('StripTags', 'StringTrim')); $date1 = new Zend_Form_Element_Text('date1'); $date1->setLabel('Date issued from: ')->setRequired(true)->setDecorators($decorators)->addErrorMessage('You must enter a date for the start of their issue.')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits'); $date2 = new Zend_Form_Element_Text('date2'); $date2->setLabel('Date issued to: ')->setRequired(true)->setDecorators($decorators)->addErrorMessage('You must enter a date for the end of their issue.')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits'); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->SetLabel('Is this ruler or issuer currently valid: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->setDecorators($decorators); $period = new Zend_Form_Element_Select('period'); $period->setLabel('Broad period attributed to: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => NULL, 'Choose reason' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->setDecorators($decorators)->addErrorMessage('You must enter a period for this ruler/issuer'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($issuer, $date1, $date2, $period, $valid, $submit, $hash)); $this->addDisplayGroup(array('issuer', 'date1', 'date2', 'period', 'valid', 'submit'), 'details'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->setLegend('Issuer or ruler details: '); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); }
public function __construct($options = null) { $periods = new Periods(); $period_actives = $periods->getCoinsPeriod(); 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('coinsclass'); $referenceName = new Zend_Form_Element_Text('referenceName'); $referenceName->setLabel('Reference volume title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->setAttrib('size', 60); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->SetLabel('Is this volume currently valid: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators); $period = new Zend_Form_Element_Select('period'); $period->setLabel('Period: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('inArray', false, array(array_keys($period_actives)))->addMultiOptions(array(NULL => NULL, 'Choose period:' => $period_actives))->addErrorMessage('You must enter a period for this mint')->setDecorators($decorators); //Submit button $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($referenceName, $valid, $period, $submit)); $this->addDisplayGroup(array('referenceName', 'period', 'valid'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->setLegend('Mint details: '); $this->details->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('submit'), 'submit'); }
public function __construct($options = null) { parent::__construct($options); $this->setAttrib('enctype', 'multipart/form-data'); $this->setName('AddRulerImage'); $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'))); $image = new Zend_Form_Element_File('image'); $image->setLabel('Upload an image: ')->setRequired(true)->setDestination('./images/rulers/')->addValidator('Size', false, 2097152)->addValidator('Extension', false, 'jpeg,tif,jpg,png,gif,JPG,TIFF')->setMaxFileSize(1024000)->setAttribs(array('class' => 'textInput'))->addValidator('Count', false, array('min' => 1, 'max' => 1))->addDecorator('File'); $caption = new Zend_Form_Element_Text('caption'); $caption->setLabel('Image caption')->setRequired(true)->setAttrib('size', 60)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a label'); $rulerID = new Zend_Form_Element_Hidden('rulerID'); $rulerID->removeDecorator('label')->removeDecorator('HtmlTag')->addValidator('Int')->setRequired(true); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Upload an image of a ruler')->setAttribs(array('class' => 'large')); $this->addElements(array($image, $rulerID, $caption, $submit))->setLegend('Add an image to a ruler profile'); $this->addDisplayGroup(array('image', 'caption'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); }
public function __construct($options = null) { $periods = new Periods(); $periodword_options = $periods->getPeriodFromWords(); $counties = new Counties(); $county_options = $counties->getCountyName2(); parent::__construct($options); $this->setAttrib('accept-charset', 'UTF-8'); $this->setMethod('get'); $this->setName('filterfinds'); $decorator = array('TableDecInput'); $objectType = new Zend_Form_Element_Select('objectType'); $objectType->setLabel('Filter by object type')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alpha', false, array('allowWhiteSpace' => true))->addErrorMessage('Come on it\'s not that hard, enter a title!')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $broadperiod = new Zend_Form_Element_Select('broadperiod'); $broadperiod->setLabel('Filter by broadperiod')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('stringLength', false, array(1, 200))->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $county = new Zend_Form_Element_Select('county'); $county->setLabel('Filter by county')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('stringLength', false, array(1, 200))->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setLabel('Filter:')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'td'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'largefilter'); $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($objectType, $broadperiod, $county, $submit)); }
public function init() { /* * Some people consider this to be "interface" stuff, * to be done in the view. Personally, I think 'action' and 'method' * can be done here, though the fact that we need the view object * in order to ender the url for the action suggests that it, too, should * be in the view. But 'name' and 'attribs' really are kind of view-ish. * * Still, I like the idea that the view-script is so simple, just render the form. * * @todo To be discussed. */ $this->setMethod('post')->setAction($this->getView()->url(array('module' => 'auth', 'controller' => 'login', 'action' => 'index')))->setAttrib('class', 'box')->setName('Login'); # Email $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->setRequired(TRUE)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty')->addValidator('EmailAddress'); # Password $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password')->setRequired(TRUE)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $hash = new Zend_Form_Element_Hash('csrf', array('salt' => 'unique')); $hash->setTimeout(300)->addErrorMessage('Form timed out. Please reload the page & try again'); # Submit $submit = new Zend_Form_Element_Submit('login'); # Create $this->addElements(array($email, $password, $submit)); }
public function __construct($options = null) { parent::__construct($options); $services = new WebServices(); $servicesListed = $services->getValidServices(); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('socialweb'); $username = new Zend_Form_Element_Text('account'); $username->setLabel('Account username: '******'StringTrim', 'StripTags'))->setAttrib('size', 30)->addErrorMessage('Please enter a valid username!')->setDecorators($decorators); $service = new Zend_Form_Element_Select('accountName'); $service->setLabel('Social services: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(NULL => 'Choose a service', 'Valid services' => $servicesListed))->addValidator('InArray', false, array(array_keys($servicesListed)))->setDecorators($decorators); $public = new Zend_Form_Element_Checkbox('public'); $public->setLabel('Show this to public users?: ')->addFilters(array('StringTrim', 'StripTags'))->setRequired(true)->setDecorators($decorators)->addErrorMessage('You must set the status of this account'); $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(4800); $this->addElements(array($service, $hash, $username, $public, $submit)); $this->addDisplayGroup(array('accountName', 'account', 'public'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $authors = new Users(); $authorOptions = $authors->getAuthors(); parent::__construct($options); $this->setName('activity'); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('Choose title for the project.'); $description = new Pas_Form_Element_CKEditor('description'); $description->setLabel('Short description of project: ')->setRequired(true)->setAttribs(array('rows' => 10, 'cols' => 40, 'Height' => 400))->setAttrib('ToolbarSet', 'Basic')->addFilters(array('BasicHtml', 'EmptyParagraph', 'StringTrim')); $length = new Zend_Form_Element_Text('length'); $length->setLabel('Length of project: ')->setAttrib('size', 12)->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a duration for this project in months')->addValidator('Digits')->setDescription('Enter length in months'); $managedBy = new Zend_Form_Element_Select('managedBy'); $managedBy->setLabel('Managed by: ')->addMultiOptions(array('Choose an author' => $authorOptions))->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($authorOptions)))->addErrorMessage('You must enter a manager for this project.'); $suitableFor = new Zend_Form_Element_Select('suitableFor'); $suitableFor->setLabel('Suitable for: ')->addMultiOptions(array(null => 'Choose type of research', 'Available types' => $projectype_list))->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter suitability for this task.'); $location = new Zend_Form_Element_Text('location'); $location->setLabel('Where would this be located?: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a location for the task.'); $valid = new Zend_Form_Element_Checkbox('status'); $valid->setLabel('Publish this task? ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim')); $submit = new Zend_Form_Element_Submit('submit'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(480); $this->addElements(array($title, $description, $length, $valid, $managedBy, $suitableFor, $location, $submit, $hash)); $this->addDisplayGroup(array('title', 'description', 'length', 'location', 'suitableFor', 'managedBy', 'status', 'submit'), 'details'); $this->details->setLegend('Activity details: '); parent::init(); }
public function __construct($options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); ZendX_JQuery::enableForm($this); parent::__construct($options); $this->setName('research'); $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'))); $investigator = new Zend_Form_Element_Text('investigator'); $investigator->setLabel('Principal work conducted by: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a lead for this project.')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => NULL, 'Choose type of research' => $projectype_list))->addValidator('inArray', false, array(array_keys($projectype_list)))->setDecorators($decorators); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Choose title for the project.')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $description = $this->addElement('RTE', 'description', array('label' => 'Short description of project: ')); $description = $this->getElement('description')->setRequired(false)->addFilter('stringTrim')->setAttribs(array('cols' => 80, 'rows' => 10))->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph'))->addDecorator('HtmlTag', array('tag' => 'li')); $startDate = new ZendX_JQuery_Form_Element_DatePicker('startDate'); $startDate->setLabel('Start date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->addValidator('Date')->setRequired(false)->addErrorMessage('You must enter a start date for this project')->setDecorators($decorators); $endDate = new ZendX_JQuery_Form_Element_DatePicker('endDate'); $endDate->setLabel('End date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->setRequired(false)->addValidator('Date')->addErrorMessage('You must enter an end date for this project')->setDecorators($decorators); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Make public: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->removeDecorator('label')->setAttrib('class', 'large')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $this->addElements(array($title, $description, $level, $startDate, $endDate, $valid, $investigator, $submit, $hash)); $this->addDisplayGroup(array('title', 'investigator', 'level', 'description', 'startDate', 'endDate', 'valid'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('submit'), 'submit'); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { parent::__construct($options); $this->setName('comments'); $commentType = new Zend_Form_Element_Hidden('comment_type'); $commentType->addFilters(array('StripTags', 'StringTrim')); $comment_findID = new Zend_Form_Element_Hidden('contentID'); $comment_findID->addFilters(array('StripTags', 'StringTrim')); $comment_author = new Zend_Form_Element_Text('comment_author'); $comment_author->setLabel('Enter your name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('Please enter a valid name!'); $comment_author_email = new Zend_Form_Element_Text('comment_author_email'); $comment_author_email->setLabel('Enter your email address: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addValidator('EmailAddress', false, array('mx' => true))->addErrorMessage('Please enter a valid email address!')->setDescription('* This will not be displayed to the public.'); $comment_author_url = new Zend_Form_Element_Text('comment_author_url'); $comment_author_url->setLabel('Enter your web address: ')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addErrorMessage('Please enter a valid address!')->addValidator('Url')->setDescription('* Not compulsory'); $comment_content = new Pas_Form_Element_CKEditor('comment_content'); $comment_content->setLabel('Enter your comment: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); $submit = new Zend_Form_Element_Submit('submit'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(4800); $status = new Zend_Form_Element_Radio('commentStatus'); $status->setLabel('Message status:')->addMultiOptions(array('isspam' => 'Set as spam', 'isham' => 'Submit ham?', 'notspam' => 'Spam free'))->setValue('notSpam')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->setOptions(array('separator' => '')); $commentApproval = new Zend_Form_Element_Radio('comment_approved'); $commentApproval->setLabel('Approval:')->addMultiOptions(array('moderation' => 'Moderation', 'approved' => 'Approved'))->setValue('approved')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->setOptions(array('separator' => '')); $this->addElements(array($comment_author, $comment_author_email, $comment_content, $comment_author_url, $comment_findID, $commentApproval, $commentType, $status, $hash, $submit)); $this->addDisplayGroup(array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'commentStatus', 'comment_approved', 'contentID', 'comment_type'), 'details'); $this->details->setLegend('Enter your comments: '); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
public function __construct($options = null) { parent::__construct($options); $roles = new Roles(); $role_options = $roles->getRoles(); $inst = new Institutions(); $inst_options = $inst->getInsts(); $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $this->setName('emailsearch'); ZendX_JQuery::enableForm($this); $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'))); $message = new Zend_Form_Element_Textarea('messageToUser'); $message->setLabel('Message to user: '******'StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10))->addFilter('BasicHtml')->addErrorMessage('You must enter a message to your recipient.'); $fullname = new Zend_Form_Element_Text('fullname'); $fullname->setLabel('Send this to: ')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setAttrib('size', 30)->setDecorators($decorators); $email = $this->addElement('text', 'email', array('label' => 'Their email Address', 'size' => '30'))->email; $email->addValidator('EmailAddress')->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->setRequired(true)->addErrorMessage('Please enter a valid address!'); $email->setDecorators($decorators); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setLabel('Send to a friend'); $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($fullname, $submit, $message)); $this->addDisplayGroup(array('fullname', 'email', 'messageToUser'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Details: '); $this->addDisplayGroup(array('submit'), 'submit'); }
public function __construct($options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $periods = new Periods(); $period_options = $periods->getPeriodFrom(); parent::__construct($options); $this->setName('suggested'); $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'))); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array('Please choose a level' => NULL, 'Research levels' => $projectype_list))->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators); $period = new Zend_Form_Element_Select('period'); $period->setLabel('Broad research period: ')->setRequired(true)->addMultiOptions(array('Please choose a period' => NULL, 'Periods available' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Choose title for the project.')->setDecorators($decorators); $description = $this->addElement('Textarea', 'description', array('label' => 'Short description of project: ')); $description = $this->getElement('description')->setRequired(false)->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'))->setAttribs(array('cols' => 80, 'rows' => 10))->addDecorator('HtmlTag', array('tag' => 'li')); $valid = new Zend_Form_Element_Checkbox('taken'); $valid->setLabel('Is the topic taken: ')->setRequired(true)->setDecorators($decorators)->addValidator('Int'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->removeDecorator('label')->removeDecorator('HtmlTag')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper'); $this->addElements(array($title, $level, $period, $description, $valid, $submit, $hash)); $this->addDisplayGroup(array('title', 'level', 'period', 'description', 'taken'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('submit'), 'submit'); }
public function __construct($options = null) { $refs = new Coinclassifications(); $ref_list = $refs->getClass(); parent::__construct($options); $this->setName('addcoinreference'); $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'))); $classID = new Zend_Form_Element_Select('classID'); $classID->setLabel('Publication title: ')->setRequired(true)->addMultiOptions(array(NULL => 'Choose reference', 'Valid choices' => $ref_list))->addValidator('InArray', false, array(array_keys($ref_list)))->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a title')->setDecorators($decorators); $volume = new Zend_Form_Element_Text('vol_no'); $volume->setLabel('Volume number: ')->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 9)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $reference = new Zend_Form_Element_Text('reference'); $reference->setLabel('Reference number: ')->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 15)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large'); $this->addElements(array($classID, $volume, $reference, $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('classID', 'vol_no', 'reference'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Add a new reference'); $this->addDisplayGroup(array('submit'), 'submit'); }
public function init() { // // $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate'); // $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element'); // $this->addPrefixPath('Pas_Form_Decorator', 'Pas/Form/Decorator/', 'decorator'); // $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li'))); $this->setName('login'); $username = $this->addElement('text', 'username', array('label' => 'Username: '******'username')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addValidator('Authorise')->setAttrib('size', '20')->setDecorators($decorators); $password = $this->addElement('password', 'password', array('label' => 'Password: '******'password')->addValidator('StringLength', true, array(3))->setRequired(true)->setAttrib('size', '20')->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators); $password->getValidator('StringLength')->setMessage('Your password is too short'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $submit = $this->addElement('submit', 'submit', array('label' => 'Login...')); $submit = $this->getElement('submit'); $submit->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'large'); $this->addDisplayGroup(array('username', 'password'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); $this->details->setLegend('Login: '); }
public function __construct($options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); parent::__construct($options); $this->setName('activity'); $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'))); $decorators2 = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('HtmlTag', array('tag' => 'li'))); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Choose title for the project.')->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('Short description of project: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->addFilters(array('BasicHtml', 'EmptyParagraph', 'StringTrim'))->addDecorator('HtmlTag', array('tag' => 'li')); $length = new Zend_Form_Element_Text('length'); $length->setLabel('Length of project: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a duration for this project in months')->addValidator('Digits')->setDecorators($decorators); $managedBy = new Zend_Form_Element_Text('managedBy'); $managedBy->setLabel('Managed by: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a manager for this project.')->setDecorators($decorators); $suitableFor = new Zend_Form_Element_Select('suitableFor'); $suitableFor->setLabel('Suitable for: ')->addMultiOptions(array(NULL => NULL, 'Choose type of research' => $projectype_list))->setRequired(true)->addValidator('InArray', false, array($projectype_list))->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter suitability for this task.')->setDecorators($decorators); $location = new Zend_Form_Element_Text('location'); $location->setLabel('Where would this be located?: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a location for the task.')->setDecorators($decorators); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Publish this task? ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->removeDecorator('HtmlTag'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setDecorators($decorators2); $this->addElements(array($title, $description, $length, $valid, $managedBy, $suitableFor, $location, $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('title', 'description', 'length', 'location', 'suitableFor', 'managedBy', 'valid', 'submit'), 'details')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'div'))->removeDecorator('HtmlTag'); $this->details->setLegend('Activity details: '); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); }