本文整理汇总了PHP中Zend_Form_Element_Text::addDecorator方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Text::addDecorator方法的具体用法?PHP Zend_Form_Element_Text::addDecorator怎么用?PHP Zend_Form_Element_Text::addDecorator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Text
的用法示例。
在下文中一共展示了Zend_Form_Element_Text::addDecorator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFormLogin
private function getFormLogin()
{
$form = new Zend_Form(array('disableLoadDefaultDecorators' => true));
$email = new Zend_Form_Element_Text('login', array('disableLoadDefaultDecorators' => true));
$email->addDecorator('ViewHelper');
$email->addDecorator('Errors');
$email->setRequired(true);
$email->setAttrib('class', 'form-control');
$email->setAttrib('placeholder', 'Login');
$email->setAttrib('required', 'required');
$email->setAttrib('autofocus', 'autofocus');
$password = new Zend_Form_Element_Password('password', array('disableLoadDefaultDecorators' => true));
$password->addDecorator('ViewHelper');
$password->addDecorator('Errors');
$password->setRequired(true);
$password->setAttrib('class', 'form-control');
$password->setAttrib('placeholder', 'Hasło');
$password->setAttrib('required', 'required');
$password->setAttrib('autofocus', 'autofocus');
$submit = new Zend_Form_Element_Submit('submit', array('disableLoadDefaultDecorators' => true));
$submit->setAttrib('class', 'btn btn-lg btn-primary btn-block');
$submit->setOptions(array('label' => 'Zaloguj'));
$submit->addDecorator('ViewHelper')->addDecorator('Errors');
$form->addElement($email)->addElement($password)->addElement($submit);
return $form;
}
示例2: init
public function init()
{
// Set the method for the display form to POST
$this->setMethod('post');
$this->setAttribs(array('class' => 'form-horizontal'));
$decoratorField = new My_Decorator_FieldLogin();
$elements = array();
// Add email field
$input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email'));
$validator = new Zend_Validate_EmailAddress();
$validator->setOptions(array('domain' => false));
$input->addValidators(array($validator, new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add password field
$input = new Zend_Form_Element_Password('password', array('required' => true, 'label' => 'Password:', 'id' => 'password', 'class' => 'form-control', 'placeholder' => 'Your password..'));
$input->addValidators(array(new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add checkbox field
$input = new Zend_Form_Element_Checkbox('rememberMe', array('label' => 'Remember me', 'id' => 'rememberMe', 'class' => 'checkbox', 'type' => 'checkbox'));
$decoratorCheckBox = new My_Decorator_CheckBox();
$input->addDecorator($decoratorCheckBox);
$elements[] = $input;
$input = new Zend_Form_Element('resetpass', array('label' => 'Reset your password', 'id' => 'resetpass', 'class' => 'form-control', 'value' => 'resetpass'));
$input->addDecorator(new My_Decorator_AnchoraForm());
$elements[] = $input;
//Add Submit button
$input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'Login'));
$input->addDecorator($decoratorField);
$elements[] = $input;
$this->addElements($elements);
$this->addDisplayGroup(array('email', 'password', 'resetpass', 'rememberMe', 'submit'), 'displgrp', array('decorators' => array('FormElements', 'Fieldset')));
}
示例3: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('class', 'col-md-9');
$decoratorField = new My_Decorator_Field();
$elements = array();
//render our form elements and the "form" tag
$this->setDecorators(array('FormElements', 'Form'));
$this->setElementDecorators(array('ViewHelper', 'Label'));
// Add Quantity field
$input = new Zend_Form_Element_Text('quantity', array('required' => true, 'class' => '"col-md-6"', 'min' => self::MIN, 'max' => self::MAX, 'step' => '1', 'type' => 'number'));
$min = new Zend_Validate_LessThan(self::MAX + 1);
$max = new Zend_Validate_GreaterThan(self::MIN);
$input->addValidators(array(new Zend_Validate_Float(), $min, $max, new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
//Add id hidden field
$input = new Zend_Form_Element_Hidden('product_id');
$min = new Zend_Validate_GreaterThan(self::MIN);
$input->addValidators(array(new Zend_Validate_Digits(), $min, new Zend_Validate_NotEmpty()));
$input->removeDecorator('HtmlTag');
$input->removeDecorator('Label');
$elements[] = $input;
$this->addElements($elements);
}
示例4: replyForm
/**
* Build replyForm
*
* @return void
*/
protected function replyForm()
{
$this->setName('replyForm')->setElementsBelongTo('replyForm');
$element = new Zend_Form_Element_Text('subject', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setAttribs(array('class' => 'input-title', 'maxlength' => 126, 'tabindex' => 1))->addFilter('StripTags')->addFilter('StringTrim');
$this->addElement($element);
$element = new Zend_Form_Element_Textarea('body', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setRequired(true)->addErrorMessage('Message cannot be empty!')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
$this->addElement($element);
$element = new Zend_Form_Element_Hash('token', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->addErrorMessage('Form must not be resubmitted');
$this->addElement($element);
$element = new Zend_Form_Element_Submit('replySubmit', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setLabel('Post Reply');
$this->addElement($element);
$element = new Zend_Form_Element_Reset('reset', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setLabel('Reset');
$this->addElement($element);
$this->clearDecorators();
$this->addDecorator('FormElements')->addDecorator('Form');
/*
$this->setName('replyForm')
->setElementsBelongTo('replyForm')
->setMethod('post')
->setEnctype('application/x-www-form-urlencoded');
$subject = new Zend_Form_Element_Text('subject');
$subject->setLabel('Post Subject')
->setAttribs(array('class' => 'input-title', 'maxlength' => 126))
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty');
$message = new Zend_Form_Element_Textarea('message');
$message->setLabel('Your Message')
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty');
$posthash = new Zend_Form_Element_Hash('token');
$submit = new Zend_Form_Element_Submit('forumSubmit');
$submit->setLabel('Post Reply');
$this->addElements(array($subject, $message, $posthash, $submit));
*/
}
示例5: init
public function init()
{
// Set the method for the display form to POST
$this->setMethod('post');
$this->setAttribs(array('class' => 'form-horizontal'));
$decoratorField = new My_Decorator_Field();
$elements = array();
// Add name field
$input = new Zend_Form_Element_Text('host', array('required' => true, 'label' => 'SMTP Host:', 'id' => 'host', 'placeholder' => 'Type something..', 'class' => 'form-control', 'value' => 'smtp.gmail.com'));
$input->addValidators(array(new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add category field
$select = new Zend_Form_Element_Select('stype', array('required' => true, 'label' => 'Security:', 'id' => 'stype', 'class' => 'form-control'));
$select->addMultiOption('TLS', 'TLS');
$select->addMultiOption('SSH', 'SSH');
$select->setValue('TLS');
$select->addDecorator($decoratorField);
$elements[] = $select;
// Add Price field
$input = new Zend_Form_Element_Text('port', array('required' => true, 'label' => 'Port:', 'id' => 'port', 'placeholder' => 'Type something..', 'class' => 'form-control', 'min' => 0, 'step' => '1', 'type' => 'number', 'value' => '587'));
$min = new Zend_Validate_GreaterThan(0);
$input->addValidators(array(new Zend_Validate_Digits(), $min, new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
$input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'SMTP Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email', 'value' => 'testarnia@gmail.com'));
$input->addValidators(array(new Zend_Validate_EmailAddress(), new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add category field
$input = new Zend_Form_Element_Password('password1', array('required' => true, 'label' => 'Password:', 'id' => 'password1', 'class' => 'form-control', 'placeholder' => 'Your SMTP password..'));
$input->addValidators(array(new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add category field
$input = new Zend_Form_Element_Password('password2', array('required' => true, 'label' => 'Password Again:', 'id' => 'password2', 'class' => 'form-control', 'placeholder' => 'Your SMTP password again..', 'validators' => array(array('identical', false, array('token' => 'password1')))));
$input->addDecorator($decoratorField);
$elements[] = $input;
//Add Submit button
$input = new Zend_Form_Element_Submit('submit', array('Label' => ' ', 'class' => 'btn btn-info', 'value' => 'Add New Configuration'));
$input->addDecorator($decoratorField);
$elements[] = $input;
$this->addElements($elements);
$this->addDisplayGroup(array('host', 'stype', 'port', 'email', 'password1', 'password2', 'submit'), 'displgrp', array('legend' => 'Add Products', 'decorators' => array('FormElements', 'Fieldset')));
return $this;
}
示例6: __construct
public function __construct()
{
$title = new Zend_Form_Element_Text('title', array('disableLoadDefaultDecorators' => true));
$title->addDecorator('ViewHelper')->setRequired(true);
$this->addElement($title);
$name = new Zend_Form_Element_Text('artist', array('disableLoadDefaultDecorators' => true));
$name->addDecorator('ViewHelper')->setRequired(true);
$this->addElement($name);
$lastname = new Zend_Form_Element_Text('genre', array('disableLoadDefaultDecorators' => true));
$lastname->addDecorator('ViewHelper')->setRequired(true);
$this->addElement($lastname);
$hash = new Zend_Form_Element_Hash('csrf');
$hash->setErrorMessages(array('Cross-site request forgery protection'));
$this->addElement($hash);
$this->clearDecorators();
$this->addDecorator('FormElements')->addDecorator('Form');
}
示例7: init
public function init()
{
// Set the method for the display form to POST
$this->setMethod('post');
$this->setAttribs(array('class' => 'form-horizontal'));
$decoratorField = new My_Decorator_FieldLogin();
$elements = array();
// Add email field
$input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email'));
$validator = new Zend_Validate_EmailAddress();
$input->addValidators(array($validator, new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
//Add Submit button
$input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'Reset'));
$input->addDecorator($decoratorField);
$elements[] = $input;
$this->addElements($elements);
$this->addDisplayGroup(array('email', 'submit'), 'displgrp', array('decorators' => array('FormElements', 'Fieldset')));
}
示例8: __construct
public function __construct($options = null)
{
parent::__construct($options);
$this->setName('create_account');
$element = new Zend_Form_Element_Text('email', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setRequired(true)->addValidator('EmailAddress')->addErrorMessage('Fornire un indirizzo email');
$this->addElement($element);
$element = new Zend_Form_Element_Password('password', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setRequired(true)->setAttrib('autocomplete', 'off')->addErrorMessage('Fornire una password');
$this->addElement($element);
$element = new Zend_Form_Element_Password('confirm_password', array('disableLoadDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setRequired(true)->setAttrib('autocomplete', 'off')->addValidator(new Frontend_Form_Validate_IdenticalFormValues('password'), true)->addErrorMessage('Le due password non corrispondono');
$this->addElement($element);
$element = new Zend_Form_Element_Hash('___h', array('disableLoadDefaultDecorators' => true));
$element->setSalt('unique')->addDecorator('ViewHelper')->addErrorMessage('Il form non puo\' essere reinviato');
$this->addElement($element);
/*
$captcha_session = new Zend_Session_Namespace('captcha');
if($captcha_session->tries > 3)
{
$recaptcha = new Zend_Service_ReCaptcha('6LfK4r0SAAAAABA5P5icMZayuRyiEOeot0k_uhW5', '6LfK4r0SAAAAAJu-NmK7-30Ng4-0J2oe0R15iIoo');
$recaptcha->setOption('theme', 'clean');
$element = new Zend_Form_Element_Captcha('captcha',
array(
'disableLoadDefaultDecorators' => true,
'captcha' => 'ReCaptcha',
'captchaOptions' => array(
'captcha' => 'ReCaptcha',
'service' => $recaptcha
)
)
);
$element->addErrorMessage('Codice di sicurezza non valido');
$this->addElement($element);
}
*/
$this->clearDecorators();
$this->addDecorator('FormElements');
$this->addDecorator('Form');
}
示例9: init
public function init()
{
// Set the method for the display form to POST
$this->setMethod('post');
$this->setAttribs(array('class' => 'form-horizontal'));
$decoratorField = new My_Decorator_FieldLogin();
$elements = array();
// Add code field
$input = new Zend_Form_Element_Text('code', array('required' => true, 'label' => 'Currency Code:', 'id' => 'currency_code', 'placeholder' => 'Example USD', 'class' => 'form-control', 'list' => 'currencies', 'autocomplete' => 'off'));
$validator = new Zend_Validate_StringLength(array('max' => 3));
$input->addValidators(array($validator, new Zend_Validate_NotEmpty()));
$currencyMapper = new Application_Model_CurrencyMapper();
$decoratorCurrency = new My_Decorator_CurrencyAutocomplete(null, $currencyMapper->getAvailableCurrencies());
$input->addDecorator($decoratorCurrency);
$elements[] = $input;
//add rate file
$input = new Zend_Form_Element_Text('rate', array('required' => true, 'label' => 'Rate:', 'id' => 'rate', 'placeholder' => '...', 'class' => 'form-control', 'step' => 'any', 'type' => 'number'));
$input->addValidators(array(new Zend_Validate_Float(), new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add checkbox field
$input = new Zend_Form_Element_Checkbox('def', array('label' => 'Default', 'id' => 'def', 'class' => 'checkbox', 'type' => 'checkbox'));
$decoratorCheckBox = new My_Decorator_CheckBox();
$input->addDecorator($decoratorCheckBox);
$elements[] = $input;
// Add checkbox field
$input = new Zend_Form_Element_Checkbox('active', array('label' => 'Active', 'id' => 'active', 'class' => 'checkbox', 'type' => 'checkbox'));
$decoratorCheckBox = new My_Decorator_CheckBox();
$input->addDecorator($decoratorCheckBox);
$elements[] = $input;
//Add Submit button
$input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'Save'));
$input->addDecorator($decoratorField);
$elements[] = $input;
$this->addElements($elements);
$this->addDisplayGroup(array('code', 'rate', 'def', 'active', 'submit'), 'displgrp', array('decorators' => array('FormElements', 'Fieldset')));
}
示例10: init
public function init()
{
// Set the method for the display form to POST
$this->setMethod('post');
$this->setAttribs(array('class' => 'form-horizontal'));
$decoratorField = new My_Decorator_FieldLogin();
$elements = array();
// Add name field
$input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email'));
$input->addValidators(array(new Zend_Validate_EmailAddress(), new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add category field
$input = new Zend_Form_Element_Password('password1', array('required' => true, 'label' => 'Password:', 'id' => 'password1', 'class' => 'form-control', 'placeholder' => 'Your password..'));
$input->addValidators(array(new Zend_Validate_Alnum(), new Zend_Validate_StringLength(array('min' => 8)), new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add category field
$input = new Zend_Form_Element_Password('password2', array('required' => true, 'label' => 'Password Again:', 'id' => 'password2', 'class' => 'form-control', 'placeholder' => 'Your password again..', 'validators' => array(array('identical', false, array('token' => 'password1')))));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add code field
$input = new Zend_Form_Element_Text('currency_code', array('required' => true, 'label' => 'Currency Code:', 'id' => 'currency_code', 'placeholder' => 'Example USD', 'class' => 'form-control', 'list' => 'currencies', 'autocomplete' => 'off'));
$validator = new Zend_Validate_StringLength(array('max' => 3));
$input->addValidators(array($validator, new Zend_Validate_NotEmpty()));
$currencyMapper = new Application_Model_CurrencyMapper();
$currencies = $currencyMapper->fetchAllActive();
$decoratorCurrency = new My_Decorator_CurrencyAutocomplete(null, $currencies);
$input->addDecorator($decoratorCurrency);
$elements[] = $input;
//Add Submit button
$input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'SignUp'));
$input->addDecorator($decoratorField);
$elements[] = $input;
$this->addElements($elements);
$this->addDisplayGroup(array('email', 'password1', 'password2', 'currency_code', 'submit'), 'displgrp', array('decorators' => array('FormElements')));
}
示例11: __construct
public function __construct($options = null)
{
parent::__construct($options);
$this->setName('login');
$element = new Zend_Form_Element_Text('email', array('disableDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->addValidator('EmailAddress')->setRequired(true)->addErrorMessage('La mail e\' obbligatoria');
$this->addElement($element);
$element = new Zend_Form_Element_Password('password', array('disableDefaultDecorators' => true));
$element->addDecorator('ViewHelper')->setRequired(true)->addErrorMessage('La password e\' obbligatoria');
$this->addElement($element);
$element = new Zend_Form_Element_Hash('___h', array('disableDefaultDecorators' => true));
$element->setSalt('unique')->addDecorator('ViewHelper')->addErrorMessage('Il form non deve essere reinviato.');
$this->addElement($element);
/*
$captcha_session = new Zend_Session_Namespace('captcha');
if($captcha_session->tries > 3)
{
$recaptcha = new Zend_Service_ReCaptcha('6LfK4r0SAAAAABA5P5icMZayuRyiEOeot0k_uhW5', '6LfK4r0SAAAAAJu-NmK7-30Ng4-0J2oe0R15iIoo');
$recaptcha->setOption('theme', 'clean');
$element = new Zend_Form_Element_Captcha('captcha', array(
'disableDefaultDecorators' => true,
'captcha' => 'ReCaptcha',
'captchaOptions' => array(
'captcha' => 'ReCaptcha',
'service' => $recaptcha
)
)
);
$element->addErrorMessage('Codice di sicurezza non valido');
$this->addElement($element);
}
*/
$this->clearDecorators();
$this->addDecorator('FormElements')->addDecorator('Form');
}
示例12: init
public function init($ppty_id)
{
global $mySession;
$db = new Db();
$address_value = "";
$telephone_value = "";
$website_value = "";
$master_cal_value = "";
$company_name_value = "";
$agent_name_value = "";
$agent_address_value = "";
$agent_telephone_value = "";
$agent_email_value = "";
$agent_website_value = "";
$direction_property_value = "";
$key_instruction_value = "";
$late_instruction_value = "";
$property_name_value = "";
$emergency_value = "";
if ($ppty_id != "") {
$arrivalValue = $db->runQuery("select * from " . PROPERTY . " where id = '" . $ppty_id . "' ");
$property_name_value = $arrivalValue['0']['property_name'];
$address_value = $arrivalValue['0']['address1'];
$telephone_value = $arrivalValue['0']['telephone'];
$emergency_value = $arrivalValue['0']['emergency_no'];
$website_value = $arrivalValue['0']['website'];
$master_cal_value = $arrivalValue['0']['master_cal_url'];
$company_name_value = $arrivalValue['0']['agent_name'];
$agent_name_value = $arrivalValue['0']['agent_person'];
$agent_address_value = $arrivalValue['0']['agent_address'];
$agent_telephone_value = $arrivalValue['0']['agent_phone'];
$agent_email_value = $arrivalValue['0']['agent_email'];
$agent_website_value = $arrivalValue['0']['agent_website'];
$direction_property_value = $arrivalValue['0']['directions_to_property'];
$key_instruction_value = $arrivalValue['0']['key_instructions'];
$late_instruction_value = $arrivalValue['0']['late_arrival_instruction'];
//$late_instruction_value = $arrivalValue['0']['late_arrival_instruction'];
}
$property_name = new Zend_Form_Element_Text('property_name');
$property_name->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "20")->setValue($property_name_value);
$address = new Zend_Form_Element_Textarea('address');
$address->setAttrib("class", "mws-textinput")->setAttrib("rows", "4")->setAttrib("cols", "30")->setValue($address_value);
$telephone = new Zend_Form_Element_Text('telephone');
$telephone->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput number")->setAttrib("maxlength", "15")->setValue($telephone_value);
$emergency = new Zend_Form_Element_Text('emergency');
$emergency->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput number")->setAttrib("maxlength", "15")->setValue($emergency_value);
$website = new Zend_Form_Element_Text('website');
$website->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput validUrl")->setValue($website_value);
$master_cal = new Zend_Form_Element_Text('master_cal');
$master_cal->setAttrib("class", "mws-textinput validUrl")->setValue($master_cal_value);
////** Agent details **////
/*company name*/
$company_name = new Zend_Form_Element_Text('company_name');
$company_name->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "50")->setValue($company_name_value);
/*agent_name*/
$agent_name = new Zend_Form_Element_Text('agent_name');
$agent_name->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "50")->setValue($agent_name_value);
/*agent_address*/
$agent_address = new Zend_Form_Element_Text('agent_address');
$agent_address->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "200")->setValue($agent_address_value);
/*agent_telephone*/
$agent_telephone = new Zend_Form_Element_Text('agent_telephone');
$agent_telephone->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "200")->setValue($agent_telephone_value);
/*agent_email*/
$agent_email = new Zend_Form_Element_Text('agent_email');
$agent_email->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "200")->setValue($agent_email_value);
/*agent_website*/
$agent_website = new Zend_Form_Element_Text('agent_website');
$agent_website->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput validUrl")->setAttrib("maxlength", "200")->setValue($agent_website_value);
////*** instructions**////
/* directions to the property*/
$direction_property = new Zend_Form_Element_Textarea('direction_property');
$direction_property->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "250")->setValue($direction_property_value);
/* Key Instructions to the property*/
$key_instruction = new Zend_Form_Element_Textarea('key_instruction');
$key_instruction->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "250")->setValue($key_instruction_value);
/* Late Instructions to the Property */
$late_instruction = new Zend_Form_Element_Textarea('late_instruction');
$late_instruction->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput")->setAttrib("maxlength", "250")->setValue($late_instruction_value);
/* Arrival Instructions to the Property */
$arrival_instruction = new Zend_Form_Element_File('arrival_instruction');
$arrival_instruction->setDestination(SITE_ROOT . 'uploads/instructions/')->addValidator('Extension', false, 'pdf,doc')->addDecorator('Errors', array('class' => 'error'));
$step = new Zend_Form_Element_Hidden('step');
$step->setValue("9");
$this->addElements(array($property_name, $address, $telephone, $emergency, $website, $master_cal, $agent_name, $agent_address, $agent_telephone, $agent_email, $agent_website, $direction_property, $key_instruction, $late_instruction, $arrival_instruction, $company_name, $step));
}
示例13: init
public function init($subscriberId)
{
global $mySession;
$db = new Db();
$CountryId = "";
$StateId = "";
$telephone_value = $subscriber_address_box1_value = $subscriber_address_box2_value = $subscriber_address_box3_value = $subscriber_address_box4_value = $subscriber_address_box5_value = "";
$CityName = "";
$latitude_value = "41.659";
$longitude_value = "-4.714";
if ($subscriberId != "") {
$subscriberData = $db->runQuery("select * from subscriber where subscriber_id='" . $subscriberId . "'");
$subscriber_name_value = $subscriberData[0]['subscriber_name'];
$subscriber_url_value = $subscriberData[0]['subscriber_url'];
$subscriber_api_username_value = $subscriberData[0]['subscriber_api_username'];
$subscriber_api_password_value = $subscriberData[0]['subscriber_api_password'];
$email_address_value = $subscriberData[0]['subscriber_email'];
$email_address1_value = $subscriberData[0]['subscriber_email_alt'];
$dealatrip_page_value = $subscriberData[0]['subscriber_dealatrip_webpage'];
$telephone_value = $subscriberData[0]['subscriber_dealatrip_webpage'];
$latitude = $subscriberData[0]['subscriber_lat_lng'];
if (!empty($latitude)) {
$latitude = explode(',', $latitude);
$latitude_value = $latitude[0];
$longitude_value = $latitude[1];
}
$_contact_name_value = explode(',', $subscriberData[0]['contact_person']);
$contact_name_value = $_contact_name_value[0];
$contact_name_value1 = isset($_contact_name_value[1]) ? $_contact_name_value[1] : '';
//customer support values
$customerSupport = explode(',', $subscriberData[0]['subscriber_customer_support']);
$customer_support_value = isset($customerSupport[0]) ? $customerSupport[0] : '';
$customer_support_value1 = isset($customerSupport[1]) ? $customerSupport[0] : '';
$customer_support_value2 = isset($customerSupport[2]) ? $customerSupport[2] : '';
$customer_support_value3 = isset($customerSupport[3]) ? $customerSupport[3] : '';
$customer_support_value4 = isset($customerSupport[4]) ? $customerSupport[4] : '';
//address
$subscriber_address = explode(',', $subscriberData[0]['subscriber_address']);
$subscriber_address_box1_value = isset($subscriber_address[0]) ? $subscriber_address[0] : '';
$subscriber_address_box2_value = isset($subscriber_address[1]) ? $subscriber_address[1] : '';
$subscriber_address_box3_value = isset($subscriber_address[2]) ? $subscriber_address[2] : '';
$subscriber_address_box4_value = isset($subscriber_address[3]) ? $subscriber_address[3] : '';
$subscriber_address_box5_value = isset($subscriber_address[4]) ? $subscriber_address[4] : '';
}
$subscriber_name = new Zend_Form_Element_Text('subscriber_name');
$subscriber_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Subscriber Name is required.'))->addDecorator('Errors', array('class' => 'error'))->addFilter('StringTrim')->setAttrib("class", "mws-textinput required")->setValue($subscriber_name_value);
$subscriber_url = new Zend_Form_Element_Text('subscriber_url');
$subscriber_url->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Subscriber url is required.'))->addDecorator('Errors', array('class' => 'error'))->addFilter('StringTrim')->setAttrib("class", "mws-textinput required")->setValue($subscriber_url_value);
$subscriber_api_username = new Zend_Form_Element_Text('subscriber_api_username');
$subscriber_api_username->addFilter('StringTrim')->setAttrib("class", "mws-textinput required")->setValue($subscriber_api_username_value);
$subscriber_api_password = new Zend_Form_Element_Text('subscriber_api_password');
$subscriber_api_password->addFilter('StringTrim')->setAttrib("class", "mws-textinput required")->setValue($subscriber_api_password_value);
$subscriber_address_box1 = new Zend_Form_Element_Text('subscriber_address_box1');
$subscriber_address_box1->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Supplier Address is required'))->addDecorator('Errors', array('class' => 'error'))->addFilter('StringTrim')->setAttrib("class", "mws-textinput required")->setValue($subscriber_address_box1_value);
$subscriber_address_box2 = new Zend_Form_Element_Text('subscriber_address_box2');
$subscriber_address_box2->addDecorator('Errors', array('class' => 'error'))->addFilter('StringTrim')->setAttrib("class", "mws-textinput")->setValue($subscriber_address_box2_value);
$subscriber_address_box3 = new Zend_Form_Element_Text('subscriber_address_box3');
$subscriber_address_box3->addFilter('StringTrim')->setAttrib("class", "mws-textinput")->setValue($subscriber_address_box3_value);
$subscriber_address_box4 = new Zend_Form_Element_Text('subscriber_address_box4');
$subscriber_address_box4->addFilter('StringTrim')->setAttrib("class", "mws-textinput")->setValue($subscriber_address_box4_value);
$subscriber_address_box5 = new Zend_Form_Element_Text('subscriber_address_box5');
$subscriber_address_box5->addFilter('StringTrim')->setAttrib("class", "mws-textinput")->setValue($subscriber_address_box5_value);
$contact_name = new Zend_Form_Element_Text('contact_name');
$contact_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Contact name is required'))->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($contact_name_value);
$contact_name1 = new Zend_Form_Element_Text('contact_name1');
$contact_name1->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput")->setValue($contact_name_value1);
$email_address = new Zend_Form_Element_Text('email_address');
$email_address->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email address is required'))->addValidator('EmailAddress', true, array('messages' => 'Please enter correct email address'))->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput")->setValue($email_address_value);
$email_address1 = new Zend_Form_Element_Text('email_address1');
$email_address1->addValidator('EmailAddress', true, array('messages' => 'Email address is required'))->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput")->setValue($email_address1_value);
$telephone = new Zend_Form_Element_Text('telephone');
$telephone->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Contact name is required'))->addValidator('Regex', true, array('/^[0-9]+$/'))->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($telephone_value);
$website = new Zend_Form_Element_Text('website');
$website->setRequired(true)->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($website_value);
$customer_support = new Zend_Form_Element_Text('customer_support');
$customer_support->setRequired(true)->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($customer_support_value);
$customer_support1 = new Zend_Form_Element_Text('customer_support1');
$customer_support1->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput")->setValue($customer_support_value1);
$customer_support2 = new Zend_Form_Element_Text('customer_support2');
$customer_support2->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput")->setValue($customer_support_value2);
$customer_support3 = new Zend_Form_Element_Text('customer_support3');
$customer_support3->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput")->setValue($customer_support_value3);
$customer_support4 = new Zend_Form_Element_Text('customer_support4');
$customer_support4->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput")->setValue($customer_support_value4);
$additional_info = new Zend_Form_Element_Text('additional_info');
$additional_info->setRequired(true)->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($additional_info_value);
$dealatrip_page = new Zend_Form_Element_Text('dealatrip_page');
$dealatrip_page->setRequired(true)->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($dealatrip_page_value);
$latitude = new Zend_Form_Element_Hidden('latitude');
$latitude->setRequired(true)->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($latitude_value);
$longitude = new Zend_Form_Element_Hidden('longitude');
$longitude->setRequired(true)->addFilter('StringTrim')->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($longitude_value);
$this->addElements(array($subscriber_name, $subscriber_url, $subscriber_api_username, $subscriber_api_password, $subscriber_address_box1, $subscriber_address_box2, $subscriber_address_box3, $subscriber_address_box4, $subscriber_address_box5, $contact_name, $contact_name1, $email_address, $email_address1, $telephone, $website, $customer_support, $customer_support1, $customer_support2, $customer_support3, $customer_support4, $additional_info, $dealatrip_page, $latitude, $longitude));
}
示例14: initMyForm
public function initMyForm($cid, $cidresume)
{
global $mySession;
$db = new Db();
$title_val = "";
$description_val = "";
$url_val = "";
$camplength_val = "";
$campaign_category_val = '';
if ($mySession->TeeLoggedID != "") {
if ($mySession->camptitl != "" && $mySession->showurl != "") {
//echo "in form with session values"; die;
$title_val = $mySession->camptitl;
$description_val = $mySession->descrip;
$url_val = $mySession->showurl;
$camplength_val = $mySession->camplength;
$campaign_category_val = $mySession->campaign_category;
}
}
if ($cid != "") {
$qur = $db->runquery("SELECT * FROM " . LAUNCHCAMPAIGN . " WHERE campaign_id='" . $cid . "'");
if ($qur != "" and count($qur) > 0) {
//prd($qur);
$title_val = $qur[0]['title'];
$description_val = $qur[0]['description'];
$url_val = $qur[0]['url'];
$camplength_val = $qur[0]['campaign_length'];
$campaign_category_val = $qur[0]['campaign_category'];
}
}
# FORM ELEMENT:camptitle
# TYPE : text
$camptitle = new Zend_Form_Element_Text('camptitle');
$camptitle->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:450px; height:30px;")->setvalue($title_val);
# FORM ELEMENT:description
# TYPE : text
$description = new Zend_Form_Element_Textarea('description');
$description->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:450px; height:120px;")->setvalue($description_val);
$daysArr = array();
$daysArr[1]['key'] = "3";
$daysArr[1]['value'] = "3 Days";
$daysArr[2]['key'] = "7";
$daysArr[2]['value'] = "7 Days";
$daysArr[3]['key'] = "10";
$daysArr[3]['value'] = "10 Days";
$daysArr[4]['key'] = "14";
$daysArr[4]['value'] = "14 Days";
$daysArr[5]['key'] = "21";
$daysArr[5]['value'] = "21 Days";
$no_ofdays = new Zend_Form_Element_Select('no_ofdays');
$no_ofdays->addMultiOptions($daysArr)->setAttrib('class', 'setgoaltxt')->setAttrib("style", "width:150px; height:30px;")->setvalue($camplength_val);
# FORM ELEMENT:url
# TYPE : text
if ($cid != "" || $cid != 0) {
$url = new Zend_Form_Element_Text('url');
$url->setRequired(true)->setAttrib('class', 'setgoaltxt')->setAttrib("readonly", "readonly")->setAttrib("style", "width:100px; height:30px;")->setvalue($url_val);
} else {
/*$url= new Zend_Form_Element_Text('url');
$url->setRequired(true)
->addDecorator('Errors', array('class'=>'errmsg'))
->setAttrib('class','setgoaltxt')
->setAttrib("onkeypress","return checkspecchar(event)")
->setAttrib('onkeyup','uniqueurl(this.value)')
->setAttrib("style","width:100px; height:30px;")
->setvalue($url_val);*/
$url = new Zend_Form_Element_Text('url');
$url->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'setgoaltxt')->setAttrib('onblur', 'uniqueurl(this.value)')->setAttrib("style", "width:100px; height:30px;")->setvalue($url_val);
}
# FORM ELEMENT:check
# TYPE : text
$add_checkbox = new Zend_Form_Element_Checkbox('add_checkbox');
$add_checkbox->setAttrib('onclick', 'opendiv(this.id);');
$newcheckbx = new Zend_Form_Element_Checkbox('newcheckbx');
$newcheckbx->setAttrib('onclick', 'newdivaddr(this.id);');
$firstname = new Zend_Form_Element_Text('firstname');
$firstname->addValidator('NotEmpty', true, array('messages' => 'First name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress');
if (array_key_exists('newcheckbx', $_REQUEST) && $_REQUEST['newcheckbx'] == 1) {
$firstname->setRequired(true);
}
$firstname->setAttrib("style", "width:180px; height:30px;");
$this->addElement($firstname);
# FORM ELEMENT:last name
# TYPE : text
$lastname = new Zend_Form_Element_Text('lastname');
$lastname->addValidator('NotEmpty', true, array('messages' => 'Last name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("onkeypress", "return checkcharonly(event);")->setAttrib('class', 'changeaddress');
if (array_key_exists('newcheckbx', $_REQUEST) && $_REQUEST['newcheckbx'] == 1) {
$lastname->setRequired(true);
}
$lastname->setAttrib("style", "width:180px; height:30px;");
//if(@$_REQUEST['lastname']!="")
// {
// $lastname-> addValidator('Alpha', true)
// ->addDecorator('Errors', array('class'=>'errmsg'))
// ->addErrorMessage('Enter only characters');
// }
$this->addElement($lastname);
# FORM ELEMENT:address
# TYPE : text
$newaddress = new Zend_Form_Element_Text('newaddress');
$newaddress->addValidator('NotEmpty', true, array('messages' => 'Address is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox');
//.........这里部分代码省略.........
示例15: getSaveProductForm
public function getSaveProductForm($id)
{
$form = new Zend_Form();
//get product whitch want update
$productMapper = new Application_Model_ProductMapper();
$product = new Application_Model_Product();
if ($id) {
$product = $productMapper->getProductById($id);
}
// Set the method for the display form to POST
$form->setMethod('post');
$form->setAttribs(array('class' => 'form-horizontal', 'enctype' => 'multipart/form-data'));
$decoratorField = new My_Decorator_Field();
$elements = array();
//Add id hidden field
$input = new Zend_Form_Element_Hidden('id', array('value' => $id));
$elements[] = $input;
// Add name field
$input = new Zend_Form_Element_Text('name', array('required' => true, 'label' => 'Name:', 'id' => 'name', 'placeholder' => 'Type something..', 'value' => $product->getName(), 'class' => 'form-control'));
$input->addValidators(array(new Zend_Validate_Alnum(), new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add category field
$select = new Zend_Form_Element_Select('category_id', array('required' => true, 'label' => 'Category:', 'id' => 'category', 'class' => 'form-control'));
$categoryMapper = new Application_Model_CategoryMapper();
$categories = $categoryMapper->fetchAll();
foreach ($categories as $category) {
$select->addMultiOption($category->getId(), $category->getName());
}
// set selected option
$select->setValue($product->getCategoryId());
$select->addDecorator($decoratorField);
$elements[] = $select;
$currencyMapper = new Application_Model_CurrencyMapper();
$currency = $currencyMapper->getDefaultCurrency();
// Add Price field
$input = new Zend_Form_Element_Text('price', array('required' => true, 'label' => 'Price in ' . $currency->getCode() . ':', 'id' => 'price', 'placeholder' => 'Type something..', 'value' => number_format((double) $product->price, 2), 'class' => 'form-control', 'min' => self::MIN, 'max' => self::MAX, 'step' => 'any', 'type' => 'number'));
$min = new Zend_Validate_LessThan(self::MAX);
$max = new Zend_Validate_GreaterThan(self::MIN);
$input->addValidators(array(new Zend_Validate_Float(), $min, $max, new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
if ($id) {
//Add File field
if ($product->file) {
$input = new Zend_Form_Element('file', array('label' => 'File:', 'id' => 'file', 'class' => 'form-control', 'value' => $product->file));
$input->addDecorator(new My_Decorator_AnchoraFileForm());
$elements[] = $input;
} else {
$input = new Zend_Form_Element_File('file', array('label' => 'File:', 'id' => 'file', 'class' => 'form-control'));
$input->addDecorator($decoratorField);
$elements[] = $input;
}
//Add Image field
if ($product->image) {
$input = new Zend_Form_Element('image', array('label' => 'Image:', 'id' => 'image', 'class' => 'form-control', 'value' => $product->image));
$input->addDecorator(new My_Decorator_ImageForm());
$elements[] = $input;
} else {
$input = new Zend_Form_Element_File('image', array('label' => 'Image:', 'id' => 'image', 'class' => 'form-control'));
$input->addDecorator($decoratorField);
$elements[] = $input;
}
} else {
//Add File field
$input = new Zend_Form_Element_File('file', array('label' => 'File:', 'id' => 'file', 'class' => 'form-control'));
$input->addDecorator($decoratorField);
$elements[] = $input;
//Add Image field
$input = new Zend_Form_Element_File('image', array('label' => 'Image:', 'id' => 'image', 'class' => 'form-control'));
$input->addDecorator($decoratorField);
$elements[] = $input;
}
//Add Description field
$input = new Zend_Form_Element_Textarea('description', array('label' => 'Description:', 'id' => 'description', 'class' => 'form-control', 'value' => $product->description));
$input->addDecorator($decoratorField);
$elements[] = $input;
//Add Submit button
if (!$id) {
$input = new Zend_Form_Element_Submit('submit', array('Label' => ' ', 'class' => 'btn btn-success', 'value' => 'Add New Product'));
} else {
$input = new Zend_Form_Element_Submit('submit', array('Label' => ' ', 'class' => 'btn btn-info', 'value' => 'Update Product'));
}
$input->addDecorator($decoratorField);
$elements[] = $input;
$form->addElements($elements);
$form->addDisplayGroup(array('name', 'category_id', 'price', 'currency_id', 'file', 'image', 'description', 'submit'), 'displgrp', array('legend' => 'Add Products', 'decorators' => array('FormElements', 'Fieldset')));
return $form;
}