function examination($employee_id = '') { $data['page_name'] = '<b>Personal Data Sheet</b>'; $data['section_name'] = '<b>Personal Information</b>'; $data['focus_field'] = 'type'; $data['msg'] = ''; $e = new Employee_m(); $data['employee'] = $e->get_by_id($employee_id); if (Input::get('op')) { $eligibility = new Eligibility(); $eligibility->where('employee_id', $employee_id)->get(); $eligibility->delete_all(); // SERVICE ELIGIBILITY================================= $types = Input::get('type'); $rating = Input::get('rating'); $date_exam_conferment = Input::get('date_exam_conferment'); $place_exam_conferment = Input::get('place_exam_conferment'); $license_no = Input::get('license_no'); $license_release_date = Input::get('license_release_date'); $i = 0; foreach ($types as $type) { if ($type != "") { $e = new Eligibility(); $e->employee_id = $employee_id; $e->type = $types[$i]; $e->rating = $rating[$i]; $e->date_exam_conferment = $date_exam_conferment[$i]; $e->place_exam_conferment = $place_exam_conferment[$i]; $e->license_no = $license_no[$i]; $e->license_release_date = $license_release_date[$i]; $e->save(); } $i++; } $data['msg'] = 'Examinations has been saved!'; } $e = new Eligibility(); // Service =========================================================== $e->order_by('id'); $services = $e->get_by_employee_id($employee_id); $i = 0; foreach ($services as $service) { $data['services']['type'][] = $service->type; $data['services']['rating'][] = $service->rating; $data['services']['date_exam_conferment'][] = $service->date_exam_conferment; $data['services']['place_exam_conferment'][] = $service->place_exam_conferment; $data['services']['license_no'][] = $service->license_no; $data['services']['license_release_date'][] = $service->license_release_date; $i++; } if ($i <= 7) { while ($i != 7) { $data['services']['type'][] = ''; $data['services']['rating'][] = ''; $data['services']['date_exam_conferment'][] = ''; $data['services']['place_exam_conferment'][] = ''; $data['services']['license_no'][] = ''; $data['services']['license_release_date'][] = ''; $i++; } } $e = new Employee_m(); $e->get_by_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'] = 'examination'; return View::make('includes/template', $data); }