本文整理汇总了PHP中Zend_Form_Element_Hash类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Hash类的具体用法?PHP Zend_Form_Element_Hash怎么用?PHP Zend_Form_Element_Hash使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Form_Element_Hash类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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');
}
示例2: init
/**
* (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);
}
示例3: __construct
/** 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();
}
示例4: testConfigureThemeWithNoLogoFileAndNoPreviousLogoFile
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));
}
示例5: __construct
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: ');
}
示例6: __construct
/** 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();
}
示例7: __construct
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');
}
示例8: __construct
/** 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();
}
示例9: __construct
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');
}
示例10: __construct
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));
}
示例11: __construct
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');
}
示例12: __construct
/** 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: ')->setRequired(true)->addFilters(array('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();
}
示例13: indexAction
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();
}
示例14: __construct
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');
}
示例15: __construct
/** 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();
}