本文整理汇总了PHP中Zend_Form_Element_Button::addDecorators方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Button::addDecorators方法的具体用法?PHP Zend_Form_Element_Button::addDecorators怎么用?PHP Zend_Form_Element_Button::addDecorators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Button
的用法示例。
在下文中一共展示了Zend_Form_Element_Button::addDecorators方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
//.........这里部分代码省略.........
$account->setLabel($this->getView()->getCibleText('form_label_account'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setOrder(8)->setAttribs(array('class' => 'stdTextInput'))->setAttrib('tabindex', '8')->setDecorators(array('ViewHelper', 'Errors', array(array('row' => 'HtmlTag'), array('tag' => 'dd')), array('label', array('class' => 'test', 'tag' => 'dt', 'tagClass' => 'alignVertical'))));
// Text Subscribe
$textSubscribe = $this->getView()->getCibleText('form_label_subscribe');
$textSubscribe = str_replace('%URL_PRIVACY_POLICY%', Cible_FunctionsPages::getPageLinkByID($this->_config->privacyPolicy->pageId), $textSubscribe);
// Newsletter subscription
$newsletterSubscription = new Zend_Form_Element_Checkbox('newsletterSubscription');
$newsletterSubscription->setLabel($textSubscribe);
if ($this->_mode == 'add') {
$newsletterSubscription->setChecked(1);
}
$newsletterSubscription->setAttrib('class', 'long-text');
$newsletterSubscription->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'subscribeNewsletter', 'class' => 'label_after_checkbox'))));
if ($this->_mode == 'add') {
$termsAgreement = new Zend_Form_Element_Checkbox('termsAgreement');
$termsAgreement->setLabel(str_replace('%URL_TERMS_CONDITIONS%', Cible_FunctionsPages::getPageLinkByID($this->_config->termsAndConditions->pageId), $this->getView()->getClientText('form_label_terms_agreement')));
$termsAgreement->setAttrib('class', 'long-text');
$termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
$termsAgreement->setRequired(true);
$termsAgreement->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'You must agree to the terms')));
} else {
$termsAgreement = new Zend_Form_Element_Hidden('termsAgreement', array('value' => 1));
}
// Submit button
$submit = new Zend_Form_Element_Submit('submit');
$submitLabel = $this->getView()->getCibleText('form_account_button_submit');
if ($this->_mode == 'edit') {
$submitLabel = $this->getView()->getCibleText('button_submit');
}
$submit->setLabel($submitLabel)->setAttrib('class', 'stdButton subscribeButton1-' . Zend_Registry::get("languageSuffix"));
// Captcha
// Refresh button
$refresh_captcha = new Zend_Form_Element_Button('refresh_captcha');
$refresh_captcha->setLabel($this->getView()->getCibleText('button_refresh_captcha'))->setAttrib('onclick', "refreshCaptcha('captcha-id')")->setAttrib('class', 'stdButton')->removeDecorator('Label')->removeDecorator('DtDdWrapper');
$refresh_captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd-refresh-captcha-button'))));
$captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->getView()->getCibleText('form_label_securityCaptcha'), 'captcha' => 'Image', 'captchaOptions' => array('captcha' => 'Word', 'wordLen' => 5, 'fontSize' => 28, 'height' => 67, 'width' => 169, 'timeout' => 300, 'dotNoiseLevel' => 0, 'lineNoiseLevel' => 0, 'font' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/fonts/ARIAL.TTF", 'imgDir' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/tmp", 'imgUrl' => "{$baseDir}/captcha/tmp")));
$captcha->setAttrib('class', 'stdTextInputCatcha');
$captcha->setRequired(true);
$captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'dd_captcha'))))->addDecorator('Label', array('class' => 'clear'));
$french = array('badCaptcha' => 'Veuillez saisir la chaîne ci-dessus correctement.');
$english = array('badCaptcha' => 'Captcha value is wrong');
$translate = new Zend_Translate('array', $french, 'fr');
$this->setTranslator($translate);
$this->getView()->jQuery()->enable();
$script = <<<EOS
function refreshCaptcha(id){
\$.getJSON('{$this->getView()->baseUrl()}/newsletter/index/captcha-reload',
function(data){
\$("dd#dd_captcha img").attr({src : data['url']});
\$("#"+id).attr({value: data['id']});
});
}
EOS;
$this->getView()->headScript()->appendScript($script);
// Captcha
/* Identification sub form */
$identificationSub = new Cible_Form_SubForm();
$identificationSub->setName('identification')->removeDecorator('DtDdWrapper');
$identificationSub->setLegend($this->getView()->getCibleText('form_account_subform_identification_legend'));
$identificationSub->setAttrib('class', 'identificationClass subFormClass');
$identificationSub->addElement($languages);
$identificationSub->addElement($salutation);
$identificationSub->addElement($lastname);
示例2: _addCaptcha
private function _addCaptcha()
{
$this->_hasCaptcha = true;
// Captcha
$captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->getView()->getCibleText('form_label_explain_captcha'), 'captcha' => 'Image', 'captchaOptions' => array('captcha' => 'Word', 'wordLen' => 6, 'dotNoiseLevel' => 0, 'lineNoiseLevel' => 0, 'fontSize' => 18, 'height' => 50, 'width' => 150, 'timeout' => 300, 'font' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/fonts/ARIAL.TTF", 'imgDir' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/tmp", 'imgUrl' => $this->_baseDir . "/captcha/tmp")));
$captcha->setAttrib('class', 'stdTextInputCaptcha');
$captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'dd_captcha'))));
$this->addElement($captcha);
// Refresh button
$refresh_captcha = new Zend_Form_Element_Button('refresh_captcha');
//$refresh_captcha->setLabel($this->getView()->getCibleText('button_refresh_captcha'))
$refresh_captcha->setLabel('')->setAttrib('onclick', "refreshCaptcha('captcha-id')")->setAttrib('class', 'refreshCaptchaButton-' . Zend_Registry::get("languageSuffix"))->removeDecorator('Label')->removeDecorator('DtDdWrapper');
$refresh_captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd'))));
$this->addElement($refresh_captcha);
// Required fields label
/*$requiredFields = new Zend_Form_Element_Hidden('RequiredFields');
$requiredFields->setLabel('<span class="field_required">*</span> ' . $this->getView()->getCibleText('form_field_required_label'));
$this->addElement($requiredFields);*/
$captchaError = array('badCaptcha' => $this->getView()->getCibleText('form_validation_message_captcha_error'));
$translate = new Zend_Translate('array', $captchaError, $this->getView()->registryGet('languageSuffix'));
$this->setTranslator($translate);
$this->_setRefreshCaptchaJs();
}
示例3: __construct
public function __construct($options = null)
{
$this->_disabledDefaultActions = true;
parent::__construct($options);
$baseDir = $this->getView()->baseUrl();
$this->getView()->jQuery()->addJavascriptFile("{$this->getView()->baseUrl()}/js/jquery/jquery.maskedinput-1.2.2.min.js");
$script1 = <<<EOS
\$('.phone_format').mask('(999) 999-9999? x99999');
\$('.postalCode_format').mask('a9a 9a9');
\$('.birthDate_format').mask('9999-99-99');
EOS;
$this->getView()->headScript()->appendScript($script1);
$script2 = <<<EOS
function refreshCaptcha(id){
\$.getJSON('{$this->getView()->baseUrl()}/forms/index/captcha-reload',
function(data){
\$("dd#dd_captcha img").attr({src : data['url']});
\$("#"+id).attr({value: data['id']});
});
}
EOS;
$this->getView()->headScript()->appendScript($script2);
// name
$name = new Zend_Form_Element_Text('name');
$name->setLabel($this->getView()->getCibleText('forms_label_name'))->setAttrib('class', 'stdTextInput');
// enterprise
$enterprise = new Zend_Form_Element_Text('prenom');
$enterprise->setLabel($this->getView()->getCibleText('forms_label_surname'))->setAttrib('class', 'stdTextInput');
// email
$email = new Zend_Form_Element_Text('email');
$email->setLabel($this->getView()->getClientText('forms_become_partner_label_email'))->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_field_required'))))->addValidator('EmailAddress', true, array('messages' => Cible_Translation::getCibleText('validation_message_emailAddressInvalid')))->setRequired(true)->setAttrib('class', 'stdTextInput');
// Commentaires
$commentaire = new Zend_Form_Element_Textarea('commentaire');
$commentaire->setLabel($this->getView()->getCibleText('form_label_comments'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextarea');
$this->addElement($enterprise);
$this->addElement($name);
$this->addElement($email);
$this->addElement($commentaire);
// Captcha
$captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->getView()->getCibleText('newsletter_captcha_label'), 'captcha' => 'Image', 'captchaOptions' => array('captcha' => 'Word', 'wordLen' => 6, 'height' => 50, 'width' => 150, 'timeout' => 600, 'dotNoiseLevel' => 0, 'lineNoiseLevel' => 0, 'font' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/fonts/ARIAL.TTF", 'imgDir' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/tmp", 'imgUrl' => "{$baseDir}/captcha/tmp")));
$captcha->setAttrib('class', 'mediumTextInput');
$captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'dd_captcha'))));
$this->addElement($captcha);
$french = array('badCaptcha' => 'Veuillez saisir la chaîne ci-dessus correctement.');
$english = array('badCaptcha' => 'Captcha value is wrong');
$translate = new Zend_Translate('array', $french, 'fr');
$this->setTranslator($translate);
$this->getView()->jQuery()->enable();
// Refresh button
$refresh_captcha = new Zend_Form_Element_Button('refresh_captcha');
$refresh_captcha->setLabel($this->getView()->getCibleText('button_captcha_refresh'))->setAttrib('onclick', "refreshCaptcha('captcha[id]')")->setAttrib('class', 'grayish-button')->removeDecorator('Label')->removeDecorator('DtDdWrapper');
$refresh_captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd'))));
$this->addElement($refresh_captcha);
// Submit button
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel($this->getView()->getCibleText('button_submit'))->setAttrib('class', 'grayish-button')->removeDecorator('DtDdWrapper');
$submit->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true))));
$this->addElement($submit);
}