Пример #1
1
 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
0
 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
0
 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
0
 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));
 }
 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
0
 /** 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
0
 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
0
 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
0
 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
0
 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
0
 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
0
 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
0
 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
0
 /**
  *
  * 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
0
 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));
 }
Пример #16
0
 public function init()
 {
     /*
     		$this->setDecorators(array(
     			array('Description', array('tag' => 'p', 'class' => 'description','escape' => false)),
     			'formElements',
     			'fieldset',
     			array('form',array('class' => 'formdefault'))
     		));
     		$this->setElementDecorators(array(
     			'ViewHelper',
     			'Description',
     			'Label',
     			'Errors',
     			array(array('tipo' => 'HtmlTag'), array('tag' => 'div'))
     		));*/
     //$this->setAttrib('class','formdefault consumidorForm');
     //$this->setLegend('Enviar Arquivos');
     $this->setName('upload');
     $this->setAttrib('enctype', 'multipart/form-data');
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel('Description')->setRequired(true)->addValidator('NotEmpty');
     $file = new Zend_Form_Element_File('arquivo');
     $file->setLabel('Selecione os arquivos EDI"s Zipados')->setDestination('temp/arquivos/zip')->setRequired(true)->addValidator('Extension', false, 'zip');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Enviar');
     $this->addElements(array($file, $submit));
 }
Пример #17
0
 public function __construct(array $dataBusinessId, $options = null)
 {
     parent::__construct($options);
     $this->setName('frmEmployee');
     $this->setMethod('post');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Employee name');
     $name->setAttrib('maxlength', 80);
     $name->setRequired(true);
     $name->addValidator(new Zend_Validate_NotEmpty());
     $this->addElement($name);
     $age = new Zend_Form_Element_Text('age');
     $age->setLabel('Employee age');
     $age->addValidator(new Zend_Validate_Int());
     $this->addElement($age);
     $businessId = new Zend_Form_Element_Select('business_id');
     $businessId->setLabel('Business');
     $businessId->setRequired(true);
     $businessId->addValidator(new Zend_Validate_NotEmpty());
     $businessId->addValidator(new Zend_Validate_Int());
     $businessId->addMultiOptions($dataBusinessId);
     $this->addElement($businessId);
     $submit = new Zend_Form_Element_Submit('bt_submit');
     $submit->setLabel('Save');
     $this->addElement($submit);
 }
Пример #18
0
    public function init()
    {
        $tr = Zend_Registry::get('tr');
        
        $handle = new Zend_Form_Element_Text('handle');
        $handle->setLabel($tr->_('HANDLE'));
        $handle->setRequired(true);
        $handle->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($handle);

        $password = new Zend_Form_Element_Password('password');
        $password->setLabel($tr->_('PASSWORD'));
        $password->setRequired(true);
        $password->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($password);

        $password1 = new Zend_Form_Element_Password('password_again');
        $password1->setLabel($tr->_('RETYPE') . ' ' . $tr->_('PASSWORD'));
        $password1->setRequired(true);
        $password1->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($password1);

        $this->addElement(new Zend_Form_Element_Submit($tr->_('SUBMIT')));

        parent::init();
    }
