本文整理汇总了PHP中Zend_Form_Element_Radio::setSeparator方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Radio::setSeparator方法的具体用法?PHP Zend_Form_Element_Radio::setSeparator怎么用?PHP Zend_Form_Element_Radio::setSeparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Radio
的用法示例。
在下文中一共展示了Zend_Form_Element_Radio::setSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFormElement
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: init
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: init
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: __construct
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: init
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: testRenderWithListSeparatorForRadio
/**
* @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: init
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: init
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: init
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: init
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'));
}
示例11: init
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');
//.........这里部分代码省略.........
示例12: setForm
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: setElementInput
/**
* 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: init
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: parseRadio
/**
* 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;
}