Example #1
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'feedforwardinit');
     $id = new Zend_Form_Element_Hidden('id');
     $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
     $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
     $appraisal_mode->setLabel("Appraisal");
     $appraisal_mode->setMultiOptions(array('' => 'Select Appraisal'));
     $appraisal_mode->setAttrib('class', 'selectoption');
     $appraisal_mode->setRequired(true);
     $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal.'));
     $status = new Zend_Form_Element_Select('status');
     $status->setLabel("Status");
     $status->setAttrib('class', 'selectoption');
     $status->setMultiOptions(array('1' => 'Open'));
     //,'2' => 'Close'
     $status->setRegisterInArrayValidator(false);
     $status->setRequired(true);
     $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
     $employee_name_view = new Zend_Form_Element_Radio('employee_name_view');
     $employee_name_view->setLabel("Employee Details");
     $employee_name_view->addMultiOptions(array('1' => 'Show', '0' => 'Hide'));
     $employee_name_view->setSeparator('');
     $employee_name_view->setValue(0);
     $employee_name_view->setRegisterInArrayValidator(false);
     $enable_to = new Zend_Form_Element_MultiCheckbox('enable_to');
     $enable_to->setLabel("Enable To");
     $enable_to->addMultiOptions(array('0' => 'Appraisal Employees', '1' => 'All Employees'));
     $enable_to->setSeparator('');
     $enable_to->setValue(0);
     $enable_to->setRequired(true);
     $enable_to->setRegisterInArrayValidator(false);
     $enable_to->addValidator('NotEmpty', false, array('messages' => 'Please check enable to.'));
     $ff_due_date = new Zend_Form_Element_Text('ff_due_date');
     $ff_due_date->setLabel("Due Date");
     $ff_due_date->setOptions(array('class' => 'brdr_none'));
     $ff_due_date->setRequired(true);
     $ff_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
     $save = new Zend_Form_Element_Submit('submit');
     $save->setAttrib('id', 'submitbutton');
     $save->setLabel('Save & Initialize');
     $save_later = new Zend_Form_Element_Submit('submit');
     $save_later->setAttrib('id', 'submitbutton1');
     $save_later->setLabel('Save & Initialize Later');
     $this->addElements(array($id, $appraisal_mode, $status, $employee_name_view, $ff_due_date, $save, $save_later, $enable_to));
     $this->setElementDecorators(array('ViewHelper'));
 }
 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();
 }
