Пример #1
0
 public function renderFormElement()
 {
     $elm = new Zend_Form_Element_Radio($this->getName(), array('label' => $this->getLabel() . ':'));
     $elm->setDescription($this->getDescription());
     $elm->setMultiOptions($this->_rankingOptions);
     $elm->setValue($this->getValue());
     $elm->setRequired($this->getRequired());
     $elm->setSeparator('');
     return $elm;
 }
Пример #2
0
 public function init()
 {
     $Ankieta = new Application_Model_DbTable_AnkietyPytania();
     $select = $Ankieta->select(array('id', 'pytanie', 'czy_obrazek'))->where('czy_wyswietlac = ?', 't')->where('sekcja = ?', 'lewa')->where('rodzaj = ?', 'normal')->order('kolejnosc DESC')->order('data_dodania DESC')->order('pytanie ASC')->limit(1);
     //echo $select->__toString();
     $ankieda = $Ankieta->fetchAll($select);
     foreach ($ankieda as $pytanie) {
         $pytania_id[] = $pytanie->id;
         $pytania[] = $pytanie->pytanie;
         $odpowiedziFetch = $pytanie->findApplication_Model_DbTable_AnkietyOdpowiedzi();
         // sortowanie
         $odpowiedziArray = $odpowiedziFetch->toArray();
         usort($odpowiedziArray, create_function('$a, $b', 'if ($a["kolejnosc"] == $b["kolejnosc"]) return 0; return ($a["kolejnosc"] < $b["kolejnosc"]) ? -1 : 1;'));
         // usort($odpowiedziArray, sort_answers($a, $b){
         // return strcmp($a["kolejnosc"], $b["kolejnosc"]);
         // });// sort
         foreach ($odpowiedziArray as $odpowiedz) {
             $odpowiedzi_id[] = $odpowiedz['id'];
             $odpowiedzi[] = $odpowiedz['odpowiedz'];
         }
     }
     $this->addElement('hidden', 'plaintext', array('description' => '<dt id="odpowiedzi-label"><h3 class="tytul">' . $pytania[0] . '</h3></dt>', 'decorators' => array(array('Description', array('escape' => false, 'tag' => '')))));
     $kontrolkaRadio = new Zend_Form_Element_Radio("odpowiedzi[]", array('multiOptions' => array_combine($odpowiedzi_id, $odpowiedzi), 'registerInArrayValidator' => false, 'validators' => array('NotEmpty' => array('validator' => 'NotEmpty', 'options' => array('messages' => 'Musisz wybrać jedną odpowiedź.')))));
     $kontrolkaRadio->setRequired(true);
     $kontrolkaRadio->removeDecorator('Label');
     $kontrolkaRadio->setSeparator(false);
     $this->addElement($kontrolkaRadio);
     if ($ankieda[0]->czy_obrazek == 't') {
         //first create an image type captcha
         $captchaimg = new Zend_Captcha_Image('captchaimg');
         $captchaimg->setFont(APPLICATION_PATH . '/../public/images/tresci/captcha/Tahoma.ttf');
         $captchaimg->setImgDir(APPLICATION_PATH . '/../public/images/tresci/captcha');
         $captchaimg->setImgUrl('/images/tresci/captcha');
         $captchaimg->setWordlen('5');
         $captchaimg->setMessages(array('badCaptcha' => 'Wpisany kod jest nieprawidłowy'));
         //            $captchaimg->generate();
         //create user input for captcha and include the captchaimg in form
         $adcaptcha = new Zend_Form_Element_Captcha('adcaptcha', array('captcha' => $captchaimg));
         $adcaptcha->setLabel('Wpisz kod z obrazka:');
         $adcaptcha->setRequired(true);
         $this->addElement($adcaptcha);
     }
     $kontrolkaSubmit = new Zend_Form_Element_Submit("submit", "Głosuj");
     //        $kontrolkaSubmit->removeDecorator('DtDdWrapper');
     //        $kontrolkaSubmit->setAttribs(array('style' => 'margin-left:130px;'));
     $kontrolkaSubmit->removeDecorator('Label');
     $this->addElement($kontrolkaSubmit);
     $this->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'sonda-content')), array('Form', array('class' => 'sonda-form'))));
     //echo $pytania_id[0];
     $this->setMethod('post');
     //$url = $view->url(array('controller' => 'sonda', 'action' => 'edit', 'id' => $pytania_id[0]), 'default');
     $url = $this->getView()->url(array('controller' => 'sonda', 'action' => 'edit', 'id' => $pytania_id[0]), 'default');
     $this->setAction($url);
 }
Пример #3
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'feedforwardinit');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
     $appraisal_mode->setLabel("Appraisal");
     $appraisal_mode->setMultiOptions(array('' => 'Select Appraisal'));
     $appraisal_mode->setAttrib('class', 'selectoption');
     $appraisal_mode->setRequired(true);
     $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal.'));
     $status = new Zend_Form_Element_Select('status');
     $status->setLabel("Status");
     $status->setAttrib('class', 'selectoption');
     $status->setMultiOptions(array('1' => 'Open'));
     //,'2' => 'Close'
     $status->setRegisterInArrayValidator(false);
     $status->setRequired(true);
     $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
     $employee_name_view = new Zend_Form_Element_Radio('employee_name_view');
     $employee_name_view->setLabel("Employee Details");
     $employee_name_view->addMultiOptions(array('1' => 'Show', '0' => 'Hide'));
     $employee_name_view->setSeparator('');
     $employee_name_view->setValue(0);
     $employee_name_view->setRegisterInArrayValidator(false);
     $enable_to = new Zend_Form_Element_MultiCheckbox('enable_to');
     $enable_to->setLabel("Enable To");
     $enable_to->addMultiOptions(array('0' => 'Appraisal Employees', '1' => 'All Employees'));
     $enable_to->setSeparator('');
     $enable_to->setValue(0);
     $enable_to->setRequired(true);
     $enable_to->setRegisterInArrayValidator(false);
     $enable_to->addValidator('NotEmpty', false, array('messages' => 'Please check enable to.'));
     $ff_due_date = new Zend_Form_Element_Text('ff_due_date');
     $ff_due_date->setLabel("Due Date");
     $ff_due_date->setOptions(array('class' => 'brdr_none'));
     $ff_due_date->setRequired(true);
     $ff_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
     $save = new Zend_Form_Element_Submit('submit');
     $save->setAttrib('id', 'submitbutton');
     $save->setLabel('Save & Initialize');
     $save_later = new Zend_Form_Element_Submit('submit');
     $save_later->setAttrib('id', 'submitbutton1');
     $save_later->setLabel('Save & Initialize Later');
     $this->addElements(array($id, $appraisal_mode, $status, $employee_name_view, $ff_due_date, $save, $save_later, $enable_to));
     $this->setElementDecorators(array('ViewHelper'));
 }
