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'); $cateOptions = Khcn_Api::_()->getDbTable('loai_audio', 'default')->getListAssoc(); $loai_audio_id = new Zend_Form_Element_Select('loai_audio_id'); $loai_audio_id->setLabel('Loại (*)')->addMultiOptions($cateOptions)->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'); $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'); $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')))); $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, $loai_audio_id, $noi_dung, $soundcloud_embed, $trang_thai, $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')); }
function setForm() { $form = new Zend_Form; $form->setMethod('post')->setAction(''); //$this->setAttrib('enctype','multipart/form-data'); $file = new Zend_Form_Element_File('video_file'); //$file->setAttrib('class','file'); $file->setLabel('video_file'); $file->setRequired(true); $video_title = new Zend_Form_Element_Text('video_title'); $video_title ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tiêu đề không được để trống')); $video_thumbnail=new Zend_Form_Element_Textarea('video_thumbnail'); $video_thumbnail->removeDecorator('HtmlTag')->removeDecorator('Label'); $video_description = new Zend_Form_Element_Textarea('video_description'); $video_description->setAttrib('rows','7'); $video_description ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mô tả không được để trống')); $is_active = new Zend_Form_Element_Radio('is_active'); $is_active->setRequired(true) ->setLabel('is_active') ->setMultiOptions(array("1" => "Có","0" => "Không")); $file->removeDecorator('HtmlTag')->removeDecorator('Label'); $video_title->removeDecorator('HtmlTag')->removeDecorator('Label'); $video_description->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($file,$video_title,$video_description,$is_active,$video_thumbnail)); return $form; }
public function init() { // profissional_beleza_id $profissional_beleza_id = new Zend_Form_Element_Radio("profissional_beleza_id"); $profissional_beleza_id->setLabel("Selecione o profissional desejado: "); $profissional_beleza_id->setRegisterInArrayValidator(false); $profissional_beleza_id->setRequired(); $profissional_beleza_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); // agenda_data $agenda_data = new Zend_Form_Element_Text("agenda_data"); $agenda_data->setLabel("Selecione a data: "); $agenda_data->setAttribs(array('class' => 'form-control', 'autocomplete' => 'off')); $agenda_data->setRequired(); $agenda_data->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // agenda_hora $agenda_hora = new Zend_Form_Element_Select("agenda_hora"); $agenda_hora->setLabel('Selecione a hora: '); $agenda_hora->setAttribs(array('class' => 'form-control')); $agenda_hora->setMultiOptions(array('' => 'Horários')); $agenda_hora->setRequired(); $agenda_hora->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $agenda_hora->setRegisterInArrayValidator(false); // agenda_observacao $agenda_observacao = new Zend_Form_Element_Textarea("agenda_observacao"); $agenda_observacao->setLabel("Observações: "); $agenda_observacao->setAttribs(array('class' => 'form-control', 'rows' => 7, 'placeholder' => 'Informe alguma observação, por exemplo, alguma preferência de produto, etc.')); // salao_id $salao_id = new Zend_Form_Element_Hidden('salao_id'); // especialidade_id $especialidade_id = new Zend_Form_Element_Hidden("especialidade_id"); // usuario_id $usuario_id = new Zend_Form_Element_Hidden("usuario_id"); $this->addElements(array($profissional_beleza_id, $agenda_data, $agenda_hora, $agenda_observacao, $salao_id, $especialidade_id, $usuario_id)); parent::init(); }
public function init() { // Set form attributes $this->addElement('Text', 'contact', array('label' => 'Contact Form Email', 'description' => 'Enter the email address you want contact form messages to be sent to.', 'decorators' => array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'class' => 'description', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'id' => 'contact-element', 'style' => 'width: 75%')), array('Label', array('tag' => 'td', 'id' => 'contact-label')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'contact-wrapper'))), 'attribs' => array('class' => 'text-input'))); // Element: mail_name $this->addElement('Text', 'name', array('label' => 'From Name', 'description' => 'Enter the name you want the emails from the system to come from in the field below.', 'value' => 'Site Admin', 'decorators' => array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'class' => 'description', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'id' => 'name-element')), array('Label', array('tag' => 'td', 'id' => 'name-label')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'name-wrapper'))), 'attribs' => array('class' => 'text-input'))); // Element: mail_from $this->addElement('Text', 'from', array('label' => 'From Address', 'description' => 'Enter the email address you want the emails from the system to come from in the field below.', 'value' => 'no-reply@' . $_SERVER['HTTP_HOST'], 'decorators' => array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'class' => 'description', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'id' => 'from-element')), array('Label', array('tag' => 'td', 'id' => 'from-label')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'from-wrapper'))), 'attribs' => array('class' => 'text-input'))); $mailSmtpOptions = array("multiOptions" => array('0' => 'Use the built-in mail() function', '1' => 'Send emails through an SMTP server')); $mail_smtp = new Zend_Form_Element_Radio('mail_smtp', $mailSmtpOptions); $mail_smtp->setRequired(true)->setLabel('Send through SMTP')->setDescription('Emails typically get sent through the web server using the PHP mail() function. Alternatively you can have emails sent out using SMTP, usually requiring a username and password, and optionally using an external mail server.')->setValue('0')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'class' => 'description', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'id' => 'mail_smtp-element')), array('Label', array('tag' => 'td', 'id' => 'mail_smtp-label')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'mail_smtp-wrapper', 'class' => 'radio_inline'))))->setAttribs(array('id' => 'mail_smtp')); $this->addElement($mail_smtp); // Element: mail_smtp_server $this->addElement('Text', 'mail_smtp_server', array('label' => 'SMTP Server Address', 'required' => false, 'value' => '127.0.0.1', 'decorators' => array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'class' => 'description', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'id' => 'mail_smtp_server-element')), array('Label', array('tag' => 'td', 'id' => 'mail_smtp_server-label')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'mail_smtp_server-wrapper'))), 'attribs' => array('class' => 'text-input'))); // Element: mail_smtp_port $this->addElement('Text', 'mail_smtp_port', array('label' => 'SMTP Server Port', 'description' => 'Default: 25. Also commonly on port 465 (SMTP over SSL) or port 587.', 'required' => false, 'value' => '25', 'validators' => array('Int'), 'decorators' => array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'class' => 'description', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'id' => 'mail_smtp_port-element')), array('Label', array('tag' => 'td', 'id' => 'mail_smtp_port-label')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'mail_smtp_port-wrapper'))), 'attribs' => array('class' => 'text-input'))); $authenticationOptions = array("multiOptions" => array(1 => 'Yes', 0 => 'No')); $mail_smtp_authentication = new Zend_Form_Element_Radio('mail_smtp_authentication', $authenticationOptions); $mail_smtp_authentication->setRequired(false)->setLabel('SMTP Authentication?')->setDescription('Does your SMTP Server require authentication?')->setValue('0')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'class' => 'description', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'id' => 'mail_smtp_authentication-element')), array('Label', array('tag' => 'td', 'id' => 'mail_smtp_authentication-label')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'mail_smtp_authentication-wrapper', 'class' => 'radio_inline'))))->setAttribs(array('id' => 'mail_smtp_authentication')); $this->addElement($mail_smtp_authentication); // Element: mail_smtp_username $this->addElement('Text', 'mail_smtp_username', array('label' => 'SMTP Username', 'decorators' => array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'class' => 'description', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'id' => 'mail_smtp_username-element')), array('Label', array('tag' => 'td', 'id' => 'mail_smtp_username-label')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'mail_smtp_username-wrapper'))), 'attribs' => array('class' => 'text-input'))); // Element: mail_smtp_password $this->addElement('Password', 'mail_smtp_password', array('label' => 'SMTP Password', 'description' => 'Leave blank to use previous.', 'decorators' => array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'class' => 'description', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'id' => 'mail_smtp_password-element')), array('Label', array('tag' => 'td', 'id' => 'mail_smtp_password-label')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'mail_smtp_password-wrapper'))), 'attribs' => array('class' => 'text-input'))); $sslOptions = array("multiOptions" => array('' => 'None', 'tls' => 'TLS', 'ssl' => 'SSL')); $mail_smtp_ssl = new Zend_Form_Element_Radio('mail_smtp_ssl', $sslOptions); $mail_smtp_ssl->setRequired(false)->setLabel('Use SSL or TLS?')->setValue('')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'class' => 'description', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'id' => 'mail_smtp_ssl-element')), array('Label', array('tag' => 'td', 'id' => 'mail_smtp_ssl-label')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'mail_smtp_ssl-wrapper', 'class' => 'radio_inline'))))->setAttribs(array('id' => 'mail_smtp_ssl')); $this->addElement($mail_smtp_ssl); // Element: submit $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span', 'id' => 'submit-element')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'id' => 'submit-wrapper'))), 'attribs' => array('class' => 'button'))); $this->addDisplayGroup(array('submit'), 'btnsubmit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'mail_settings')), 'Form')); }
public function __construct($forSearch = false) { parent::__construct(); if ($forSearch) { $radioKind = new Zend_Form_Element_Radio('kind'); $radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or')); $radioKind->setValue('and'); $radioKind->setLabel('Search field combination:'); $radioKind->setRequired(true); $this->addElement($radioKind); } $this->addElement('hidden', CalibrationExercise::COL_ID, array('required' => true)); $this->addElement('hidden', CalibrationExercise::COL_WORKSHOP_ID, array('required' => true)); $valiAlphaWhiteSpace = new Zend_Validate_Alpha(true); $valiAlnumWhiteSpace = new Zend_Validate_Alnum(true); $this->addElement('text', CalibrationExercise::COL_NAME, array('label' => 'Calibration exercise name:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace))); $this->addElement('text', CalibrationExercise::COL_DESCRIPTION, array('label' => 'Description:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace))); $this->addElement(new Default_Form_Element_KeyTableSelect(CalibrationExercise::COL_KEY_TABLE_ID, array('label' => 'Protocol:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace)))); $this->addElement(new Default_Form_Element_ExpertiseSelect(CalibrationExercise::COL_EXPERTISE_ID, array('label' => 'Expertise:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace)))); $this->addElement('checkbox', CalibrationExercise::COL_COMPAREABLE, array('label' => 'Show comparable other user/group annotations/references:', 'required' => true)); $this->addElement('checkbox', CalibrationExercise::COL_RANDOMIZED, array('label' => 'Allow adding images to image set at random:', 'required' => true)); $this->addElement('submit', 'save', array('label' => 'Save')); $this->addElement('hidden', 'Token'); $this->addElement('hidden', CalibrationExercise::COL_IS_STOPPED); }
public function init() { $this->setName('f2')->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $ma = new Zend_Form_Element_Text('ma'); $ma->setLabel('Mã')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToUpper')->addValidator(new Zend_Validate_StringLength(0, 10))->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'))))->setAttribs(array('class' => 'text-input')); $ten = new Zend_Form_Element_Text('ten'); $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 250))->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 medium-input'); $ofSGUOptions = array("multiOptions" => array('1' => 'Thuộc', '0' => 'Không thuộc')); $thuoc_sgu = new Zend_Form_Element_Radio('thuoc_sgu', $ofSGUOptions); $thuoc_sgu->setRequired(true)->setLabel('Thuộc SGU')->setValue('1')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => 'radio_inline'))))->setAttribs(array('id' => 'thuoc_sgu')); $deptOptions = array("multiOptions" => array('1' => 'Khoa - Bộ môn TT', '0' => 'Phòng ban - Trung tâm')); $la_khoa = new Zend_Form_Element_Radio('la_khoa', $deptOptions); $la_khoa->setRequired(true)->setLabel('Loại đơn vị')->setValue('1')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'la_khoa', 'class' => 'radio_inline')))); $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' => 'don-vi', '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($id, $ma, $ten, $thuoc_sgu, $la_khoa, $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')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'don_vi')), 'Form')); }
public function __construct() { parent::__construct(); $radioKind = new Zend_Form_Element_Radio('kind'); $radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or')); $radioKind->setValue('and'); $radioKind->setLabel('Search field combination:'); $radioKind->setRequired(true); $this->addElement($radioKind); $fishSampleCode = new Zend_Form_Element_Text(Fish::COL_SAMPLE_CODE); $fishSampleCode->setLabel('Fish Sample Code:'); //--------------------------------------------------------- //read the available image attributes from attribute descriptor+group image $metadata = new Default_MetaData(); $fishRowSetArray = $metadata->getAttributesComplete('fish'); //---------------------------------------------------------- $this->addDynamicElements($fishRowSetArray, true); $this->addElement($fishSampleCode); $this->addElement('submit', 'submit', array('label' => 'search')); $this->addElement('hidden', 'Token'); $this->setElementFilters(array('StringTrim')); //#####################new################################### $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'dynamic_form')), array('Description', array('placement' => 'prepend')), 'Form')); $this->setElementDecorators(array('ViewHelper', 'Errors', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr')))); $this->setSubFormDecorators(array('FormElements', array('HtmlTag', array('tag' => 'tr')))); foreach ($this->getSubForms() as $index => $subform) { $subform->setElementDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))); } $this->submit->setDecorators(array(array('decorator' => 'ViewHelper', 'options' => array('helper' => 'formSubmit')), array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td', 'colspan' => 2)), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr')))); //########################################################### }
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() { $this->setName('f2')->setMethod('post'); $ten = new Zend_Form_Element_Text('ten'); $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 255))->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'))))->setAttribs(array('class' => 'text-input medium-input')); $statusOptions = array("multiOptions" => array(1 => 'Thuộc SGU', 0 => 'Liên kết trang mạng')); $is_sgu = new Zend_Form_Element_Radio('is_sgu', $statusOptions); $is_sgu->setRequired(true)->setLabel('Liên kết')->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')))); $url = new Zend_Form_Element_Text('url'); $url->setLabel('Url (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 255))->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 medium-input'); $file = new Zend_Form_Element_File('file'); $file->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/small/images/lien_ket')->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')))); $maxOrder = Khcn_Api::_()->getDbTable('lien_ket', 'default')->getMaxOrderItem(); $order = new Zend_Form_Element_Text('order'); $order->setLabel('Thứ tự *')->setValue($maxOrder->order + 1)->addValidator(new Zend_Validate_Int())->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'))))->setAttribs(array('class' => 'text-input tinysmall-input')); $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' => 'lien-ket', '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($ten, $is_sgu, $url, $file, $order, $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')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'lien_ket')), 'Form')); }
function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $image_name = new Zend_Form_Element_Text('image_name'); $image_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên ảnh không được để trống')); $image_link = new Zend_Form_Element_Textarea('image_link'); $image_link->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Hình ảnh không được để trống')); $is_active = new Zend_Form_Element_Radio('is_active'); $is_active->setRequired(true) ->setLabel('is_active') ->setMultiOptions(array("1" => "Có","0" => "Không")); $image_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $image_link->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($image_name,$image_link,$is_active)); return $form; }
public function init() { $this->setMethod("post"); $title = new Zend_Form_Element_Text("title"); $title->setAttrib("placeholder", "Title"); $title->setAttrib("class", "form-control"); $title->setLabel("Title: "); $title->setRequired(); $body = new Zend_Form_Element_Textarea("body"); $body->setAttrib("class", "form-control"); $body->setAttrib("placeholder", "Write body here...."); $body->setLabel("Body: "); $body->setAttrib("rows", "5"); $body->setAttrib("cols", "55"); $body->setRequired(); $picture = new Zend_Form_Element_File('picture'); $picture->setLabel("Picture:"); $picture->setRequired(); $picture->setDestination('/var/www/html/RNR/public/images/thread'); $stick = new Zend_Form_Element_Radio("stick"); $stick->setLabel("Sticky:"); $stick->addMultiOption("on", "on"); $stick->addMultiOption("off", "off"); $stick->setRequired(); $id = new Zend_Form_Element_Hidden("id"); $submit = new Zend_Form_Element_Submit("Submit"); $submit->setAttrib("class", "btn btn-primary"); $submit->setLabel("Save"); $rest = new Zend_Form_Element_Submit('Rest'); $rest->setAttrib("class", "btn btn-info"); $this->addElements(array($id, $title, $body, $picture, $stick, $submit, $rest)); }
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() { $this->setName('f3')->setMethod('post'); $mauOptions = array("multiOptions" => Default_Model_Constraints::report()); $mau = new Zend_Form_Element_Select('mau', $mauOptions); $mau->setRequired(true)->setLabel('Mẫu báo cáo (*)')->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'))))->setAttribs(array('id' => 'mau')); $namOptions = array("multiOptions" => Default_Model_Constraints::nam()); $nam = new Zend_Form_Element_Select('nam', $namOptions); $nam->setRequired(true)->setLabel('Năm (*)')->setValue(date('Y'))->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' => 'nam')); $quyet_dinh = new Zend_Form_Element_Text('quyet_dinh'); $quyet_dinh->setLabel('Quyết định')->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'))))->setAttrib('class', 'text-input medium-input'); $loai_lv = new Default_Model_LoaiLinhVuc(); $llvOptions = array("multiOptions" => $loai_lv->getMultiOptions()); $ma_loai = new Zend_Form_Element_Select('ma_loai', $llvOptions); $ma_loai->setLabel('Loại')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'ma_loai-wrapper')))); $options = array("multiOptions" => array('1' => 'Có', '0' => 'Không')); $thong_bao = new Zend_Form_Element_Radio('thong_bao', $options); $thong_bao->setRequired(true)->setLabel('Tạo thông báo mới')->setValue('0')->setSeparator('')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'thong_bao')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'thong_bao-wrapper'))))->setAttribs(array('id' => 'thong_bao')); $fileTypeOptions = array("multiOptions" => array('excel' => 'Excel', 'pdf' => 'Pdf')); $file_type = new Zend_Form_Element_Select('file_type', $fileTypeOptions); $file_type->setRequired(true)->setLabel('Xuất Thành File')->setSeparator('')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'file_type')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'file_type-wrapper'))))->setAttribs(array('id' => 'file_type')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Xuất')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'filter_btn_l'))))->setAttribs(array('class' => 'button', 'id' => 'submit')); $this->addElements(array($mau, $nam, $quyet_dinh, $ma_loai, $thong_bao, $file_type, $submit)); $this->addDisplayGroup(array('submit'), 'report', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'report'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'report_dt')), 'Form')); }
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'); $cateOptions = Khcn_Api::_()->getDbTable('loai_thong_tin', 'default')->getListAssoc(); $loai_thong_tin_id = new Zend_Form_Element_Select('loai_thong_tin_id'); $loai_thong_tin_id->setLabel('Loại (*)')->addMultiOptions($cateOptions)->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'); $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_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')); $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/thong_tin')->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($loai_thong_tin_id, $tieu_de, $noi_dung, $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 _initVOType() { $element = new Zend_Form_Element_Radio('vo_type'); $element->addMultiOptions(array('MIXED' => 'Mixed', 'GROUP' => 'Group', 'STEM' => 'Stem', 'IDP' => 'IdP')); $element->setRequired(true); $element->setAllowEmpty(false); $element->setValue('MIXED'); return $this->addElement($element); }
public function renderFormElement() { $elm = new Zend_Form_Element_Radio($this->getName(), array('label' => $this->getLabel() . ':')); $elm->setDescription($this->getDescription()); $elm->setMultiOptions($this->_rankingOptions); $elm->setValue($this->getValue()); $elm->setRequired($this->getRequired()); $elm->setSeparator(''); return $elm; }
public function init() { $Ankieta = new Application_Model_DbTable_AnkietyPytania(); $select = $Ankieta->select(array('id', 'pytanie', 'czy_obrazek'))->where('czy_wyswietlac = ?', 't')->where('sekcja = ?', 'lewa')->where('rodzaj = ?', 'normal')->order('kolejnosc DESC')->order('data_dodania DESC')->order('pytanie ASC')->limit(1); //echo $select->__toString(); $ankieda = $Ankieta->fetchAll($select); foreach ($ankieda as $pytanie) { $pytania_id[] = $pytanie->id; $pytania[] = $pytanie->pytanie; $odpowiedziFetch = $pytanie->findApplication_Model_DbTable_AnkietyOdpowiedzi(); // sortowanie $odpowiedziArray = $odpowiedziFetch->toArray(); usort($odpowiedziArray, create_function('$a, $b', 'if ($a["kolejnosc"] == $b["kolejnosc"]) return 0; return ($a["kolejnosc"] < $b["kolejnosc"]) ? -1 : 1;')); // usort($odpowiedziArray, sort_answers($a, $b){ // return strcmp($a["kolejnosc"], $b["kolejnosc"]); // });// sort foreach ($odpowiedziArray as $odpowiedz) { $odpowiedzi_id[] = $odpowiedz['id']; $odpowiedzi[] = $odpowiedz['odpowiedz']; } } $this->addElement('hidden', 'plaintext', array('description' => '<dt id="odpowiedzi-label"><h3 class="tytul">' . $pytania[0] . '</h3></dt>', 'decorators' => array(array('Description', array('escape' => false, 'tag' => ''))))); $kontrolkaRadio = new Zend_Form_Element_Radio("odpowiedzi[]", array('multiOptions' => array_combine($odpowiedzi_id, $odpowiedzi), 'registerInArrayValidator' => false, 'validators' => array('NotEmpty' => array('validator' => 'NotEmpty', 'options' => array('messages' => 'Musisz wybrać jedną odpowiedź.'))))); $kontrolkaRadio->setRequired(true); $kontrolkaRadio->removeDecorator('Label'); $kontrolkaRadio->setSeparator(false); $this->addElement($kontrolkaRadio); if ($ankieda[0]->czy_obrazek == 't') { //first create an image type captcha $captchaimg = new Zend_Captcha_Image('captchaimg'); $captchaimg->setFont(APPLICATION_PATH . '/../public/images/tresci/captcha/Tahoma.ttf'); $captchaimg->setImgDir(APPLICATION_PATH . '/../public/images/tresci/captcha'); $captchaimg->setImgUrl('/images/tresci/captcha'); $captchaimg->setWordlen('5'); $captchaimg->setMessages(array('badCaptcha' => 'Wpisany kod jest nieprawidłowy')); // $captchaimg->generate(); //create user input for captcha and include the captchaimg in form $adcaptcha = new Zend_Form_Element_Captcha('adcaptcha', array('captcha' => $captchaimg)); $adcaptcha->setLabel('Wpisz kod z obrazka:'); $adcaptcha->setRequired(true); $this->addElement($adcaptcha); } $kontrolkaSubmit = new Zend_Form_Element_Submit("submit", "Głosuj"); // $kontrolkaSubmit->removeDecorator('DtDdWrapper'); // $kontrolkaSubmit->setAttribs(array('style' => 'margin-left:130px;')); $kontrolkaSubmit->removeDecorator('Label'); $this->addElement($kontrolkaSubmit); $this->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'sonda-content')), array('Form', array('class' => 'sonda-form')))); //echo $pytania_id[0]; $this->setMethod('post'); //$url = $view->url(array('controller' => 'sonda', 'action' => 'edit', 'id' => $pytania_id[0]), 'default'); $url = $this->getView()->url(array('controller' => 'sonda', 'action' => 'edit', 'id' => $pytania_id[0]), 'default'); $this->setAction($url); }
public function __construct($options = null) { parent::__construct($options); $newsletterID = $options['newsletterID']; $imageSrc = $options['imageSrc']; $isNewImage = $options['isNewImage']; // Title $title = new Zend_Form_Element_Text('NA_Title'); $title->setLabel($this->getView()->getCibleText('form_label_title'))->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($title); // article image if ($newsletterID == '') { $pathTmp = "../../../../../data/images/newsletter/tmp"; } else { $pathTmp = "../../../../../data/images/newsletter/{$newsletterID}/tmp"; } // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); //$newImage->setDecorators(array('ViewHelper')); $this->addElement($newImage); $imageTmp = new Zend_Form_Element_Hidden('ImageSrc_tmp'); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden('ImageSrc_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image('ImageSrc_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $this->addElement($imageView); $imagePicker = new Cible_Form_Element_ImagePicker('ImageSrc', array('onchange' => "document.getElementById('imageView').src = document.getElementById('ImageSrc').value", 'associatedElement' => 'ImageSrc_preview', 'pathTmp' => $pathTmp, 'contentID' => $newsletterID)); $imagePicker->removeDecorator('Label'); $this->addElement($imagePicker); $imageAlt = new Zend_Form_Element_Text("NA_ImageAlt"); $imageAlt->setLabel($this->getView()->getCibleText('form_label_description_image'))->setAttrib('class', 'stdTextInput'); $this->addElement($imageAlt); // resume text $resume = new Cible_Form_Element_Editor('NA_Resume', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $resume->setLabel($this->getView()->getCibleText('form_label_short_text'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_empty_field')))); $resume->setAttrib('class', 'largeEditor'); $this->addElement($resume); $optionText = new Zend_Form_Element_Radio('NA_TextLink'); $optionText->setRequired(true)->addMultiOption('1', $this->getView()->getCibleText('extranet_newsletter_option_text_url_text'))->addMultiOption('2', $this->getView()->getCibleText('extranet_newsletter_option_text_url_url'))->addMultiOption('3', $this->getView()->getCibleText('extranet_newsletter_option_text_url_nothing')); // Text $text = new Cible_Form_Element_Editor('NA_Text', array('mode' => Cible_Form_Element_Editor::ADVANCED, 'class' => 'textAreaToMoveUp')); $text->setLabel($this->getView()->getCibleText('form_label_text'))->setAttrib('class', 'largeEditor'); $this->addElement($text); $url = new Zend_Form_Element_Text('NA_URL'); $url->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInputNewsletterURL'); $this->addElement($optionText); $this->addElement($url); $this->addDisplayGroup(array('NA_TextLink', 'NA_URL'), 'linkTo', array('legend' => $this->getView()->getCibleText('extranet_newsletter_text_url'))); }
public function init($sId) { global $mySession; $db = new Db(); $OfferName = ""; $min_nights_value = "0"; $min_nights_def_value = ""; if ($sId != "") { $PageData = $db->runQuery("select * from " . SPCL_OFFER_TYPES . " where id='" . $sId . "'"); $OfferName = $PageData[0]['type_name']; $status_value = $PageData[0]['status']; $promo_code_value = $PageData[0]['promo_code']; $discount_type_value = $PageData[0]['discount_type']; $min_nights_value = $PageData[0]['min_nights_type']; if ($min_nights_value == '1') { $min_nights_def_value = $PageData[0]['min_nights']; } } $offer_name = new Zend_Form_Element_Text('offer_name'); $offer_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Country Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($OfferName); $statusArr[0]['key'] = '0'; $statusArr[0]['value'] = 'Disable'; $statusArr[1]['key'] = '1'; $statusArr[1]['value'] = 'Enable'; $status = new Zend_Form_Element_Select('status'); $status->addDecorator('Errors', array('class' => 'error'))->addMultiOptions($statusArr)->setAttrib("class", "mws-textinput required")->setValue($status_value); $promo_code = new Zend_Form_Element_Text('promo_code'); $promo_code->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Promo Code is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "5")->setValue($promo_code_value); $nightsArr[1]['key'] = "0"; $nightsArr[1]['value'] = "Not Fixed"; $nightsArr[2]['key'] = "1"; $nightsArr[2]['value'] = "Fixed"; $min_nights = new Zend_Form_Element_Radio('min_nights'); $min_nights->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Minimum stay value is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("onclick", "min_nightss();")->addMultiOptions($nightsArr)->setValue($min_nights_value); $min_nights_def = new Zend_Form_Element_Text('min_nights_def'); $min_nights_def->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "3")->setValue($min_nights_def_value); $discountArr[1]['key'] = "0"; $discountArr[1]['value'] = "Discount Percentage"; $discountArr[2]['key'] = "1"; $discountArr[2]['value'] = "Nights Free"; $discountArr[3]['key'] = "2"; $discountArr[3]['value'] = "Free Pool heating"; $discountArr[4]['key'] = "3"; $discountArr[4]['value'] = "7 Nights Free"; $discount_type = new Zend_Form_Element_Radio('discount_type'); $discount_type->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Minimum stay value is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->addMultiOptions($discountArr)->setValue($discount_type_value); $this->addElements(array($offer_name, $status, $promo_code, $min_nights, $min_nights_def, $discount_type)); }
public function init() { // cliente_tipo $cliente_tipo = new Zend_Form_Element_Radio("cliente_tipo"); $cliente_tipo->setLabel("Tipo: "); $cliente_tipo->setRequired(); $cliente_tipo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); $cliente_tipo->setMultiOptions(array('PF' => ' Pessoa Física', 'PJ' => ' Pessoa Jurídica')); // cliente_empresa $cliente_empresa = new Zend_Form_Element_Text("cliente_empresa"); $cliente_empresa->setLabel("Empresa:"); $cliente_empresa->setAttribs(array('class' => 'form-control')); // cliente_nome $cliente_nome = new Zend_Form_Element_Text("cliente_nome"); $cliente_nome->setLabel("Contato:"); $cliente_nome->setRequired(); $cliente_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $cliente_nome->setAttribs(array('class' => 'form-control')); // cliente_email $cliente_email = new Zend_Form_Element_Text("cliente_email"); $cliente_email->setLabel("E-mail:"); $cliente_email->setRequired(); $cliente_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $cliente_email->setAttribs(array('class' => 'form-control')); // cliente_telefone $cliente_telefone = new Zend_Form_Element_Text("cliente_telefone"); $cliente_telefone->setLabel("Telefone:"); $cliente_telefone->setAttribs(array('class' => 'form-control')); // cliente_celular $cliente_celular = new Zend_Form_Element_Text("cliente_celular"); $cliente_celular->setLabel("Celular:"); $cliente_celular->setAttribs(array('class' => 'form-control')); // cliente_cidade $cliente_cidade = new Zend_Form_Element_Text("cliente_cidade"); $cliente_cidade->setLabel("Cidade:"); $cliente_cidade->setAttribs(array('class' => 'form-control')); // cliente_estado $cliente_estado = new Zend_Form_Element_Select("cliente_estado"); $cliente_estado->setLabel("Estado:"); $cliente_estado->setAttribs(array('class' => 'form-control')); $cliente_estado->setMultiOptions($this->getEstados()); /** * Add elements */ $this->addElements(array($cliente_tipo, $cliente_empresa, $cliente_nome, $cliente_email, $cliente_telefone, $cliente_celular, $cliente_cidade, $cliente_estado)); parent::init(); }
public function init() { // profissional_beleza_nome $profissional_beleza_nome = new Zend_Form_Element_Text("profissional_beleza_nome"); $profissional_beleza_nome->setLabel("Nome: "); $profissional_beleza_nome->setAttribs(array('class' => 'form-control')); $profissional_beleza_nome->setRequired(); $profissional_beleza_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // profissional_beleza_email $profissional_beleza_email = new Zend_Form_Element_Text("profissional_beleza_email"); $profissional_beleza_email->setLabel("E-mail: "); $profissional_beleza_email->setValidators(array('EmailAddress')); $profissional_beleza_email->addValidator(new App_Validate_ProfissionalBeleza()); $profissional_beleza_email->setAttribs(array('class' => 'form-control')); $profissional_beleza_email->setRequired(); $profissional_beleza_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * profisional_beleza_sexo */ $profissional_beleza_sexo = new Zend_Form_Element_Radio("profissional_beleza_sexo"); $profissional_beleza_sexo->setLabel("Sexo:"); $profissional_beleza_sexo->setRequired(); $profissional_beleza_sexo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); $profissional_beleza_sexo->setMultiOptions(array('M' => ' Masculino', 'F' => ' Feminino')); // profissional_beleza_avatar $profissional_beleza_avatar = new Zend_Form_Element_File("profissional_beleza_avatar"); $profissional_beleza_avatar->setLabel(" \n Foto: \n "); $profissional_beleza_avatar->addDecorators(App_Forms_Decorators::$ElementDecoratorFile); $profissional_beleza_avatar->setAttribs(array('class' => 'filestyle', 'data-buttonText' => 'Selecione a foto', 'data-iconName' => 'fa fa-user')); $profissional_beleza_avatar->setRequired(); $profissional_beleza_avatar->setDestination(Zend_Registry::get('config')->profissional->avatar->path); $profissional_beleza_avatar->addValidators(array(array('Extension', false, 'jpg,jpeg,png'))); $profissional_beleza_avatar->addFilter(new Skoch_Filter_File_Resize(array('width' => 160, 'keepRatio' => true))); // especialidade_id $especialidade_id = new Zend_Form_Element_MultiCheckbox("especialidade_id"); $especialidade_id->setLabel("Selecione as especialidades: "); $especialidade_id->setAttribs(array('class' => '')); $especialidade_id->setRequired(); $especialidade_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); $especialidade_id->setSeparator(' '); $especialidade_id->setMultiOptions($this->getEspecialidades()); // addElements $this->addElements(array($profissional_beleza_nome, $profissional_beleza_email, $profissional_beleza_sexo, $profissional_beleza_avatar, $especialidade_id)); parent::init(); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data'); $this->addElement('Hidden', 'search', array('value' => 1)); $chu_de = new Zend_Form_Element_Text('chu_de'); $chu_de->setLabel('Chủ đề (*)')->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'); $managementOptions = array("multiOptions" => Default_Model_Constraints::hoithao_capquanly()); $cap_quan_ly = new Zend_Form_Element_Radio('cap_quan_ly', $managementOptions); $cap_quan_ly->setRequired(true)->setLabel('Quy mô (*)')->setValue(1)->setSeparator('')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'cap_ql')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $so_luong_dai_bieu = new Zend_Form_Element_Text('so_luong_dai_bieu'); $so_luong_dai_bieu->setLabel('Số lượng đại biểu')->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'); $dia_diem = new Zend_Form_Element_Text('dia_diem'); $dia_diem->setLabel('Địa điểm')->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 medium-input'); $don_vi = new Default_Model_DonVi(); $dvptOptions = array("multiOptions" => $don_vi->getDSDVSGU()); $don_vi_id = new Zend_Form_Element_Select('don_vi_id', $dvptOptions); $don_vi_id->setRequired(true)->setLabel('Đơn vị quản lý (*)')->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')))); $don_vi_phu_trach = new Zend_Form_Element_Text('don_vi_phu_trach'); $don_vi_phu_trach->setLabel('Đơn vị phụ trách')->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'))))->setAttrib('class', 'text-input large-input'); $ngay_to_chuc = new Zend_Form_Element_Text('ngay_to_chuc'); $ngay_to_chuc->setRequired(true)->setLabel('Ngày tổ chức')->setDescription('(dd-mm-YYYY)')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'ngay_to_chuc')); $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', 'class' => 'trang_thai')))); $anh_trang_bia = new Zend_Form_Element_File('file_anh_trang_bia'); $anh_trang_bia->setLabel('Upload ảnh trang bìa')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/images/hoi_thao/')->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')))); $thong_cao_bao_chi = new Zend_Form_Element_File('file_thong_cao_bao_chi'); $thong_cao_bao_chi->setLabel('Thông cáo báo chí')->setDescription('(*.doc, *.docx, *.pdf , < 10MB )')->setDestination(BASE_PATH . '/upload/files/hoi_thao/')->addValidator(new Zend_Validate_File_Extension(array('doc,docx,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')))); $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')))); $mo_ta = new Zend_Form_Element_Textarea('mo_ta'); $mo_ta->setLabel('Nội dung')->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', 'class' => 'text-input textarea')); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setLabel('Lưu và tiếp tục')->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->setLabel('Lưu và thoát')->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-thao', 'action' => 'index'), null, true); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Không lưu')->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($chu_de, $don_vi_id, $don_vi_phu_trach, $ngay_to_chuc, $cap_quan_ly, $so_luong_dai_bieu, $dia_diem, $anh_trang_bia, $image, $thong_cao_bao_chi, $mo_ta, $trang_thai, $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' => 'hoi_thao')), 'Form')); }
public function init() { $this->setName('popup_dv')->setMethod('post'); $ma = new Zend_Form_Element_Text('popup_dv_ma'); $ma->setLabel('Mã')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToUpper')->addValidator(new Zend_Validate_StringLength(0, 10))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 80%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'onblur' => 'kiem_tra_dv(this)')); $ten = new Zend_Form_Element_Text('popup_dv_ten'); $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 250))->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 medium-input'); $ofSGUOptions = array("multiOptions" => array('1' => 'Thuộc', '0' => 'Không thuộc')); $thuoc_sgu = new Zend_Form_Element_Radio('popup_dv_thuoc_sgu', $ofSGUOptions); $thuoc_sgu->setRequired(true)->setLabel('Thuộc SGU')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'thuoc_sgu')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'popup_dv_thuoc_sgu', 'onchange' => 'change_thuoc_sgu(this)')); $deptOptions = array("multiOptions" => array('1' => 'Khoa - Bộ môn TT', '0' => 'Phòng ban - Trung tâm')); $la_khoa = new Zend_Form_Element_Radio('popup_dv_la_khoa', $deptOptions); $la_khoa->setRequired(true)->setLabel('Loại đơn vị')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'la_khoa')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'la_khoa')))); $submit = new Zend_Form_Element_Button('popup_dv_submit'); $submit->setLabel('Lưu')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'add_dv(this.form)')); $this->addElements(array($ma, $ten, $thuoc_sgu, $la_khoa, $submit)); $this->addDisplayGroup(array('popup_dv_submit'), 'btn_submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'popup_dv')), 'Form')); }
public function __construct($forSearch = false) { parent::__construct(); if ($forSearch) { $radioKind = new Zend_Form_Element_Radio('kind'); $radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or')); $radioKind->setValue('and'); $radioKind->setLabel('Search field combination:'); $radioKind->setRequired(true); $this->addElement($radioKind); } $this->addElement('hidden', CalibrationExercise::COL_ID, array('required' => true)); $valiAlphaWhiteSpace = new Zend_Validate_Alpha(true); $valiAlnumWhiteSpace = new Zend_Validate_Alnum(true); $this->addElement('text', CalibrationExercise::COL_NAME, array('label' => 'Calibration exercise name:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace))); $this->addElement('text', CalibrationExercise::COL_DESCRIPTION, array('label' => 'Description:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace))); $this->addElement('submit', 'save', array('label' => 'Save')); $this->addElement('hidden', 'Token'); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post'); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $slideshow = new Zend_Form_Element_Radio('slideshow', $statusOptions); $slideshow->setRequired(true)->setLabel('Hiển thị slideshow')->setValue(0)->setSeparator('')->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')))); $file = new Zend_Form_Element_File('ten_file'); $file->setLabel('Upload file')->setDescription('(*.jpg, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/flash/image-scroller/images/')->setRequired(true)->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')); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'gioi-thieu', 'action' => 'hinh-anh'), 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($slideshow, $file, $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 __construct($options = null) { parent::__construct($options); $this->setAttrib('accept-charset', 'UTF-8'); $this->clearDecorators(); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'class' => 'leftalign')), array('HtmlTag', array('tag' => 'div'))); $this->setName('workflow'); $id = new Zend_Form_Element_Hidden('id'); $id->removeDecorator('label'); $wfstage = new Zend_Form_Element_Radio('wfstage'); $wfstage->setRequired(false)->addMultiOptions(array('1' => 'Quarantine', '2' => 'Review', '4' => 'Validation', '3' => 'Published'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators($decorators); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->clearDecorators(); $submit->addDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'div', 'class' => 'submit')))); $this->setLegend('Workflow status'); $this->addDecorator('FormElements')->addDecorator('Form')->addDecorator('Fieldset'); $this->addElements(array($id, $wfstage, $submit)); }
public function __construct($ratingdata, $param){ parent::__construct(); $this->setName("selectrating"); $this->setMethod('post'); $this->setAttrib('enctype', 'multipart/form-data'); $jsparam = 'javascript:confirm("Are you sure?")'; $action = 'process?' . $param; $this->setAction($action); $this->addAttribs(array('onSubmit'=>$jsparam)); $ratings1 = new Zend_Form_Element_Radio('artrating'); $ratings1->setRequired(true); $ratings1->setLabel('Artifact Rating: ') ->addMultiOptions($ratingdata); $acomment = new Zend_Form_Element_Text('acomment'); $acomment->setLabel('Comment') ->setName('acomment') ->setRequired(true) ->addValidator('NotEmpty'); $ratings2 = new Zend_Form_Element_Radio('refrating'); $ratings2->setRequired(true); $ratings2->setLabel('Cover Sheet Rating: ') ->addMultiOptions($ratingdata); $rcomment = new Zend_Form_Element_Text('rcomment'); $rcomment->setLabel('Comment') ->setName('rcomment') ->setRequired(true) ->addValidator('NotEmpty'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Select'); $this->addElements(array($ratings1, $acomment, $ratings2, $rcomment, $submit)); }
public function __construct($facultydata, $param){ parent::__construct(); $this->setName("selectfaculty"); $this->setMethod('post'); $jsparam = 'javascript:confirm("Are you sure?")'; $action = 'submitartifact/process?' . $param; $this->setAction($action); $this->addAttribs(array('onSubmit'=>$jsparam)); $faculty = new Zend_Form_Element_Radio('faculty'); $faculty->setRequired(true); $faculty->setLabel('Faculty: ') ->addMultiOptions($facultydata); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Select'); $this->addElements(array($faculty, $submit)); }
function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $category_name = new Zend_Form_Element_Text('category_name'); $category_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên chuyên mục không được để trống')); $is_active= new Zend_Form_Element_Radio('is_active'); $is_active->setRequired(true) ->setLabel('Are you sure?') ->setMultiOptions(array( "1" => "Có", "0" => "Không")); $category_name->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($category_name,$is_active)); return $form; }
function setForm() { $form=new Zend_Form; $form->setMethod('post')->setAction(''); $user_login = new Zend_Form_Element_Text('user_login'); $user_login->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên đăng nhập không được để trống')); $user_pass = new Zend_Form_Element_Password('user_pass'); $user_pass->setAttrib('renderPassword', true); $user_pass->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mật khẩu không được để trống')); $user_fullname = new Zend_Form_Element_Text('user_fullname'); $user_fullname->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên người dùng không được để trống')); $user_email = new Zend_Form_Element_Text('user_email'); $user_email->addValidator('EmailAddress',true,array('messages'=>'Địa chỉ email không hợp lệ')); $user_email->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Email không được để trống')); $user_address = new Zend_Form_Element_Text('user_address'); $user_address->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Địa chỉ không được để trống')); $is_active=new Zend_Form_Element_Radio('is_active'); $is_active->setRequired(true) ->setLabel('Is active?') ->setMultiOptions(array( "0" => "Không", "1" => "Có")); $user_login->removeDecorator('HtmlTag')->removeDecorator('Label'); $user_pass->removeDecorator('HtmlTag')->removeDecorator('Label'); $user_fullname->removeDecorator('HtmlTag')->removeDecorator('Label'); $user_email->removeDecorator('HtmlTag')->removeDecorator('Label'); $user_address->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($user_login,$user_pass,$user_fullname,$user_email,$user_address,$is_active)); return $form; }