本文整理汇总了PHP中Zend_Form_Element_Textarea::setDecorators方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Textarea::setDecorators方法的具体用法?PHP Zend_Form_Element_Textarea::setDecorators怎么用?PHP Zend_Form_Element_Textarea::setDecorators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Textarea
的用法示例。
在下文中一共展示了Zend_Form_Element_Textarea::setDecorators方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
*
* Edit Album form
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditAlbum.phtml'))));
// get group from database
$request = Zend_Controller_Front::getInstance()->getRequest();
$album_id = $request->getParam('id');
$Albums = new Application_Model_Albums();
$album = $Albums->getAlbum($album_id);
$username_minchars = Zend_Registry::get('config')->get('username_minchars');
$username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
// fields
$id = new Zend_Form_Element_Hidden('id');
$id->setValue($album);
$album_name = new Zend_Form_Element_Text('album_name');
$album_name->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Album Name'))->setRequired(true)->setValue($album['name'])->setAttrib('class', 'form-control');
$description = new Zend_Form_Element_Textarea('description');
$description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($album['description'])->setLabel($this->translator->translate('About this album'))->setAttrib('class', 'form-control');
$submit = new Zend_Form_Element_Submit('formsubmit');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($id, $album_name, $description, $submit));
$this->postInit();
}
示例2: _mensagem
protected function _mensagem()
{
$e = new Zend_Form_Element_Textarea('mensagem');
$e->setLabel('Mensagem:')->setRequired(true)->setAttrib('rows', 5)->addFilter('StringTrim')->setAttrib('class', 'form-control');
$e->setDecorators(array('ViewHelper', 'Description', 'Errors', array('HtmlTag', ''), array('Label', '')));
return $e;
}
示例3: init
public function init()
{
// contato_nome
$contato_nome = new Zend_Form_Element_Text("contato_nome");
$contato_nome->setLabel("Nome");
$contato_nome->setRequired();
$contato_nome->setAttribs(array('class' => 'form-control'));
$contato_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
// contato_email
$contato_email = new Zend_Form_Element_Text("contato_email");
$contato_email->setLabel("E-mail");
$contato_email->setRequired();
$contato_email->setAttribs(array('class' => 'form-control'));
$contato_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
// contato_assunto
$contato_assunto = new Zend_Form_Element_Select("contato_assunto");
$contato_assunto->setLabel("Assunto");
$contato_assunto->setRequired();
$contato_assunto->setAttribs(array('class' => 'form-control'));
$contato_assunto->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$contato_assunto->setMultiOptions(array("" => "Selecione o assunto...", "Informação" => "Informação", "Elogio" => "Eologio", "Crítica" => "Crítica", "Sugestão" => "Sugestão", "Outros" => "Outros"));
// contato_mensagem
$contato_mensagem = new Zend_Form_Element_Textarea("contato_mensagem");
$contato_mensagem->setLabel("mensagem");
$contato_mensagem->setRequired();
$contato_mensagem->setAttribs(array('class' => 'form-control', 'rows' => 5));
$contato_mensagem->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$this->addElements(array($contato_nome, $contato_email, $contato_assunto, $contato_mensagem));
parent::init();
}
示例4: init
public function init()
{
// attribs
$this->setAttribs(array('id' => 'form-site-contato'));
$this->setMethod('post');
$this->setAction('contato/');
// contato_nome
$contato_nome = new Zend_Form_Element_Text('contato_nome');
$contato_nome->setLabel("Nome:");
$contato_nome->setRequired();
$contato_nome->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!"));
$contato_nome->setAttrib('class', 'form-control');
$contato_nome->setAttrib('placeholder', 'Informe seu nome');
$contato_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
// contato_email
$contato_email = new Zend_Form_Element_Text('contato_email');
$contato_email->setLabel("E-mail:");
$contato_email->setRequired();
$contato_email->addErrorMessages(array(Zend_Validate_EmailAddress::INVALID => "Email inválido!"));
$contato_email->addValidator('EmailAddress');
$contato_email->setAttrib('class', 'form-control');
$contato_email->setAttrib('placeholder', 'Informe seu email');
$contato_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
// contato_mensagem
$contato_mensagem = new Zend_Form_Element_Textarea('contato_mensagem');
$contato_mensagem->setLabel("Mensagem:");
$contato_mensagem->setRequired();
$contato_mensagem->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!"));
$contato_mensagem->setAttrib('class', 'form-control');
$contato_mensagem->setAttrib('placeholder', 'Digite aqui sua mensagem');
$contato_mensagem->setAttrib('rows', 5);
$contato_mensagem->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$this->addElements(array($contato_nome, $contato_email, $contato_mensagem));
parent::init();
}
示例5: init
/**
*
* Themes & styles
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsStyles.phtml'))));
// load settings
$AppOptions = new Application_Model_AppOptions();
$all_meta = $AppOptions->getAllOptions();
// fields
$themes_array = array('/bootstrap/css/bootstrap.min.css' => 'Bootstrap');
$css_theme = new Zend_Form_Element_Select('css_theme');
$css_theme->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($themes_array)->setErrorMessages(array($this->translator->translate('Please select')))->setLabel($this->translator->translate('Choose css theme'))->setRequired(true)->setValue(isset($all_meta['css_theme']) ? $all_meta['css_theme'] : 'bootstrap')->setAttrib('class', 'form-control');
$wide_layout = new Zend_Form_Element_Checkbox('wide_layout');
$wide_layout->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['wide_layout']) && $all_meta['wide_layout'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Extra-wide layout on large screens'))->setCheckedValue("1")->setUncheckedValue("0");
$cover_ysize = new Zend_Form_Element_Text('cover_ysize');
$cover_ysize->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Cover image height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['cover_ysize']) ? $all_meta['cover_ysize'] : '220')->setAttrib('class', 'form-control');
$user_background = new Zend_Form_Element_Checkbox('user_background');
$user_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_background']) && $all_meta['user_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Users can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0");
$subscriber_background = new Zend_Form_Element_Checkbox('subscriber_background');
$subscriber_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['subscriber_background']) && $all_meta['subscriber_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Subscribers can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0");
$custom_css = new Zend_Form_Element_Textarea('css_custom');
$custom_css->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '15')->setValue(isset($all_meta['css_custom']) ? $all_meta['css_custom'] : '')->setLabel($this->translator->translate('Custom css'))->setAttrib('class', 'form-control');
$submit = new Zend_Form_Element_Submit('submitbtn');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($css_theme, $wide_layout, $cover_ysize, $user_background, $subscriber_background, $custom_css, $submit));
$this->postInit();
}
示例6: init
/**
*
* Edit Group form
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditGroup.phtml'))));
// get group from database
$request = Zend_Controller_Front::getInstance()->getRequest();
$group = $request->getParam('name');
$Profiles = new Application_Model_Profiles();
$ProfilesMeta = new Application_Model_ProfilesMeta();
$profile = $Profiles->getProfile($group, false, true);
$owners_profile = $Profiles->getProfileByField('id', $profile->owner);
$username_minchars = Zend_Registry::get('config')->get('username_minchars');
$username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
// fields
$id = new Zend_Form_Element_Hidden('id');
$id->setValue($profile->id);
$name = new Zend_Form_Element_Text('name');
$name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Group Name'))->setValue($profile->name)->setIgnore(true)->setAttrib('readonly', true)->setAttrib('class', 'form-control');
$screenname = new Zend_Form_Element_Text('screen_name');
$screenname->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue($profile->screen_name)->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Screen Name'))->setRequired(true)->setAttrib('class', 'form-control');
$description = new Zend_Form_Element_Textarea('description');
$description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($ProfilesMeta->getMetaValue('description', $profile->id))->setLabel($this->translator->translate('About this group'))->setAttrib('class', 'form-control');
$profile_privacy = new Zend_Form_Element_Select('profile_privacy');
$profile_privacy->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('group_privacy_array'))->setErrorMessages(array($this->translator->translate('Select group visibility')))->setLabel($this->translator->translate('Select group visibility'))->setRequired(true)->setValue($profile->profile_privacy)->setAttrib('class', 'form-control');
$is_hidden = new Zend_Form_Element_Checkbox('is_hidden');
$is_hidden->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($profile->is_hidden) && $profile->is_hidden == 1 ? 1 : 0)->setLabel($this->translator->translate('Remove?'))->setCheckedValue("1")->setUncheckedValue("0");
$submit = new Zend_Form_Element_Submit('formsubmit');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($id, $name, $screenname, $profile_privacy, $description, $is_hidden, $submit));
$this->postInit();
}
示例7: _resumo
protected function _resumo()
{
$e = new Zend_Form_Element_Textarea('resumo');
$e->setLabel(_('Abstract:'))->setRequired(true)->setAttrib('rows', 10)->setAttrib("data-required", "true")->addFilter('StringTrim')->setAttrib('class', 'form-control')->addValidator('stringLength', false, array(20))->addFilter(new Sige_Filter_HTMLPurifier())->addErrorMessage("Resumo com número insuficiente de caracteres (mín. 20).");
$e->setDecorators(array('ViewHelper', 'Description', 'Errors', array('HtmlTag', ''), array('Label', '')));
return $e;
}
示例8: init
public function init()
{
// agenda_cancelado_motivo
$agenda_cancelado_motivo = new Zend_Form_Element_Textarea("agenda_cancelado_motivo");
$agenda_cancelado_motivo->setLabel("Motivo cancelamento: ");
$agenda_cancelado_motivo->setRequired();
$agenda_cancelado_motivo->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$agenda_cancelado_motivo->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o motivo do cancelamento', 'rows' => 10));
$this->addElements(array($agenda_cancelado_motivo));
parent::init();
}
示例9: __construct
/**
* @author code generate
* @return mixed
*/
public function __construct($option = array())
{
$contactId = new Zend_Form_Element_Hidden('ContactId');
$contactId->setDecorators(array('ViewHelper'));
$this->addElement($contactId);
$contactName = new Zend_Form_Element_Text('ContactName');
$contactName->setLabel('Họ tên *');
$contactName->addFilter('StringTrim');
$contactName->setRequired(true);
$contactName->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
$contactName->addValidator('stringLength', false, array(1, 50, "messages" => " dài tối đa 50 ký tự"));
$this->addElement($contactName);
$userId = new Zend_Form_Element_Text('UserId');
$userId->setLabel('UserId');
$userId->addFilter('StringTrim');
$userId->setAttrib('disabled', true);
$userId->setDecorators(array('ViewHelper'));
$this->addElement($userId);
$contactPhone = new Zend_Form_Element_Text('ContactPhone');
$contactPhone->setLabel('Điện thoại *');
$contactPhone->addFilter('StringTrim');
$contactPhone->setRequired(true);
$contactPhone->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
$contactPhone->addValidator('stringLength', false, array(1, 15, "messages" => " dài tối đa 50 ký tự"));
$this->addElement($contactPhone);
$contactTitle = new Zend_Form_Element_Text('ContactTitle');
$contactTitle->setLabel('Tiêu đề *');
$contactTitle->addFilter('StringTrim');
$contactTitle->setRequired(true);
$contactTitle->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
$contactTitle->addValidator('stringLength', false, array(1, 250, "messages" => " dài tối đa 250 ký tự"));
$this->addElement($contactTitle);
$contactContent = new Zend_Form_Element_Textarea('ContactContent');
$contactContent->setLabel('Nội dung *');
$contactContent->setRequired(true);
$contactContent->setOptions(array('cols' => '10', 'rows' => '4'));
$contactContent->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
$contactPhone->addValidator('stringLength', false, array(1, 2000, "messages" => " dài tối đa 2000 ký tự"));
$this->addElement($contactContent);
$save = new Zend_Form_Element_Submit('Save');
$save->setLabel('Gửi');
$save->setAttrib('class', 'btn btn-primary');
$save->setDecorators(array('ViewHelper'));
$this->addElement($save);
$reset = new Zend_Form_Element_Reset('Reset');
$reset->setLabel('Làm lại');
$reset->setAttrib('class', 'btn btn-primary');
$reset->setDecorators(array('ViewHelper'));
$this->addElement($reset);
}
示例10: init
/**
*
* Edit comment
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditComment.phtml'))));
// fields
$comment = new Zend_Form_Element_Textarea('comment');
$comment->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setAttrib('class', 'form-control');
$submit = new Zend_Form_Element_Submit('submitcomment');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($comment, $submit));
$this->postInit();
}
示例11: init
/**
*
* Edit post
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditPost.phtml'))));
// fields
$text = new Zend_Form_Element_Textarea('content');
$text->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '8')->addFilter('StripTags')->setAttrib('class', 'form-control');
$privacy = new Zend_Form_Element_Select('privacy');
$privacy->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('post_privacy_array'))->setErrorMessages(array($this->translator->translate('Select post privacy')))->setLabel($this->translator->translate('Privacy'))->setAttrib('class', 'form-control');
$submit = new Zend_Form_Element_Submit('submitbutton');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($text, $privacy, $submit));
$this->postInit();
}
示例12: __construct
/**
*
* @param array $options Options to build the form
*/
public function __construct($options = null)
{
// Disable the defaults buttons
if (isset($options['disableAction'])) {
$this->_disabledDefaultActions = $options['disableAction'];
}
if (isset($options['recipients'])) {
$recipients = $options['recipients'];
$recipientsList = $this->_setRecipientList($recipients);
unset($options['recipients']);
}
parent::__construct($options);
// Title
$title = new Zend_Form_Element_Text('FI_Title');
$title->setLabel($this->getView()->getCibleText('form_label_title'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput');
$this->addElement($title);
// Notification
$notification = new Zend_Form_Element_Checkbox('F_Notification');
$notification->setLabel($this->getView()->getCibleText('form_label_has_notification'));
$notification->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
$this->addElement($notification);
$emailList = new Zend_Form_Element_Textarea('FN_Email');
$emailList->setAttrib('title', $this->getView()->getCibleText('form_notification_emails_info'));
if (!empty($recipientsList)) {
$emailList->setValue($recipientsList);
}
$emailList->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'formRecipientsEmail'))));
$this->addElement($emailList);
// isSercure
// $hasProfil = new Zend_Form_Element_Checkbox('F_Profil');
// $hasProfil->setLabel($this->getView()->getCibleText(
// 'form_label_has_profil'));
// $hasProfil->setDecorators(array(
// 'ViewHelper',
// array('label', array('placement' => 'append')),
// array(
// array('row' => 'HtmlTag'),
// array('tag' => 'dd', 'class' => 'label_after_checkbox')),
// ));
//
// $this->addElement($hasProfil);
//hasCaptcha
$hasCaptcha = new Zend_Form_Element_Checkbox('F_Captcha');
$hasCaptcha->setLabel($this->getView()->getCibleText('form_label_has_captcha'))->setValue(true)->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
$this->addElement($hasCaptcha);
$this->setAttrib('id', 'Form');
}
示例13: init
/**
*
* Edit Profile form
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Profile.phtml'))));
// get user from database
$Profiles = new Application_Model_Profiles();
$ProfilesMeta = new Application_Model_ProfilesMeta();
$profile = $Profiles->getProfile(Zend_Auth::getInstance()->getIdentity()->name, true);
$all_meta = $ProfilesMeta->getMetaValues($profile->id);
$username_minchars = Zend_Registry::get('config')->get('username_minchars');
$username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
// fields
$id = new Zend_Form_Element_Hidden('id');
$id->setValue($profile->id);
$name = new Zend_Form_Element_Text('name');
$name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Username'))->setValue($profile->name)->setIgnore(true)->setAttrib('readonly', true)->setAttrib('class', 'form-control');
$email = new Zend_Form_Element_Text('email');
$email->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Email'))->setValue($profile->email)->setIgnore(true)->setAttrib('readonly', true)->setAttrib('class', 'form-control');
$screenname = new Zend_Form_Element_Text('screen_name');
$screenname->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue($profile->screen_name)->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Screen Name'))->setRequired(true)->setAttrib('class', 'form-control');
$description = new Zend_Form_Element_Textarea('description');
$description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue(isset($all_meta['description']) ? $all_meta['description'] : '')->setLabel($this->translator->translate('About you'))->setAttrib('class', 'form-control');
$profile_privacy = new Zend_Form_Element_Select('profile_privacy');
$profile_privacy->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('profile_privacy_array'))->setErrorMessages(array($this->translator->translate('Select profile visibility')))->setLabel($this->translator->translate('Profile visibility'))->setRequired(true)->setValue($profile->profile_privacy)->setAttrib('class', 'form-control');
$birthday = new Application_Form_Element_Date('birthday');
$birthday->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('class', 'form-control')->setLabel($this->translator->translate('Date of birth'))->setErrorMessages(array($this->translator->translate('Please enter a valid date')))->setYearSpan(1920, date('Y') - 1);
if (isset($all_meta['birthday'])) {
$timestamp = strtotime($all_meta['birthday']);
$birthday->setValue(array('day' => date('d', $timestamp), 'month' => date('m', $timestamp), 'year' => date('Y', $timestamp)));
}
$gender = new Zend_Form_Element_Select('gender');
$gender->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('genders_array'))->setErrorMessages(array($this->translator->translate('Please select something')))->setLabel($this->translator->translate('Gender'))->setRequired(true)->setValue(isset($all_meta['gender']) ? $all_meta['gender'] : '')->setAttrib('class', 'form-control');
$online_status = new Zend_Form_Element_Select('show_online_status');
$online_status->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('onlinestatus_array'))->setErrorMessages(array($this->translator->translate('Select profile visibility')))->setLabel($this->translator->translate('Online Status'))->setRequired(true)->setValue(isset($all_meta['show_online_status']) ? $all_meta['show_online_status'] : 's')->setAttrib('class', 'form-control');
$contact_privacy = new Zend_Form_Element_Select('contact_privacy');
$contact_privacy->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('contactprivacy_array'))->setErrorMessages(array($this->translator->translate('Please select something')))->setLabel($this->translator->translate('Who can contact me?'))->setRequired(true)->setValue(isset($all_meta['contact_privacy']) ? $all_meta['contact_privacy'] : 'e')->setAttrib('class', 'form-control');
$location = new Zend_Form_Element_Text('location');
$location->setDecorators(array('ViewHelper', 'Errors'))->setRequired(false)->setLabel($this->translator->translate('Location'))->setAttrib('class', 'form-control')->addFilter('StripTags')->setValue(isset($all_meta['location']) ? $all_meta['location'] : '')->setErrorMessages(array($this->translator->translate('Enter a valid location')));
$website = new Zend_Form_Element_Text('website');
$website->setDecorators(array('ViewHelper', 'Errors'))->setRequired(false)->setLabel($this->translator->translate('Website'))->setAttrib('class', 'form-control')->addFilter('StripTags')->setValue(isset($all_meta['website']) ? $all_meta['website'] : '')->setErrorMessages(array($this->translator->translate('Enter a valid website')));
$submit = new Zend_Form_Element_Submit('formsubmit');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default form-control');
$this->addElements(array($id, $name, $email, $screenname, $gender, $profile_privacy, $online_status, $contact_privacy, $description, $location, $website, $birthday, $submit));
$this->postInit();
}
示例14: init
/**
*
* Add new post
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname), true, false);
// show privacy
$show_privacy = new Zend_Form_Element_Hidden('show_privacy');
$show_privacy->setDecorators(array('ViewHelper'))->setValue($this->show_privacy);
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/AddPost.phtml'))));
// fields
$text = new Zend_Form_Element_Textarea('content');
$text->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setAttrib('class', 'form-control')->setAttrib('placeholder', $this->translator->translate('What is on your mind?'));
$submit = new Zend_Form_Element_Submit('submitbutton');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Post'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($text, $submit));
$this->postInit();
}
示例15: init
/**
*
* Add Album
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/AddAlbum.phtml'))));
$username_minchars = Zend_Registry::get('config')->get('username_minchars');
$username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
// fields
$album_name = new Zend_Form_Element_Text('album_name');
$album_name->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Album Name'))->setRequired(true)->setAttrib('class', 'form-control');
$description = new Zend_Form_Element_Textarea('description');
$description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setLabel($this->translator->translate('About this album'))->setAttrib('class', 'form-control');
$submit = new Zend_Form_Element_Submit('formsubmit');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($album_name, $description, $submit));
$this->postInit();
}