当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_Element_Checkbox::setDescription方法代码示例

本文整理汇总了PHP中Zend_Form_Element_Checkbox::setDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Checkbox::setDescription方法的具体用法?PHP Zend_Form_Element_Checkbox::setDescription怎么用?PHP Zend_Form_Element_Checkbox::setDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_Element_Checkbox的用法示例。


在下文中一共展示了Zend_Form_Element_Checkbox::setDescription方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderFormElement

 public function renderFormElement()
 {
     $elm = new Zend_Form_Element_Checkbox($this->getName(), array('label' => $this->getLabel() . ':'));
     $elm->setDescription($this->getDescription());
     $elm->setValue($this->getValue());
     $elm->setRequired($this->getRequired());
     return $elm;
 }
开发者ID:ncsuwebdev,项目名称:otframework,代码行数:8,代码来源:Checkbox.php

示例2: parseBoolean

 /**
  * Faz o parse de um campo <boolean>
  * @param SimpleXMLElement $element
  */
 protected function parseBoolean($element)
 {
     $form_element = new Zend_Form_Element_Checkbox((string) $element->id);
     $form_element->setLabel((string) $element->label);
     $form_element->setDescription("Habilitar");
     if (isset($element->value) && $element->value == "true") {
         $form_element->setAttrib('checked', 'checked');
     } else {
         if (isset($element->default) && $element->default == "true") {
             $form_element->setAttrib('checked', 'checked');
         }
     }
     return $form_element;
 }
开发者ID:rootzig,项目名称:SNEP,代码行数:18,代码来源:ActionConfig.php

