public function init() { $media_library_model = new Cms_Model_MediaLibraries(); $media_library = $media_library_model->getByPath($this->_attribs['media_library_path']); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Title'); $title->setRequired(true); $title->addFilter('StringTrim'); $title->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $this->addElement($title); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('Description'); $description->addFilter('StringTrim'); $description->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $this->addElement($description); $original = new Zend_Form_Element_File('original'); $original->addValidator('Count', false, 1); $original->addValidator('Extension', false, 'jpeg,jpg,png'); $original->addFilter('Rename', $this->_attribs['file_name']); $original->setDestination(My_Utilities::getUploadMediaPathDiffSizes($this->_attribs['file_name'], $this->_attribs['media_library_path'], 'original')); $original->setLabel('Image:'); $this->addElement($original); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Potvrdi'); $this->setAction('')->setMethod('post')->addElement($submit); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Cancel'); $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black'); $cancel->setAttrib("onClick", "window.location = window.location.origin+'/cms/medias/index/library_id/" . $media_library->id . "'"); $this->addElement($cancel); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'empleaves'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $emp_leave_limit = new Zend_Form_Element_Text('leave_limit'); $emp_leave_limit->setAttrib('maxLength', 3); $emp_leave_limit->addFilter(new Zend_Filter_StringTrim()); $emp_leave_limit->setRequired(true); $emp_leave_limit->addValidator('NotEmpty', false, array('messages' => 'Please enter leave limit for current year.')); $emp_leave_limit->addValidator("regex", true, array('pattern' => '/^(\\-?[1-9]|\\-?[1-9][0-9])$/', 'messages' => array('regexNotMatch' => 'Leave limit must be in the range of 0 to 100.'))); $used_leaves = new Zend_Form_Element_Text('used_leaves'); $used_leaves->setAttrib('maxLength', 3); $used_leaves->setAttrib('readonly', 'true'); $used_leaves->setAttrib('onfocus', 'this.blur()'); $alloted_year = new Zend_Form_Element_Text('alloted_year'); $alloted_year->setAttrib('maxLength', 4); $alloted_year->setAttrib('readonly', 'true'); $alloted_year->setAttrib('onfocus', 'this.blur()'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $submitbutton = new Zend_Form_Element_Button('submitbutton'); $submitbutton->setAttrib('id', 'submitbuttons'); $submitbutton->setLabel('Save'); $this->addElements(array($id, $userid, $emp_leave_limit, $used_leaves, $alloted_year, $submit, $submitbutton)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { // create elements $userId = new Zend_Form_Element_Hidden('id'); $mail = new Zend_Form_Element_Text('email'); $name = new Zend_Form_Element_Text('name'); $radio = new Zend_Form_Element_Radio('radio'); $file = new Zend_Form_Element_File('file'); $multi = new Zend_Form_Element_MultiCheckbox('multi'); $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'Figlet')); $submit = new Zend_Form_Element_Button('submit'); $cancel = new Zend_Form_Element_Button('cancel'); // config elements $mail->setLabel('Mail:')->setAttrib('placeholder', 'data please!')->setRequired(true)->setDescription('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis fringilla purus eget ante ornare vitae iaculis est varius.')->addValidator('emailAddress'); $name->setLabel('Name:')->setRequired(true); $radio->setLabel('Radio:')->setMultiOptions(array('1' => PHP_EOL . 'test1', '2' => PHP_EOL . 'test2'))->setRequired(true); $file->setLabel('File:')->setRequired(true)->setDescription('Check file upload'); $multiOptions = array('view' => PHP_EOL . 'view', 'edit' => PHP_EOL . 'edit', 'comment' => PHP_EOL . 'comment'); $multi->setLabel('Multi:')->addValidator('Alpha')->setMultiOptions($multiOptions)->setRequired(true); $captcha->setLabel('Captcha:')->setRequired(true)->setDescription("This is a test"); $submit->setLabel('Save')->setAttrib('type', 'submit'); $cancel->setLabel('Cancel'); // add elements $this->addElements(array($userId, $mail, $name, $radio, $file, $captcha, $multi, $submit, $cancel)); // add display group $this->addDisplayGroup(array('email', 'name', 'radio', 'multi', 'file', 'captcha', 'submit', 'cancel'), 'users'); // set decorators EasyBib_Form_Decorator::setFormDecorator($this, EasyBib_Form_Decorator::BOOTSTRAP_MINIMAL, 'submit', 'cancel'); }
public function init() { $menu_items_model = new Admin_Model_MenuItems(); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Usergroup name')->setRequired(true)->setAttrib("class", "form-control")->setAttrib("style", "width:200px"); $menu_items = new Zend_Form_Element_Multiselect('admin_menu_item_id'); $menu_items->addValidator(new Zend_Validate_Digits(), true); $menu_items->setLabel('Menu Items: '); $menu_items->setAttrib("class", "select2"); $menu_items->setAttrib("data-placeholder", "Choose..."); $menu_items->setAttrib("style", "width:200px"); $menu_items->addMultiOptions($menu_items_model->getForDropDown()); $permit = new Zend_Form_Element_MultiCheckbox('permit'); $permit->setLabel('Available resources '); $resources_table = new Admin_Model_Resources(); foreach ($resources_table->getAll() as $resource) { $permit->addMultiOption((string) $resource->id, ' ' . $resource->name); } $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Cancel'); $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black'); $cancel->setAttrib("onClick", "window.location = window.location.origin+'/admin/admin-usersgroups/'"); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Confirm'); $this->setAction('')->setMethod('post')->addElement($name)->addElement($menu_items)->addElement($permit)->addElement($cancel)->addElement($submit); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'frm_interview_rpt'); $interview_date = new Zend_Form_Element_Text("interview_date"); $interview_date->setLabel("Interview Date"); $interview_date->setAttrib('readonly', 'readonly'); $req_id = new Zend_Form_Element_Select("req_id"); $req_id->setRegisterInArrayValidator(false); $req_id->setLabel("Requisition Code")->addMultiOptions(array('' => 'Select Requisition Code')); $department_id = new Zend_Form_Element_Select("department_id"); $department_id->setLabel("Department"); $department_id->setRegisterInArrayValidator(false); $department_id->addMultiOptions(array('' => 'Select Department')); $interviewer_id = new Zend_Form_Element_Text("interviewer_id"); $interviewer_id->setLabel("Interviewer"); $interviewer_id->setAttrib('name', ''); $interviewer_id->setAttrib('id', 'idinterviewer_id'); $createdby = new Zend_Form_Element_Text("createdby"); $createdby->setLabel("Interview Planned By"); $createdby->setAttrib('name', ''); $createdby->setAttrib('id', 'idcreatedby'); $submit = new Zend_Form_Element_Button('submit'); $submit->setAttrib('id', 'idsubmitbutton'); $submit->setLabel('Report'); $this->addElements(array($submit, $interview_date, $req_id, $department_id, $interviewer_id, $createdby)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setAttrib('class', 'form_create_tai_lieu'); $this->addElement('Hidden', 'search', array('value' => 1)); $ten = new Zend_Form_Element_Text('ten'); $ten->setLabel('Chuyên đề (*)')->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'); $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')); $thoi_gian = new Zend_Form_Element_Text('thoi_gian'); $thoi_gian->setLabel('Ngày tổ chức')->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' => 'thoi_gian')); $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'); $file = new Zend_Form_Element_File('file'); $file->setLabel('Upload file')->setDescription('(*.doc, *.docx, *.pdf , < 10MB )')->setDestination(BASE_PATH . '/upload/files/sinh_hoat_chuyen_de')->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')))); $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' => 'sinh-hoat-chuyen-de', '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($ten, $noi_dung, $thoi_gian, $dia_diem, $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 init() { $this->setName('dept_report')->setMethod('post'); $nams = array(); for ($i = 2005; $i < 2030; $i++) { $nams[$i] = $i; } $namOption = array("multiOptions" => $nams); $from = new Zend_Form_Element_Select('dept_from', $namOption); $from->setLabel('Từ : ')->setValue(date('Y'))->setRequired(true)->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'from', 'style' => 'margin-left : 23px'))))->setAttribs(array('style' => 'width:10%')); $to = new Zend_Form_Element_Select('dept_to', $namOption); $to->setLabel('Đến : ')->setValue(date('Y') + 1)->setRequired(true)->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'to'))))->setAttribs(array('style' => 'width:10%')); $don_vi = new Default_Model_DonVi(); $dv = $don_vi->getDSDVSGU(); unset($dv['1']); $dvOptions = array("multiOptions" => $dv); $ma_don_vi = new Zend_Form_Element_Select('dept_don_vi', $dvOptions); $ma_don_vi->setRequired(true)->setLabel('Đơn vị : ')->setValue('0')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'style' => 'margin-bottom: 10px;'))))->setAttribs(array('id' => 'dept_don_vi', 'style' => 'width : 50%')); $amounts = array(); for ($i = 1; $i <= 10; $i++) { $amounts[$i * 10] = $i * 10; } $amountOptions = array("multiOptions" => $amounts); $amount = new Zend_Form_Element_Select('dept_amount', $amountOptions); $amount->setLabel('Số lượng GV : ')->setValue(10)->setRequired(true)->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'amount')))); $submit = new Zend_Form_Element_Button('dept_submit'); $submit->setLabel('Xem'); $submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span', 'align' => 'left')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'style' => 'margin-left : 10px')))); $this->addElements(array($ma_don_vi, $from, $to, $amount, $submit)); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'dept_report')), 'Form')); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setAttrib('class', 'form_create_bai_bao'); $this->addElement('Hidden', 'search', array('value' => 1)); $ten = new Zend_Form_Element_Text('ten'); $ten->setLabel('Tên sản phẩm (*)')->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'); $so_luong_thanh_vien = new Zend_Form_Element_Text('so_luong_thanh_vien'); $so_luong_thanh_vien->setRequired(true)->setLabel('Số lượng thành viên')->addValidator(new Zend_Validate_Int())->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' => 'so_luong_thanh_vien'))->setAttrib('class', 'text-input small-input'); $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')); $thong_tin = new Zend_Form_Element_Text('thong_tin'); $thong_tin->setRequired(true)->setLabel('Thông tin')->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' => 'thong_tin'))->setAttrib('class', 'text-input large-input'); $thangOptions = Default_Model_Constraints::lichct_thang(); $thang = new Zend_Form_Element_Select('thang'); $thang->setLabel('Tháng')->addMultiOptions($thangOptions)->setValue(date('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')))); $namOptions = Default_Model_Constraints::years(); $nam = new Zend_Form_Element_Select('nam'); $nam->setLabel('Năm')->addMultiOptions($namOptions)->setValue(date('Y'))->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')))); $dot = new Zend_Form_Element_Text('dot'); $dot->setRequired(true)->setLabel('Đợt')->addValidator(new Zend_Validate_Int())->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' => 'dot')); $file = new Zend_Form_Element_File('file'); $file->setLabel('Upload file')->setDescription('(*.doc, *.docx, *.pdf , < 10MB )')->setDestination(BASE_PATH . '/upload/files/bai_bao')->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')))); $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' => 'bai-bao', '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($ten, $thong_tin, $mo_ta, $so_luong_thanh_vien, $thang, $nam, $dot, $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 init() { $settings = Engine_Api::_()->getApi('settings', 'core'); // Init form $this->setDescription('Modify your invite settings for your members.'); // Init subject $subject = new Zend_Form_Element_Text('subject'); $subject->setLabel('Subject')->setDescription("This is the subject line of emails sent to invited people. Use %siteName% to include your site's name.")->setValue($settings->getSetting('invite.subject', ''))->setRequired(true)->setAttrib('size', '90%'); // Init from fields $fromName = new Zend_Form_Element_Text('fromName'); $fromName->setLabel('From (name)')->setDescription('Whom the invite email is shown as being from (usually your website name)')->setValue($settings->getSetting('invite.fromName', ''))->setRequired(true)->setAttrib('size', '90%'); $fromEmail = new Zend_Form_Element_Text('fromEmail'); $fromEmail->setLabel('From (email)')->setDescription('The "Reply-To" address for emails')->setValue($settings->getSetting('invite.fromEmail', 'noreply@' . $_SERVER['HTTP_HOST']))->addValidator('emailAddress', true)->setRequired(true)->setAttrib('size', '90%'); // Init allow custom invite message $allowCustomMessage = new Zend_Form_Element_Checkbox('allowCustomMessage'); $allowCustomMessage->setLabel('Allow custom invite message?')->setDescription('If disabled, the invite email will use the message below.')->setValue($settings->getSetting('invite.allowCustomMessage', true))->setAttrib('style', 'width: auto;')->setCheckedValue('1'); // Init default invite message $message = new Zend_Form_Element_Textarea('message'); $message->setLabel('Default Invite Message')->setDescription('Use %invite_url% to include the invite URL')->setValue($settings->getSetting('invite.message', '%invite_url%'))->setAttrib('rows', 6)->setAttrib('cols', 75); // // Init submit $submit = new Zend_Form_Element_Button('submit'); $submit->setLabel('Save Settings')->setAttrib('type', 'submit')->removeDecorator('Errors'); // Add elements $this->addElements(array($subject, $fromName, $fromEmail, $allowCustomMessage, $message, $submit)); }
public function init() { $model_countries = new Locale_Model_Languages(); $model_t_keys = new Locale_Model_TranslateKeys(); $key_id = new Zend_Form_Element_Select('key_id'); $key_id->addValidator(new Zend_Validate_Digits(), true); $key_id->setLabel('Key'); $key_id->setRequired(true); $key_id->setMultiOptions($model_t_keys->getIdAndKeyArray(true)); $this->addElement($key_id); $country_id = new Zend_Form_Element_Select('language_id'); $country_id->addValidator(new Zend_Validate_Digits(), true); $country_id->setLabel('Language'); $country_id->setRequired(true); $country_id->setMultiOptions($model_countries->getIdAndNameArray()); $this->addElement($country_id); $value = new My_Form_Element_CKEditor('value'); $value->setLabel('Translation'); $value->setDescription('Tags for dynamic values: {1}, {2}, {3}...Double quotes (")are not allowed'); $this->addElement($value); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Cancel'); $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black'); $cancel->setAttrib("onClick", "window.location = window.location.origin+'/locale/translate-messages/'"); $this->addElement($cancel); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Confirm'); $this->setAction('')->setMethod('post')->addElement($submit); }
public function init() { $this->setName('popup_gv')->setMethod('post'); $ma_gv = new Zend_Form_Element_Text('popup_gv_ma'); $ma_gv->setLabel('Mã')->addFilter('StripTags')->addFilter('StringTrim')->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_gv(this)')); $ho_ten = new Zend_Form_Element_Text('popup_gv_ho_ten'); $ho_ten->setLabel('Họ tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 120))->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'); $chuc_vu = new Zend_Form_Element_Text('popup_gv_chuc_vu'); $chuc_vu->setLabel('Chức vụ')->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'); $don_vi = new Default_Model_DonVi(); $dvOptions = array("multiOptions" => $don_vi->getDSDV()); $ma_don_vi = new Zend_Form_Element_Select('popup_gv_ma_don_vi', $dvOptions); $ma_don_vi->setRequired(true)->setLabel('Đơn vị (*)')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $hoc_vi = new Default_Model_HocVi(); $hvOptions = array("multiOptions" => $hoc_vi->getDSHV()); $ma_hoc_vi = new Zend_Form_Element_Select('popup_gv_ma_hoc_vi', $hvOptions); $ma_hoc_vi->setRequired(true)->setLabel('Học vị (*)')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $email = new Zend_Form_Element_Text('popup_gv_email'); $email->setLabel('Email')->addFilter('StripTags')->addFilter('StringTrim')->addValidator(new Zend_Validate_EmailAddress())->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('class' => 'text-input', 'id' => 'email')); $so_dien_thoai = new Zend_Form_Element_Text('popup_gv_so_dien_thoai'); $so_dien_thoai->setLabel('Số điện thoại')->addFilter('StringTrim')->addValidator(new Zend_Validate_Int())->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('class' => 'text-input', 'onkeypress' => 'return inputNumber(event)')); $submit = new Zend_Form_Element_Button('popup_gv_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_gv(this.form)')); $this->addElements(array($ma_gv, $ho_ten, $ma_don_vi, $ma_hoc_vi, $chuc_vu, $email, $so_dien_thoai, $submit)); $this->addDisplayGroup(array('popup_gv_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', 'id' => 'btn'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'popup_gv')), 'Form')); }
public function init() { $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear')); $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box')); $provider = new Zend_Form_Element_Text('name'); $provider->setLabel('Provider Name')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Title Name')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $levelMultiOptions = array(0 => ' '); /* $table = $this->_helper->api()->getItemTable('user'); $select = $viewer->membership()->getMembersSelect('user_id'); $friends = $table->fetchAll($select);*/ $MultiOptions = array('' => 'All', 'email' => 'email', 'social' => 'social'); $type = new Zend_Form_Element_Select('type'); $type->setLabel('Provider Type')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($MultiOptions); $enabled = new Zend_Form_Element_Select('enable'); $enabled->setLabel('Enabled/Disabled')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => 'All', '0' => 'Disabled', '1' => 'Enabled'))->setValue('-1'); $submit = new Zend_Form_Element_Button('search', array('type' => 'submit')); $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div')); $this->addElement('Hidden', 'order', array('order' => 10001)); $this->addElement('Hidden', 'order_direction', array('order' => 10002)); $this->addElements(array($provider, $title, $type, $enabled, $submit)); // Set default action $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array())); }
public function init() { $this->setName('f2')->setMethod('post'); $thangOptions = Default_Model_Constraints::lichct_thang(); $thang = new Zend_Form_Element_Select('thang'); $thang->setLabel('Tháng (*)')->setValue(date('m'))->setRequired(true)->addMultiOptions($thangOptions)->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'); $this->addElement($thang); $tuanOptions = Default_Model_Constraints::lichct_tuan(); $tuan = new Zend_Form_Element_Select('tuan'); $tuan->setLabel('Tuần (*)')->setRequired(true)->addMultiOptions($tuanOptions)->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'); $this->addElement($tuan); $ngay_bat_dau = new Zend_Form_Element_Text('ngay_bat_dau'); $ngay_bat_dau->setLabel('Ngày bắt đầu (*)')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), 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', 'id' => 'ngay_bat_dau')); $this->addElement($ngay_bat_dau); $ngay_ket_thuc = new Zend_Form_Element_Text('ngay_ket_thuc'); $ngay_ket_thuc->setLabel('Ngày kết thúc (*)')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty')->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_ket_thuc')); $this->addElement($ngay_ket_thuc); $ghi_chu = new Zend_Form_Element_Textarea('ghi_chu'); $ghi_chu->setLabel('Ghi chú')->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' => 'ghi_chu', 'class' => 'text-input textarea', 'rows' => 4)); $this->addElement($ghi_chu); $submit = new Zend_Form_Element_Submit('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')); $this->addElement($submit); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'lich-cong-tac', '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->addElement($cancel); $this->addDisplayGroup(array('submit', 'cancel'), 'submitbtn', 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('year_report')->setMethod('post'); $nams = array(); for ($i = 2005; $i < 2030; $i++) { $nams[$i] = $i; } $namOption = array("multiOptions" => $nams); $from = new Zend_Form_Element_Select('year_from', $namOption); $from->setLabel('Từ : ')->setValue(date('Y'))->setRequired(true)->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'from'))))->setAttribs(array('style' => 'width:10%')); $to = new Zend_Form_Element_Select('year_to', $namOption); $to->setLabel('Đến : ')->setValue(date('Y') + 1)->setRequired(true)->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'to'))))->setAttribs(array('style' => 'width:10%')); $amounts = array(); for ($i = 1; $i <= 10; $i++) { $amounts[$i * 10] = $i * 10; } $amountOptions = array("multiOptions" => $amounts); $amount = new Zend_Form_Element_Select('year_amount', $amountOptions); $amount->setLabel('Số lượng GV : ')->setValue(10)->setRequired(true)->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'amount')))); $submit = new Zend_Form_Element_Button('year_submit'); $submit->setLabel('Xem'); $submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span', 'align' => 'left')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'style' => 'margin-left : 10px')))); $this->addElements(array($from, $to, $amount, $submit)); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'year_report')), 'Form')); }
public function init() { $this->setName('f3')->setMethod('get'); $linh_vuc = new Default_Model_LinhVuc(); $lv = $linh_vuc->getDSLV(); $lv = array('0' => '========= Tất cả =========') + $lv; $lvOptions = array("multiOptions" => $lv); $ma_linh_vuc = new Zend_Form_Element_Select('ma_linh_vuc', $lvOptions); $ma_linh_vuc->setRequired(true)->setLabel('Lĩnh vực')->setValue('0')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('id' => 'ma_linh_vuc')); $nams = Default_Model_Constraints::nam(); $nams = array('0' => '== Tất cả ==') + $nams; ksort($nams); $namOption = array("multiOptions" => $nams); $nam = new Zend_Form_Element_Select('nam', $namOption); $nam->setLabel('Năm')->setValue(date('Y'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('id' => 'nam')); $submit = new Zend_Form_Element_Submit('loc'); $submit->setLabel('Lọc')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'filter_btn_l'))))->setAttribs(array('class' => 'button')); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'hoi-dong', 'action' => 'danh-sach-hdd'), null, true); $reset = new Zend_Form_Element_Button('reset'); $reset->setLabel('Làm mới')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'filter_btn_r'))))->setAttribs(array('class' => 'button', 'id' => 'reset', 'onclick' => 'window.location.href="' . $link . '"')); $this->addElements(array($ma_linh_vuc, $nam, $submit, $reset)); // Element: order $this->addElement('Hidden', 'order', array('order' => 10004)); // Element: direction $this->addElement('Hidden', 'direction', array('order' => 10005)); $this->addDisplayGroup(array('ma_linh_vuc', 'nam', 'loc', 'reset'), 'group1', array('order' => 1, 'decorators' => array('FormElements', array('HtmlTag', array('tag' => 'tr', 'align' => 'left', 'class' => 'text'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'filter_hdd', 'style' => 'width : 65%')), 'Form')); }
public function init() { $this->setMethod('post'); // $this->setAction('/index/login'); $this->setAttrib('id', 'msform'); $email = new Zend_Form_Element_Text('email'); $email->setAttrib('placeholder', 'E-mail'); $email->setAttrib('autocomplete', 'off'); $email->addFilter('StripTags'); $email->addFilter('HtmlEntities'); $email->addFilter('StringTrim'); $email->setRequired(true)->addErrorMessage('Username Required'); $email->addValidator('EmailAddress')->addErrorMessage('Invalid Email used'); $email->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field'); $password = new Zend_Form_Element_Password('password'); $password->setAttrib('placeholder', 'Password'); $password->setAttrib('autocomplete', 'off'); $password->addFilter('StripTags'); $password->addFilter('HtmlEntities'); $password->addFilter('StringTrim'); $password->setRequired(true)->addErrorMessage('Password Required'); $password->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field'); $link = new Zend_Form_Element_Note('forgot_password', array('value' => '<a href="#" id="link">Forgot your password ?</a>')); $submit = new Zend_Form_Element_Submit('SignIn'); $submit->setLabel('Sign In'); $submit->setAttrib('class', 'btn btn-info'); $register = new Zend_Form_Element_Button('register'); $register->setLabel('Register'); $register->setAttrib('class', 'btn btn-warning'); $this->addElements(array($email, $password, $submit, $register, $link)); $this->setElementDecorators(array('ViewHelper')); $submit->setDecorators(array('ViewHelper')); $register->setDecorators(array('ViewHelper')); $this->setDecorators(array('FormElements', 'Form')); }
public function init() { $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear')); $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'))->setMethod('GET'); $displayname = new Zend_Form_Element_Text('displayname'); $displayname->setLabel('Display Name')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $username = new Zend_Form_Element_Text('username'); $username->setLabel('Username')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->getLevelsAssoc(); $levelMultiOptions = array(0 => ' '); foreach ($levels as $key => $value) { $levelMultiOptions[$key] = $value; } $level_id = new Zend_Form_Element_Select('level_id'); $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions); $enabled = new Zend_Form_Element_Select('enabled'); $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->setValue('-1'); $submit = new Zend_Form_Element_Button('search', array('type' => 'submit')); $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div')); $this->addElement('Hidden', 'order', array('order' => 10001)); $this->addElement('Hidden', 'order_direction', array('order' => 10002)); $this->addElement('Hidden', 'user_id', array('order' => 10003)); $this->addElements(array($displayname, $username, $email, $level_id, $enabled, $submit)); // Set default action without URL-specified params $params = array(); foreach (array_keys($this->getValues()) as $key) { $params[$key] = null; } $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble($params)); }
public function init() { $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear')); $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box')); $username = new Zend_Form_Element_Text('username'); $username->setLabel('Username')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $levelMultiOptions = array(0 => ' '); /* $table = $this->_helper->api()->getItemTable('user'); $select = $viewer->membership()->getMembersSelect('user_id'); $friends = $table->fetchAll($select);*/ $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->fetchAll(); foreach ($levels as $row) { $levelMultiOptions[$row->level_id] = $row->getTitle(); } $level_id = new Zend_Form_Element_Select('level_id'); $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions); $enabled = new Zend_Form_Element_Select('enabled'); $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->setValue('-1'); $submit = new Zend_Form_Element_Button('search', array('type' => 'submit')); $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div')); $this->addElement('Hidden', 'order', array('order' => 10001)); $this->addElement('Hidden', 'order_direction', array('order' => 10002)); $this->addElements(array($username, $email, $level_id, $enabled, $submit)); // Set default action $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array())); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setAttrib('class', 'form_create_ChienDichCauNguyen'); $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'); $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/chien_dich_cau_nguyen')->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')))); $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->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' => 'chien-dich-cau-nguyen', '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($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 init() { $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear')); $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'))->setMethod('GET'); $types = Engine_Api::_()->getDbtable('modules', 'ynmoderation')->getTypesAssoc(); $typeMultiOptions = array(0 => ' '); foreach ($types as $key => $value) { $typeMultiOptions[$key] = $value; } $type_id = new Zend_Form_Element_Select('type_id'); $type_id->setLabel('Type')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($typeMultiOptions); $description = new Zend_Form_Element_Text('description'); $description->setLabel('Description')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $submit = new Zend_Form_Element_Button('search', array('type' => 'submit')); $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div')); $this->addElement('Hidden', 'order', array('order' => 10001)); $this->addElement('Hidden', 'order_direction', array('order' => 10002)); $this->addElements(array($type_id, $description, $submit)); // Set default action without URL-specified params $params = array(); foreach (array_keys($this->getValues()) as $key) { $params[$key] = null; } $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble($params)); }
public function init() { $country_code = new Zend_Form_Element_Text('country_code'); $country_code->setLabel('Country code'); $country_code->setDescription('List of codes you can see here: http://framework.zend.com/manual/1.12/en/zend.locale.appendix.html'); $country_code->setRequired(true); $this->addElement($country_code); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name'); $name->setRequired(true); $this->addElement($name); $is_active = new Zend_Form_Element_Checkbox('is_active'); $is_active->setLabel('Active'); $is_active->setRequired(true); $this->addElement($is_active); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Cancel'); $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black'); $cancel->setAttrib("onClick", "window.location = window.location.origin+'/locale/languages/'"); $this->addElement($cancel); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Confirm'); $this->setAction('')->setMethod('post')->addElement($submit); }
public function init() { $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear')); $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'))->setMethod('GET'); $username = new Zend_Form_Element_Text('username'); $username->setLabel('Member')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email Address')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $ip = new Zend_Form_Element_Text('ip'); $ip->setLabel('Ip Address')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $state = new Zend_Form_Element_Select('state'); $state->setLabel('State')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', 'success' => 'Success', 'bad-password' => 'Bad Password', 'no-member' => 'No Member', 'disabled' => 'Disabled', 'unpaid' => 'Unpaid', 'third-party' => 'Third-Party', 'v3-migration' => 'V3 Migration'))->setValue('-1'); $source = new Zend_Form_Element_Select('source'); $source->setLabel('Source')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', 'facebook' => 'Facebook', 'twitter' => 'Twitter', 'janrain' => 'Janrain'))->setValue('-1'); $submit = new Zend_Form_Element_Button('search', array('type' => 'submit')); $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div')); $this->addElement('Hidden', 'order', array('order' => 10001)); $this->addElement('Hidden', 'order_direction', array('order' => 10002)); $this->addElement('Hidden', 'user_id', array('order' => 10003)); $this->addElements(array($username, $email, $ip, $state, $source, $submit)); // Set default action without URL-specified params $params = array(); foreach (array_keys($this->getValues()) as $key) { $params[$key] = null; } $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble($params)); }
/** * @group ZF-3961 */ public function testValuePropertyShouldNotBeRendered() { $this->element->setLabel('Button Label')->setView($this->getView()); $html = $this->element->render(); $this->assertContains('Button Label', $html, $html); $this->assertNotContains('value="', $html); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'frm_servicedesk_report'); $raised_by = new Zend_Form_Element_Text("raised_by"); $raised_by->setLabel("Raised by"); $raised_by->setAttrib('name', ''); $raised_by->setAttrib('id', 'idraised_by'); $service_desk_type = new Zend_Form_Element_Select('service_desk_id'); $service_desk_type->setLabel("Category"); $service_desk_type->addMultiOptions(array('' => 'Select category')); $service_request_id = new Zend_Form_Element_Select('service_request_id'); $service_request_id->setLabel("Request Type"); $service_request_id->addMultiOptions(array('' => 'Select request')); $priority = new Zend_Form_Element_Select('priority'); $priority->setLabel("Priority"); $priority->addMultiOptions(array('' => 'Select priority', '1' => 'Low', '2' => 'Medium', '3' => 'High')); $status = new Zend_Form_Element_Select('status'); $status->setLabel("Status"); $status->addMultiOptions(array('' => 'Select status', 'Open' => 'Open', 'Cancelled' => 'Cancelled', 'To management approve' => 'To management approve', 'To manager approve' => 'To manager approve', 'Manager approved' => 'Manager approved', 'Management approved' => 'Management approved', 'Management rejected' => 'Management rejected', 'Manager rejected' => 'Manager rejected', 'Closed' => 'Closed', 'Rejected' => 'Rejected')); $raised_date = new Zend_Form_Element_Text("raised_date"); $raised_date->setLabel("Raised On"); $raised_date->setAttrib('readonly', 'readonly'); $submit = new Zend_Form_Element_Button('submit'); $submit->setAttrib('id', 'idsubmitbutton'); $submit->setLabel('Report'); $this->addElements(array($raised_by, $service_desk_type, $service_request_id, $priority, $status, $raised_date, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'frm_requisition_report'); $raised_by = new Zend_Form_Element_Text("raised_by"); $raised_by->setLabel("Raised By"); $raised_by->setAttrib('name', ''); $raised_by->setAttrib('id', 'idraised_by'); $raised_by->setAttrib('title', 'Raised By'); $requisition_status = new Zend_Form_Element_Select("req_status"); $requisition_status->setLabel("Requisition Status"); $requisition_status->addMultiOptions(array('' => 'Select Requisition Status', 'Initiated' => 'Initiated', 'Approved' => 'Approved', 'Rejected' => 'Rejected', 'Closed' => 'Closed', 'On hold' => 'On hold', 'Complete' => 'Complete', 'In process' => 'In process')); $requisition_status->setAttrib('title', 'Requisition Status'); $raised_in = new Zend_Form_Element_Select('createdon'); $raised_in->setLabel('Raised In'); $raised_in->setAttrib('id', 'createdon'); $reporting_manager = new Zend_Form_Element_Text("reporting_manager"); $reporting_manager->setLabel("Reporting Manager"); $reporting_manager->setAttrib('name', ''); $reporting_manager->setAttrib('id', 'idreporting_manager'); $job_title = new Zend_Form_Element_Select("jobtitle"); $job_title->setLabel("Job Title"); $job_title->setAttrib("onchange", "getpositions_req('department','business_unit','position_id','jobtitle');"); $job_title->setAttrib('title', 'Job Title.'); $submit = new Zend_Form_Element_Button('submit'); $submit->setAttrib('id', 'idsubmitbutton'); $submit->setLabel('Report'); $this->addElements(array($raised_by, $requisition_status, $raised_in, $reporting_manager, $job_title, $submit)); $this->setElementDecorators(array('ViewHelper')); }
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')); }
public function init() { $this->setName('f3')->setMethod('get'); $ma = new Zend_Form_Element_Text('ma'); $ma->setLabel('Mã')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('class' => 'text-input', 'style' => 'width: 70px')); $ho = new Zend_Form_Element_Text('ho'); $ho->setLabel('Họ')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('class' => 'text-input', 'style' => 'width: 100px')); $ten = new Zend_Form_Element_Text('ten'); $ten->setLabel('Tên')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('class' => 'text-input', 'style' => 'width: 50px', 'id' => 'ten')); $don_vi = new Default_Model_DonVi(); $dv = $don_vi->getDSDV(); $dv = array('0' => '=============== Tất cả ===============') + $dv; $dvOptions = array("multiOptions" => $dv); $ma_don_vi = new Zend_Form_Element_Select('ma_don_vi', $dvOptions); $ma_don_vi->setRequired(true)->setLabel('Đơn vị')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('id' => 'ma_don_vi')); $submit = new Zend_Form_Element_Button('loc', array('type' => 'submit')); $submit->setLabel('Lọc')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'filter_btn_l'))))->setAttribs(array('class' => 'button')); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'giang-vien', 'action' => 'index'), null, true); $reset = new Zend_Form_Element_Button('reset'); $reset->setLabel('Làm mới')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'filter_btn_r'))))->setAttribs(array('class' => 'button', 'id' => 'reset', 'onclick' => 'window.location.href="' . $link . '"')); $this->addElements(array($ma, $ho, $ten, $ma_don_vi, $submit, $reset)); // Element: order $this->addElement('Hidden', 'order', array('order' => 10004)); // Element: direction $this->addElement('Hidden', 'direction', array('order' => 10005)); $this->addDisplayGroup(array('ma', 'ho', 'ten', 'ma_don_vi', 'loc', 'reset'), 'filter', array('order' => '0', 'decorators' => array('FormElements', array('HtmlTag', array('tag' => 'tr', 'align' => 'left', 'class' => 'text'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'filter_gv')), 'Form')); }
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() { $this->setName('f2')->setAttrib('class', 'form_create_nhan_su'); $ho_ten = new Zend_Form_Element_Text('ho_ten'); $ho_ten->setLabel('Họ tên (*)')->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 medium-input'); $chuc_vu = new Zend_Form_Element_Text('chuc_vu'); $chuc_vu->setLabel('Chức vụ')->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'); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->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'); $website = new Zend_Form_Element_Text('website'); $website->setLabel('Website')->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'); $so_dien_thoai = new Zend_Form_Element_Text('so_dien_thoai'); $so_dien_thoai->setLabel('Số điện thoại')->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'); $file = new Zend_Form_Element_File('file'); $file->setLabel('Ảnh cá nhân')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/nhan_su/')->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('nhan_su', 'default')->getMaxOrder(); $order = new Zend_Form_Element_Text('order'); $order->setLabel('Số thứ tự')->setValue($maxOrder)->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 tinysmall-input'); $submit = new Zend_Form_Element_Submit('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')); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'gioi-thieu', 'action' => 'nhan-su'), 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($ho_ten, $chuc_vu, $email, $website, $so_dien_thoai, $file, $order, $submit, $cancel)); $this->addDisplayGroup(array('submit', 'cancel'), 'submitbtn', 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->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'emppersonaldetails'); $id = new Zend_Form_Element_Hidden('id'); $userid = new Zend_Form_Element_Hidden('user_id'); $genderid = new Zend_Form_Element_Select('genderid'); $genderid->addMultiOption('', 'Select Gender'); $genderid->setRegisterInArrayValidator(false); $genderid->setRequired(true); $genderid->addValidator('NotEmpty', false, array('messages' => 'Please select gender.')); $maritalstatusid = new Zend_Form_Element_Select('maritalstatusid'); $maritalstatusid->addMultiOption('', 'Select Marital Status'); $maritalstatusid->setRegisterInArrayValidator(false); $maritalstatusid->setRequired(true); $maritalstatusid->addValidator('NotEmpty', false, array('messages' => 'Please select marital status.')); $ethniccodeid = new Zend_Form_Element_Select('ethniccodeid'); $ethniccodeid->addMultiOption('', 'Select Ethnic Code'); $ethniccodeid->setLabel('Ethnic Code'); $ethniccodeid->setRegisterInArrayValidator(false); $racecodeid = new Zend_Form_Element_Select('racecodeid'); $racecodeid->addMultiOption('', 'Select Race Code'); $racecodeid->setLabel('Race Code'); $racecodeid->setRegisterInArrayValidator(false); $languageid = new Zend_Form_Element_Select('languageid'); $languageid->addMultiOption('', 'Select Language'); $languageid->setLabel('Language'); $languageid->setRegisterInArrayValidator(false); $nationalityid = new Zend_Form_Element_Select('nationalityid'); $nationalityid->addMultiOption('', 'Select Nationality'); $nationalityid->setRegisterInArrayValidator(false); $nationalityid->setRequired(true); $nationalityid->addValidator('NotEmpty', false, array('messages' => 'Please select nationality.')); $dob = new ZendX_JQuery_Form_Element_DatePicker('dob'); $dob->setOptions(array('class' => 'brdr_none')); $dob->setRequired(true); $dob->setAttrib('readonly', 'true'); $dob->setAttrib('onfocus', 'this.blur()'); $dob->addValidator('NotEmpty', false, array('messages' => 'Please select date of birth.')); //DOB should not be current date.... $celebrated_dob = new ZendX_JQuery_Form_Element_DatePicker('celebrated_dob'); $celebrated_dob->setOptions(array('class' => 'brdr_none')); $celebrated_dob->setAttrib('readonly', 'true'); $celebrated_dob->setAttrib('onfocus', 'this.blur()'); $bloodgroup = new Zend_Form_Element_Text('bloodgroup'); $bloodgroup->setAttrib('size', 5); $bloodgroup->setAttrib('maxlength', 10); /*$submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save');*/ $submitadd = new Zend_Form_Element_Button('submitbutton'); $submitadd->setAttrib('id', 'submitbuttons'); $submitadd->setAttrib('onclick', 'validatedocumentonsubmit(this)'); $submitadd->setLabel('Save'); $this->addElements(array($id, $userid, $genderid, $maritalstatusid, $nationalityid, $ethniccodeid, $racecodeid, $languageid, $dob, $celebrated_dob, $bloodgroup, $submitadd)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('dob', 'celebrated_dob')); }