"", 'thead_open' => '', 'thead_close' => '', 'heading_row_start' => '', 'heading_row_end' => '', 'heading_cell_start' => '', 'tbody_open' => '', 'tbody_close' => '', 'row_start' => '', 'row_end' => '', 'cell_start' => '', 'row_alt_start' => '', 'row_alt_end' => '', 'cell_alt_start' => '', 'table_close' => '
', 'heading_cell_end' => '
', 'cell_end' => '
', 'cell_alt_end' => '
' ); public function index() { $this->load->helper('url'); $data = array(); /* $this->load->model('admindash_model'); $out = $this->admindash_model->getAdminDashData($data); $data['recent_signup'] = $out['recent_signup']; $this->load->model('service_model'); $outx = $this->service_model->getServiceRequestList(100); $data['transport_request'] = $outx['service_request_list']; $this->load->library('googlemaps'); $config['center'] = 'atalnta,GA,USA'; $config['zoom'] = 'auto'; $config['directions'] = TRUE; $config['directionsStart'] = '4201 defoors farm trail, powder springs, GA 30127, USA'; $config['directionsEnd'] = '2324 stancrest ln, lawrenceville, 30044, GA, USA'; $config['directionsDivID'] = 'directionsDiv'; $this->googlemaps->initialize($config); $data['map'] = $this->googlemaps->create_map(); */ $this->load->library('table'); $this->table->set_template($this->template); $mysql = "SELECT id,username,firstname,lastname,'' As action FROM members"; $query = $this->read_replica->query($mysql); $this->table->set_heading(array('data' => 'ID', 'style' => 'width:10px'), 'USERNAME', 'FIRSTNAME', 'LASTNAME', array('data' => 'ACTION', 'style' => 'width:90px')); $data['member_table'] = $this->table->generate($query); //$data['js'] = array('https://maps.googleapis.com/maps/api/js?key=AIzaSyDvjiRTxngOQyBP4zpqFlZuiquc0ROvo9c&callback=initMap'); $this->renderAdminPage('view_dash', $data); // echo 'Ameye Olu'; } protected function renderAdminPage($page_name, $data) { $this->load->view('admin/view_admin_header', $data); $this->load->view('admin/' . $page_name, $data); $this->load->view('admin/view_admin_footer', $data); } public function gpsdata() { $data = array(); /* $this->load->model('admindash_model'); $out = $this->admindash_model->getAdminDashData($data); $data['recent_signup'] = $out['recent_signup']; $this->load->model('service_model'); $outx = $this->service_model->getServiceRequestList(100); $data['transport_request'] = $outx['service_request_list']; $this->load->library('googlemaps'); $config['center'] = 'atalnta,GA,USA'; $config['zoom'] = 'auto'; $config['directions'] = TRUE; $config['directionsStart'] = '4201 defoors farm trail, powder springs, GA 30127, USA'; $config['directionsEnd'] = '2324 stancrest ln, lawrenceville, 30044, GA, USA'; $config['directionsDivID'] = 'directionsDiv'; $this->googlemaps->initialize($config); $data['map'] = $this->googlemaps->create_map(); */ ob_start(); $this->load->library('table'); $this->table->set_template($this->template); $data['page_title'] = "Recent Tracking Data"; $mysql = "SELECT m.id,m.firstname,'' As action FROM members m"; $query = $this->read_replica->query($mysql); // $this->table->set_heading(array('data' => 'ID', 'style' => 'width:10px'), 'USERNAME','FIRSTNAME','LASTNAME', array('data' => 'ACTION', 'style' => 'width:90px')); $res = array(array('First Name','Action','ID','Member ID','Tracked Group','Speed','Latitude','Longitude','Time','Location','Created')); $gps = $this->load->database('gps', TRUE); $dummy = new stdClass; $dummy->id = ""; $dummy->member_id = ""; $dummy->traked_group = ""; $dummy->speed = ""; $dummy->lat = ""; $dummy->lng = ""; $dummy->ttime = ""; $dummy->loc = ""; $dummy->created = ""; foreach ($query->result() as $row) { $q = "SELECT * FROM members_tracking WHERE member_id=".$row->id." ORDER BY id DESC LIMIT 1"; $r = $gps->query($q); $d = $r->result(); if (is_array($d) && count($d)>0 && is_object($d[0])) { list($f) = $d; $res[] = array($row->firstname,$row->action,$f->id,$f->member_id,$f->traked_group,$f->speed,$f->lat,$f->lng,$f->ttime,$f->loc,$f->created); } } $data['member_table'] = $this->table->generate($res); ob_get_clean(); //$data['js'] = array('https://maps.googleapis.com/maps/api/js?key=AIzaSyDvjiRTxngOQyBP4zpqFlZuiquc0ROvo9c&callback=initMap'); $this->renderAdminPage('view_gpstrack', $data); } public function crashlog() { $this->load->model('crash_log_model'); $data = []; $params = []; $params = $this->input->get(); $query = $this->crash_log_model->getLogQuery($params); $tableData = $this->returnAdminTable( [ 'count_query' => $query, 'query' => $query, ], '/tracking/crashlog', [ 'per_page' => 20, 'reuse_query_string' => TRUE, ] ); $data['filterData'] = $params; $data['links'] = $tableData['links']; $data['crashlog_table'] = $tableData['output_table']; $this->renderAdminPage('view_crashlog', $data); } public function crashlogentry() { $id = (int)$this->input->get('id'); if ($id>0) { $q = "SELECT * FROM crash_log WHERE id=${id}"; $r = $this->read_replica->query($q); $f = $r->result_array(); if (is_array($f) and count($f)>0) { $data['entry'] = $f[0]; $data['entry']['data'] = Tracking::prettyPrint($data['entry']['data']); $this->load->view('admin/view_crashlog_entry', $data); } else { echo "Record was not found"; return; } } else { echo "Invalid ID"; return; } } public static function prettyPrint( $json ) { $result = ''; $level = 0; $in_quotes = false; $in_escape = false; $ends_line_level = NULL; $json_length = strlen( $json ); for( $i = 0; $i < $json_length; $i++ ) { $char = $json[$i]; $new_line_level = NULL; $post = ""; if( $ends_line_level !== NULL ) { $new_line_level = $ends_line_level; $ends_line_level = NULL; } if ( $in_escape ) { $in_escape = false; } else if( $char === '"' ) { $in_quotes = !$in_quotes; } else if( ! $in_quotes ) { switch( $char ) { case '}': case ']': $level--; $ends_line_level = NULL; $new_line_level = $level; break; case '{': case '[': $level++; case ',': $ends_line_level = $level; break; case ':': $post = " "; break; case " ": case "\t": case "\n": case "\r": $char = ""; $ends_line_level = $new_line_level; $new_line_level = NULL; break; } } else if ( $char === '\\' ) { $in_escape = true; } if( $new_line_level !== NULL ) { $result .= "\n".str_repeat( "\t", $new_line_level ); } $result .= $char.$post; } return $result; } }