Пример #4
0
 public function __construct($options = null)
 {
     //        $this->_disabledDefaultActions = true;
     //        $this->_object = $options['object'];
     unset($options['object']);
     parent::__construct($options);
     // Subform for the retailer status on website
     $retailerForm = new Cible_Form_SubForm();
     $retailerForm->setName('retailerForm')->removeDecorator('DtDdWrapper');
     //checkbox to set the retailers address as valid
     $isValid = new Zend_Form_Element_Checkbox('R_Active');
     $isValid->setLabel($this->getView()->getCibleText('form_label_approved_onweb'));
     $isValid->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     $retailerForm->addElement($isValid);
     $isRetailer = new Zend_Form_Element_Radio('isDistributeur');
     $isRetailer->setLabel($this->getView()->getCibleText('form_label_Display_web'))->setOrder(0);
     $isRetailer->setSeparator('');
     $isRetailer->setAttrib('class', 'vertAlignRadio');
     $isRetailer->addMultiOptions(array(1 => $this->getView()->getCibleText('form_account_no'), 2 => $this->getView()->getCibleText('form_account_yes')))->setValue(1);
     $txtFr = new Cible_Form_Element_Html('lblFr', array('value' => $this->getView()->getCibleText('form_address_retailer_fr')));
     $txtFr->setOrder(1)->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'formLanguage'))));
     $retailerForm->addElement($txtFr);
     $adressRetailer = new Cible_View_Helper_FormAddress($retailerForm);
     $adressRetailer->enableFields(array('name' => true, 'firstAddress' => false, 'secondAddress' => false, 'state' => false, 'cityTxt' => false, 'zipCode' => false, 'country' => false, 'firstTel' => false, 'secondTel' => false, 'fax' => false, 'email' => false, 'webSite' => false));
     $adressRetailer->formAddress();
     $retailerForm->addElement($isRetailer);
     $retailerForm->getElement('AI_SecondTel')->setAttrib('class', 'stdTextInput phoneFree');
     // Subform for the retailer status on website
     $retailerFormEn = new Cible_Form_SubForm();
     $retailerFormEn->setName('retailerFormEn')->removeDecorator('DtDdWrapper');
     $txtEn = new Cible_Form_Element_Html('lblEn', array('value' => $this->getView()->getCibleText('form_address_retailer_en')));
     $txtEn->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'formLanguage'))));
     $adressRetailerEn = new Cible_View_Helper_FormAddress($retailerFormEn);
     $adressRetailerEn->enableFields(array('name' => false, 'firstAddress' => false, 'secondAddress' => false, 'firstTel' => false, 'secondTel' => false, 'webSite' => false));
     $adressRetailerEn->formAddress();
     $retailerFormEn->addElement($txtEn);
     $retailerFormEn->getElement('AI_SecondTel')->setAttrib('class', 'stdTextInput phoneFree');
     //*** Add subform to the form ***/
     $this->addSubForm($retailerForm, 'retailerForm');
     $this->addSubForm($retailerFormEn, 'retailerFormEn');
 }
