Exemplo n.º 1
0
 public function toolbar_request_attendance()
 {
     require_once APPPATH . '/controllers/admin/staff_call' . EXT;
     $ids = form_checkids_ids('assignment_check_id');
     if (count($ids) == 0) {
         set_message_note($this->lang->line('error_no_staff_check_id', 'request attendance'), MESSAGE_NOTE_WARNING);
     }
     $this->load->library('staff_phone_manager');
     $staff_ins = new Staff_call();
     //var_dump($ids); //exit;
     foreach ($ids as $id) {
         $this->staff_assignment_model->load_by_id($id);
         $next_shift = $this->_get_next_shift_date_time($this->staff_assignment_model->staff_id, $this->staff_assignment_model->site_id, $this->staff_assignment_model->shift_type);
         //  var_dump($next_shift); exit;
         if ($next_shift) {
             if ($next_shift->call_type != 'Voice') {
                 $this->staff_phone_manager->request_attendance($next_shift->staff_id, $next_shift->site_id, $next_shift->schedule_id, $next_shift->shift_type, $next_shift->start_time, $next_shift->call_type);
             } else {
                 $res = $staff_ins->Random_Call($next_shift->staff_id, $next_shift->schedule_id);
             }
         }
     }
     redirect(uri_string());
     jquery_tab_set_tab_index(2);
 }
Exemplo n.º 2
0
 public function request_attendance()
 {
     $this->load->model('site_shift_model');
     $schedule_id = intval($this->input->post('schedule_id'));
     $send_pref = $this->input->post('send_pref');
     $row = reset($this->schedule_model->get_rows(array('id' => $schedule_id)));
     $this->staff_model->load_by_id($row->staff_id);
     $start_time = $row->start_date;
     $shift_row = reset($this->site_shift_model->get_rows(array('site_id' => $row->site_id, 'shift_type' => $row->shift_type)));
     if ($shift_row) {
         $start_time .= ' ' . $shift_row->start_time;
     }
     if ($this->staff_model->phone_number == '91234567') {
         return 'Invalid Number';
     }
     $this->load->library('staff_phone_manager');
     if ($send_pref == 'sms') {
         $this->staff_phone_manager->request_attendance($row->staff_id, $row->site_id, $row->id, $row->shift_type, $start_time, $send_pref);
         return 'SMS is sent';
     } else {
         $staff_ins = new Staff_call();
         $res = $staff_ins->Random_Call($row->staff_id, $row->id);
         return 'Call is initiated';
     }
 }