Example #3
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'empscreening/add');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'empscreening');
     $id = new Zend_Form_Element_Hidden('id');
     $employee = new Zend_Form_Element_Select('employee');
     $employee->setLabel('employee');
     $employee->setRequired(true)->addErrorMessage('Please select employee.');
     $employee->setAttrib('onchange', 'getemployeeData(this)');
     $employee->setRegisterInArrayValidator(false);
     $bgcheck_status = new Zend_Form_Element_Select('bgcheck_status');
     $bgcheck_status->setLabel('employee');
     $bgcheck_status->setRequired(true)->addErrorMessage('Please select bgcheck status.');
     $bgcheck_status->addMultiOption('0', 'Select status');
     $bgcheck_status->addMultiOption('In process', 'In process');
     $bgcheck_status->addMultiOption('On hold', 'On hold');
     $bgcheck_status->addMultiOption('Complete', 'Complete');
     $bgcheck_status->setRegisterInArrayValidator(false);
     $checktype = new Zend_Form_Element_MultiCheckbox('checktype');
     $checktype->setAttrib('onclick', 'displayAgencyList()');
     $bgcheckModal = new Default_Model_Bgscreeningtype();
     $checktypesData = $bgcheckModal->fetchAll('isactive=1', 'type');
     foreach ($checktypesData->toArray() as $data) {
         $checktype->addMultiOption($data['id'], $data['type']);
     }
     $checktype->setSeparator(PHP_EOL);
     $checkagency = new Zend_Form_Element_Hidden('checkagency');
     $agency = new Zend_Form_Element_Hidden('agencyids');
     $agencyData = Zend_Controller_Front::getInstance()->getRequest()->getParam('checkagency', null);
     if ($agencyData == 'checked') {
         $agency->setRequired(true);
         $agency->addValidator('NotEmpty', false, array('messages' => 'Please select agency.'));
     }
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $employee, $bgcheck_status, $checkagency, $checktype, $agency, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'empconfiguration');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'empconfiguration');
     $empConfigureArray = array('emp_leaves' => 'Employee Leaves', 'emp_holidays' => 'Employee Holidays', 'emp_salary' => 'Salary Details', 'emppersonaldetails' => 'Personal Details', 'empcommunicationdetails' => 'Contact Details', 'emp_skills' => 'Employee Skills', 'emp_jobhistory' => 'Employee Job History', 'experience_details' => 'Experience Details', 'education_details' => 'Education  Details', 'trainingandcertification_details' => 'Training & Certification  Details', 'medical_claims' => 'Medical Claims', 'disabilitydetails' => 'Disability Details', 'dependency_details' => 'Dependency Details', 'visadetails' => 'Visa and Immigration Details', 'creditcarddetails' => 'Corporate Card Details', 'workeligibilitydetails' => 'Work Eligibility Details', 'emp_additional' => 'Additional Details', 'emp_renumeration' => 'Remuneration Details', 'emp_security' => 'Security Credentials', 'emp_performanceappraisal' => 'Performance Appraisal', 'emp_payslips' => 'Pay slips', 'emp_benifits' => 'Benefits');
     $checktype = new Zend_Form_Element_MultiCheckbox('checktype');
     foreach ($empConfigureArray as $key => $val) {
         $checktype->addMultiOption($key, $val);
     }
     $checktype->setRequired(true);
     $checktype->addValidator('NotEmpty', false, array('messages' => 'Please select atleast one employee configuration.'));
     $checktype->setOptions(array('class' => 'empconfigcheckbox'));
     $checktype->setSeparator(PHP_EOL);
     $checkall = new Zend_Form_Element_Checkbox('checkall');
     $checkall->setLabel('Check All');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($checktype, $checkall, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
 /**
  * @group ZF-9689
  */
 public function testRenderWithListSeparatorForMulticheckbox()
 {
     require_once 'Zend/Form/Element/MultiCheckbox.php';
     $element = new Zend_Form_Element_MultiCheckbox('foo');
     $options = array('foo' => 'Foo', 'bar' => 'Bar');
     $element->setMultiOptions($options);
     $element->setSeparator('</p><p>');
     $element->setDecorators(array(array('ViewHelper', array('separator' => '')), array('HtmlTag', array('tag' => 'p'))));
     $expected = '<p><label><input type="checkbox" name="foo[]" id="foo-foo" value="foo">Foo</label></p>' . '<p><label><input type="checkbox" name="foo[]" id="foo-bar" value="bar">Bar</label></p>';
     $actual = $element->render($this->getView());
     $this->assertEquals($expected, $actual);
 }
Example #6
0
 /**
  * Defines and build an input field which is not a text field.
  * According to the parameter elem, it will set the element.
  *
  * $params['exclude']   => boolean; The column will not be built.<br />
  * $params['required '] => boolean;<br />
  * $params['elem']      => select, checkbox, radio, editor;<br />
  *                         If $params['elem'] = select, then the $params['src']<br />
  *                         parameter must be defined.
  * $params['src']       => string; name of the source for the element.<br />
  *
  * @param array $meta
  * @param array $params
  *
  * @return void
  */
 public function setElementInput(array $meta, array $params)
 {
     if (!empty($params)) {
         if (!isset($params['elem'])) {
             $params['elem'] = '';
         }
         $fieldId = $meta['COLUMN_NAME'];
         switch ($params['elem']) {
             case 'select':
                 if (empty($params['src'])) {
                     throw new Exception('Trying to build an element but no data source given');
                 }
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_Select($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId))->setAttrib('class', 'largeSelect')->addMultiOptions($this->_srcData);
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'checkbox':
                 $element = new Zend_Form_Element_Checkbox($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $this->_decoParams['class'] .= 'label_after_checkbox';
                 $this->_decoParams['labelPos'] = 'append';
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'radio':
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_Radio($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $element->setSeparator('')->addMultiOptions($this->_srcData);
                 $this->_decoParams['class'] .= 'radio radioInline';
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'hidden':
                 $element = new Zend_Form_Element_Hidden($fieldId);
                 $element->removeDecorator('Label');
                 $element->removeDecorator('DtDdWrapper');
                 break;
             case 'multiCheckbox':
                 if (empty($params['src'])) {
                     throw new Exception('Trying to build an element but no data source given');
                 }
                 $this->_defineSrc($params, $meta);
                 $element = new Zend_Form_Element_MultiCheckbox($fieldId);
                 $element->addMultiOptions($this->_srcData);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId));
                 $element->setAttrib('class', 'multicheckbox');
                 $element->setSeparator(' ');
                 $element = $this->_setBasicDecorator($element);
                 break;
             case 'multiSelect':
                 break;
             default:
                 $element = new Zend_Form_Element_Text($fieldId);
                 $element->setLabel($this->getView()->getCibleText('form_label_' . $fieldId))->addFilter('StringTrim')->setAttrib('class', 'smallTextInput');
                 $element = $this->_setBasicDecorator($element);
                 break;
         }
         if (!empty($params['disabled'])) {
             $element->setAttrib('disabled', (bool) $params['disabled']);
         }
         $this->addElement($element);
     }
 }