109 lines
4.3 KiB
PHP
109 lines
4.3 KiB
PHP
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Dash extends Agent_Controller {
|
|
|
|
/**
|
|
* Index Page for this controller.
|
|
*
|
|
* Maps to the following URL
|
|
* http://example.com/index.php/welcome
|
|
* - or -
|
|
* http://example.com/index.php/welcome/index
|
|
* - or -
|
|
* Since this controller is set as the default controller in
|
|
* config/routes.php, it's displayed at http://example.com/
|
|
*
|
|
* So any other public methods not prefixed with an underscore will
|
|
* map to /index.php/welcome/<method_name>
|
|
* @see https://codeigniter.com/user_guide/general/urls.html
|
|
*/
|
|
function __construct() {
|
|
parent::__construct();
|
|
}
|
|
|
|
public function index() {
|
|
$data = $this->indexPageReal(array());
|
|
|
|
$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->renderAgentPage('view_agent_dash', $data);
|
|
}
|
|
|
|
public function indexPage() {
|
|
$data = $this->indexPageReal(array());
|
|
$data['do_not_script'] = true;
|
|
$this->load->view('agent/extra/transport_list', $data);
|
|
}
|
|
|
|
private function indexPageRealDELETE($data) {
|
|
$data['do_not_script'] = false;
|
|
$data['pageNumber'] = $this->input->get('pageNumber');
|
|
if ($data['pageNumber']=='' || $data['pageNumber']<1) $data['pageNumber'] = 1;
|
|
$in['agent_id'] = $_SESSION['agent_id'];
|
|
$in['limit'] = 30;
|
|
$in["transport_id"] = 0;
|
|
$in['action'] = MEDTRANS_USER_GET_TRANSLIST;
|
|
$out = array();
|
|
$ret = $this->medtrans_call_api(MEDTRANS_TRANSP_GET_TRANSLIST, $in, $out);
|
|
|
|
$data['result_per_page'] = 10;
|
|
$data['result_total'] = count($out['result_list']);
|
|
$data['result_list'] = $out['result_list'];
|
|
|
|
$pages = ceil(1.0*$data['result_total']/$data['result_per_page']);
|
|
if ($data['pageNumber']>$pages) $data['pageNumber'] = 1;
|
|
|
|
$offset = $data['result_per_page'] * ($data['pageNumber'] - 1);
|
|
$data['result_list'] = array_slice($out['result_list'],$offset,$data['result_per_page']);
|
|
return $data;
|
|
}
|
|
|
|
|
|
public function transp_modal() {
|
|
// $data = $this->getSessionArray();
|
|
$data['transport_id'] = trim($this->input->get('transport_id'));
|
|
|
|
if ($data["transport_id"] != '' and $data["transport_id"] > 0) {
|
|
|
|
$in['agent_id'] = $_SESSION['agent_id'];
|
|
$in['limit'] = 30;
|
|
$in["transport_id"] = $data["transport_id"];
|
|
$in['action'] = MEDTRANS_USER_GET_TRANSLIST;
|
|
$out = array();
|
|
$ret = $this->medtrans_call_api(MEDTRANS_TRANSP_GET_TRANSLIST, $in, $out);
|
|
$data['selected_transport'] = $out['result_list'];
|
|
$data['transport_data'] = $data['selected_transport'][0];
|
|
|
|
$out = $this->makeGoogleAddress($data['transport_data']);
|
|
$this->load->library('googlemaps');
|
|
$config['center'] = 'atlanta,GA,USA';
|
|
$config['zoom'] = 'auto';
|
|
$config['directions'] = TRUE;
|
|
$config['directionsStart'] = $out['directionsStart']; //'4201 defoors farm trail, powder springs, GA 30127, USA';
|
|
$config['directionsEnd'] = $out['directionsEnd']; //'2324 stancrest ln, lawrenceville, 30044, GA, USA';
|
|
$config['directionsDivID'] = 'directionsDiv';
|
|
$this->googlemaps->initialize($config);
|
|
$data['map'] = $this->googlemaps->create_map();
|
|
|
|
$data['directionsStart'] = $out['directionsStart'];
|
|
$data['directionsEnd'] = $out['directionsEnd'];
|
|
// $lat_long = get_lat_long_from_address($config['center']);
|
|
// $data['latCenter'] = $lat_long[0];
|
|
// $data['longCenter'] = $lat_long[1];
|
|
// $data['transport_request_id'] = $transport_request_id;
|
|
$this->load->view('agent/modals/view_dash_modal', $data);
|
|
}
|
|
}
|
|
|
|
}
|