Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
- class Roadmap extends CI_Controller {
- function __construct() {
- parent::__construct();
- $this->load->library('googlemaps');
- $this->load->model('roadmap/M_map');
- $this->load->model('roadmap/D_map');
- }
- public function index() {
- // Initialize the map, passing through any parameters
- $config['center'] = '106.7018137,-6.1358678';
- $config['zoom'] = "auto";
- $this->googlemaps->initialize($config);
- // Get the co-ordinates from the database using our model
- $coords = $this->M_map->get_coordinates();
- // Loop through the coordinates we obtained above and add them to the map
- foreach ($coords as $coordinate) {
- $marker = array();
- $marker['position'] = $coordinate->LAT.','.$coordinate->LNG;
- $marker['title'] = $coordinate->NMRS;
- $marker['icon'] = "http://93.188.161.251/ids/assets/img/mark.png";
- //$marker['icon'] = "https://www.shareicon.net/data/48x48/2017/07/08/888189_flag_512x512.png";
- $marker['infowindow_content'] = $coordinate->WINDOW;
- $this->googlemaps->add_marker($marker);
- }
- $polyline = array();
- $polyline['points'] = array('-6.15018053, 106.897536',
- '-6.12989141, 106.9010896',
- '-6.12953328, 106.8906516',
- '-6.12325847, 106.8891642',
- '-6.13952669, 106.8443176');
- $this->googlemaps->add_polyline($polyline);
- // Create the map
- $data = array();
- $data = array('title' => 'ROAD MAP', 'menu_title' => 'ROAD MAP','sub_menu_title' => 'ROADMAP');
- $data['map'] = $this->googlemaps->create_map();
- $this->template->display('map/roadmap', $data);
- }
- public function rutemap()
- {
- // Initialize the map, passing through any parameters
- $config['center'] = '106.7018137,-6.1358678';
- $config['zoom'] = "auto";
- $this->googlemaps->initialize($config);
- // Get the co-ordinates from the database using our model
- $coords = $this->M_map->get_coordinates();
- // Loop through the coordinates we obtained above and add them to the map
- foreach ($coords as $coordinate) {
- $marker = array();
- $marker['position'] = $coordinate->LAT.','.$coordinate->LNG;
- $marker['title'] = $coordinate->NMRS;
- $marker['icon'] = "http://93.188.161.251/ids/assets/img/mark.png";
- //$marker['icon'] = "https://www.shareicon.net/data/48x48/2017/07/08/888189_flag_512x512.png";
- $marker['infowindow_content'] = $coordinate->WINDOW;
- $this->googlemaps->add_marker($marker);
- }
- $salesmans = $this->D_map->get_list_salesmans();
- $opt2 = array('' => 'Show All');
- foreach ($salesmans as $salesman) {
- $opt2[$salesman] = $salesman;
- }
- $polyline = array();
- $polyline['points'] = array('-6.15018053, 106.897536',
- '-6.12989141, 106.9010896',
- '-6.12953328, 106.8906516',
- '-6.12325847, 106.8891642',
- '-6.13952669, 106.8443176');
- $this->googlemaps->add_polyline($polyline);
- // Create the map
- $data = array();
- $data = array('title' => 'ROAD MAP', 'menu_title' => 'ROAD MAP','sub_menu_title' => 'ROADMAP');
- $data['form_salesmans'] = form_dropdown('',$opt2,'','id="salesman" class="form-control js-example-basic-single"');
- $data['map'] = $this->googlemaps->create_map();
- $data['x'] = $this->D_map->get_hari();
- $this->template->display('map/rutemap', $data);
- }
- public function dataRutemap()
- {
- $data = array();
- $data = array('title' => 'ROAD MAP', 'menu_title' => 'ROAD MAP','sub_menu_title' => 'ROADMAP');
- $data['rute'] = $this->D_map->get_rutedata();
- $this->template->display('map/data_rute',$data);
- }
- public function formRute(){
- $salesmans = $this->D_map->get_list_salesmans();
- $opt2 = array('' => 'Show All');
- foreach ($salesmans as $salesman) {
- $opt2[$salesman] = $salesman;
- }
- $data = array();
- $data = array('title' => 'ROAD MAP', 'menu_title' => 'ROAD MAP','sub_menu_title' => 'ROADMAP');
- $data['form_salesmans'] = form_dropdown('',$opt2,'','id="salesman" class="form-control js-example-basic-single" onchange="getForm(this.value)"');
- $this->template->display('map/edit_rute',$data);
- }
- public function get_Form()
- {
- /* bukan 'id_jurusan' tetapi 'row'.
- * Lihat fungsi getProdi di views/mahasiswa/add.php.
- */
- $NMSAL = $this->input->post('row');
- $nohp = $this->D_map->getNohp($NMSAL);
- $opt1 = array();
- foreach ($nohp as $row) {
- $opt1[$row] = $row;
- }
- $nmrs = $this->D_map->getNmrs($NMSAL);
- $opt2 = array();
- foreach ($nmrs as $row) {
- $opt2[$row] = $row;
- }
- $nors = $this->D_map->getNors($NMSAL);
- $opt3 = array();
- foreach ($nors as $row) {
- $opt3[$row] = $row;
- }
- $lng = $this->D_map->getLang($NMSAL);
- $opt4 = array();
- foreach ($lng as $row) {
- $opt4[$row] = $row;
- }
- $opt5 = Array( "Senin" => "Senin", "Selasa" => "Selasa","Rabu" => "Rabu","Kamis" => "Kamis","Jum'at" => "Jum'at","Sabtu" => "Sabtu", "Minggu" => "Minggu");
- $formOpt = array("nohp" => form_dropdown('',$opt1,'','id="NOHP" class="form-control js-example-basic-single"'), "nmrs" => form_dropdown('',$opt2,'','id="NMRS" class="form-control js-example-basic-single"'), "nors" => form_dropdown('',$opt3,'','id="NORS" class="form-control js-example-basic-single"'), "lng" => form_dropdown('',$opt4,'','id="LNG" class="form-control js-example-basic-single"'),"hari" => form_dropdown('',$opt5,'','id="HARI" class="form-control js-example-basic-single"'));
- //now it is converted to object and you can access it.
- echo json_encode($formOpt);
- }
- }
Add Comment
Please, Sign In to add comment