Exemplo n.º 1
0
 function other_info($employee_id = '')
 {
     $data['page_name'] = '<b>Personal Data Sheet</b>';
     $data['section_name'] = '<b>Personal Information</b>';
     $data['focus_field'] = 'skill';
     $data['msg'] = '';
     $e = new Employee_m();
     $data['employee'] = $e->get_by_id($employee_id);
     if (Input::get('op')) {
         // OTHER INFORMATION=========================
         $skills = Input::get('skill');
         $recognition = Input::get('recognition');
         $membership_organization = Input::get('membership_organization');
         $o = new Other_info();
         $o->get_by_employee_id($employee_id);
         $o->delete_all();
         $i = 0;
         foreach ($skills as $skill) {
             $o = new Other_info();
             $o->employee_id = $employee_id;
             $o->special_skills = $skills[$i];
             $o->recognition = $recognition[$i];
             $o->membership_organization = $membership_organization[$i];
             $o->save();
             $i++;
         }
         // QUESTIONS=======================================
         $questions = Input::get('q');
         $answer = Input::get('q');
         $details = Input::get('details');
         $q = new Question();
         $q->get_by_employee_id($employee_id);
         // Delete Questions
         $q->delete_all();
         $i = 0;
         $count = 0;
         foreach ($questions as $question) {
             $count += 1;
             $q = new Question();
             $q->employee_id = $employee_id;
             $q->question_no = $count;
             $q->answer = $answer[$i];
             $q->details = $details[$i];
             $q->save();
             $i++;
         }
         // REFERENCE
         $names = Input::get('ref_name');
         $address = Input::get('ref_address');
         $no = Input::get('ref_tel');
         $r = new Reference();
         $r->get_by_employee_id($employee_id);
         $r->delete_all();
         $i = 0;
         foreach ($names as $name) {
             $r = new Reference();
             $r->employee_id = $employee_id;
             $r->name = $names[$i];
             $r->address = $address[$i];
             $r->tel_no = $no[$i];
             $r->ctc_no = Input::get('ctc_no');
             $r->issue_at = Input::get('issue_at');
             $r->issue_on = Input::get('issue_on');
             $r->save();
             $i++;
         }
         $data['msg'] = 'Other Information has been saved!';
     }
     // Other information============================================
     $o = new Other_info();
     $data['infos'] = $o->get_by_employee_id($employee_id);
     // Question ====================================================
     $q = new Question();
     $data['question_options'] = array('0' => 'No', '1' => 'Yes');
     $data['question1'] = $q->get_question($employee_id, 1);
     $data['question2'] = $q->get_question($employee_id, 2);
     $data['question3'] = $q->get_question($employee_id, 3);
     $data['question4'] = $q->get_question($employee_id, 4);
     $data['question5'] = $q->get_question($employee_id, 5);
     $data['question6'] = $q->get_question($employee_id, 6);
     $data['question7'] = $q->get_question($employee_id, 7);
     $data['question8'] = $q->get_question($employee_id, 8);
     $data['question9'] = $q->get_question($employee_id, 9);
     $data['question10'] = $q->get_question($employee_id, 10);
     // References=================================================
     $r = new Reference();
     $data['references'] = $r->get_by_employee_id($employee_id);
     $data['selected'] = $e->office_id;
     //Use for office listbox
     $data['options'] = $this->options->office_options();
     $data['employee_id'] = $employee_id;
     $data['main_content'] = 'other_info';
     return View::make('includes/template', $data);
 }