Пример #5
0
 public function init()
 {
     $this->setMethod('post');
     //$this->setAttrib('action',DOMAIN.'language/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'servicedeskrequests');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $businessunit_id = new Zend_Form_Element_Select('businessunit_id');
     $businessunit_id->setLabel("Business Unit");
     $businessunit_id->setAttrib('class', 'selectoption');
     if ($postid == '') {
         $businessunit_id->setAttrib('onchange', 'displayemployees(this)');
         $bunitModel = new Default_Model_Businessunits();
         $bunitdata = $bunitModel->fetchAll('isactive=1', 'unitname');
         $businessunit_id->addMultiOptions(array('' => 'Select Business unit', '0' => 'No Business Unit'));
         foreach ($bunitdata->toArray() as $data) {
             $businessunit_id->addMultiOption($data['id'], $data['unitname']);
         }
     } else {
         $businessunit_id->addMultiOptions(array('' => 'Select Business unit'));
     }
     $businessunit_id->setRegisterInArrayValidator(false);
     $businessunit_id->setRequired(true);
     $businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
     $department_id = new Zend_Form_Element_Select('department_id');
     $department_id->setLabel("Department");
     $department_id->setAttrib('class', 'selectoption');
     $department_id->addMultiOption('', 'Select Department');
     if ($postid == '') {
         $department_id->setAttrib('onchange', 'displayemployees(this)');
     }
     $department_id->setRegisterInArrayValidator(false);
     $service_desk_flag = new Zend_Form_Element_Radio('service_desk_flag');
     $service_desk_flag->setLabel("Applicability");
     $service_desk_flag->setAttrib('onclick', 'changeimplementation(this)');
     $service_desk_flag->addMultiOptions(array('1' => 'Business unit wise', '0' => 'Department wise'));
     $service_desk_flag->setSeparator('');
     $service_desk_flag->setValue(1);
     $service_desk_flag->setRegisterInArrayValidator(false);
     $service_desk_flag->setRequired(true);
     $service_desk_flag->addValidator('NotEmpty', false, array('messages' => 'Please select applicability.'));
     $service_desk_id = new Zend_Form_Element_Select('service_desk_id');
     $service_desk_id->setLabel("Category");
     $service_desk_id->setAttrib('class', 'selectoption');
     $service_desk_id->addMultiOption('', 'Select category');
     $service_desk_id->setRegisterInArrayValidator(false);
     $service_desk_id->setRequired(true);
     $service_desk_id->addValidator('NotEmpty', false, array('messages' => 'Please select category.'));
     $request_recievers = new Zend_Form_Element_Multiselect('request_recievers');
     $request_recievers->setLabel("Executors");
     $request_recievers->setAttrib('class', 'selectoption');
     $request_recievers->setRegisterInArrayValidator(false);
     $request_recievers->setRequired(true);
     $request_recievers->addValidator('NotEmpty', false, array('messages' => 'Please select executor.'));
     $approvingauthority = new Zend_Form_Element_Select('approvingauthority');
     $approvingauthority->setLabel("No. of Approvers");
     $approvingauthority->setAttrib('class', 'selectoption');
     $approvingauthority->setAttrib('onchange', 'displayapprovingauthority(this)');
     $approvingauthority->addMultiOptions(array('' => 'Select no. of approvers', '1' => '1', '2' => '2', '3' => '3'));
     $approvingauthority->setRegisterInArrayValidator(false);
     $approvingauthority->setRequired(true);
     $approvingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select no. of approvers.'));
     $approver_1 = new Zend_Form_Element_Select('approver_1');
     $approver_1->setLabel("Approver 1");
     $approver_1->setAttrib('class', 'selectoption');
     $approver_1->addMultiOption('', 'Select Approver 1');
     $approver_1->setAttrib('onchange', 'displayapprovingauthority(this)');
     $approver_1->setRegisterInArrayValidator(false);
     $approver_2 = new Zend_Form_Element_Select('approver_2');
     $approver_2->setLabel("Approver 2");
     $approver_2->setAttrib('class', 'selectoption');
     $approver_2->addMultiOption('', 'Select Approver 2');
     $approver_2->setAttrib('onchange', 'displayapprovingauthority(this)');
     $approver_2->setRegisterInArrayValidator(false);
     $approver_3 = new Zend_Form_Element_Select('approver_3');
     $approver_3->setLabel("Approver 3");
     $approver_3->setAttrib('class', 'selectoption');
     $approver_3->addMultiOption('', 'Select Approver 3');
     $approver_3->setRegisterInArrayValidator(false);
     $cc_mail_recievers = new Zend_Form_Element_Multiselect('cc_mail_recievers');
     $cc_mail_recievers->setLabel("Request Viewers");
     $cc_mail_recievers->setAttrib('class', 'selectoption');
     $cc_mail_recievers->setRegisterInArrayValidator(false);
     $attachment = new Zend_Form_Element_Radio('attachment');
     $attachment->setLabel("Attachment");
     $attachment->addMultiOptions(array('1' => 'Yes', '0' => 'No'));
     $attachment->setSeparator('');
     $attachment->setValue(0);
     $attachment->setRegisterInArrayValidator(false);
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel("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, $businessunit_id, $department_id, $description, $service_desk_flag, $service_desk_id, $request_recievers, $approvingauthority, $approver_1, $approver_2, $approver_3, $cc_mail_recievers, $attachment, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Пример #6
0
 /**
  * @group ZF-9689
  */
 public function testRenderWithListSeparatorForRadio()
 {
     require_once 'Zend/Form/Element/Radio.php';
     $element = new Zend_Form_Element_Radio('foo');
     $options = array('foo' => 'Foo', 'bar' => 'Bar');
     $element->setMultiOptions($options);
     $element->setSeparator('</p><p>');
     $element->setDecorators(array(array('ViewHelper', array('separator' => '')), array('HtmlTag', array('tag' => 'p'))));
     $expected = '<p><label><input type="radio" name="foo" id="foo-foo" value="foo">Foo</label></p>' . '<p><label><input type="radio" name="foo" id="foo-bar" value="bar">Bar</label></p>';
     $actual = $element->render($this->getView());
     $this->assertEquals($expected, $actual);
 }
Пример #7
0
 public function init()
 {
     $this->setMethod("post");
     // produto_nome
     $produto_nome = new Zend_Form_Element_Text("produto_nome");
     $produto_nome->setLabel("Nome");
     $produto_nome->setRequired();
     $produto_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do produto'));
     $produto_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     // produto_id
     $produto_id = new Zend_Form_Element_Hidden("produto_id");
     // fabricante_nome
     $fabricante_nome = new Zend_Form_Element_Text("fabricante_nome");
     $fabricante_nome->setLabel("Fabricante");
     //$fabricante_nome->setRequired();
     $fabricante_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do fabricante'));
     $fabricante_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     // fabricante_id
     $fabricante_id = new Zend_Form_Element_Hidden("fabricante_id");
     // marca_nome
     $marca_nome = new Zend_Form_Element_Text("marca_nome");
     $marca_nome->setLabel("Marca");
     $marca_nome->setRequired();
     $marca_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome da marca'));
     $marca_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     // marca_id
     $marca_id = new Zend_Form_Element_Hidden("marca_id");
     // reclamacao_nome
     $reclamacao_nome = new Zend_Form_Element_Text("reclamacao_nome");
     $reclamacao_nome->setLabel("Nome");
     $reclamacao_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu nome'));
     // reclamacap_email
     $reclamacao_email = new Zend_Form_Element_Text("reclamacao_email");
     $reclamacao_email->setLabel("E-mail");
     $reclamacao_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu e-mail'));
     // reclamacao_empresa
     $reclamacao_empresa = new Zend_Form_Element_Text("reclamacao_empresa");
     $reclamacao_empresa->setLabel("Empresa onde comprou o produto");
     $reclamacao_empresa->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu e-mail'));
     // reclamacao_cidade
     $reclamacao_cidade = new Zend_Form_Element_Text("reclamacao_cidade");
     $reclamacao_cidade->setLabel("Cidade");
     $reclamacao_cidade->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe sua cidade'));
     // reclamacao_estado
     $reclamacao_estado = new Zend_Form_Element_Select("reclamacao_estado");
     $reclamacao_estado->setLabel("Estado");
     $reclamacao_estado->setAttribs(array('class' => 'form-control'));
     $reclamacao_estado->setMultiOptions($this->getEstados());
     // reclamacao_descricao
     $reclamacao_descricao = new Zend_Form_Element_Textarea("reclamacao_descricao");
     $reclamacao_descricao->setLabel("Descreva sua reclamação");
     $reclamacao_descricao->setRequired();
     $reclamacao_descricao->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     $reclamacao_descricao->setAttribs(array('class' => 'form-control', 'rows' => 5, 'placeholder' => 'Informe porque você está insatisfeito com o produto', 'maxlenght' => 500));
     $reclamacao_descricao->addValidator(new App_Validate_Reclamacao());
     // reclamacao_nota
     $reclamacao_nota = new Zend_Form_Element_Radio("reclamacao_nota");
     $reclamacao_nota->setLabel("Dê sua nota para o produto");
     $reclamacao_nota->setRequired();
     $reclamacao_nota->setAttribs(array('class' => ''));
     $reclamacao_nota->setMultiOptions($this->getNotasHtml());
     $reclamacao_nota->setOptions(array('escape' => false));
     $reclamacao_nota->setSeparator(" ");
     $reclamacao_nota->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
     // submit
     $submit = new Zend_Form_Element_Submit("submit");
     $submit->setLabel("Registrar Reclamação");
     $submit->setAttrib("class", 'form-control btn btn-success');
     $this->addElements(array($produto_nome, $fabricante_nome, $marca_nome, $reclamacao_descricao, $reclamacao_nome, $reclamacao_email, $reclamacao_cidade, $reclamacao_estado, $reclamacao_nota, $submit, $produto_id, $marca_id, $fabricante_id));
 }
Пример #8
0
 public function init()
 {
     $this->setMethod('post');
     //$this->setAttrib('action',DOMAIN.'language/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'appraisalconfig');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $businessunit_id = new Zend_Form_Element_Select('businessunit_id');
     $businessunit_id->setLabel("Business Unit");
     $businessunit_id->setAttrib('class', 'selectoption');
     if ($postid == '') {
         $businessunit_id->setAttrib('onchange', 'displayDept(this)');
         $bunitdata = $this->bunitdata;
         if (!empty($bunitdata)) {
             $businessunit_id->addMultiOptions(array('' => 'Select Business unit', '0' => 'No Business Unit'));
             foreach ($bunitdata as $data) {
                 $businessunit_id->addMultiOption($data['id'], $data['unitname']);
             }
         } else {
             $businessunit_id->addMultiOptions(array('' => 'Select Business unit'));
         }
     } else {
         $businessunit_id->addMultiOptions(array('' => 'Select Business unit'));
     }
     $businessunit_id->setRegisterInArrayValidator(false);
     $businessunit_id->setRequired(true);
     $businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
     $department_id = new Zend_Form_Element_Select('department_id');
     $department_id->setLabel("Department");
     $department_id->setAttrib('class', 'selectoption');
     $department_id->addMultiOption('', 'Select Department');
     if ($postid == '') {
         $department_id->setAttrib('onchange', 'displayDept(this)');
     }
     $department_id->setRegisterInArrayValidator(false);
     $performance_app_flag = new Zend_Form_Element_Radio('performance_app_flag');
     $performance_app_flag->setLabel("Applicability");
     $performance_app_flag->setAttrib('onclick', 'checkimplementfun(this)');
     $performance_app_flag->addMultiOptions(array('1' => 'Business unit wise', '0' => 'Department wise'));
     $performance_app_flag->setSeparator('');
     $performance_app_flag->setValue(1);
     $performance_app_flag->setRegisterInArrayValidator(false);
     $performance_app_flag->setRequired(true);
     $performance_app_flag->addValidator('NotEmpty', false, array('messages' => 'Please select applicability.'));
     $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
     $appraisal_mode->setLabel("Appraisal Mode");
     $appraisal_mode->setAttrib('class', 'selectoption');
     $appraisal_mode->addMultiOptions(array('' => 'Select appraisal mode', 'Quarterly' => 'Quarterly', 'Half-yearly' => 'Half-yearly', 'Yearly' => 'Yearly'));
     $appraisal_mode->setRegisterInArrayValidator(false);
     $appraisal_mode->setRequired(true);
     $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal mode.'));
     $appraisal_ratings = new Zend_Form_Element_Select('appraisal_ratings');
     $appraisal_ratings->setLabel("Appraisal Ratings");
     $appraisal_ratings->setAttrib('class', 'selectoption');
     $appraisal_ratings->addMultiOptions(array('' => 'Select ratings', '1' => '1-5', '2' => '1-10'));
     $appraisal_ratings->setRegisterInArrayValidator(false);
     $appraisal_ratings->setRequired(true);
     $appraisal_ratings->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal ratings.'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $businessunit_id, $performance_app_flag, $department_id, $appraisal_mode, $appraisal_ratings, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Пример #9
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'timemanagement/expenses/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'expensecategory');
     $id = new Zend_Form_Element_Hidden('id');
     $client = new Zend_Form_Element_Select('client_id');
     $client->addMultiOption('', 'Select Client');
     $client->setRegisterInArrayValidator(false);
     $client->setAttrib('onchange', 'loadProjects(this)');
     $client->setRequired(true);
     $client->addValidator('NotEmpty', false, array('messages' => 'Please select Client.'));
     $client->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_clients', 'field' => 'id', 'exclude' => 'is_active = 1')));
     $client->getValidator('Db_RecordExists')->setMessage('Selected Client is inactivated.');
     $project = new Zend_Form_Element_Select('project_id');
     $project->addMultiOption('', 'Select Project');
     $project->setRegisterInArrayValidator(false);
     $project->setRequired(true);
     $project->addValidator('NotEmpty', false, array('messages' => 'Please select Project.'));
     $project->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_projects', 'field' => 'id', 'exclude' => 'is_active = 1')));
     $project->getValidator('Db_RecordExists')->setMessage('Selected Project is inactivated.');
     $category = new Zend_Form_Element_Select('expense_cat_id');
     $category->addMultiOption('', 'Select Category');
     $category->setRegisterInArrayValidator(false);
     $category->setRequired(true);
     $category->addValidator('NotEmpty', false, array('messages' => 'Please select Category.'));
     $category->addValidator(new Zend_Validate_Db_RecordExists(array('table' => 'tm_expense_categories', 'field' => 'id', 'exclude' => 'is_active = 1')));
     $category->getValidator('Db_RecordExists')->setMessage('Selected Category is inactivated.');
     $expenseDate = new ZendX_JQuery_Form_Element_DatePicker('expense_date');
     $expenseDate->setOptions(array('class' => 'brdr_none'));
     //$date_of_leaving->setAttrib('onchange', 'validatejoiningdate(this)');
     $expenseDate->setAttrib('readonly', 'true');
     $expenseDate->setAttrib('onfocus', 'this.blur()');
     $expenseAmount = new Zend_Form_Element_Text('expense_amount');
     $expenseAmount->setAttrib('maxLength', 8);
     $expenseAmount->setLabel("Unit Price");
     $expenseAmount->addValidator("regex", true, array('pattern' => '/^[1-9]\\d{1,4}(\\.\\d{1,2})?$/', 'messages' => array('regexNotMatch' => 'Please enter valid Amount.')));
     $note = new Zend_Form_Element_Text('note');
     $note->setAttrib('maxLength', 200);
     $note->setLabel("Note");
     $billable = new Zend_Form_Element_Radio('is_billable');
     $billable->setLabel("Type");
     $billable->addMultiOptions(array('1' => 'Yes', '0' => 'No'));
     $billable->setSeparator('');
     $billable->setValue('billable');
     $billable->setRegisterInArrayValidator(false);
     $billable->setRequired(true);
     $billable->addValidator('NotEmpty', false, array('messages' => 'Please select Type.'));
     /*
     client_idbigint(20) unsigned NOT NULL
     project_idbigint(20) unsigned NOT NULL
     expense_cat_idint(10) unsigned NOT NULL
     expense_datetimestamp NOT NULL
     expense_amountdecimal(8,2) unsigned NOT NULL
     notevarchar(200) NULL
     is_billabletinyint(1) unsigned NOT NULL
     receipt_filevarchar(200) NULL
     expense_statusenum('saved','submitted','approved','rejected') NULL
     status_update_datetimestamp NOT NULL
     status_update_byint(11) NULL
     reject_notevarchar(200) NULL
     */
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $client, $project, $category, $expenseDate, $expenseAmount, $note, $billable, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('expense_date'));
 }
Пример #10
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'identitydocuments');
     $id = new Zend_Form_Element_Hidden('id');
     /*$identitydocuments = new Zend_Form_Element_MultiCheckbox('identitydoc');
     		$identitydocuments->setLabel('Identity Documents');
     		$identitydocuments->setMultiOptions(array(
                                	'1'=>'Passport',
     							'2'=>'SSN',
     							'3'=>'Aadhaar',
                                 '4'=>'Pan Card',
                                 '5'=>'Driving License',
     							));
     		$identitydocuments->setRequired(true);
     		$identitydocuments->addValidator('NotEmpty', false, array('messages' => 'Please select at least one identity document type.'));
     		$identitydocuments->setSeparator(PHP_EOL);	
     		
     		$othercheck = new Zend_Form_Element_Checkbox('othercheck');
     		$othercheck->setLabel('Other Documents');
     		$othercheck->setAttrib('onclick', 'displayotherdocumentdiv(this)');
     	 
     		
     		$otherdocument = new Zend_Form_Element_Text('otherdocument');
     		$otherdocument->setAttrib('maxlength',50);
     		$otherdocument->setAttrib('onblur', 'validate_otherdocument(this)');
     		$otherdocument->setLabel('Document Name');
     		$otherdocument->addValidator("regex",true,array(
     							'pattern'=> '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\-\s]*)$/',
                                'messages'=>array(
                                    'regexNotMatch'=>'Please enter valid document name.'
                                )
             	));*/
     $documentname = new Zend_Form_Element_Text('document_name');
     $documentname->setAttrib('maxlength', 50);
     $documentname->setLabel('Document Name');
     $documentname->setRequired(true);
     $documentname->addValidator('NotEmpty', false, array('messages' => 'Please enter document name.'));
     $documentname->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\\-\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid document name.')));
     $documentname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_identitydocuments', 'field' => 'document_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1')));
     $documentname->getValidator('Db_NoRecordExists')->setMessage('Document name already exists.');
     $mandatory = new Zend_Form_Element_Radio('mandatory');
     $mandatory->setLabel("Mandatory");
     $mandatory->addMultiOptions(array('1' => 'Yes', '0' => 'No'));
     $mandatory->setRequired(true);
     $mandatory->addValidator('NotEmpty', false, array('messages' => 'Please select mandatory.'));
     $mandatory->setSeparator('');
     $mandatory->setValue(0);
     $mandatory->setRegisterInArrayValidator(false);
     $expiry = new Zend_Form_Element_Radio('expiry');
     $expiry->setLabel("Expiry");
     $expiry->addMultiOptions(array('1' => 'Yes', '0' => 'No'));
     $expiry->setRequired(true);
     $expiry->addValidator('NotEmpty', false, array('messages' => 'Please select expiry.'));
     $expiry->setSeparator('');
     $expiry->setValue(0);
     $expiry->setRegisterInArrayValidator(false);
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel("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, $documentname, $mandatory, $expiry, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     if (isset($this->advertisement)) {
         $user = Advertisement::getUser($this->advertisement->id);
         $element = new Zend_Form_Element_Hidden('id');
         $element->setValue($this->advertisement->id);
         $this->addElement($element);
         $element = new Zend_Form_Element_Hidden('password');
         $element->setValue($this->password);
         $this->addElement($element);
         $this->setAction('/' . strtolower($this->city->name) . '/bulletin/update');
     } else {
         $this->setAction('/' . strtolower($this->city->name) . '/bulletin/create');
     }
     $element = new Zend_Form_Element_Hidden('city');
     $element->setValue($this->city->id);
     $this->addElement($element);
     $this->setMethod('POST');
     $this->setName('createAdForm');
     $element = new Zend_Form_Element_Text('name');
     $element->setLabel('怎么称呼您');
     $element->setDescription('必填,中英文都可,2到30个字');
     $element->setRequired(true);
     //$element->addValidator(new Zend_Validate_StringLength(2,30));
     if (isset($user)) {
         $element->setValue($user->name);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('email');
     $element->setLabel('您的Email');
     $element->setRequired(true);
     $element->addValidator(new Zend_Validate_EmailAddress());
     $element->addValidator('NotEmpty');
     $element->setDescription('必填,将不会显示在您的帖子里');
     if (isset($user)) {
         $element->setValue($user->email);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('mobile');
     $element->setLabel('您的手机号');
     $element->addFilter(new Zend_Filter_HtmlEntities());
     $element->addFilter(new Zend_Filter_StripTags());
     $element->setDescription('方便其他用户联系您');
     if (isset($user)) {
         $element->setValue($user->mobile);
     }
     $this->addElement($element);
     $this->addDisplayGroup(array('name', 'email', 'mobile'), 'aboutYou');
     $this->getDisplayGroup('aboutYou')->removeDecorator('DtDdWrapper');
     // radio box
     $element = new Zend_Form_Element_Radio('type');
     $element->addMultiOptions(array('lease' => '供', 'want' => '求'))->removeDecorator('Label');
     $element->setSeparator('')->setValue(Advertisement::LEASE);
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->type);
     }
     $this->addElement($element);
     // category
     $element = new Zend_Form_Element_Checkbox("isBusiness");
     $element->setLabel('是商铺/店面吗?');
     if (isset($this->advertisement) && $this->advertisement->category_id == Category::SHOP) {
         $element->setValue(1);
     } else {
         $element->setValue(0);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('title');
     $element->setLabel('帖子标题');
     $element->setRequired(true);
     $element->addValidator('NotEmpty');
     //$element->addValidator(new Zend_Validate_StringLength(10,30));
     $element->setDescription('必填,5-100字,概括题目,突出重点');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->title);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('address');
     $element->setLabel('房子的住址');
     $element->setDescription('必填,以便用户在地图上方便的找到');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->address);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('rent');
     $element->setLabel('租金');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->rent);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Select('currency');
     //$element->setLabel("货币");
     $element->addMultiOptions(Currency::getAvailableCurrencyAsArray());
     if (isset($this->advertisement)) {
         $element->setValue(Advertisement::getCurrency($this->advertisement)->id);
     } else {
         $element->setValue(127);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Radio('rent_measurement');
     $element->addMultiOptions(array('month' => '每月', 'day' => '每日'))->setSeparator('')->setDescription('必填')->removeDecorator('Label');
     $element->setSeparator('')->setValue(Advertisement::RENT_MONTHLY);
     if (isset($this->advertisement)) {
         if ($this->advertisement->rent_measurement == Advertisement::RENT_MONTHLY) {
             $element->setValue('month');
         } else {
             if ($this->advertisement->rent_measurement == Advertisement::RENT_DAILY) {
                 $element->setValue('day');
             }
         }
     }
     $element->setRequired(true);
     $element->addValidator('NotEmpty');
     $element->addValidator(new Zend_Validate_Alnum());
     $this->addElement($element);
     // start date and stop date
     $element = new Zend_Form_Element_Text('start_date');
     $element->setRequired(true);
     $element->addValidator('NotEmpty');
     $element->setLabel('开始日期');
     $element->setDescription('必填,格式为2010-09-11');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->start_date);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('stop_date');
     $element->setLabel('结束日期');
     $element->setDescription('同上,留空则为长期');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->stop_date);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('area');
     $element->setLabel('面积(平方米)');
     $element->addValidator(new Zend_Validate_Alnum());
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->area);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('num_of_room');
     $element->setLabel('房间数');
     $element->addValidator(new Zend_Validate_Alnum());
     $element->setDescription('卧房数');
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->num_of_room);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Textarea('description');
     $element->setLabel('其他描述');
     $element->setDescription('更多详细信息,例如: 交通是否方便? 是否有独立卫生间和厨房? 是否仅限女生? 是否有家具? 月租是否包括网费? 您的个人习惯等等。');
     $element->setAttrib('rows', 4);
     if (isset($this->advertisement)) {
         $element->setValue($this->advertisement->description);
     }
     $this->addElement($element);
     $element = new Elements();
     $element->addReCaptcha($this);
     $element = new Zend_Form_Element_Submit('post');
     $element->setValue('提交')->removeDecorator('Label');
     $this->addElement($element);
     $this->addDisplayGroup(array('isBusiness', 'type', 'title', 'address', 'rent', 'currency', 'rent_measurement', 'start_date', 'stop_date', 'area', 'num_of_room', 'description', 'challenge', 'post'), 'aboutRoom');
     $this->getDisplayGroup('aboutRoom')->removeDecorator('DtDdWrapper');
 }
