public function index($row_pos = 0) { $this->load->library('googlemaps'); $config['center'] = '37.4419, -122.1419'; $config['zoom'] = 'auto'; $this->googlemaps->initialize($config); $this->_filter = filter_load('filter', array('name_match' => '', 'is_published' => 'True')); $row_count = $this->site_model->get_row_count($this->_filter); $rows = $this->site_model->get_rows($this->_filter); $i = 1; foreach ($rows as $row) { $loc = $this->reverseAddress(urlencode($row->street_name . ' ' . $row->postcode . ',' . $row->country)); if ($loc['meta']['status'] == 200) { $lat = $loc['response']['lat']; $lng = $loc['response']['lng']; $marker = array(); $marker['position'] = $lat . ',' . $lng; $marker['infowindow_content'] = $row->name; $marker['animation'] = 'DROP'; $marker['icon'] = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' . $i . '|9999FF|000000'; $this->googlemaps->add_marker($marker); $i++; } } $data['map'] = $this->googlemaps->create_map(); $this->load->view('admin/site_map', $data); }
public function index() { $this->_sort_order = $this->user_model->get_sort_order(); $this->load->helper('filter_helper'); $this->_filter = filter_load('filter', array('name_match' => '', 'username_match' => '', 'group_id' => 0)); if (toolbar_process_task($this)) { return; } $data = array('rows' => $this->user_model->get_rows($this->_filter, $this->_sort_order), 'sort_order' => $this->_sort_order, 'filter' => $this->_filter, 'group_list' => $this->user_model->get_group_dropdown_list('Select Group')); $this->load->view('admin/user_list', $data); }
public function index($row_pos = 0) { $this->_sort_order = $this->duty_model->get_sort_order(); $this->_filter = filter_load('filter', array()); toolbar_process_task($this); $this->load->library('pagination'); $row_pos = intval($row_pos); $row_count = $this->duty_model->get_row_count($this->_filter); $config = array('total_rows' => $row_count, 'base_url' => site_url('admin/duty/index'), 'cur_page' => $row_pos, 'per_page' => 100); $this->pagination->initialize($config); $rows = $this->duty_model->get_rows($this->_filter, $this->_sort_order, $row_pos, $this->pagination->per_page); $data = array('rows' => $rows, 'filter' => $this->_filter, 'sort_order' => $this->_sort_order, 'pagination_links' => $this->pagination->create_links()); $this->load->view('admin/duty_list', $data); }
public function index($row_pos = 0) { $this->_sort_order = $this->schedule_model->get_sort_order(); $this->_filter = filter_load('filter', array('start_date' => datetime_start_month(), 'site_id_match' => '')); toolbar_process_task($this); $this->load->library('pagination'); $row_pos = intval($row_pos); $row_count = $this->schedule_model->get_row_count($this->_filter); $config = array('total_rows' => $row_count, 'base_url' => site_url('admin/schedule/index'), 'cur_page' => $row_pos, 'per_page' => 100); $this->pagination->initialize($config); $rows = $this->schedule_model->get_rows($this->_filter, $this->_sort_order, $row_pos, $this->pagination->per_page); $data = array('rows' => $rows, 'site_list' => $this->site_model->get_dropdown_list('Select Site'), 'filter' => $this->_filter, 'sort_order' => $this->_sort_order, 'pagination_links' => $this->pagination->create_links()); $this->load->view('admin/schedule_list', $data); }
function _save_workingdays_rows() { $site_days = $this->input->post('days'); $site_days_type = $this->input->post('selday'); $siteid = $this->site_model->id; foreach ($site_days as $d) { $filter = filter_load('filter', array('site_id' => $siteid, 'working_day' => $d)); $row_count = $this->site_model->get_row_workingday_count($filter); $data = array('site_id' => $siteid, 'working_day' => $d, 'shift_type' => $site_days_type[$d - 1]); // var_dump($data); if ($row_count != 0) { $this->site_model->updateSiteWorkingDays($data, array('site_id' => $siteid, 'working_day' => $d)); } else { $this->site_model->insertSiteWorkingDays($data); } } //exit; jquery_tab_set_tab_index(3); }
function leave_plane() { $this->load->model(array('site_model', 'schedule_model', 'staff_model')); $this->_filter = filter_load('filter', array('is_published' => 'True')); $sites_rows = $this->site_model->get_rows($this->_filter); $html = ''; foreach ($sites_rows as $site) { $html = ''; $lastmont = date('m'); for ($i = 1; $i <= $lastmont; $i++) { if ($i <= 9) { $month = '0' . $i; } else { $month = $i; } if ($i == 1) { $monthname = "Jan"; } if ($i == 2) { $monthname = "Feb"; } if ($i == 3) { $monthname = "Mar"; } if ($i == 4) { $monthname = "Apr"; } if ($i == 5) { $monthname = "May"; } if ($i == 6) { $monthname = "Jun"; } if ($i == 7) { $monthname = "Jul"; } if ($i == 8) { $monthname = "Aug"; } if ($i == 9) { $monthname = "Sep"; } if ($i == 10) { $monthname = "Oct"; } if ($i == 11) { $monthname = "Nov"; } if ($i == 12) { $monthname = "Dec"; } $leavetype = $this->input->post('leave_type'); $sch_rows = $this->schedule_model->leaveschedule($month, $site->id, $leavetype); $stf_leave = $CB_res = 0; $str = ''; //For Call Back//// foreach ($sch_rows as $sch) { if ($sch->reply_status_id == 6) { $CB_res += 1; $class = 'alert-info'; } else { if ($sch->work_status_id == 2) { $stf_leave += 1; $class = 'alert-info'; } else { if ($sch->work_status_id == 3) { $stf_leave += 1; $class = 'alert-info'; } else { if ($sch->work_status_id == 4) { $stf_leave += 1; $class = 'alert-info'; } else { if ($sch->work_status_id == 7) { $stf_leave += 1; $class = 'alert-info'; } } } } } } /* $y=date('Y-'.$month); $sql = "SELECT count(att.id) as countstaff" ." FROM #__attendance AS att" ." WHERE att.att_date like '%".$y."%' and att.site_id='".$site->id."'" ; // var_dump($sql);exit; $query = $this->db->query($sql); $row = $query->row();*/ if ($stf_leave > 0 or $CB_res > 0) { $html .= '<tr ><td class="' . $class . '"><a href="admin/schedule/assignment/true/' . $sch->id . '" >' . $site->code . '</a></td><td><a href="index.php/admin/home/att_report/1/' . $sch->id . '">' . date('Y') . "-" . $monthname . '</a></td><td><a href="index.php/admin/home/att_report/1/' . $sch->id . '">' . $stf_leave . '</a></td><td><a href="index.php/admin/home/att_report/4/' . $sch->id . '">' . $CB_res . '</a></td></tr>'; } } echo $html; } }
public function import_attexcel() { $this->load->library('upload'); $this->load->helper('file'); $rootpath = $_SERVER['DOCUMENT_ROOT'] . '/uploads/staff/'; $config['upload_path'] = $rootpath; $config['allowed_types'] = 'xls|xlsx'; $config['max_size'] = '1000'; $this->upload->initialize($config); echo $this->upload->file_type; if (!$this->upload->do_upload('file')) { set_message_note($this->upload->display_errors(), MESSAGE_NOTE_FAILURE); } else { require_once APPPATH . '/libraries/PHPExcel.php'; require_once APPPATH . '/libraries/PHPExcel/IOFactory.php'; $upload_data = $this->upload->data(); //Returns array of containing all of the data related to the file you uploaded. $file_name = $upload_data['file_name']; $inputFileType = PHPExcel_IOFactory::identify($rootpath . $file_name); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objReader->setReadDataOnly(true); $objPHPExcel = $objReader->load($config['upload_path'] . $file_name); $objWorksheet = $objPHPExcel->setActiveSheetIndex(0); $highestRow = $objWorksheet->getHighestRow(); $checksite_name = $objWorksheet->getCellByColumnAndRow(0, 1)->getValue(); $checkstaff_code = $objWorksheet->getCellByColumnAndRow(1, 1)->getValue(); $checkdate = $objWorksheet->getCellByColumnAndRow(2, 1)->getValue(); $checkshift = $objWorksheet->getCellByColumnAndRow(3, 1)->getValue(); $checkintime = $objWorksheet->getCellByColumnAndRow(4, 1)->getValue(); $checkout_time = $objWorksheet->getCellByColumnAndRow(5, 1)->getValue(); $checkhours = $objWorksheet->getCellByColumnAndRow(6, 1)->getValue(); $checkstatus = $objWorksheet->getCellByColumnAndRow(7, 1)->getValue(); if (strtolower($checksite_name) !== "site") { set_message_note('site field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkstaff_code) !== "code") { set_message_note('code field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkdate) !== "date") { set_message_note('date field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkshift) !== "shift") { set_message_note('shift field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkintime) !== "in time") { set_message_note('In time field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkout_time) !== "out time") { set_message_note('Out time field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkhours) !== "hours") { set_message_note('Out time field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkstatus) !== "status") { set_message_note('status is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } $err = ''; $scnt = 0; for ($i = 2; $i <= $highestRow; $i++) { $site_name = $objWorksheet->getCellByColumnAndRow(0, $i)->getValue(); $staff_code = $objWorksheet->getCellByColumnAndRow(1, $i)->getValue(); $att_date = $objWorksheet->getCellByColumnAndRow(2, $i)->getValue(); $att_shift = $objWorksheet->getCellByColumnAndRow(3, $i)->getValue(); $att_intime = $objWorksheet->getCellByColumnAndRow(4, $i)->getValue(); $att_out_time = $objWorksheet->getCellByColumnAndRow(5, $i)->getValue(); $att_hours = $objWorksheet->getCellByColumnAndRow(6, $i)->getValue(); $att_status = $objWorksheet->getCellByColumnAndRow(7, $i)->getValue(); $filter = filter_load('filter', array('id' => $staff_code, 'is_published' => 'True')); $existstaff = $this->staff_model->get_row_count($filter); $existsite = $this->site_model->checkcode($site_name); // var_dump($existstaff); if ($existstaff != false && $existsite != false && $att_date != '' && $att_shift != '' && (strtolower($att_status) == 'p' || strtolower($att_status) == 'a')) { //check staff site assignment in roster against the date provided $filter_sch = filter_load('filter', array('staff_id' => $staff_code, 'site_id' => $existsite[0]->id, 'start_date' => date('Y-m-d', strtotime($att_date)), 'shift_type' => $att_shift)); $is_sch = $this->schedule_model->get_row_count($filter_sch); if ($is_sch > 0) { $data = array('site_id' => $existsite[0]->id, 'staff_id' => $staff_code, 'att_date' => date('Y-m-d', strtotime($att_date)), 'att_in' => $att_intime, 'att_out' => $att_out_time, 'att_hours' => $att_hours, 'att_shift' => $att_shift, 'att_status' => $att_status); //var_dump($data); $this->attendance_model->insert($data); $scnt = $scnt + 1; } } else { $err .= ' Check staff or site or date or shift. Make sure status must be "P" or "A" at row number ' . $i . '<br/>'; } } if ($scnt > 0) { set_message_note($scnt . ' rows imported successfully'); } if (!empty($err)) { set_message_note($err, MESSAGE_NOTE_FAILURE); } } //exit; redirect('admin/attendance/import'); exit; }