Пример #19
0
 public function init()
 {
     //        if (!$this->hasTranslator()) {
     //            $this->setTranslator(Zend_Registry::get('Zend_Translate'));
     //        }
     $userid = new Zend_Form_Element_Hidden('UserID');
     $userid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden'))));
     $username = new Zend_Form_Element_Text('Username');
     $username->setOptions(array('label' => 'Username', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $birthday = new Zend_Form_Element_Text('Birthday');
     $birthday->setOptions(array('label' => 'Birthday', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $role = new Zend_Form_Element_Select('Role');
     $role->setOptions(array('label' => 'User Type', 'MultiOptions' => array(3 => 'User', 2 => 'IT', 1 => 'Admin', 0 => 'SuperAdmin')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label'))));
     $fullname = new Zend_Form_Element_Text('FullName');
     $fullname->setOptions(array('label' => 'FullName'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $email = new Zend_Form_Element_Text('Email');
     $email->setOptions(array('label' => 'Email', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $group = new Zend_Form_Element_Text('Group');
     $group->setOptions(array('label' => 'Group'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $phone = new Zend_Form_Element_Text('Phone');
     $phone->setOptions(array('label' => 'Phone'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $address = new Zend_Form_Element_Textarea('Address');
     $address->setOptions(array('label' => 'Address', 'style' => "width: 200px; height: 150px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label'))));
     $this->setName('user-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($userid, $username, $role, $fullname, $email, $birthday, $group, $phone, $address))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form'));
 }
Пример #20
0
 /** 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 init()
 {
     $this->setMethod('post');
     $this->addElement('text', 'fullname', array('label' => 'Name', 'required' => false, 'filters' => array('StringTrim', 'StripTags'), 'class' => 'title'));
     $this->addElement('text', 'nickname', array('label' => 'Nickname', 'required' => false, 'filters' => array('StringTrim', 'StripTags'), 'class' => 'text'));
     $this->addElement('text', 'email', array('label' => 'Email', 'required' => false, 'validators' => array('emailAddress'), 'filters' => array('StringTrim', 'StripTags'), 'class' => 'text'));
     $this->addElement('select', 'gender', array('label' => 'Gender', 'required' => false, 'validators' => array(array('inArray', false, array(array('M', 'F')))), 'multiOptions' => array('' => 'Not specified', 'M' => 'Male', 'F' => 'Female')));
     $this->addElement('text', 'dob', array('label' => 'Date of birth (dd/mm/yyyy)', 'required' => false, 'class' => 'text', 'validators' => array(array('date', false, array('d/m/Y'))), 'filters' => array('StringTrim', 'StripTags')));
     // get the list of countries
     $countries = Zend_Locale::getTranslationList('Territory', 'en', 2);
     asort($countries, SORT_LOCALE_STRING);
     $country = new Zend_Form_Element_Select('country');
     $country->setLabel('Country')->addMultiOption('', 'Not specified')->addMultiOption('GB', 'United Kingdom')->addMultiOptions($countries)->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->setLabel('Postcode')->setAttrib("class", "text")->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $languages = Zend_Locale::getTranslationList('Language', 'en');
     asort($languages, SORT_LOCALE_STRING);
     $language = new Zend_Form_Element_Select('language');
     $language->setLabel('Language')->addMultiOption('', 'Not specified')->addMultiOption('en_GB', 'British English')->addMultiOptions($languages)->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
     $timeZone = new Zend_Form_Element_Text('timezone');
     $timeZone->setLabel('Timezone')->setAttrib("class", "text")->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $this->addElements(array($country, $postcode, $language, $timeZone));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Save'));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset')), array('Description', array('placement' => 'prepend', 'class' => 'error')), 'Form'));
 }
Пример #22
0
 public function init()
 {
     $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));
     $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $levelMultiOptions = array(0 => ' ');
     /*      $table = $this->_helper->api()->getItemTable('user');
           $select = $viewer->membership()->getMembersSelect('user_id');
           $friends = $table->fetchAll($select);*/
     $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->fetchAll();
     foreach ($levels as $row) {
         $levelMultiOptions[$row->level_id] = $row->getTitle();
     }
     $level_id = new Zend_Form_Element_Select('level_id');
     $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions);
     $enabled = new Zend_Form_Element_Select('enabled');
     $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->setValue('-1');
     $submit = new Zend_Form_Element_Button('search', array('type' => 'submit'));
     $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div'));
     $this->addElement('Hidden', 'order', array('order' => 10001));
     $this->addElement('Hidden', 'order_direction', array('order' => 10002));
     $this->addElements(array($username, $email, $level_id, $enabled, $submit));
     // Set default action
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
 }
Пример #23
0
 public function init()
 {
     $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));
     $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'))->setMethod('GET');
     $displayname = new Zend_Form_Element_Text('displayname');
     $displayname->setLabel('Display Name')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->getLevelsAssoc();
     $levelMultiOptions = array(0 => ' ');
     foreach ($levels as $key => $value) {
         $levelMultiOptions[$key] = $value;
     }
     $level_id = new Zend_Form_Element_Select('level_id');
     $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions);
     $enabled = new Zend_Form_Element_Select('enabled');
     $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->setValue('-1');
     $submit = new Zend_Form_Element_Button('search', array('type' => 'submit'));
     $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div'));
     $this->addElement('Hidden', 'order', array('order' => 10001));
     $this->addElement('Hidden', 'order_direction', array('order' => 10002));
     $this->addElement('Hidden', 'user_id', array('order' => 10003));
     $this->addElements(array($displayname, $username, $email, $level_id, $enabled, $submit));
     // Set default action without URL-specified params
     $params = array();
     foreach (array_keys($this->getValues()) as $key) {
         $params[$key] = null;
     }
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble($params));
 }
Пример #24
0
 public function getElement()
 {
     $element = new Zend_Form_Element_Text('foo');
     $element->setView($this->getView());
     $this->decorator->setElement($element);
     return $element;
 }
Пример #25
0
 public function init()
 {
     $languageFile = Zend_Registry::get('languageFile');
     $translate = new Zend_Translate('array', $languageFile, 'zh_CN');
     $this->setTranslator($translate);
     $this->setMethod('POST');
     $this->setName('contactForm');
     $element = new Zend_Form_Element_Text('name');
     $element->setLabel('怎么称呼您');
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('email');
     $element->setLabel('您的Email');
     //$element->setRequired(true);
     $this->addElement($element);
     $element = new Elements();
     $element->addReCaptcha($this);
     $this->addDisplayGroup(array('name', 'email', 'captcha'), 'leftSection');
     $this->getDisplayGroup('leftSection')->removeDecorator('DtDdWrapper');
     $element = new Zend_Form_Element_Textarea('body');
     $element->setLabel('想要开通城市地区和找房贴士,关于您的简单介绍');
     $element->addPrefixPath('My_Validator', 'My/Validator/', 'validate');
     $element->addValidator('FormValueNotNull', true);
     //$element->setRequired(true);
     $element->setAttrib('rows', 13);
     $this->addElement($element);
     $this->addDisplayGroup(array('body'), 'rightSection');
     $this->getDisplayGroup('rightSection')->removeDecorator('DtDdWrapper');
     $element = new Zend_Form_Element_Submit('post');
     $element->removeDecorator('Label');
     $this->addElement($element);
 }
Пример #26
0
 public function init()
 {
     // Add start date element
     $startDate = new Zend_Form_Element_Text('add_show_start_date');
     $startDate->class = 'input_text';
     $startDate->setRequired(true)->setLabel('Date/Time Start:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array(array(array('open' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true)), 'ViewHelper', 'Description', array('Label', array('tag' => 'dt'))));
     $this->addElement($startDate);
     // Add start time element
     $startTime = new Zend_Form_Element_Text('add_show_start_time');
     $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-9:]+$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper', 'Errors', array(array('close' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true))));
     $this->addElement($startTime);
     // Add end date element
     $endDate = new Zend_Form_Element_Text('add_show_end_date_no_repeat');
     $endDate->class = 'input_text';
     $endDate->setRequired(true)->setLabel('Date/Time End:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array(array(array('open' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true)), 'ViewHelper', 'Description', array('Label', array('tag' => 'dt'))));
     $this->addElement($endDate);
     // Add end time element
     $endTime = new Zend_Form_Element_Text('add_show_end_time');
     $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-9:]+$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper', 'Errors', array(array('close' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true))));
     $this->addElement($endTime);
     // Add duration element
     $this->addElement('text', 'add_show_duration', array('label' => 'Duration:', 'class' => 'input_text', 'value' => '01h00m', 'readonly' => true));
     // Add repeats element
     $this->addElement('checkbox', 'add_show_repeats', array('label' => 'Repeats?', 'required' => false));
 }
Пример #27
0
		function setForm()
		{
			$form = new Zend_Form;
			$form->setMethod('post')->setAction('');
			//$this->setAttrib('enctype','multipart/form-data');
			
			$file = new Zend_Form_Element_File('video_file');
			//$file->setAttrib('class','file');
			$file->setLabel('video_file');
           	$file->setRequired(true);
           	
			$video_title = new Zend_Form_Element_Text('video_title');
			$video_title ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tiêu đề không được để trống'));
			
			$video_thumbnail=new Zend_Form_Element_Textarea('video_thumbnail');
			$video_thumbnail->removeDecorator('HtmlTag')->removeDecorator('Label');
			
			$video_description = new Zend_Form_Element_Textarea('video_description');
			$video_description->setAttrib('rows','7');
			$video_description ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mô tả không được để trống'));
			
			$is_active = new Zend_Form_Element_Radio('is_active');
			$is_active->setRequired(true)
					->setLabel('is_active')
					->setMultiOptions(array("1" => "Có","0" => "Không"));
			
			$file->removeDecorator('HtmlTag')->removeDecorator('Label');	
			$video_title->removeDecorator('HtmlTag')->removeDecorator('Label');	
			$video_description->removeDecorator('HtmlTag')->removeDecorator('Label');
			$is_active->removeDecorator('HtmlTag')->removeDecorator('Label');		
			
			$form->addElements(array($file,$video_title,$video_description,$is_active,$video_thumbnail));
			return $form;
		}
Пример #28
0
 public function init()
 {
     $this->setName('contact');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $id->removeDecorator('label');
     //
     //        $company_id = new Zend_Form_Element_Hidden('company_id');
     //        $company_id->addFilter('Int');
     //        $company_id->removeDecorator('label');
     //
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $telephone = new Zend_Form_Element_Text('telephone');
     $telephone->setLabel('Telephone')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $status = new Zend_Form_Element_Text('status');
     $status->setLabel('Status')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $direction = new Zend_Form_Element_Text('direction');
     $direction->setLabel('Direction')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label');
     $this->addElements(array($id, $name, $email, $telephone, $direction, $status, $submit));
 }
Пример #29
0
 public function __construct($options = null)
 {
     // variable
     parent::__construct($options);
     $baseDir = $options['baseDir'];
     // name
     $name = new Zend_Form_Element_Text('EGI_Name');
     $name->setLabel($this->getView()->getCibleText('form_label_name'))->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($name);
     // description
     $description = new Zend_Form_Element_Textarea('EGI_Description');
     $description->setLabel($this->getView()->getCibleText('form_label_description'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextareaEdit');
     $this->addElement($description);
     //status
     $status = new Zend_Form_Element_Select('EG_Status');
     $status->setLabel($this->getView()->getCibleText('form_label_status'))->setAttrib('class', 'stdSelect');
     $status = Cible_FunctionsGeneral::fillStatusSelectBox($status, 'Extranet_Groups', 'EG_Status');
     $this->addElement($status);
     // Hidden GroupID
     $groupID = new Zend_Form_Element_Hidden('groupID');
     $groupID->removeDecorator('label');
     $groupID->removeDecorator('DtDdWrapper');
     if (isset($options['groupID'])) {
         $groupID->setValue($options['groupID']);
     }
     $this->addElement($groupID);
 }
 /** 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();
 }