Пример #12
0
		function setForm()
		{
			$form=new Zend_Form;
			 
			$form->setMethod('post')->setAction('');
			
			$user_login = new Zend_Form_Element_Text('user_login');
			$user_login->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên đăng nhập không được để trống'));
			
			$user_pass = new Zend_Form_Element_Password('user_pass');
			$user_pass->setAttrib('renderPassword', true);
			$user_pass->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mật khẩu không được để trống'));
			
			$user_fullname = new Zend_Form_Element_Text('user_fullname');
			$user_fullname->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên người dùng không được để trống'));
			
			$user_email = new Zend_Form_Element_Text('user_email');
			$user_email->addValidator('EmailAddress',true,array('messages'=>'Địa chỉ email không hợp lệ'));
			$user_email->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Email không được để trống'));
			
			$user_address = new Zend_Form_Element_Text('user_address');
			$user_address->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Địa chỉ 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"));
			$is_active->setSeparator('');
			
			$user_login->removeDecorator('HtmlTag')->removeDecorator('Label');	
			$user_pass->removeDecorator('HtmlTag')->removeDecorator('Label');
			$user_fullname->removeDecorator('HtmlTag')->removeDecorator('Label');
			$user_email->removeDecorator('HtmlTag')->removeDecorator('Label');
			$user_address->removeDecorator('HtmlTag')->removeDecorator('Label');	
			$is_active->removeDecorator('HtmlTag')->removeDecorator('Label');
			
			$form->addElements(array($user_login,$user_pass,$user_fullname,$user_email,$user_address,$is_active));
			return $form;
		}