示例3: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $this->removeDecorator('DtDdWrapper');
     $this->setName('register_form');
     $this->setAttrib('id', 'register_form');
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $this->addElementPrefixPath('Oibs_Validators', 'OIBS/Validators/', 'validate');
     $city = new Zend_Form_Element_Text('city');
     $city->setLabel($translate->_("account-register-city"))->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), array('Regex', true, array('/^[\\p{L}0-9.\\- ]*$/'))))->setDecorators(array('RegistrationDecorator'));
     $mailvalid = new Zend_Validate_EmailAddress();
     $mailvalid->setMessage('email-invalid', Zend_Validate_EmailAddress::INVALID);
     $mailvalid->setMessage('email-invalid-hostname', Zend_Validate_EmailAddress::INVALID_HOSTNAME);
     $mailvalid->setMessage('email-invalid-mx-record', Zend_Validate_EmailAddress::INVALID_MX_RECORD);
     $mailvalid->setMessage('email-dot-atom', Zend_Validate_EmailAddress::DOT_ATOM);
     $mailvalid->setMessage('email-quoted-string', Zend_Validate_EmailAddress::QUOTED_STRING);
     $mailvalid->setMessage('email-invalid-local-part', Zend_Validate_EmailAddress::INVALID_LOCAL_PART);
     $mailvalid->setMessage('email-length-exceeded', Zend_Validate_EmailAddress::LENGTH_EXCEEDED);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-hostname', Zend_Validate_Hostname::INVALID_HOSTNAME);
     $mailvalid->hostnameValidator->setMessage('hostname-local-name-not-allowed', Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED);
     $mailvalid->hostnameValidator->setMessage('hostname-unknown-tld', Zend_Validate_Hostname::UNKNOWN_TLD);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-local-name', Zend_Validate_Hostname::INVALID_LOCAL_NAME);
     $mailvalid->hostnameValidator->setMessage('hostname-undecipherable-tld', Zend_Validate_Hostname::UNDECIPHERABLE_TLD);
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel($translate->_("account-register-email"))->setRequired(true)->addFilter('StringtoLower')->addValidators(array($mailvalid))->addErrorMessage('email-invalid')->setDecorators(array('RegistrationDecorator'));
     $e_options = array("" => "account-select", "private_sector" => "account-register_private_sector", "public_sector" => "account-register_public_sector", "education_sector" => "account-register_education_sector", "student" => "account-register_student", "pentioner" => "account-register_pentioner", "other" => "account-register_other");
     $employment = new Zend_Form_Element_Select('employment');
     $employment->setLabel($translate->_("account-register-employment"))->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty')))))->addMultiOptions($e_options)->setDecorators(array('RegistrationDecorator'));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel($translate->_("account-register-username"))->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), array('StringLength', false, array(4, 16, 'messages' => array('stringLengthTooShort' => 'field-too-short', 'stringLengthTooLong' => 'field-too-long'))), new Oibs_Validators_UsernameExists('username'), new Oibs_Validators_Username('username')))->setDecorators(array('RegistrationDecorator'));
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel($translate->_("account-register-password"));
     $password->setRequired(true);
     $password->addValidators(array(new Oibs_Validators_RepeatValidator('confirm_password'), array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), array('StringLength', false, array(4, 16, 'messages' => array('stringLengthTooShort' => 'field-too-short', 'stringLengthTooLong' => 'field-too-long')))));
     $password->setDecorators(array('RegistrationDecorator'));
     $confirm_password = new Zend_Form_Element_Password('confirm_password');
     $confirm_password->setLabel($translate->_("account-register-password_confirm"));
     $confirm_password->setRequired(true);
     $confirm_password->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty')));
     $confirm_password->addValidator('StringLength', false, array(4, 16, 'messages' => array('stringLengthTooShort' => 'field-too-short', 'stringLengthTooLong' => 'field-too-long')));
     $confirm_password->setDecorators(array('RegistrationDecorator'));
     $captcha = new Zend_Form_Element('captcha');
     $captcha->setDecorators(array('CaptchaDecorator'));
     $captcha_text = new Zend_Form_Element_Text('captcha_text');
     $captcha_text->setLabel($translate->_("account-register-enter_text"))->addValidators(array(new Oibs_Validators_CaptchaValidator(), array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty')))))->setRequired(true)->setDecorators(array('RegistrationDecorator'));
     $text = sprintf($translate->_("account-register-terms_and_privacy"), "terms", "privacy");
     // this solution sucks. the codes are in the translate block directly.
     // anyone think of a fix to move codes out of there?
     // - Joel
     $terms = new Zend_Form_Element_Checkbox('terms');
     $terms->setDescription($text)->setLabel("account-register-terms")->setChecked(false)->setRequired(true)->addValidators(array(new Oibs_Validators_CheckboxValidator()))->setDecorators(array('RegistrationTermsDecorator'));
     // checkboxes always have a value of 1or0, this is a "feature" in ZF
     // custom validator is a workaround
     // -Joel
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($translate->_("account-register-submit"))->removeDecorator('DtDdWrapper')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registration_submit_div'))))->setAttrib('class', 'registration_form_submit_' . $translate->getLocale());
     $this->addElements(array($username, $password, $confirm_password, $city, $email, $employment, $captcha, $captcha_text, $terms, $submit));
     /*$this->addDisplayGroup(array('username', 'password', 'confirm_password'), 'account_information');
       $this->account_information->setLegend('register-account-information');
       $this->account_information->removeDecorator('DtDdWrapper');
       $this->addDisplayGroup(array('city', 'email', 'employment'), 'personal_information');
       $this->personal_information->removeDecorator('DtDdWrapper');
       $this->personal_information->setLegend('register-personal-information');
       
       $this->addDisplayGroup(array('captcha', 'captcha_text', 'terms', 'submit'), 'confirmations');
       $this->confirmations->removeDecorator('DtDdWrapper');
       $this->confirmations->setLegend('register-confirmations');*/
 }
开发者ID:jannev,项目名称:site,代码行数:69,代码来源:RegistrationForm.php

示例4: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'registerInfo');
     $firstName = new Zend_Form_Element_Text('firstName');
     $firstName->setAttrib('autocomplete', 'off');
     $firstName->setAttrib('maxlength', '55');
     $firstName->setLabel('First Name' . '*');
     $firstName->addFilter('StripTags');
     $firstName->addFilter('HtmlEntities');
     $firstName->addFilter('StringTrim');
     $firstName->setRequired(true)->addErrorMessage('Required Field');
     $firstName->addValidator('Regex', true, array('/^[a-zA-Z0-9.-\\s]*$/'))->addErrorMessage('Invalid characters used');
     $firstName->addValidator('StringLength', true, array(1, 95))->addErrorMessage('Invalid Length');
     $lastName = new Zend_Form_Element_Text('lastName');
     $lastName->setAttrib('autocomplete', 'off');
     $lastName->setAttrib('maxlength', '55');
     $lastName->setLabel('Last Name' . '*');
     $lastName->addFilter('StripTags');
     $lastName->addFilter('HtmlEntities');
     $lastName->addFilter('StringTrim');
     $lastName->setRequired(true)->addErrorMessage('Required Field');
     $lastName->addValidator('Regex', true, array('/^[a-zA-Z0-9.,:-\\s]*$/'))->addErrorMessage('Invalid characters used');
     $telephone = new Zend_Form_Element_Text('telephone');
     $telephone->setAttrib('autocomplete', 'off');
     $telephone->setAttrib('maxlength', '15');
     $telephone->setLabel('Telephone' . '*');
     $telephone->addFilter('StripTags');
     $telephone->addFilter('HtmlEntities');
     $telephone->addFilter('StringTrim');
     $telephone->setRequired(true)->addErrorMessage('Required Field');
     $telephone->addValidator('Regex', true, array('/^[0-9.+\\s]*$/'))->addErrorMessage('Invalid characters used');
     $email = new Zend_Form_Element_Text('emailRegister');
     $email->setAttrib('autocomplete', 'off');
     $email->setLabel('Email' . '*');
     $email->addFilter('StripTags');
     $email->addFilter('HtmlEntities');
     $email->addFilter('StringTrim');
     $email->setRequired(true)->addErrorMessage('Required');
     $email->addValidator('EmailAddress')->addErrorMessage('Invalid Email used');
     $email->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
     $password = new Zend_Form_Element_Password('passwordRegister');
     $password->setAttrib('autocomplete', 'off');
     $password->setLabel('Password*');
     $password->addFilter('StripTags');
     $password->addFilter('HtmlEntities');
     $password->addFilter('StringTrim');
     $password->setRequired(true)->addErrorMessage('Password Required');
     $password->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
     $driverCheck = new Zend_Form_Element_Checkbox('driverCheck');
     $driverCheck->setDescription('Driver');
     $driverCheck->setUncheckedValue(0);
     $carModel = new Zend_Form_Element_Text('carModel');
     $carModel->setAttrib('autocomplete', 'off');
     $carModel->setAttrib('maxlength', '55');
     $carModel->setLabel('Car Model' . '*');
     $carModel->addFilter('StripTags');
     $carModel->addFilter('HtmlEntities');
     $carModel->addFilter('StringTrim');
     $carModel->addValidator('Regex', true, array('/^[a-zA-Z0-9.,:-\\s]*$/'))->addErrorMessage('Invalid characters used');
     $carMake = new Zend_Form_Element_Text('carMake');
     $carMake->setAttrib('autocomplete', 'off');
     $carMake->setAttrib('maxlength', '55');
     $carMake->setLabel('Car Make' . '*');
     $carMake->addFilter('StripTags');
     $carMake->addFilter('HtmlEntities');
     $carMake->addFilter('StringTrim');
     $carMake->addValidator('Regex', true, array('/^[a-zA-Z0-9.,:-\\s]*$/'))->addErrorMessage('Invalid characters used');
     $driverLicense = new Zend_Form_Element_Text('driverLicense');
     $driverLicense->setAttrib('autocomplete', 'off');
     $driverLicense->setAttrib('readonly', 'readonly');
     $driverLicense->setAttrib('maxlength', '10');
     $driverLicense->setLabel('Driver License Since' . '*');
     $driverLicense->addFilter('StripTags');
     $driverLicense->addFilter('HtmlEntities');
     $driverLicense->addFilter('StringTrim');
     $driverLicense->addValidator('Regex', true, array('/^[0-9.\\s]*$/'))->addErrorMessage('Invalid characters used');
     $this->addElements(array($firstName, $lastName, $telephone, $email, $password, $driverCheck, $carModel, $carMake, $driverLicense));
     $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors'));
     $this->setDecorators(array('FormElements', 'Form', array('HtmlTag', array('tag' => 'div', 'id' => 'registerFormContainer'))));
     $driverCheck->setDecorators(array('ViewHelper', array('Description', array('placement' => Zend_Form_Decorator_Abstract::APPEND, 'tag' => 'em', 'class' => 'activeCheck')), array('HtmlTag', array('tag' => 'div', 'id' => 'driverCheckBox'))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Register');
     $submit->setAttrib('class', 'btn btn-success pull-right');
     $submit->setAttrib('id', 'submitUser');
     $this->addElement($submit);
     $submit->setDecorators(array('ViewHelper'));
 }
开发者ID:bogdanmatra,项目名称:ibm-hackathon,代码行数:88,代码来源:Registration.php


注:本文中的Zend_Form_Element_Checkbox::setDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。