本文整理汇总了PHP中Zend_Form_Element_Text类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Text类的具体用法?PHP Zend_Form_Element_Text怎么用?PHP Zend_Form_Element_Text使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Form_Element_Text类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
global $mySession;
$db = new Db();
$emailid_val = "";
$qur = $db->runquery("SELECT * FROM " . USERS . " WHERE user_id='" . $mySession->TeeLoggedID . "' ");
//$qur=$db->runquery("select * from ".ADDRESS." join ".STATE." on ".STATE.".state_id=".ADDRESS.".state where user_id='".$mySession->TeeLoggedID."' ");
if ($qur != "" and count($qur) > 0) {
$emailid_val = $qur[0]['emailid'];
}
# FORM ELEMENT:public name
# TYPE : text
$emailid = new Zend_Form_Element_Text('emailid');
$emailid->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib('readonly', 'readonly')->setAttrib("style", "width:300px; height:30px;")->setValue($emailid_val);
# FORM ELEMENT:address
# TYPE : text
$friendsemailid = new Zend_Form_Element_Text('friendsemailid');
$friendsemailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'One id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:300px; height:30px;")->setAttrib('class', 'changepasstextbox');
//if(@$_REQUEST['friendsemailid']!="")
// {
// $friendsemailid-> addValidator('EmailAddress', true)
// ->addDecorator('Errors', array('class'=>'errmsg'))
// ->addErrorMessage('Please enter a valid email address');
// }
//
# FORM ELEMENT:city
# TYPE : text
$url = new Zend_Form_Element_Text('url');
$url->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'URL is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib("style", "width:100px; height:30px;");
$this->addElements(array($emailid, $friendsemailid, $url));
}
示例2: init
public function init()
{
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/daterange.phtml'))));
// Add start date element
$startDate = new Zend_Form_Element_Text('his_date_start');
$startDate->class = 'input_text';
$startDate->setRequired(true)->setLabel('Date Start:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array('ViewHelper'));
$startDate->setAttrib('alt', 'date');
$this->addElement($startDate);
// Add start time element
$startTime = new Zend_Form_Element_Text('his_time_start');
$startTime->class = 'input_text';
$startTime->setRequired(true)->setValue('00:00')->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('HH:mm')), array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper'));
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
// Add end date element
$endDate = new Zend_Form_Element_Text('his_date_end');
$endDate->class = 'input_text';
$endDate->setRequired(true)->setLabel('Date End:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array('ViewHelper'));
$endDate->setAttrib('alt', 'date');
$this->addElement($endDate);
// Add end time element
$endTime = new Zend_Form_Element_Text('his_time_end');
$endTime->class = 'input_text';
$endTime->setRequired(true)->setValue('01:00')->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('HH:mm')), array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper'));
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);
}
示例3: __construct
public function __construct($options = null)
{
parent::__construct($options);
$id = new Zend_Form_Element_Hidden('id');
$hierarchyLevel = new Zend_Form_Element_Hidden('hierarchyLevel');
$officeType = new Zend_Form_Element_Text('officeType');
$officeType->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(4, 50))));
// $officeType->addValidator($db_lookup_validator);
$officeType->setAttrib('class', 'txt_put');
$officeType->setAttrib('id', 'officeType');
$officeCode = new Zend_Form_Element_Text('officeCode');
//add validation
$officeCode->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(2, 2))));
$officeCode->setAttrib('class', 'txt_put');
$officeCode->setAttrib('id', 'officeCode')->setAttrib('size', '2');
$this->addElements(array($id, $officeType, $officeCode, $hierarchyLevel));
$submit = new Zend_Form_Element_Submit('Edit');
$submit->setAttrib('class', 'officebutton');
$submit->setLabel('edit');
$submit->removeDecorator('DtDdWrapper');
$next = new Zend_Form_Element_Submit('Next');
$next->setAttrib('class', 'officesubmit');
$next->setLabel('Next');
//add form element to form
$this->addElements(array($submit, $next));
}
示例4: init
public function init($catId)
{
global $mySession;
$db = new Db();
$catname = "";
$catdescription = "";
if ($catId != "") {
$Data = $db->runQuery("select * from " . CATEGORY . " where cat_id='" . $catId . "'");
$catname = $Data[0]['cat_name'];
$catdescription = $Data[0]['cat_description'];
}
$cat_name = new Zend_Form_Element_Text('cat_name');
$cat_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category name is required.'))->addDecorator('Errors', array('class' => 'errormsg'))->setAttrib("class", "mws-textinput required")->setValue($catname);
$cat_description = new Zend_Form_Element_Textarea('cat_description');
$cat_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category description is required.'))->addDecorator('Errors', array('class' => 'errormsg'))->setAttrib("class", "mws-textinput required")->setValue($catdescription);
/* $pagepositionArr=array();
$pagepositionArr[0]['key']="0";
$pagepositionArr[0]['value']="Top";
$pagepositionArr[1]['key']="1";
$pagepositionArr[1]['value']="Bottom";
$pageposition= new Zend_Form_Element_Radio('pageposition');
$pageposition->addMultiOptions($pagepositionArr)
->setValue($pageposition_value);
*/
$this->addElements(array($cat_name, $cat_description));
}
示例5: init
public function init()
{
parent::init();
if (!$this->getHmHomeId()) {
throw new Exception();
}
$element = new Zend_Form_Element_Select('year');
$element->setLabel('Jaar')->setRequired(true)->addMultiOption('', '...');
$percentages = Model_Hm_Day_Percentage::findAllByHomeId($this->_hmHomeId)->execute(null, Doctrine_Core::HYDRATE_ARRAY);
$availableYears = new Model_Hm_AvailableYears($percentages, 5);
foreach ($availableYears->toArray() as $year) {
$element->addMultiOption($year, $year);
}
$this->addElement($element);
$elements[] = 'year';
for ($i = 1; $i <= 7; $i++) {
$elementName = $this->_labelTemplates[$i];
$elements[] = 'day_' . $i;
$element = new Zend_Form_Element_Text('day_' . $i);
$element->setLabel($elementName)->setRequired(true)->setAttribs(array('maxlength' => 6))->setValidators(array(array('float'), array('stringLength', false, array('max' => 6))));
$this->addElement($element);
}
$this->addDisplayGroup($elements, 'days', array('legend' => 'Percentage'));
$element = new Zend_Form_Element_Submit('submit_percentageday');
$element->setLabel('Verwerken')->setAttrib('class', 'submit');
$this->addElement($element);
$this->addDisplayGroup(array('submit_percentageday'), 'submit', array('class' => 'submit'));
$this->bhvkDecorators();
$this->bhvkDecorateSubmitElement($this->getElement('submit_percentageday'));
}
示例6: __construct
/** the constructor
* @access public
* @param array $options
* @return void
*/
public function __construct(array $options = null)
{
$periods = new Periods();
$period_options = $periods->getCoinsPeriod();
parent::__construct($options);
$this->setName('moneyers');
$name = new Zend_Form_Element_Text('name');
$name->setLabel('Moneyer\'s name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('Enter a moneyer\'s name');
$period = new Zend_Form_Element_Select('period');
$period->setLabel('Broad period: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must enter a period for this type')->addMultioptions(array(null => 'Choose a period', 'Available Options' => $period_options));
$date_1 = new Zend_Form_Element_Text('date_1');
$date_1->setLabel('Issued coins from: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a date for the start of moneyer period');
$date_2 = new Zend_Form_Element_Text('date_2');
$date_2->setLabel('Issued coins until: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a date for the end of moneyer period');
$appear = new Zend_Form_Element_Text('appear');
$appear->setLabel('Appearance on coins: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'));
$RRC = new Zend_Form_Element_Text('RRC');
$RRC->setLabel('RRC ID number: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'));
$bio = new Pas_Form_Element_CKEditor('bio');
$bio->setLabel('Biography: ')->setRequired(true)->addFilters(array('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10, 'cols' => 40, 'Height' => 400))->setAttrib('ToolbarSet', 'Finds')->addErrorMessage('You must enter a biography');
$valid = new Zend_Form_Element_Checkbox('valid');
$valid->setLabel('Is this term valid?: ');
$submit = new Zend_Form_Element_Submit('submit');
$this->addElements(array($period, $name, $date_1, $date_2, $bio, $appear, $RRC, $valid, $submit));
$this->addDisplayGroup(array('name', 'period', 'date_1', 'date_2', 'appear', 'RRC', 'bio', 'valid', 'submit'), 'details');
parent::init();
}
示例7: init
public function init()
{
// init the parent
parent::init();
// set the form's method
$this->setMethod('post');
$id = new Zend_Form_Element_Hidden('id');
$id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/'))));
$this->addElement($id);
$firstname = new Zend_Form_Element_Text('firstname');
$firstname->setOptions(array('label' => $this->t('First name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
$this->addElement($firstname);
$lastname = new Zend_Form_Element_Text('lastname');
$lastname->setOptions(array('label' => $this->t('Last name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
$this->addElement($lastname);
$checkEmailNotJunk = new Zend_Validate_Callback(array($this, 'emailNotJetable'));
$uniqueEmailValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'email'));
$email = new Zend_Form_Element_Text('email');
$email->setOptions(array('label' => $this->t('Email'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $checkEmailNotJunk, $uniqueEmailValidator)));
$this->addElement($email);
$raisonsocial = new Zend_Form_Element_Text('raison sociale');
$raisonsocial->setOptions(array('label' => $this->t('Raison sociale'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
$this->addElement($raisonsocial);
// $groupsInArrayValidator = new Zend_Validate_InArray(array_keys(array(1, 2, 3)));
// $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".');
$status = new Zend_Form_Element_Radio('status');
$status->setOptions(array('label' => $this->t('Status'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => array('Gérant' => 'Gérant', 'Associé' => 'Associé', 'Freelance patenté' => 'Freelance patenté')));
$this->addElement($status);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setOptions(array('label' => $this->t('Save user'), 'required' => true, 'order' => 100));
$this->addElement($submit);
}
示例8: __construct
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');
}
示例9: init
public function init()
{
$this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post');
$this->addElement('Hidden', 'search', array('value' => 1));
$tieu_de = new Zend_Form_Element_Text('tieu_de');
$tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
$noi_dung = new Zend_Form_Element_Textarea('noi_dung');
$noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea'));
$soundcloud_embed = new Zend_Form_Element_Text('soundcloud_embed');
$soundcloud_embed->setLabel('Embed SoundCloud')->setDescription('How to get SoundCloud embed code? <a href="http://help.soundcloud.com/customer/portal/articles/243751-how-can-i-put-my-track-or-playlist-on-my-site-or-blog-" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
$youtube_embed = new Zend_Form_Element_Text('youtube_embed');
$youtube_embed->setLabel('Embed Youtube')->setDescription('How to get Youtube embed code? <a href="https://support.google.com/youtube/answer/171780?hl=en" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
$link_nct = new Zend_Form_Element_Text('link_nct');
$link_nct->setLabel('Nhac cua tui')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
$link_mp3 = new Zend_Form_Element_Text('link_mp3');
$link_mp3->setLabel('Mp3')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input');
$statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai());
$trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions);
$trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$noi_bat = new Zend_Form_Element_Select('noi_bat');
$noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$photo = new Zend_Form_Element_File('photo');
$photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/bai_giang')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$submitCon = new Zend_Form_Element_Submit('submitCon');
$submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
$submitExit = new Zend_Form_Element_Submit('submitExit');
$submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
$cancel = new Zend_Form_Element_Button('cancel');
$cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"'));
$this->addElements(array($tieu_de, $noi_dung, $soundcloud_embed, $youtube_embed, $link_nct, $link_mp3, $trang_thai, $noi_bat, $photo, $submitCon, $submitExit, $cancel));
$this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
$this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
}
示例10: init
public function init()
{
// if (!$this->hasTranslator()) {
// $this->setTranslator(Zend_Registry::get('Zend_Translate'));
// }
$itemid = new Zend_Form_Element_Hidden('ItemID');
$itemid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden'))));
$maTS = new Zend_Form_Element_Text('MaTS');
$maTS->setOptions(array('label' => 'Mã TS', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
$tenTS = new Zend_Form_Element_Text('TenTS');
$tenTS->setOptions(array('label' => 'Tên tài sản', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
$descr = new Zend_Form_Element_Textarea('Description');
$descr->setOptions(array('label' => 'Mô tả', 'style' => "width: 200px; height: 50px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label'))));
$type = new Zend_Form_Element_Select('Type');
$type->setOptions(array('label' => 'Loại bảo mật', 'required' => TRUE, 'MultiOptions' => array(1 => 'Bảo mật thấp', 0 => 'Bảo mật cao')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label'))));
$startDate = new Zend_Form_Element_Text('StartDate');
$startDate->setOptions(array('label' => 'Bắt đầu SD', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
$price = new Zend_Form_Element_Text('Price');
$price->setOptions(array('label' => 'Giá', 'required' => TRUE, 'filters' => array('Int')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
$warrantyTime = new Zend_Form_Element_Text('WarrantyTime');
$warrantyTime->setOptions(array('label' => 'Bảo hành', 'required' => TRUE, 'filters' => array('Int')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
$status = new Zend_Form_Element_Select('Status');
$status->setOptions(array('label' => 'Tình trạng', 'required' => TRUE, 'MultiOptions' => array(0 => 'Có thể mượn', 1 => 'Đang cho mượn', 2 => 'Hỏng')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label'))));
$place = new Zend_Form_Element_Textarea('Place');
$place->setOptions(array('label' => 'Địa điểm hiện tại', 'style' => "width: 200px; height: 50px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label'))));
$this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($itemid, $maTS, $tenTS, $descr, $type, $startDate, $price, $warrantyTime, $status, $place))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form'));
}
示例11: __construct
public function __construct($options = null)
{
parent::__construct($options);
$this->setAttrib('accept-charset', 'UTF-8');
$this->setName('safcontrollers');
$id = new Zend_Form_Element_Hidden('id');
$hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf'));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$label = new Zend_Form_Element_Text('label');
$label->setLabel('label');
$name = new Zend_Form_Element_Text('name');
$name->setLabel('name');
$image = new Zend_Form_Element_Textarea('image');
$image->setLabel('image');
$description = new Zend_Form_Element_Textarea('description');
$description->setLabel('description');
$safmodulesId = new Zend_Form_Element_Select('safmodules_id');
$options = new Safmodules();
$safmodulesId->addMultiOption('', '----------');
foreach ($options->fetchAlltoFlatArray() as $k => $v) {
$safmodulesId->addMultiOption($k, $v['mlabel']);
}
$safmodulesId->setLabel('safmodules_id');
$this->addElements(array($id, $hash, $label, $name, $image, $description, $safmodulesId));
$this->addElements(array($submit));
}
示例12: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('action', DOMAIN . 'employmentstatus/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'employmentstatus');
$id = new Zend_Form_Element_Hidden('id');
$workcode = new Zend_Form_Element_Text('workcode');
$workcode->setAttrib('maxLength', 20);
$workcode->setRequired(true);
$workcode->addValidator('NotEmpty', false, array('messages' => 'Please enter work short code.'));
$workcode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid work short code.')));
$workcodename = new Zend_Form_Element_Select('workcodename');
$workcodename->setAttrib('class', 'selectoption');
$workcodename->setRegisterInArrayValidator(false);
$workcodename->setRequired(true);
$workcodename->addValidator('NotEmpty', false, array('messages' => 'Please select work code.'));
$description = new Zend_Form_Element_Textarea('description');
$description->setAttrib('rows', 10);
$description->setAttrib('cols', 50);
$description->setAttrib('maxlength', '200');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $workcode, $workcodename, $description, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例13: __construct
public function __construct($options = null)
{
parent::__construct($options);
// salutation
$salutation = new Zend_Form_Element_Select('salutation');
$salutation->setLabel('Salutation :')->setAttrib('class', 'largeSelect');
$categoriesData = $this->getView()->getAllSalutation();
foreach ($categoriesData as $categoryData) {
$salutation->addMultiOption($categoryData['C_ID'], $categoryData['CI_Title']);
}
$this->addElement($salutation);
// fName
$fname = new Zend_Form_Element_Text('firstName');
$fname->setLabel($this->getView()->getCibleText('form_label_fname'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput');
$this->addElement($fname);
// lName
$lname = new Zend_Form_Element_Text('lastName');
$lname->setLabel($this->getView()->getCibleText('form_label_lname'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput');
$this->addElement($lname);
// email
$regexValidate = new Cible_Validate_Email();
$regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
$email = new Zend_Form_Element_Text('email');
$email->setLabel($this->getView()->getCibleText('form_label_email'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttrib('class', 'stdTextInput');
$this->addElement($email);
}
示例14: init
/**
*
* Themes & styles
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsStyles.phtml'))));
// load settings
$AppOptions = new Application_Model_AppOptions();
$all_meta = $AppOptions->getAllOptions();
// fields
$themes_array = array('/bootstrap/css/bootstrap.min.css' => 'Bootstrap');
$css_theme = new Zend_Form_Element_Select('css_theme');
$css_theme->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($themes_array)->setErrorMessages(array($this->translator->translate('Please select')))->setLabel($this->translator->translate('Choose css theme'))->setRequired(true)->setValue(isset($all_meta['css_theme']) ? $all_meta['css_theme'] : 'bootstrap')->setAttrib('class', 'form-control');
$wide_layout = new Zend_Form_Element_Checkbox('wide_layout');
$wide_layout->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['wide_layout']) && $all_meta['wide_layout'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Extra-wide layout on large screens'))->setCheckedValue("1")->setUncheckedValue("0");
$cover_ysize = new Zend_Form_Element_Text('cover_ysize');
$cover_ysize->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Cover image height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['cover_ysize']) ? $all_meta['cover_ysize'] : '220')->setAttrib('class', 'form-control');
$user_background = new Zend_Form_Element_Checkbox('user_background');
$user_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_background']) && $all_meta['user_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Users can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0");
$subscriber_background = new Zend_Form_Element_Checkbox('subscriber_background');
$subscriber_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['subscriber_background']) && $all_meta['subscriber_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Subscribers can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0");
$custom_css = new Zend_Form_Element_Textarea('css_custom');
$custom_css->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '15')->setValue(isset($all_meta['css_custom']) ? $all_meta['css_custom'] : '')->setLabel($this->translator->translate('Custom css'))->setAttrib('class', 'form-control');
$submit = new Zend_Form_Element_Submit('submitbtn');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($css_theme, $wide_layout, $cover_ysize, $user_background, $subscriber_background, $custom_css, $submit));
$this->postInit();
}
示例15: init
public function init()
{
$this->setName('shipping_address');
$id = new Zend_Form_Element_Hidden('id');
$id->addFilter('Int');
$customerid = new Zend_Form_Element_Hidden('customerid');
$customerid->addFilter('Int');
$address1 = new Zend_Form_Element_Text('shipping_address1');
$address1->setLabel('Street Address')->setAttrib('id', 'address1')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
$address2 = new Zend_Form_Element_Text('shipping_address2');
$address2->setLabel('')->setAttrib('id', 'address2')->addFilter('StripTags')->addFilter('StringTrim');
$address3 = new Zend_Form_Element_Text('shipping_address3');
$address3->setLabel('')->setAttrib('id', 'address3')->addFilter('StripTags')->addFilter('StringTrim');
$postcode = new Zend_Form_Element_Text('shipping_postcode');
$postcode->setLabel('Postcode')->setAttrib('id', 'postcode')->addFilter('StripTags')->addFilter('StringTrim');
$country = new Zend_Form_Element_Text('shipping_country');
$country->setLabel('Country')->setAttrib('id', 'country')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
$city = new Zend_Form_Element_Text('shipping_city');
$city->setLabel('City')->setAttrib('id', 'city')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
$phone = new Zend_Form_Element_Text('shipping_phone');
$phone->setLabel('Phone')->setAttrib('id', 'phone')->addFilter('StripTags')->addFilter('StringTrim');
$fax = new Zend_Form_Element_Text('shipping_fax');
$fax->setLabel('Fax')->setAttrib('id', 'fax')->addFilter('StripTags')->addFilter('StringTrim');
$email = new Zend_Form_Element_Text('shipping_email');
$email->setLabel('E-Mail')->setAttrib('id', 'email')->addFilter('StripTags')->addFilter('StringTrim');
$internet = new Zend_Form_Element_Text('shipping_internet');
$internet->setLabel('Internet')->setAttrib('id', 'internet')->addFilter('StripTags')->addFilter('StringTrim');
$submit = new Zend_Form_Element_Button('shipping_submit');
$submit->setAttrib('onclick', 'addAddress()');
$this->addElements(array($id, $customerid, $address1, $address2, $address3, $postcode, $city, $country, $phone, $fax, $email, $internet, $submit));
}