Пример #13
0
 /**
  * Defines and build an input field which is not a text field.
  * According to the parameter elem, it will set the element.
  *
  * $params['exclude']   => boolean; The column will not be built.<br />
  * $params['required '] => boolean;<br />
  * $params['elem']      => select, checkbox, radio, editor;<br />
  *                         If $params['elem'] = select, then the $params['src']<br />
  *                         parameter must be defined.
  * $params['src']       => string; name of the source for the element.<br />
  *
  * @param array $meta
  * @param array $params
  *
  * @return void
  */
 public function setElementInput(array $meta, array $params)
 {
     if (!empty($params)) {
         if (!isset($params['elem'])) {
             $params['elem'] = '';
         }
         $fieldId = $meta['COLUMN_NAME'];
         switch ($params['elem']) {
             case 'select':
                 if (empty($params['src'])) {
                     throw new Exception('Trying to build an element but no data source given');
                 }
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_Select($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId))->setAttrib('class', 'largeSelect')->addMultiOptions($this->_srcData);
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'checkbox':
                 $element = new Zend_Form_Element_Checkbox($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $this->_decoParams['class'] .= 'label_after_checkbox';
                 $this->_decoParams['labelPos'] = 'append';
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'radio':
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_Radio($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $element->setSeparator('')->addMultiOptions($this->_srcData);
                 $this->_decoParams['class'] .= 'radio radioInline';
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'hidden':
                 $element = new Zend_Form_Element_Hidden($fieldId);
                 $element->removeDecorator('Label');
                 $element->removeDecorator('DtDdWrapper');
                 break;
             case 'multiCheckbox':
                 if (empty($params['src'])) {
                     throw new Exception('Trying to build an element but no data source given');
                 }
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_MultiCheckbox($fieldId);
                 $element->addMultiOptions($this->_srcData);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $element->setAttrib('class', 'multicheckbox');
                 $element->setSeparator(' ');
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'multiSelect':
                 break;
             default:
                 $element = new Zend_Form_Element_Text($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId))->addFilter('StringTrim')->setAttrib('class', 'smallTextInput');
                 $element = $this->_setBasicDecorator($element);
                 break;
         }
         if (!empty($params['disabled'])) {
             $element->setAttrib('disabled', (bool) $params['disabled']);
         }
         $this->addElement($element);
     }
 }
