/** * (non-PHPdoc) * @see Zend_Form#init() */ public function init() { $table = new Tri_Db_Table('activity'); $validators = $table->getValidators(); $filters = $table->getFilters(); $statusOptions = $table->fetchPairs('status', 'status'); $this->setAction('activity/index/save')->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->addValidators($validators['id'])->addFilters($filters['id'])->removeDecorator('Label')->removeDecorator('HtmlTag'); $filters['title'][] = 'StripTags'; $title = new Zend_Form_Element_Text('title'); $title->setLabel('Title')->addValidators($validators['title'])->addFilters($filters['title']); $filters['description'][] = 'StripTags'; $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('Description')->addValidators($validators['description'])->addFilters($filters['description'])->setAttrib('rows', 10)->setAllowEmpty(false); if (!$statusOptions || isset($statusOptions[''])) { $status = new Zend_Form_Element_Text('status'); } else { $statusOptions = array_unique($statusOptions); $status = new Zend_Form_Element_Select('status'); $status->addMultiOptions(array('' => '[select]') + $statusOptions)->setRegisterInArrayValidator(false); } $begin = new Zend_Form_Element_Text('begin'); $begin->setLabel('Begin')->setAttrib('class', 'date')->addFilters($filters['begin'])->addValidators($validators['begin'])->setAllowEmpty(false)->getPluginLoader('filter')->addPrefixPath('Tri_Filter', 'Tri/Filter'); $end = new Zend_Form_Element_Text('end'); $end->setLabel('End')->setAttrib('class', 'date')->addFilters($filters['end'])->getPluginLoader('filter')->addPrefixPath('Tri_Filter', 'Tri/Filter'); $status->setLabel('Status')->addValidators($validators['status'])->addFilters($filters['status']); $this->addElement($id)->addElement($title)->addElement($description)->addElement($begin)->addElement($end)->addElement($status)->addElement('submit', 'Save'); }
public function init() { $this->setName('send-tweet'); $e = new Zend_Form_Element_Text('latitude'); $e->setLabel('Latitude'); $e->addFilter('StringTrim'); $e->setAttrib('onblur', 'setMarkerFromForm()'); $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/')); $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Latitude is not valid'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Text('longitude'); $e->setLabel('Longitude'); $e->addFilter('StringTrim'); $e->setAttrib('onblur', 'setMarkerFromForm()'); $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/')); $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Longitude is not valid'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Textarea('tweet'); $e->setLabel('Tweet'); $e->setRequired(true); $e->addFilter('StripTags'); $e->addFilter('StringTrim'); $e->addValidator(new Zend_Validate_StringLength(array('max' => 140))); $e->setTranslator(new Zend_Translate_Adapter_Array(array('isEmpty' => 'Please supply the message to be tweeted', 'stringLengthTooLong' => 'No more than 140 characters please!'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Submit('send'); $e->setIgnore(true); $e->setLabel('Tweet!'); $this->addElement($e); }
public function init() { $languageFile = Zend_Registry::get('languageFile'); $translate = new Zend_Translate('array', $languageFile, 'zh_CN'); $this->setTranslator($translate); $this->setMethod('POST'); $this->setName('contactForm'); $element = new Zend_Form_Element_Text('name'); $element->setLabel('怎么称呼您'); $this->addElement($element); $element = new Zend_Form_Element_Text('email'); $element->setLabel('您的Email'); //$element->setRequired(true); $this->addElement($element); $element = new Elements(); $element->addReCaptcha($this); $this->addDisplayGroup(array('name', 'email', 'captcha'), 'leftSection'); $this->getDisplayGroup('leftSection')->removeDecorator('DtDdWrapper'); $element = new Zend_Form_Element_Textarea('body'); $element->setLabel('想要开通城市地区和找房贴士,关于您的简单介绍'); $element->addPrefixPath('My_Validator', 'My/Validator/', 'validate'); $element->addValidator('FormValueNotNull', true); //$element->setRequired(true); $element->setAttrib('rows', 13); $this->addElement($element); $this->addDisplayGroup(array('body'), 'rightSection'); $this->getDisplayGroup('rightSection')->removeDecorator('DtDdWrapper'); $element = new Zend_Form_Element_Submit('post'); $element->removeDecorator('Label'); $this->addElement($element); }
public function __construct($options = null) { parent::__construct($options); $this->setAttrib('accept-charset', 'UTF-8'); $this->setName('applog'); $id = new Zend_Form_Element_Hidden('id'); $hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $timestamp = new Zend_Form_Element_Text('timestamp'); $timestamp->setLabel('timestamp'); $priorityName = new Zend_Form_Element_Text('priorityName'); $priorityName->setLabel('priorityName'); $priority = new Zend_Form_Element_Text('priority'); $priority->setLabel('priority'); $className = new Zend_Form_Element_Text('className'); $className->setLabel('className'); $message = new Zend_Form_Element_Textarea('message'); $message->setLabel('message'); $identity = new Zend_Form_Element_Text('identity'); $identity->setLabel('identity'); $httpReferer = new Zend_Form_Element_Textarea('HTTP_REFERER'); $httpReferer->setLabel('HTTP_REFERER'); $remoteAddr = new Zend_Form_Element_Text('REMOTE_ADDR'); $remoteAddr->setLabel('REMOTE_ADDR'); $requestMethod = new Zend_Form_Element_Text('REQUEST_METHOD'); $requestMethod->setLabel('REQUEST_METHOD'); $requestTime = new Zend_Form_Element_Text('REQUEST_TIME'); $requestTime->setLabel('REQUEST_TIME'); $mysqltimestamp = new Zend_Form_Element_Text('mysqltimestamp'); $mysqltimestamp->setLabel('mysqltimestamp'); $elements = array($id, $hash, $timestamp, $priorityName, $priority, $className, $message, $identity, $httpReferer, $remoteAddr, $requestMethod, $requestTime, $mysqltimestamp); $this->addElements($elements); $this->addElements(array($submit)); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post'); $this->addElement('Hidden', 'search', array('value' => 1)); $tieu_de = new Zend_Form_Element_Text('tieu_de'); $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $quan_trong = new Zend_Form_Element_Select('quan_trong'); $quan_trong->setLabel('Quan Trọng')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $noi_bat = new Zend_Form_Element_Select('noi_bat'); $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $photo = new Zend_Form_Element_File('photo'); $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $image = new Zend_Form_Element_Image('image'); $image->setLabel('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions); $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $mo_ta_tom_tat = new Zend_Form_Element_Textarea('mo_ta_tom_tat'); $mo_ta_tom_tat->setLabel('Mô tả tóm tắt')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_tom_tat', 'class' => 'textarea', 'rows' => '4')); $mo_ta_chi_tiet = new Zend_Form_Element_Textarea('mo_ta_chi_tiet'); $mo_ta_chi_tiet->setLabel('Mô tả chi tiết (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_chi_tiet', 'class' => 'text-input textarea')); $pdf = new Zend_Form_Element_File('pdf'); $pdf->setLabel('Upload PDF')->setDescription('(*.pdf < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('pdf')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'tin-tuc', 'action' => 'index'), null, true); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"')); $this->addElements(array($tieu_de, $quan_trong, $noi_bat, $photo, $image, $pdf, $trang_thai, $mo_ta_tom_tat, $mo_ta_chi_tiet, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'tin_tuc')), 'Form')); }
public function init() { $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name'); $name->setRequired(true); $this->addElement($name); $enabled = new Zend_Form_Element_Checkbox('enabled'); $enabled->setLabel('Is the action enabled ?'); $this->addElement($enabled); $public = new Zend_Form_Element_Checkbox('public'); $public->setLabel('Is the action public ?'); $this->addElement($public); $use_custom_route = new Zend_Form_Element_Checkbox('use_custom_route'); $use_custom_route->setLabel('Custom Route'); $this->addElement($use_custom_route); $custom_route = new Zend_Form_Element_Text('route'); //$custom_route->setLabel('Custom Route'); $this->addElement($custom_route); $desc = new Zend_Form_Element_Textarea('description'); $desc->cols = 40; $desc->rows = 15; $desc->setLabel('Description'); $desc->setRequired(false); $this->addElement($desc); parent::init(); }
public function __construct($options = null) { parent::__construct($options); $this->setName('WhatIDoForm'); // image, uploader $image = new Zend_Form_Element_File('Image'); $image->setLabel('Image:')->setDestination('img/profile')->addValidator('Count', false, 1)->addValidator('Size', false, 10000000)->addValidator('Extension', false, 'jpg,png,gif')->addFilter('Rename', 'WhatIDo.jpg'); // PictureCaption, string $pictureCaption = new Zend_Form_Element_Textarea('PictureCaption'); $pictureCaption->setLabel('Picture caption:')->setRequired(); // MainText, string $mainText = new Zend_Form_Element_Textarea('MainText'); $mainText->setLabel('Main text:')->setRequired(); // FooterText, string $footerText = new Zend_Form_Element_Textarea('FooterText'); $footerText->setLabel('Footer text:')->setRequired(); // LinkText, string $linkText = new Zend_Form_Element_Text('LinkText'); $linkText->setLabel('Link text:')->setRequired(); // LinkUrl, string $linkUrl = new Zend_Form_Element_Text('LinkUrl'); $linkUrl->setLabel('Link Url:')->setRequired(); // Submit button $submit = new Zend_Form_Element_Submit('Submit'); $submit->setLabel('Submit'); $this->addElements(array($image, $pictureCaption, $mainText, $footerText, $linkText, $linkUrl, $submit)); }
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(); }
public function init() { $this->setMethod('post'); $subject = new \Zend_Form_Element_Text('subject'); $message = new \Zend_Form_Element_Textarea('message'); $priorityId = new \Zend_Form_Element_Select('priorityId'); $categories = new \Zend_Form_Element_Select('categories', array('multiple' => true)); $file = new \Zend_Form_Element_File('file'); $submit = new \Zend_Form_Element_Button('submit'); $cancel = new \Zend_Form_Element_Button('cancel'); $subject->setLabel('Konu:')->setAttrib('placeholder', 'Konu giriniz!')->setAttrib('class', 'form-control')->setRequired(true)->setDescription('')->setErrorMessages(array('required' => 'Bu alan zorunludur!')); $message->setLabel('Mesaj:')->setAttrib('placeholder', 'Mesaj giriniz!')->setAttrib('class', 'form-control')->setAttrib('rows', '5')->setRequired(true)->setDescription('')->setErrorMessages(array('required' => 'Bu alan zorunludur!')); $priorityId->setLabel('Öncelik:')->setAttrib('placeholder', 'Öncelik seçiniz!')->setAttrib('class', 'form-control')->setRequired(true)->setDescription('')->setErrorMessages(array('required' => 'Bu alan zorunludur!')); $categories->setLabel('Kategori:')->setAttrib('placeholder', 'Kategori seçiniz!')->setAttrib('class', 'form-control')->setRequired(true)->setDescription('')->setValidators(array('StringLength'))->setErrorMessages(array('StringLength' => 'En az bir adet seçmelisiniz!', 'reuqired' => 'Bu alan zorunludur')); $file->setLabel('File')->setAttrib('enctype', 'multipart/form-data')->setAttrib('accept', 'image/*')->setAttrib('id', 'upload')->setDestination('/var/www/destek-sistemi/web/upload')->addValidator('Count', false, 1)->addValidator('Size', false, 8388608)->addValidator('Extension', false, 'png,jpg'); $submit->setLabel('Kaydet')->setAttrib('class', 'btn btn-lg btn-primary btn-block')->setAttrib('type', 'submit'); $cancel->setLabel('İptal')->setAttrib('class', 'btn btn-md btn-default btn-block')->setAttrib('type', 'reset'); //$hash->setIgnore(true); // add elements $this->addElements(array($subject, $message, $priorityId, $categories, $file, $submit, $cancel)); // add display group $this->addDisplayGroup(array('subject', 'message', 'priorityId', 'categories', 'submit', 'cancel'), 'ticketForm'); // set decorators \EasyBib_Form_Decorator::setFormDecorator($this, \EasyBib_Form_Decorator::BOOTSTRAP_MINIMAL, 'submit', 'cancel'); }
public function init() { $http_code = new Zend_Form_Element_Text('http_code'); $http_code->setLabel('HTTP Code'); $http_code->setRequired(false); $this->addElement($http_code); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name'); $name->setRequired(true); $this->addElement($name); $msg = new Zend_Form_Element_Textarea('message'); $msg->setLabel('Error Message'); $msg->setAttribs(array('rows' => 10, 'cols' => 40)); $msg->setRequired(true); $this->addElement($msg); /** Maybe next version will have it back. $action = new Default_Model_Action; $all = $action->getList(); $actions = new Zend_Form_Element_Multiselect('actions'); $actions->setLabel('Associated Actions with this Error'); $actions->setMultiOptions($all); $actions->setAttrib('size', 8); $this->addElement($actions); */ $desc = new Zend_Form_Element_Textarea('description'); $desc->cols = 40; $desc->rows = 15; $desc->setLabel('Description'); $desc->setRequired(false); $this->addElement($desc); $this->addElement(new Zend_Form_Element_Submit('submit')); parent::init(); }
public function init() { /** * @todo Localize */ $tr = Zend_Registry::get('tr'); $name = new Zend_Form_Element_Text('mimetype'); $name->setLabel($tr->_('MIMETYPE')); $name->setRequired(true); $name->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($name); $name = new Zend_Form_Element_Text('output_format'); $name->setLabel($tr->_('OUTPUT_FORMAT')); $name->setRequired(true); $name->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($name); $desc = new Zend_Form_Element_Textarea('description'); $desc->cols = 35; $desc->rows = 15; $desc->setLabel($tr->_('DESCRIPTION')); $desc->setRequired(false); $this->addElement($desc); $this->addElement(new Zend_Form_Element_Submit($tr->_('SUBMIT'))); parent::init(); }
protected function _bio() { $e = new Zend_Form_Element_Textarea('bio'); $e->setLabel('Bio:')->setAttrib('rows', 5)->setAttrib('placeholder', _('Write a little about yourself...'))->addFilter('StripTags')->addFilter('StringTrim'); $e->setAttrib('class', 'form-control'); return $e; }
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(); }
public function init() { $this->setName('f2')->setMethod('post'); $nams = Default_Model_Constraints::nam(); $namOption = array("multiOptions" => $nams); $nam = new Zend_Form_Element_Select('nam', $namOption); $nam->setValue(date('Y'))->setLabel('Năm (*)')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'nam')); $bizHDD = new Default_Model_Hdd(); $hdds = $bizHDD->getDSHDByNam(date('Y')); if ($hdds == null) { $hdsOptions = array("multiOptions" => array('-1' => '== Chưa thành lập ==')); } else { $hdds = array('0' => '== Tất cả ==') + $hdds; $hddsOptions = array("multiOptions" => $hdds); } $noi_nhan = new Zend_Form_Element_Select('noi_nhan', $hddsOptions); $noi_nhan->setRequired(true)->setLabel('Hội đồng')->setValue('0')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_nhan'))->setRegisterInArrayValidator(false); $tieu_de = new Zend_Form_Element_Text('tieu_de'); $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $noi_dung = new Zend_Form_Element_Textarea('noi_dung'); $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'hoi-dong', 'action' => 'ds-mail-tb'), null, true); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"')); $this->addElements(array($nam, $noi_nhan, $tieu_de, $noi_dung, $submit, $cancel)); $this->addDisplayGroup(array('submit', 'cancel'), 'btn_submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form')); }
public function __construct($options = null) { parent::__construct(); $this->setMethod('post'); $this->setEnctype('multipart/form-data'); //$this->setAction(''); $this->setName('custom_layout_advanced_form'); $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator'); $clearall = new Oibs_Form_Element_Note('clearall'); $clearall->setValue('<div style="clear:both;"></div>'); $csstextarea = new Zend_Form_Element_Textarea('csscontent'); $csstextarea->setLabel('Editable custom layout css for advanced users')->setAttrib('id', 'css_textarea')->setAttrib('style', 'width: 575px; height: 660px; margin-left: -5px; margin-right: 10px; margin-bottom: 10px;')->setValue($options['cssContent'])->addDecorator('Label', array('tag' => 'div', 'style' => '/*font-weight:bold;*/ float:left; margin-top:6px'))->addValidators(array(array('StringLength', false))); $savecssbutton = new Zend_Form_Element_Submit('save_css_button'); $savecssbutton->setLabel('Save')->setAttrib('style', 'width:60px; float:right;')->removeDecorator('DefaultDecorator')->removeDecorator('DtDdWrapper'); $cancelcssbutton = new Zend_Form_Element_Button('cancel_css_button'); $cancelcssbutton->setLabel('Cancel')->setAttrib('style', 'width:60px; float:right; margin-right:10px')->removeDecorator('DefaultDecorator')->removeDecorator('DtDdWrapper'); $defaultcssbutton = new Zend_Form_Element_Button('default_css_button'); $defaultcssbutton->setLabel('Default')->setAttrib('style', 'width:80px; float:left; margin-left: 10px; margin-top:-17px;')->removeDecorator('DefaultDecorator')->removeDecorator('DtDdWrapper'); $restorecssbutton = new Zend_Form_Element_Button('restore_css_button'); $restorecssbutton->setLabel('Restore')->setAttrib('style', 'width:80px; float:left; margin-left: -5px; margin-top:-17px;')->removeDecorator('DefaultDecorator')->removeDecorator('DtDdWrapper'); $defaultcsshidden = new Zend_Form_Element_Hidden('default_css'); $defaultcsshidden->setAttrib('id', 'default_css')->setValue($options['default_css']); $originalcsshidden = new Zend_Form_Element_Hidden('original_css'); $originalcsshidden->setAttrib('id', 'original_css')->setValue($options['cssContent']); $advancedhelp = new Oibs_Form_Element_Note('help_link_advanced'); $advancedhelp->setValue('<a href="#" onClick="return false;">Help</a>'); $this->addElements(array($csstextarea, $savecssbutton, $cancelcssbutton, $advancedhelp, $restorecssbutton, $defaultcssbutton, $defaultcsshidden, $originalcsshidden)); // Add decorators $this->setDecorators(array('FormElements', 'Form')); }
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; }
public function init() { $this->setAction('/core/event/new'); $this->setAttrib('enctype', 'multipart/form-data'); $eventModel = new Core_Model_Event(); $category = new Zend_Form_Element_Select('category_id'); $category->setLabel('Category')->setMultiOptions($eventModel->getCategories())->setAttrib('class', 'medium')->setDecorators(array('Composite')); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Title')->setRequired(true)->addValidator('regex', true, array('pattern' => '/^.*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Wrong format')))->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'sessions', 'field' => 'title')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 30 characters, only letters, numbers and spaces allowed')->setDecorators(array('Composite')); $desc = new Zend_Form_Element_Textarea('description'); $desc->setLabel('Description')->setAttrib('class', 'medium')->setDescription('Please don\'t make your description too long')->setRequired(false)->addValidator('StringLength', true, array(1, 5000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer description', Zend_Validate_StringLength::TOO_LONG => 'Your description is too long')))->setDecorators(array('Composite')); $locationModel = new Core_Model_Location(); $location = new Zend_Form_Element_Select('location_id'); $location->setLabel('Location')->setDescription('<a href="/core/location/new/type/2">Add a new location</a>')->setMultiOptions($locationModel->getLocationsForSelect())->setAttrib('class', 'medium')->setDecorators(array('Composite')); $closed = new Zend_Form_Element_Checkbox('closed'); $closed->setLabel('Closed meeting')->setRequired(false)->setDecorators(array('Composite')); $cancelled = new Zend_Form_Element_Checkbox('cancelled'); $cancelled->setLabel('Meeting cancelled')->setRequired(false)->setDecorators(array('Composite')); $registration = new Zend_Form_Element_Text('registration'); $registration->setLabel('Registration link')->addValidator('Url')->setAttrib('class', 'medium')->setDescription('Please supply a valid Url')->setDecorators(array('Composite')); $person = new Zend_Form_Element_Text('persons'); $person->setLabel('Persons')->setAttrib('class', 'medium')->setDescription('Please add person(s)')->setDecorators(array('Composite')); $start = new Zend_Form_Element_Text('tstart'); $start->setLabel('Start')->setDescription('dd/MM/yyyy HH:mm - 23/11/2011 14:30')->setAttrib('class', 'medium')->addFilter('Null')->setRequired(false)->setDecorators(array('Composite')); $end = new Zend_Form_Element_Text('tend'); $end->setLabel('End')->setDescription('dd/MM/yyyy HH:mm')->setAttrib('class', 'medium')->addFilter('Null')->addValidator('DateIsLater', false, array('tstart'))->setRequired(false)->setDecorators(array('Composite')); $resize = new TA_Filter_ImageResize(); $resize->setWidth(260)->setHeight(170); $image = new TA_Form_Element_MagicFile('file'); $image->setLabel('Image')->setDescription('This image will show on the event details page')->addDecorators($this->_magicFileElementDecorator)->addFilter($resize)->addValidators(array(array('Count', true, 1), array('IsImage', true), array('Size', true, array('max' => '5Mb')), array('ImageSize', true, array('minwidth' => 300, 'minheight' => 200)))); $this->addElements(array($category, $title, $person, $start, $end, $registration, $desc, $location, $closed, $cancelled, $image)); $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator)); }
/** * (non-PHPdoc) * @see Zend_Form#init() */ public function init() { $this->addElementPrefixPath('Tri_Filter', 'Tri/Filter', 'FILTER'); $table = new Tri_Db_Table('chat_room'); $validators = $table->getValidators(); $filters = $table->getFilters(); $statusOptions = array('open' => 'open', 'close' => 'close'); $this->setAction('chat/room/save')->setMethod('post')->setAttrib('enctype', 'multipart/form-data'); $id = new Zend_Form_Element_Hidden('id'); $id->addValidators($validators['id'])->addFilters($filters['id'])->removeDecorator('Label')->removeDecorator('HtmlTag'); $filters['name'][] = 'StripTags'; $title = new Zend_Form_Element_Text('title'); $title->setLabel('Title')->addValidators($validators['title'])->addFilters($filters['title']); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('Description')->addValidators($validators['description'])->addFilters($filters['description'])->setAttrib('rows', 10); $max = new Zend_Form_Element_Text('max_student'); $max->setLabel('Max student')->addValidators($validators['max_student'])->addFilters($filters['max_student']); if (!$statusOptions || isset($statusOptions[''])) { $status = new Zend_Form_Element_Text('status'); } else { $statusOptions = array_unique($statusOptions); $status = new Zend_Form_Element_Select('status'); $status->addMultiOptions(array('' => '[select]') + $statusOptions)->setRegisterInArrayValidator(false); } $status->setLabel('Status')->addValidators($validators['status'])->addFilters($filters['status']); $this->addElement($id)->addElement($title)->addElement($description)->addElement($status)->addElement('submit', 'Save'); }
public function init() { $this->setAction(URL_BASE . '/action'); $tr = Zend_Registry::get('tr'); $name = new Zend_Form_Element_Text('name'); $name->setLabel($tr->_('NAME')); $name->setRequired(true); $name->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($name); $enabled = new Zend_Form_Element_Checkbox('enabled'); $enabled->setLabel($tr->_('IS_ACTION_ENABLED')); $this->addElement($enabled); $public = new Zend_Form_Element_Checkbox('public'); $public->setLabel($tr->_('IS_ACTION_PUBLIC')); $this->addElement($public); $route = new Zend_Form_Element_Text('route'); $route->setLabel($tr->_('CUSTOM_ROUTE')); $route->setRequired(true); $route->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($route); $desc = new Zend_Form_Element_Textarea('description'); $desc->cols = 35; $desc->rows = 15; $desc->setLabel($tr->_('DESCRIPTION')); $desc->setRequired(false); $this->addElement($desc); parent::init(); }
public function __construct($options = null) { parent::__construct($options); $roles = new Roles(); $role_options = $roles->getRoles(); $inst = new Institutions(); $inst_options = $inst->getInsts(); $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $this->setName('emailsearch'); ZendX_JQuery::enableForm($this); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $message = new Zend_Form_Element_Textarea('messageToUser'); $message->setLabel('Message to user: '******'StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10))->addFilter('BasicHtml')->addErrorMessage('You must enter a message to your recipient.'); $fullname = new Zend_Form_Element_Text('fullname'); $fullname->setLabel('Send this to: ')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setAttrib('size', 30)->setDecorators($decorators); $email = $this->addElement('text', 'email', array('label' => 'Their email Address', 'size' => '30'))->email; $email->addValidator('EmailAddress')->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->setRequired(true)->addErrorMessage('Please enter a valid address!'); $email->setDecorators($decorators); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setLabel('Send to a friend'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $this->addElements(array($fullname, $submit, $message)); $this->addDisplayGroup(array('fullname', 'email', 'messageToUser'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Details: '); $this->addDisplayGroup(array('submit'), 'submit'); }
public function init() { $this->setAction('/core/submit/new'); $type = new Zend_Form_Element_MultiCheckbox('submission_type'); $type->setLabel('')->setRequired(false)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('submission_type'))->setSeparator('<br />')->setDecorators(array('Composite')); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Title')->setRequired(true)->addValidator('StringLength', true, array(2, 64, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer title', Zend_Validate_StringLength::TOO_LONG => 'Your title is too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 64 characters')->setAttrib('maxLength', 64)->setDecorators(array('Composite')); $audience = new Zend_Form_Element_Radio('target_audience'); $audience->setLabel('Please mark the target audience for your presentation')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('target_audience'))->setSeparator('<br />')->setDecorators(array('Composite')); $publish = new Zend_Form_Element_Radio('publish_paper'); $publish->setLabel('Please indicate whether you wish to prepare a full paper for possible publication')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('publish_paper', 'submit'))->setSeparator('<br />')->setDecorators(array('Composite')); $topicModel = new Core_Model_Topic(); $topicsForSelect = $topicModel->getTopicsForSelect(); $topicsel = new Zend_Form_Element_MultiCheckbox('topic'); $topicsel->setLabel('Topic')->setRequired(false)->setAttrib('class', 'tiny')->setMultiOptions($topicsForSelect)->setSeparator('<br />')->setDecorators(array('Composite')); $keywords = new Zend_Form_Element_Text('keywords'); $keywords->setLabel('Keywords')->setRequired(false)->addValidator('StringLength', true, array(2, 500, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide longer keywords', Zend_Validate_StringLength::TOO_LONG => 'Your keywords are too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 500 characters')->setDecorators(array('Composite')); $abstract = new Zend_Form_Element_Textarea('abstract'); $abstract->setLabel('Submission Summary (If your submission is accepted, this will be publicly visible!)')->setAttrib('class', 'small')->setDescription('Must be between 5 and 2000 characters')->setRequired(false)->addValidator('StringLength', true, array(5, 2000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer abstract', Zend_Validate_StringLength::TOO_LONG => 'Your abstract is too long')))->setDecorators(array('Composite')); $comment = new Zend_Form_Element_Textarea('comment'); $comment->setLabel('Information for Reviewers')->setAttrib('class', 'small')->setDescription('Must be between 5 and 1000 characters')->setRequired(false)->addValidator('StringLength', true, array(5, 1000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer description', Zend_Validate_StringLength::TOO_LONG => 'Your description is too long')))->setDecorators(array('Composite')); $file = new TA_Form_Element_MagicFile('file'); $file->setLabel('Your submission (File must be pdf and no bigger than 10Mb) *')->setRequired(false)->addDecorators($this->_magicFileElementDecorator)->addValidators(array(array('Count', true, 1), array('Size', true, 10000000), array('Extension', true, array('pdf', 'case' => true)), array('MimeType', false, array('application/pdf')))); $file->getValidator('Extension')->setMessage('Only pdf files are allowed!'); $subform = new Zend_Form_SubForm(); $subform->setDecorators(array('FormElements')); $subform->addElements(array($type, $file, $title, $audience, $topicsel, $keywords, $abstract, $comment)); $this->addSubForm($subform, 'submission'); $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator)); }
public function __construct($options = null) { parent::__construct($options); $translate = Zend_Registry::get('Zend_Translate'); $this->setName('registercomplete_form'); $this->setAttrib('id', 'registercomplete_form'); $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator'); $this->addElementPrefixPath('Oibs_Validators', 'OIBS/Validators/', 'validate'); $this->removeDecorator('DtDdWrapper'); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setLabel($translate->_("account-register-firstname"))->setRequired(false)->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_firstname')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_firstname'))))->setDecorators(array('RegistercompleteDecorator')); $surname = new Zend_Form_Element_Text('surname'); $surname->setLabel($translate->_("account-register-surname"))->setRequired(false)->removeDecorator('DtDdWrapper')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_surname'))))->setAttrib('id', 'registercomplete_surname')->setDecorators(array('RegistercompleteDecorator')); $image = new Zend_Form_Element_File('image'); $image->setLabel($translate->_("account-registercomplete-add-image"))->setDestination('../www/upload')->addValidator('Count', false, 1)->addValidator('Size', false, 25600)->addValidator('Extension', false, 'jpg,png,gif')->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_image')->removeDecorator('DefaultDecorator')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'form_registercomplete_image', 'style' => 'display:block'))->addDecorator('Label', array('tag' => 'div', 'id' => 'form_registercomplete_image_label', 'style' => 'display:block')); $bio = new Zend_Form_Element_Textarea('bio'); $bio->setLabel($translate->_("account-register-bio"))->setRequired(false)->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_bio')->setAttribs(array("onkeydown" => "textCounter(this,'progressbar_bio',0,160," . $translate->getLocale() . ");", "onkeyup" => "textCounter(this,'progressbar_bio',0,160," . $translate->getLocale() . ");"))->setDescription($translate->_('account-register-bio-desc'))->setDecorators(array('RegistercompleteDecorator')); // $bio_counter here... $select_str = $translate->_("account-select"); $country = new Zend_Form_Element_Select('country'); $country->setLabel($translate->_("account-register-country"))->setRequired(false)->removeDecorator('DtDdWrapper')->setMultiOptions(array($select_str, 'fi' => 'Finland'))->setAttrib('id', 'registercomplete_country')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_country'))))->setDecorators(array('RegistercompleteDecorator')); $deflang = new Zend_Form_Element_Select('deflang'); $deflang->setLabel($translate->_("account-register-deflang"))->setMultiOptions(array($select_str, 'en' => 'English', 'fi' => 'Finnish'))->addFilter('StringToLower')->setRequired(false)->removeDecorator('DtDdWrapper')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_deflang'))))->setAttrib('id', 'registercomplete_deflang')->setDecorators(array('RegistercompleteDecorator')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel($translate->_("account-register-submit"))->removeDecorator('DtDdWrapper')->setAttrib('id', 'registercomplete_submit')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registrationcomplete_submit_div'))))->setAttrib('class', 'registrationcomplete_form_submit_' . $translate->getLocale())->setAttrib('disabled', 'true'); $this->addElements(array($firstname, $surname, $image, $bio, $country, $deflang, $submit)); $this->setAttrib('enctype', 'multipart/form-data'); $this->addDisplayGroup(array('firstname', 'surname', 'image', 'bio', 'country', 'deflang', 'submit'), 'allFields'); $this->allFields->removeDecorator('DtDdWrapper'); $this->allFields->setLegend('register-confirmations'); }
public function init() { $this->setMethod('post'); //$this->setAttrib('action',DOMAIN.'language/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'servicedeskdepartment'); $id = new Zend_Form_Element_Hidden('id'); $servicedeskdepartment = new Zend_Form_Element_Text("service_desk_name"); $servicedeskdepartment->setLabel("Category"); $servicedeskdepartment->setAttrib('maxLength', 30); $servicedeskdepartment->addFilter(new Zend_Filter_StringTrim()); $servicedeskdepartment->setRequired(true); $servicedeskdepartment->addValidator('NotEmpty', false, array('messages' => 'Please enter category.')); $servicedeskdepartment->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9\\- ]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid category.'))); $servicedeskdepartment->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_sd_depts', 'field' => 'service_desk_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1'))); $servicedeskdepartment->getValidator('Db_NoRecordExists')->setMessage('Category name already exists.'); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel("Description"); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $servicedeskdepartment, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'appraisalcategory'); $id = new Zend_Form_Element_Hidden('id'); $appraisalcategory = new Zend_Form_Element_Text("category_name"); $appraisalcategory->setLabel('Parameter'); $appraisalcategory->setAttrib('maxLength', 30); $appraisalcategory->addFilter(new Zend_Filter_StringTrim()); $appraisalcategory->setRequired(true); $appraisalcategory->addValidator('NotEmpty', false, array('messages' => 'Please enter parameter.')); $appraisalcategory->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?\',\\/#@$&*()!+]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid parameter.'))); $appraisalcategory->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_pa_category', 'field' => 'category_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1'))); $appraisalcategory->getValidator('Db_NoRecordExists')->setMessage('Parameter name already exists.'); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel("Description"); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $appraisalcategory, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function __construct($options = null) { parent::__construct($options); $this->setAttrib('accept-charset', 'UTF-8'); $this->setName('safcontrollers'); $id = new Zend_Form_Element_Hidden('id'); $hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $label = new Zend_Form_Element_Text('label'); $label->setLabel('label'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('name'); $image = new Zend_Form_Element_Textarea('image'); $image->setLabel('image'); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('description'); $safmodulesId = new Zend_Form_Element_Select('safmodules_id'); $options = new Safmodules(); $safmodulesId->addMultiOption('', '----------'); foreach ($options->fetchAlltoFlatArray() as $k => $v) { $safmodulesId->addMultiOption($k, $v['mlabel']); } $safmodulesId->setLabel('safmodules_id'); $this->addElements(array($id, $hash, $label, $name, $image, $description, $safmodulesId)); $this->addElements(array($submit)); }
public function init() { /** * projeto_id */ $modelProjeto = new Model_DbTable_Projeto(); $projeto_id = new Zend_Form_Element_Select("projeto_id"); $projeto_id->setLabel("Projeto: "); $projeto_id->setAttribs(array('class' => 'form-control')); $projeto_id->setMultiOptions($modelProjeto->fetchPairs()); $this->addElement($projeto_id); /** * tarefa_nome */ $tarefa_nome = new Zend_Form_Element_Text("tarefa_nome"); $tarefa_nome->setLabel("Título: "); $tarefa_nome->setAttribs(array('class' => 'form-control')); $tarefa_nome->setRequired(); $this->addElement($tarefa_nome); /** * tarefa_descricao */ $tarefa_descricao = new Zend_Form_Element_Textarea("tarefa_descricao"); $tarefa_descricao->setLabel("Descrição: "); $tarefa_descricao->setAttribs(array('class' => 'form-control', 'rows' => 10)); $tarefa_descricao->setRequired(); $this->addElement($tarefa_descricao); parent::init(); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post'); $this->addElement('Hidden', 'search', array('value' => 1)); $tieu_de = new Zend_Form_Element_Text('tieu_de'); $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $noi_dung = new Zend_Form_Element_Textarea('noi_dung'); $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea')); $soundcloud_embed = new Zend_Form_Element_Text('soundcloud_embed'); $soundcloud_embed->setLabel('Embed SoundCloud')->setDescription('How to get SoundCloud embed code? <a href="http://help.soundcloud.com/customer/portal/articles/243751-how-can-i-put-my-track-or-playlist-on-my-site-or-blog-" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $youtube_embed = new Zend_Form_Element_Text('youtube_embed'); $youtube_embed->setLabel('Embed Youtube')->setDescription('How to get Youtube embed code? <a href="https://support.google.com/youtube/answer/171780?hl=en" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $link_nct = new Zend_Form_Element_Text('link_nct'); $link_nct->setLabel('Nhac cua tui')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $link_mp3 = new Zend_Form_Element_Text('link_mp3'); $link_mp3->setLabel('Mp3')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions); $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $noi_bat = new Zend_Form_Element_Select('noi_bat'); $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $photo = new Zend_Form_Element_File('photo'); $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/bai_giang')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"')); $this->addElements(array($tieu_de, $noi_dung, $soundcloud_embed, $youtube_embed, $link_nct, $link_mp3, $trang_thai, $noi_bat, $photo, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form')); }
public function init() { $tr = Zend_Registry::get('tr'); $name = new Zend_Form_Element_Text('name'); $name->setLabel($tr->_('NAME')); $name->setRequired(true); $this->addElement($name); $enabled = new Zend_Form_Element_Checkbox('enabled'); $enabled->setLabel($tr->_('IS_ACTION_ENABLED')); $this->addElement($enabled); $public = new Zend_Form_Element_Checkbox('public'); $public->setLabel($tr->_('IS_ACTION_PUBLIC')); $this->addElement($public); $route = new Zend_Form_Element_Text('route'); $route->setLabel($tr->_('ROUTE')); $route->setRequired(true); $this->addElement($route); $desc = new Zend_Form_Element_Textarea('description'); $desc->cols = 35; $desc->rows = 15; $desc->setLabel($tr->_('DESCRIPTION')); $desc->setRequired(false); $this->addElement($desc); parent::init(); }
public function __construct($options = null) { // variable parent::__construct($options); $baseDir = $options['baseDir']; // name $name = new Zend_Form_Element_Text('EGI_Name'); $name->setLabel($this->getView()->getCibleText('form_label_name'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($name); // description $description = new Zend_Form_Element_Textarea('EGI_Description'); $description->setLabel($this->getView()->getCibleText('form_label_description'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextareaEdit'); $this->addElement($description); //status $status = new Zend_Form_Element_Select('EG_Status'); $status->setLabel($this->getView()->getCibleText('form_label_status'))->setAttrib('class', 'stdSelect'); $status = Cible_FunctionsGeneral::fillStatusSelectBox($status, 'Extranet_Groups', 'EG_Status'); $this->addElement($status); // Hidden GroupID $groupID = new Zend_Form_Element_Hidden('groupID'); $groupID->removeDecorator('label'); $groupID->removeDecorator('DtDdWrapper'); if (isset($options['groupID'])) { $groupID->setValue($options['groupID']); } $this->addElement($groupID); }
public function init() { $this->setMethod('POST'); $this->setName('guestForm'); $element = new Zend_Form_Element_Text('name'); $element->setLabel('怎么称呼您'); $element->setDescription('必填,中英文都可,2到30个字'); $element->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Text('email'); $element->setLabel('您的Email'); $element->setRequired(true); $element->addValidator(new Zend_Validate_EmailAddress()); $element->addValidator('NotEmpty'); $element->setDescription('必填'); $this->addElement($element); $element = new Zend_Form_Element_Textarea('body'); $element->setLabel('您的留言'); $element->setAttrib('rows', 4); $element->addValidator('NotEmpty'); $this->addElement($element); $element = new Elements(); $element->addReCaptcha($this); $element = new Zend_Form_Element_Submit('post'); $element->setValue('提交')->removeDecorator('Label'); $this->addElement($element); }