function training_event() { $options = array(); $ci =& get_instance(); $t = new Training_event(); $t->order_by('event_from', 'DESC'); $types = $t->get(); $ci->load->helper('text'); foreach ($types as $type) { $tc = new Training_course(); $tc->get_by_id($type->course_id); $options[$type->id] = $type->event_from . "\t \t | " . $type->event_to . "\t \t | " . $tc->course_title; } return $options; }
function employees($employee_id = '') { $data['page_name'] = '<b>Employee\'s Training Record</b>'; $data['focus_field'] = 'tra_name'; $data['msg'] = ''; $employee_id = Input::get('employee_id'); $e = new Employee_m(); $data['employee'] = $e->get_by_id(Input::get('employee_id')); $data['pics'] = file_exists('pics/' . $e->pics) ? $e->pics : 'not_available.jpg'; $image_properties = array('src' => base_url() . 'pics/' . $data['pics'], 'width' => '140', 'height' => '140'); $data['pics'] = $image_properties; $em = new Employee_movement_m(); $em->get_by_id($e->employee_movement_id); $data['employment_movement'] = $em->employee_movement; if (Input::get('op')) { // TRAINING PROGRAMS========================= $tra_name = Input::get('tra_name'); $tra_date_from = Input::get('tra_date_from'); $tra_date_to = Input::get('tra_date_to'); $tra_hours = Input::get('tra_hours'); $tra_conduct = Input::get('tra_conduct'); $tra_location = Input::get('tra_location'); $t = new Training(); $t->get_by_employee_id($employee_id); $t->delete_all(); $i = 0; foreach ($tra_name as $tra) { if ($tra != "") { $t = new Training(); $t->employee_id = $employee_id; $t->name = $tra_name[$i]; $t->date_from = $tra_date_from[$i]; $t->date_to = $tra_date_to[$i]; $t->number_hours = $tra_hours[$i]; $t->conducted_by = $tra_conduct[$i]; $t->location = $tra_location[$i]; $t->save(); } $i++; } $data['msg'] = 'Trainings has been saved!'; } // Recommended trainings if (Input::get('op2')) { $recommends = Input::get('recommend_id'); $reco_year = Input::get('reco_year'); $course_id = Input::get('course_id'); $relevant = Input::get('relevant'); $reco_remarks = Input::get('reco_remarks'); $i = 0; foreach ($recommends as $r_id) { if ($reco_year[$i] != '') { $t = new Training_recomended_m(); $t->where('course_id', $course_id[$i]); $t->where('reco_year', $reco_year[$i]); $t->where('employee_id', $employee_id); $t->get(); $t->employee_id = $employee_id; $t->reco_year = $reco_year[$i]; $t->course_id = $course_id[$i]; $t->relevant = $relevant[$i]; $t->reco_remarks = $reco_remarks[$i]; $t->save(); } $i++; } // Remove checked if (Input::get('remove')) { foreach (Input::get('remove') as $recommended_id) { $t = new Training_recomended_m(); $t->get_by_id($recommended_id); $t->delete(); } } } // Actual duties if (Input::get('op3')) { $duties_ids = Input::get('duties_id'); $duty_from = Input::get('duty_from'); $duty_to = Input::get('duty_to'); $duty_desc = Input::get('duty_desc'); $i = 0; foreach ($duties_ids as $r_id) { if ($duty_from[$i] != '') { $ed = new Employee_duty_m(); $ed->get_by_id($r_id); $ed->employee_id = $employee_id; $ed->duty_from = $duty_from[$i]; $ed->duty_to = $duty_to[$i]; $ed->duty_desc = $duty_desc[$i]; $ed->save(); } $i++; } } // Training=========================================================== $t = new Training(); $t->order_by('date_from', 'DESC'); $data['trains'] = $t->get_by_employee_id($employee_id); $data['tra_location_options'] = array('local' => 'Local', 'regional' => 'Regional', 'national' => 'National', 'international' => 'International'); if ($employee_id == '') { $data['trains'] = array(); } // Recommended Trainings $t = new Training_recomended_m(); $t->order_by('reco_year'); $data['recommends'] = $t->get_by_employee_id($employee_id); // Actual Duties $ed = new Employee_duty_m(); $ed->order_by('duty_from'); $data['duties'] = $ed->get_by_employee_id($employee_id); $data['selected'] = $e->office_id; //Use for office listbox $data['options'] = $this->options->office_options(); // Courses $t = new Training_course(); $data['courses'] = $t->courses(); $data['employee_id'] = $employee_id; $data['main_content'] = 'employees'; return View::make('includes/template', $data); }
<th width="2%" bgcolor="#D6D6D6">ID</th> <th width="8%" bgcolor="#D6D6D6"><strong>Course Title</strong></th> <th width="7%" bgcolor="#D6D6D6">Date From</th> <th width="5%" bgcolor="#D6D6D6">Date To</th> <th width="14%" bgcolor="#D6D6D6">Venue</th> <th width="13%" bgcolor="#D6D6D6">Conducted By</th> <th width="8%" bgcolor="#D6D6D6">Attendees</th> <th width="5%" bgcolor="#D6D6D6">Local Cost</th> <th width="5%" bgcolor="#D6D6D6">Other Cost</th> <th width="7%" bgcolor="#D6D6D6">Actual Duration</th> <th width="8%" bgcolor="#D6D6D6">Evaluation</th> <th width="7%" bgcolor="#D6D6D6">Remarks</th> <th width="11%" bgcolor="#D6D6D6"><strong>Actions</strong></th> </tr> <?php $course = new Training_course(); $contact = new Training_contact(); ?> <?php foreach ($rows as $row) { ?> <?php $course->get_by_id($row->course_id); ?> <?php $contact->get_by_id($row->contact_id); ?> <?php $bg = $this->Helps->set_line_colors(); ?>
</tr> <tr class="type-one-header"> <th width="4%">Remove</th> <th width="4%">Year</th> <th width="63%">Course</th> <th width="13%">Relevant</th> <th width="17%">Remarks</th> </tr> <?php $i = 0; ?> <?php foreach ($recommends as $recommend) { ?> <?php $t = new Training_course(); ?> <?php $t->get_by_id($recommend->course_id); ?> <tr> <td align="center"><?php echo form_checkbox('remove[]', $recommend->id, FALSE); ?> </td> <td align="right"><span style="clear: both;"> <input name="recommend_id[]" type="hidden" id="recommend_id[]" value="<?php echo $recommend->id; ?> " /> </span> <input name="reco_year[]" type="text" id="reco_year[]" value="<?php
<td width="25%"></td> </tr> </table> <table width="100%" border="0" class="type-one"> <tr class="type-one-header"> <th width="8%" bgcolor="#D6D6D6">ID</th> <th width="21%" bgcolor="#D6D6D6">Name</th> <th width="10%" bgcolor="#D6D6D6">Local</th> <th width="10%" bgcolor="#D6D6D6">Other</th> <th width="9%" bgcolor="#D6D6D6">Relevant</th> <th width="9%" bgcolor="#D6D6D6">Certified</th> <th width="15%" bgcolor="#D6D6D6">Remarks</th> <th width="18%" bgcolor="#D6D6D6"><strong>Actions</strong></th> </tr> <?php $course = new Training_course(); $event = new Training_event(); $employee = new Training_employee(); ?> <?php foreach ($rows as $row) { ?> <?php $event->get_by_id($row->event_id); ?> <?php $course->get_by_id($event->course_id); ?> <?php $employee->get_by_id($row->employee_id); ?>