Beispiel #1
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'requisition');
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $id = new Zend_Form_Element_Hidden('id');
     $requisition_code = new Zend_Form_Element_Text('requisition_code');
     $requisition_code->setAttrib('title', 'Requisition Code.');
     $requisition_code->setAttrib('readonly', 'readonly');
     $requisition_code->setAttrib('onfocus', 'this.blur()');
     $requisition_code->setRequired(true);
     $requisition_code->addValidator('NotEmpty', false, array('messages' => 'Identity codes are not configured yet.'));
     $onboard_date = new Zend_Form_Element_Text('onboard_date');
     $onboard_date->setAttrib('title', 'Due Date.');
     $onboard_date->setAttrib('maxLength', 10);
     $onboard_date->setAttrib('readonly', 'readonly');
     $onboard_date->setAttrib('onfocus', 'this.blur()');
     $business_unit = new Zend_Form_Element_Select("business_unit");
     $business_unit->setAttrib("class", "formDataElement");
     $business_unit->setAttrib("onchange", "getdepts_req(this,'department','billable_empname');");
     $business_unit->setAttrib('title', 'Business Unit.');
     $business_unit->setRequired(true);
     $business_unit->addValidator('NotEmpty', false, array('messages' => 'Business Unit not configured yet.'));
     //$business_unit->setAttrib('onchange', 'displayEmplistonbusinessunit(this,"billable_empname","req")');
     $department = new Zend_Form_Element_Select("department");
     $department->setAttrib("class", "formDataElement");
     $department->setAttrib('title', 'Department.');
     $department->addMultiOptions(array('' => 'Select Department'));
     $department->setAttrib('onchange', 'displayEmpReportingmanagers(this,"reporting_id","req")');
     /*
      * added New $ipbusiness_unit and $ipdepartment controls
      */
     //start---------------
     $ipbusiness_unit = new Zend_Form_Element_Select("ipbusiness_unit");
     $ipbusiness_unit->setAttrib("class", "formDataElement");
     $ipbusiness_unit->setAttrib("onchange", "getdepts_req(this,'ipdepartment','position_id');");
     $ipbusiness_unit->setAttrib('title', 'Business Unit.');
     $ipdepartment = new Zend_Form_Element_Select("ipdepartment");
     $ipdepartment->setAttrib("class", "formDataElement");
     $ipdepartment->setAttrib('title', 'Department.');
     $ipdepartment->addMultiOptions(array('' => 'Select Department'));
     $ipdepartment->setAttrib('onchange', 'displayEmpReportingmanagers(this,"ipreporting_id","req")');
     $ipdepartment->setRegisterInArrayValidator(false);
     //$ipdepartment->setRequired(true);
     $ipdepartment->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
     //$ipreporting_id = new Zend_Form_Element_Select("ipreporting_id");
     $ipreporting_id = new Zend_Form_Element_Multiselect("ipreporting_id");
     $ipreporting_id->setAttrib('title', 'Interview Panel Member.');
     $ipreporting_id->setAttrib("class", "formDataElement");
     $ipreporting_id->addMultiOptions(array('' => 'Select Interview Panel Member'));
     $ipreporting_id->setRegisterInArrayValidator(false);
     $ipreporting_id->setRequired(true);
     $ipreporting_id->addValidator('NotEmpty', false, array('messages' => 'Please select Interview Panel Member.'));
     $technicalskill_id = new Zend_Form_Element_Multiselect("technicalskill_id");
     $technicalskill_id->setAttrib('title', 'Technical Skill');
     $technicalskill_id->setAttrib("class", "formDataElement");
     $technicalskill_id->addMultiOptions(array('' => 'Select Technical Skill'));
     $technicalskill_id->setRegisterInArrayValidator(false);
     $technicalskill_id->setRequired(true);
     $technicalskill_id->addValidator('NotEmpty', false, array('messages' => 'Please select Technical Skill.'));
     $nontechnicalskill_id = new Zend_Form_Element_Multiselect("nontechnicalskill_id");
     $nontechnicalskill_id->setAttrib('title', 'Non-Technical Skill');
     $nontechnicalskill_id->setAttrib("class", "formDataElement");
     $nontechnicalskill_id->addMultiOptions(array('' => 'Select Non-Technical Skill'));
     $nontechnicalskill_id->setRegisterInArrayValidator(false);
     $nontechnicalskill_id->setRequired(true);
     $nontechnicalskill_id->addValidator('NotEmpty', false, array('messages' => 'Please select Non-Technical Skill.'));
     //end---------------
     $jobtitle = new Zend_Form_Element_Select("jobtitle");
     $jobtitle->setAttrib("class", "formDataElement");
     $jobtitle->setAttrib("onchange", "getpositions_req('department','business_unit','position_id','jobtitle');");
     $jobtitle->setAttrib('title', 'Job Title.');
     $reporting_id = new Zend_Form_Element_Select("reporting_id");
     $reporting_id->setAttrib('title', 'Reporting Manager.');
     $reporting_id->setRegisterInArrayValidator(false);
     $reporting_id->addMultiOptions(array('' => 'Select Reporting Manager'));
     $position_id = new Zend_Form_Element_Select("position_id");
     $position_id->setAttrib("class", "formDataElement");
     $position_id->setAttrib('title', 'Position.');
     $position_id->addMultiOptions(array('' => 'Select Position'));
     $req_no_positions = new Zend_Form_Element_Text('req_no_positions');
     $req_no_positions->setAttrib('maxLength', 4);
     $req_no_positions->setAttrib('title', 'Required no.of positions.');
     $req_no_positions->addFilter(new Zend_Filter_StringTrim());
     $jobdescription = new Zend_Form_Element_Textarea('jobdescription');
     $jobdescription->setAttrib('rows', 10);
     $jobdescription->setAttrib('cols', 50);
     $jobdescription->setAttrib('title', 'Job description.');
     $jobdescription->addValidator('NotEmpty', false, array('messages' => 'Please select Job Description document.'));
     $uploadjd = new Zend_Form_Element_Button('requ_jd');
     $uploadjd->setAttrib('title', 'Job description.');
     $uploadjd->setRequired(true);
     $uploadjd->addValidator('NotEmpty', false, array('messages' => 'Please Upload Job Description document.'));
     $req_skills = new Zend_Form_Element_Textarea('req_skills');
     $req_skills->setAttrib('rows', 10);
     $req_skills->setAttrib('cols', 50);
     $req_skills->setAttrib('maxlength', 400);
     $req_skills->setAttrib('title', 'Required Skills.');
     /* $req_qualification = new Zend_Form_Element_Text('req_qualification');
         $req_qualification->setAttrib('maxLength', 100);
         $req_qualification->setAttrib('title', 'Required Qualification.');
         $req_qualification->addFilter(new Zend_Filter_StringTrim());
        */
     $req_qualification = new Zend_Form_Element_Select("req_qualification");
     $req_qualification->setRegisterInArrayValidator(true);
     $req_qualification->setAttrib("class", "formDataElement");
     $req_qualification->addMultiOptions(array('' => 'Select Qualification', 'Graduate' => 'Graduate', 'Post-Graduate' => 'Post-Graduate', 'Masters' => 'Masters'));
     $req_qualification->setAttrib('title', 'Interview Type');
     $req_exp_years = new Zend_Form_Element_Text('req_exp_years');
     $req_exp_years->setAttrib('maxLength', 5);
     $req_exp_years->setAttrib('title', 'Required Experience.');
     $req_exp_years->addFilter(new Zend_Filter_StringTrim());
     $emp_type = new Zend_Form_Element_Select("emp_type");
     $emp_type->setAttrib("class", "formDataElement");
     $emp_type->setAttrib('title', 'Employment Status.');
     $req_priority = new Zend_Form_Element_Select("req_priority");
     $req_priority->setAttrib('title', 'Priority.');
     $req_priority->addMultiOptions(array('' => 'Select Priority', 1 => 'High', 3 => 'Low', 2 => 'Medium'));
     $req_priority->setAttrib("class", "formDataElement");
     $additional_info = new Zend_Form_Element_Textarea('additional_info');
     $additional_info->setAttrib('rows', 10);
     $additional_info->setAttrib('cols', 50);
     $additional_info->setAttrib('maxlength', 400);
     $additional_info->setAttrib('title', 'Additional Information.');
     $req_status = new Zend_Form_Element_Select('req_status');
     $req_status->setLabel('Requisition Status');
     if ($loginuserGroup == HR_GROUP || $loginuserGroup == '' || $loginuserGroup == MANAGEMENT_GROUP) {
         $reporting_id->setAttrib("class", "formDataElement");
         $reporting_id->setRequired(true);
         $reporting_id->addValidator('NotEmpty', false, array('messages' => 'Please select reporting manager.'));
     }
     $onboard_date->setRequired(true);
     $onboard_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
     $department->setRegisterInArrayValidator(false);
     $department->setRequired(true);
     $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
     $jobtitle->setRegisterInArrayValidator(false);
     $jobtitle->setRequired(true);
     $jobtitle->addValidator('NotEmpty', false, array('messages' => 'Please select job title.'));
     $position_id->setRegisterInArrayValidator(false);
     //$position_id->setRequired(true);
     $position_id->addValidator('NotEmpty', false, array('messages' => 'Please select position.'));
     /* $req_no_positions->setRequired(true);
         $req_no_positions->addValidator('NotEmpty', false, array('messages' => 'Please enter required no.of positions.'));
         $req_no_positions->addValidator("regex", true, array(
         'pattern' => '/^([0-9]+?)+$/',
         'messages' => array(
         'regexNotMatch' => 'Please enter only numbers.'
         )
         ));
         $req_no_positions->addValidator("greaterThan", true, array(
         'min' => 0,
         'messages' => array(
         'notGreaterThan' => 'No.of positions cannot be zero.'
         )
         ));
        */
     //$req_skills->setRequired(true);
     $req_skills->addValidator('NotEmpty', false, array('messages' => 'Please enter required skills.'));
     $req_qualification->setRequired(true);
     $req_qualification->addValidator('NotEmpty', false, array('messages' => 'Please select qualification.'));
     $req_qualification->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z\\/\\-\\. ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid qualification.')));
     $req_exp_years->setRequired(true);
     $req_exp_years->addValidator('NotEmpty', false, array('messages' => 'Please enter required experience range.'));
     $req_exp_years->addValidator("regex", true, array('pattern' => '/^([0-9]{1,2}\\-[0-9]{1,2})+$/', 'messages' => array('regexNotMatch' => 'Please enter valid experience range.')));
     $emp_type->setRegisterInArrayValidator(false);
     $emp_type->setRequired(true);
     $emp_type->addValidator('NotEmpty', false, array('messages' => 'Please select employment status.'));
     $req_priority->setRequired(true);
     $req_priority->addValidator('NotEmpty', false, array('messages' => 'Please select priority.'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $email_cnt = new Zend_Form_Element_Hidden('email_cnt');
     $idval = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
     $bunit_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('business_unit', null);
     $approver1 = new Zend_Form_Element_Select("approver1");
     $approver1->setRegisterInArrayValidator(false);
     $approver1->addMultiOptions(array('' => 'Select Approver -1'));
     $approver1->setRequired(true);
     $approver1->addValidator('NotEmpty', false, array('messages' => 'Please select approver-1.'));
     $approver2 = new Zend_Form_Element_Select("approver2");
     $approver2->setRegisterInArrayValidator(false);
     $approver2->addMultiOptions(array('' => 'Select Approver -2'));
     $approver3 = new Zend_Form_Element_Select("approver3");
     $approver3->setRegisterInArrayValidator(false);
     $approver3->addMultiOptions(array('' => 'Select Approver -3'));
     $billable = new Zend_Form_Element_Select("billable");
     $billable->setRegisterInArrayValidator(true);
     $billable->setAttrib("class", "formDataElement");
     $billable->addMultiOptions(array('' => 'Select Billable Type', 'Client' => 'Client', 'Delta' => 'Delta'));
     $billable->setAttrib('title', 'Billable Type');
     $billable->setRequired(true);
     $billable->addValidator('NotEmpty', false, array('messages' => 'Please select billable type.'));
     $billablefor = new Zend_Form_Element_Select("billablefor");
     $billablefor->setRegisterInArrayValidator(true);
     $billablefor->setAttrib("class", "formDataElement");
     $billablefor->setAttrib("onchange", "getemployee_req(this,'business_unit','billable_empname');");
     $billablefor->addMultiOptions(array('' => 'Select Requisition For', 'New' => 'New', 'Replacement' => 'Replacement', 'Backup' => 'Backup'));
     $billablefor->setAttrib('title', 'Requisition For');
     $billablefor->setRequired(true);
     $billablefor->addValidator('NotEmpty', false, array('messages' => 'Please select Requisition For.'));
     $billable_empname = new Zend_Form_Element_Select("billable_empname");
     $billable_empname->setRegisterInArrayValidator(false);
     $billable_empname->setAttrib("class", "formDataElement");
     $billable_empname->setAttrib('title', 'Requisition For Employee');
     $billable_empname->addValidator('NotEmpty', false, array('messages' => 'Please select Requisition For Employee.'));
     $interviewroundscount = new Zend_Form_Element_Select("interviewroundscount");
     $interviewroundscount->setRegisterInArrayValidator(true);
     $interviewroundscount->setAttrib("class", "formDataElement");
     $interviewroundscount->addMultiOptions(array('' => 'Select Number Of Interview Rounds', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5'));
     $interviewroundscount->setAttrib('title', 'Billable Type');
     $interviewroundscount->setRequired(true);
     $interviewroundscount->addValidator('NotEmpty', false, array('messages' => 'Please select No. Of Interview Rounds.'));
     $technology = new Zend_Form_Element_Select("technology");
     $technology->setRegisterInArrayValidator(true);
     $technology->setAttrib("class", "formDataElement");
     $technology->setAttrib('title', 'Technology');
     $technology->setRequired(true);
     $technology->addValidator('NotEmpty', false, array('messages' => 'Please select technology.'));
     /*
      * added New $ipbusiness_unit and $ipdepartment controls
      */
     $this->addElements(array($id, $submit, $requisition_code, $onboard_date, $business_unit, $department, $jobtitle, $reporting_id, $position_id, $req_no_positions, $jobdescription, $uploadjd, $req_skills, $req_qualification, $req_exp_years, $emp_type, $req_priority, $additional_info, $req_status, $email_cnt, $approver1, $approver2, $approver3, $ipbusiness_unit, $ipdepartment, $ipreporting_id, $technicalskill_id, $nontechnicalskill_id, $billable, $billablefor, $billable_empname, $interviewroundscount, $technology));
     $this->setElementDecorators(array('ViewHelper'));
 }