Пример #14
0
 public function init()
 {
     $myNamespace = new Zend_Session_Namespace(Constant::USER_DATA);
     $searchData = $myNamespace->searchData;
     $this->setMethod('POST');
     $this->setName('searchForm');
     $element = new Zend_Form_Element_Radio('type');
     $element->addMultiOptions(array('all' => '全部', 'lease' => '供', 'want' => '求'));
     if (!empty($searchData[Constant::VAR_SEARCH_DATA_TYPE])) {
         $element->setValue($searchData[Constant::VAR_SEARCH_DATA_TYPE]);
     } else {
         $element->setValue('all');
     }
     $element->setSeparator('');
     $element->removeDecorator('Label');
     $this->addElement($element);
     //		$element = new Zend_Form_Element_Checkbox("search_business");
     //		$element->setValue(0);
     //		$this->addElement($element);
     $element = new Zend_Form_Element_Hidden('status');
     $element->setValue('active');
     $this->addElement($element);
     /*$element = new Zend_Form_Element_Text('rent');
     		$element->setLabel('租金');
     		$this->addElement($element);
     		
     		$element = new Zend_Form_Element_Radio('rent_measurement');
     		$element->setMultiOptions(
     			array(
     				'day' => '克朗每日',
     				'month' => '克朗每月'
     			)
     		);
     		$element->setSeparator('');
     		$element->removeDecorator('Label');
     		$element->setValue('month');
     		$this->addElement($element);*/
     $element = new Zend_Form_Element_Text(Constant::VAR_SEARCH_DATA_CHECKIN_DATE);
     $element->setLabel('入住日期');
     //$element->setDescription('例:2010-10-20');
     if (!empty($searchData[Constant::VAR_SEARCH_DATA_CHECKIN_DATE])) {
         $element->setValue($searchData[Constant::VAR_SEARCH_DATA_CHECKIN_DATE]);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text(Constant::VAR_SEARCH_DATA_CHECKOUT_DATE);
     $element->setLabel('搬出日期(留空为长期)');
     if (!empty($searchData[Constant::VAR_SEARCH_DATA_CHECKOUT_DATE]) && $searchData[Constant::VAR_SEARCH_DATA_CHECKOUT_DATE] != Constant::DEFAULT_CHECKOUT_DATE) {
         $element->setValue($searchData[Constant::VAR_SEARCH_DATA_CHECKOUT_DATE]);
     }
     $this->addElement($element);
     $element = new Zend_Form_Element_Text("keyword");
     $element->setLabel("关键字");
     //$element->setDescription("例:女生,lappis");
     if (!empty($searchData[Constant::VAR_SEARCH_DATA_KEYWORD])) {
         $element->setValue($searchData[Constant::VAR_SEARCH_DATA_KEYWORD]);
     }
     $this->addElement($element);
     //		$element = new Zend_Form_Element_Radio('sortedBy');
     //		$element->setLabel('排序');
     //		$element->addMultiOptions(array(
     //			'created' => '发帖时间',
     //			'rent' => '房租'
     //		));
     //		$element->setSeparator('');
     //		$element->setValue('created');
     //		$this->addElement($element);
     //
     //		$element = new Zend_Form_Element_Hidden('city');
     //		$element->setValue($this->city);
     //		$element->removeDecorator('Label');
     //		$this->addElement($element);
     $element = new Zend_Form_Element_Submit('search');
     $element->setValue('搜索');
     $element->removeDecorator('Label');
     $this->addElement($element);
 }
Пример #15
0
 /**
  * Faz o parse de um elemento <radio> para Zend_Form.
  * @param SimpleXMLElement $element
  */
 protected function parseRadio($element)
 {
     $form_element = new Zend_Form_Element_Radio((string) $element->id);
     $form_element->setSeparator("");
     $form_element->setLabel((string) $element->label);
     foreach ($element->option as $option) {
         $form_element->addMultiOption((string) $option->value, $option->label);
     }
     if (isset($element->value)) {
         $form_element->setValue($element->value);
     } else {
         if (isset($element->default)) {
             $form_element->setValue($element->default);
         }
     }
     return $form_element;
 }
Пример #16
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('consumer');
     $id = new Zend_Form_Element_Hidden('id');
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel($this->getView()->translate('CONTACT INFORMATION_EMAIL'))->setRequired(true)->setDescription('*')->setAttrib('readOnly', true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addErrorMessage($this->getView()->translate('Register_email_is_invalid'))->addValidator('EmailAddress');
     $email->setDecorators(array('ViewHelper', array('Description', array('color' => 'red', 'tag' => 'font')), 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $phone = new Zend_Form_Element_Text('phone');
     $phone->setLabel($this->getView()->translate('CONTACT INFORMATION_PHONE'))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 50))))->addErrorMessage($this->getView()->translate('Please_enter_your_phone'));
     $phone->setDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $login_phone = new Zend_Form_Element_Text('login_phone');
     $login_phone->setLabel($this->getView()->translate('CONTACT INFORMATION_PHONE'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('readOnly', true)->addValidators(array(array('StringLength', false, array(0, 50))))->addErrorMessage($this->getView()->translate('Please_enter_your_phone'));
     $login_phone->setDecorators(array('ViewHelper', array('Description', array('color' => 'red', 'tag' => 'font')), 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel($this->getView()->translate('CONTACT INFORMATION_NAME'))->setRequired(true)->setDescription('*')->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(1, 50))))->addErrorMessage($this->getView()->translate('Please_enter_your_name'));
     $name->setDecorators(array('ViewHelper', array('Description', array('color' => 'red', 'tag' => 'font')), 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $recipients_name = new Zend_Form_Element_Text('recipients_name');
     $recipients_name->setLabel($this->getView()->translate('CONTACT INFORMATION_RECIPIENTS_NAME'))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(1, 30))))->addErrorMessage($this->getView()->translate('Please_enter_your_recipients_name'));
     $recipients_name->setDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $address1 = new Zend_Form_Element_Text('address1');
     $address1->setLabel($this->getView()->translate('CONTACT INFORMATION_ADDRESS1'))->setAttribs(array('rows' => 3, 'cols' => 80))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 240))))->addErrorMessage($this->getView()->translate('Please_enter_your_address'));
     $address1->setDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $postalcode = new Zend_Form_Element_Text('postalcode');
     $postalcode->setLabel($this->getView()->translate('CONTACT POSTAL_CODE'))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 30))))->addErrorMessage($this->getView()->translate('Please_enter_your_postalcode'));
     $postalcode->setDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'input-area')), array('Label')));
     $birthdate = new Zend_Form_Element_Text('birthdate');
     $birthdate->setLabel($this->getView()->translate('CONTACT BIRTHDAY'))->setAttrib('readOnly', true)->addFilter('StripTags')->addFilter('StringTrim')->addErrorMessage($this->getView()->translate('Please_enter_your_birthdate'))->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'birthdate_value')), array('Label')));
     //
     $gender = new Zend_Form_Element_Radio('gender');
     $gender->setLabel($this->getView()->translate('Consumer_gender'))->addMultiOptions(array('0' => $this->getView()->translate('Consumer_gender_Female'), '1' => $this->getView()->translate('Consumer_gender_Male')))->setSeparator('&nbsp;&nbsp;')->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'gender_value')), array('Label')));
     //
     //		$birth_year = new Zend_Form_Element_Select('birth_year');
     //		$birth_year->setLabel($this->getView()->translate('Consumer_birth_year'));
     //		$birth_year->addMultiOption('', '');
     //		$birth_year->addMultiOption('<1960', $this->getView()->translate('Consumer_birth_year_Before 1960'));
     //		for($i = 1960; $i<=1995; $i++){
     //			$birth_year->addMultiOption($i, $i);
     //		}
     //		$birth_year->addMultiOption('>1995', $this->getView()->translate('Consumer_birth_year_After 1995'));
     //
     $profession = new Zend_Form_Element_Select('profession');
     $profession->setLabel($this->getView()->translate('Consumer_profession'))->addMultiOptions(array('' => '', 'Student' => $this->getView()->translate('Consumer_profession_Student'), 'Education' => $this->getView()->translate('Consumer_profession_Education'), 'Freelancers' => $this->getView()->translate('Consumer_profession_Freelancers'), 'Housewife/Retirement' => $this->getView()->translate('Consumer_profession_Housewife/Retirement'), 'Manufacturing/Operating' => $this->getView()->translate('Consumer_profession_Manufacturing/Operating'), 'Construction' => $this->getView()->translate('Consumer_profession_Construction'), 'Art/Design' => $this->getView()->translate('Consumer_profession_Art/Design'), 'Advertising/Marketing' => $this->getView()->translate('Consumer_profession_Advertising/Marketing'), 'Finance/Banking' => $this->getView()->translate('Consumer_profession_Finance/Banking'), 'IT/Electronics Industry' => $this->getView()->translate('Consumer_profession_IT/Electronics Industry'), 'Service Industry' => $this->getView()->translate('Consumer_profession_Service Industry'), 'Financial Accounting' => $this->getView()->translate('Consumer_profession_Financial Accounting'), 'Servant/Interpreter' => $this->getView()->translate('Consumer_profession_Servant/Interpreter'), 'HR/Administration' => $this->getView()->translate('Consumer_profession_HR/Administration'), 'Medical treatment' => $this->getView()->translate('Consumer_profession_Medical treatment'), 'Consulting/Lawyer' => $this->getView()->translate('Consumer_profession_Consulting/Lawyer'), 'Marketing' => $this->getView()->translate('Consumer_profession_Marketing'), 'Purchasing/Distributing' => $this->getView()->translate('Consumer_profession_Purchasing/Distributing'), 'Biology/Pharmacy' => $this->getView()->translate('Consumer_profession_Biology/Pharmacy'), 'Supporting' => $this->getView()->translate('Consumer_profession_Supporting'), 'Other' => $this->getView()->translate('Consumer_profession_Other')))->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'profession_value')), array('Label')));
     //
     $education = new Zend_Form_Element_Select('education');
     $education->setLabel($this->getView()->translate('Consumer_education'))->addMultiOptions(array('' => '', 'High-School' => $this->getView()->translate('Consumer_education_High-School'), 'Junior college' => $this->getView()->translate('Consumer_education_Junior_college'), 'Bachelor' => $this->getView()->translate('Consumer_education_Bachelor'), 'Master' => $this->getView()->translate('Consumer_education_Master'), 'Doctorate' => $this->getView()->translate('Consumer_education_Doctorate'), 'Other' => $this->getView()->translate('Consumer_education_Other')))->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'education_value')), array('Label')));
     //
     $have_children = new Zend_Form_Element_Radio('have_children');
     $have_children->setLabel($this->getView()->translate('Consumer_have_children'))->addMultiOptions(array('0' => $this->getView()->translate('No'), '1' => $this->getView()->translate('Yes')))->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'have_children_value')), array('Label')));
     $have_children->setSeparator('&nbsp;');
     //
     $children_birth_year = new Zend_Form_Element_Select('children_birth_year');
     $children_birth_year->setLabel($this->getView()->translate('Consumer_children_birth_year'));
     $children_birth_year->addMultiOption('', '');
     $children_birth_year->addMultiOption('<1980', $this->getView()->translate('Consumer_children_birth_year_Before 1980'));
     for ($i = 1980; $i <= 2010; $i++) {
         $children_birth_year->addMultiOption($i, $i);
     }
     $children_birth_year->addMultiOption('>2010', $this->getView()->translate('Consumer_children_birth_year_After 2010'))->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'children_birth_year_value')), array('Label')));
     //
     $income = new Zend_Form_Element_Select('income');
     $income->setLabel($this->getView()->translate('Consumer_income_level_per_month'));
     $income->addMultiOption('', '');
     for ($i = 0; $i < 20000; $i = $i + 2000) {
         $income->addMultiOption($i . "-" . ($i + 2000), $i . "-" . ($i + 2000));
     }
     $income->addMultiOption('>20000', '>20000')->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'income_value')), array('Label')));
     //
     $online_shopping = new Zend_Form_Element_Radio('online_shopping');
     $online_shopping->setLabel($this->getView()->translate('Consumer_do_your_often_go_shopping_online'))->addMultiOptions(array('Once a week or more' => $this->getView()->translate('Consumer_do_your_often_go_shopping_online_Once a week or more'), 'Once a month or more' => $this->getView()->translate('Consumer_do_your_often_go_shopping_online_Once a month or more'), 'Less then once a month' => $this->getView()->translate('Consumer_do_your_often_go_shopping_online_Less then once a month'), 'Never' => $this->getView()->translate('Consumer_do_your_often_go_shopping_online_Never')))->setSeparator('')->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area', 'id' => 'onlineShopping_value')), array('Label')));
     //
     $use_extra_bonus_for = new Zend_Form_Element_MultiCheckbox('use_extra_bonus_for');
     $use_extra_bonus_for->setLabel($this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for'))->addMultiOptions(array('Traveling' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Traveling'), 'House ware' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_House ware'), 'Further education' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Further education'), 'Clothes and shoes' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Clothes and shoes'), 'Electronic products' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Electronic products'), 'Good food' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Good food'), 'Luxury' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Luxury'), 'Skin care products' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Skin care products'), 'Gym and yoga' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Gym and yoga'), 'Party' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_High-level party'), 'Investment and stock' => $this->getView()->translate('Consumer_What_will_you_use_extra_bouns_for_Investment and stock')))->setSeparator('');
     $use_extra_bonus_for->addDecorators(array(array('HtmlTag', array('tag' => 'div', 'class' => 'info_value input-area multi-lines form-multi-options', 'id' => 'bonus_value')), array('Label')));
     //
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($this->getView()->translate('CONTACT INFORMATION_EDIT'))->setAttrib('id', 'edit');
     $this->addElements(array($id, $email, $login_phone, $name, $recipients_name, $phone, $address1, $postalcode, $birthdate, $gender, $profession, $education, $have_children, $children_birth_year, $income, $online_shopping, $use_extra_bonus_for, $submit));
 }
 /**
  * Get Radio Option
  * @param string $id
  * @param array $option
  * @param string $value
  * @return Zend_Form_Element_Radio
  */
 public function getRadios($id, $option, $value = '', $elementequired = false)
 {
     $element = new Zend_Form_Element_Radio($id);
     $element->addMultiOptions($option);
     $element->removeDecorator('HtmlTag');
     $element->removeDecorator('DtDdWrapper');
     $element->removeDecorator('Label');
     $element->setSeparator('<br/>');
     if ($value !== '') {
         $element->setValue($value);
     }
     if ($elementequired) {
         $element->setAttribs(array('class' => 'validate[required] radio'));
     }
     return $element;
 }