Jump to content

FSX30HD

Members
  • Posts

    83
  • Joined

  • Last visited

Posts posted by FSX30HD

  1. code I have does not work, there is an example on the site?

    <script type="text/javascript">
    var myMarkers = new Array();
    var lines = new Array();
    $.getJSON( "<?php echo actionurl("Destinations/getAirports"); ?>", function( data ) {
     var items = [];
     $.each( data, function( key, val ) {
    
     var icontype = "default";
       if(val.hub == 1){
     var icontype = "hub";
      $("#info_icao").html(val.icao);
     $("#info_name").html(val.name);
     $("#info_country").html(val.country);
       }
       addMarker(val.lat, val.lng,icontype, val);
     });
    });
    
    function addMarker(lat, lng, icontype, info){
    
    if(icontype == "default"){
     var image = "<?php echo fileurl('lib/images/mapassets/airport_icon.png'); ?>";
    }else if(icontype == "hub"){
     var image = "<?php echo fileurl('lib/images/mapassets/hub_icon.png'); ?>";
    }
    
    var marker = new google.maps.Marker({
       position: CreateLatLngObject(lat, lng),
       map: map,
       icon: image
      });
    
    // Polyline
    google.maps.event.addListener(marker, 'click', function() {
    for (i=0; i<lines.length; i++)
    {
    lines[i].setMap(null); //or line[i].setVisible(false);
    }
    $.getJSON("<?php echo actionurl("Destinations/getAirportsByArpt"); ?>/" + info.icao, function (data) {
    $.each( data, function( key, val ) {
    var line = new google.maps.Polyline({
    path: [CreateLatLngObject(lat, lng), new google.maps.LatLng(val.lat, val.lng)],
    geodesic: true,
    strokeColor: '#7CFC00',
    strokeOpacity: 0.6,
    strokeWeight: 1
    });
    line.setMap(map);
    lines.push(line);
    });
    });
    });
    // Polyline
    
    google.maps.event.addListener(marker, 'mouseover', function() {
     $("#info_icao").html(info.icao);
     $("#info_name").html(info.name);
     $("#info_country").html(info.country);
    });
    
    myMarkers.push(marker);
    }
    function CreateLatLngObject(Latitude, Longitude) {
        var latlng = new google.maps.LatLng(parseFloat(Latitude), parseFloat(Longitude));
        return latlng;
    }
    var styles = [
    {
     "featureType": "landscape",
     "stylers": [
      {
       "color": "#01356a"
      }
     ]
    }, {
     "featureType": "administrative",
     "stylers": [
      {
       "visibility": "off"
      }
     ]
    } , {
     "featureType": "transit",
     "stylers": [
      {
       "visibility": "off"
      }
     ]
    },
    {
     "featureType": "road",
     "stylers": [
    {
    "visibility": "off"
    }
     ]
    },
    {
     "featureType": "water",
     "stylers": [
      {
       "color": "#0b508e"
      }
     ]
    },
    {
     "featureType": "poi",
     "stylers": [
     {
       "visibility": "off"
      }
     ]
    },{ featureType: "all", elementType: "labels", stylers: [ { visibility: "off" } ] }
    ];
    var acars_map_defaults = {
     mapTypeControl: false,
     mapTypeControlOptions: {
    	 style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
    	 position: google.maps.ControlPosition.BOTTOM_CENTER
     },
     zoomControl: true,
     zoomControlOptions: {
    	 style: google.maps.ZoomControlStyle.SMALL,
    	 position: google.maps.ControlPosition.TOP_RIGHT
     },
     scaleControl: false,
     streetViewControl: false,
    
    autozoom: true,
    zoom: 2,
    center: new google.maps.LatLng("<?php echo Config::Get('MAP_CENTER_LAT'); ?>", "<?php echo Config::Get('MAP_CENTER_LNG'); ?>"),
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    refreshTime: 10000,
    styles:_styles
    };
    </script>
    

    http://www.skydream-airlines.com/index.php/destinations

  2. EDIT : Would you mind telling me what should I include in the header_map.tpl

    You need to include in your header

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=10" charset=utf-8>
    <title><?php echo $page_title; ?></title>
    
    <?php
    Template::Show('core_htmlhead.tpl');
    ?>
    </head>
    <body>
    <?php
    Template::Show('core_htmlreq.tpl');
    ?>
    

  3. This is the code you need to put to index.php in the same time you need to create a new header_something.tpl

    $BaseTemplate->Set('title', MainController::$page_title .' - '.SITE_NAME);
    $BaseTemplate->Set('page_title', MainController::$page_title .' - '.SITE_NAME);
    if(file_exists(SKINS_PATH.'/layout.tpl'))
    {
    $BaseTemplate->Set('page_htmlhead', Template::Get('core_htmlhead.tpl', true));
    $BaseTemplate->Set('page_htmlreq', Template::Get('core_htmlreq.tpl', true));
    $BaseTemplate->Set('page_content', $page_content);
    # It's a template sammich!
    if (strpos($page_content,'html { height: 100% }
    body { height: 100%; margin: 0; padding: 0 }') !== false) {
    $BaseTemplate->ShowTemplate('header_map.tpl');
    echo $page_content;}
    elseif (strpos($page_content,'html { height: 100% }
    body { height: 100%; margin: 0; padding: 0 }') !== false) {
    $BaseTemplate->ShowTemplate('header_vrs.tpl');
    echo $page_content;}
    else {
    $BaseTemplate->ShowTemplate('layout.tpl'); }
    }
    

    You need also touch ACARS.php module to declare an new *.tpl render in this new file you copy paste the acarsmap.tpl inside

    public function viewmapbig()
    {
    $this->set('acarsdata', ACARSData::GetACARSData());
    $this->render('acarsmapbig.tpl');
    }
    

    Inside the new.tpl put this in the top of your tpl:

    <style>
    html { height: 100% }
    body { height: 100%; margin: 0; padding: 0 }
    body {
    padding: 0;
    margin: 0;
    }
    html, body, #acarsmap{
    height: 100%;
    }
    </style>
    

    http://www.skydream-airlines.com/index.php/acars/viewmapbig

  4. FSX30HD,

    That did not work either. Now I have the code below and it's not working either. Also, when I connect via acars no image shows up when on the ground, but the image does show when I am in the air, although it is the wrong image because the code is not working in acarsmap.js .

    Here is my complete code as of now. I think I have changed things so much I have just messed up the code completely.

    
    /* var pos = new google.maps.LatLng(lat, lng);
    flightMarkers[flightMarkers.length] = new google.maps.Marker({
    position: pos,
    map: map,
    icon: url+"/lib/images/inair2/"+data[i].heading+".png",
    flightdetails: data[i],
    infowindow_content: detailed_bubble
    });
    
    /* inair images for different airlines */
    
    if (data[i].code == "AIO"){
    var pos = new google.maps.LatLng(lat, lng);
    flightMarkers[flightMarkers.length] = new google.maps.Marker({
    position: pos,
    map: map,
    icon: url+"/lib/images/inair"+data[i].code+"/"+data[i].heading+".png",
    flightdetails: data[i],
    infowindow_content: detailed_bubble
    });
    }
    else if (data[i].code == "PAG"){
    var pos = new google.maps.LatLng(lat, lng);
    flightMarkers[flightMarkers.length] = new google.maps.Marker({
    position: pos,
    map: map,
    icon: url+"/lib/images/inair"+data[i].code+"/"+data[i].heading+".png",
    flightdetails: data[i],
    infowindow_content: detailed_bubble
    });
    }
    /* inair images for different airlines */
    

    Missing else in your condition and more easy to change just the icon value:

    /* inair images for different airlines */if (data[i].flightnum.substring(0, 3) == "AIO")
    
    {
    var icon = url+"/lib/images/inair"+data[i].flightnum.substring(0, 3)+"/"+data[i].heading+".png";
    }
    elseif (data[i].flightnum.substring(0, 3) == "PAG")
    {
    var icon = url+"/lib/images/inair"+data[i].flightnum.substring(0, 3)+"/"+data[i].heading+".png";
    }
    else
    {
    var icon = ..... ;
    }
    
    /* inair images for different airlines */
    

  5. i am using simpilot 5.5x not working for me giving below error any help will be appreciatedFatal error: Call to undefined function recaptcha_get_html() in /home/pakvacc1/public_html/PIA/lib/skins/vp/RouteSubmit/RouteSubmit.php on line 136on line 136
    Maybe this code for phpvms_5.5.x

       <tr>
     <td width="1%" nowrap><strong>Captcha</strong></td>
     <td>
    			    <?php if(isset($captcha_error)){echo '<p class="error">'.$captcha_error.'</p>';} ?>
    			    <div class="g-recaptcha" data-sitekey="<?php echo $sitekey;?>"></div>
    			    <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang;?>">
    			    </script>
     </td>
    </tr>
    

  6. I am trying to have different images for different airline ICAO and only one part is working.

    In the acarsmap.js I replaced this:

    var pos = new google.maps.LatLng(lat, lng);

    flightMarkers[flightMarkers.length] = new google.maps.Marker({

    position: pos,

    map: map,

    icon: url+"/lib/images/inair/"+data.heading+".png",

    flightdetails: data,

    infowindow_content: detailed_bubble

    });

    with this and it does not work:

    if (data.code == "AIO"){

    var pos = new google.maps.LatLng(lat, lng);

    flightMarkers[flightMarkers.length] = new google.maps.Marker({

    position: pos,

    map: map,

    icon: url+"/lib/images/inair"+data.heading+".png",

    flightdetails: data,

    infowindow_content: detailed_bubble

    });

    }

    else if (data.code == "PAG"){

    var pos = new google.maps.LatLng(lat, lng);

    flightMarkers[flightMarkers.length] = new google.maps.Marker({

    position: pos,

    map: map,

    icon: url+"/lib/images/inair2"+data.heading+".png",

    flightdetails: data,

    infowindow_content: detailed_bubble

    });

    }

    When I make a test flight no images at all show up. I have AIO images in the inair folder and the PAG images in the inair2 folder. I've checked permissions on my folders and that is fine. I know the image path's are working because when I switch out inair with inair2 in the image path of the original code, I get the correct images from the folder I am referencing in the original code. However the code that should select the image depending on ICAO code does not work!

    What could be the problem?

    Any help appreciated!

    The good code is

    icon: url+"/lib/images/inair/"+data[i].code+"/"+data[i].heading+".png"
    

    instead

    icon: url+"/lib/images/inair/"+data[i].heading+".png"
    

    • Like 1
  7. Why not use the native cURL wrapper in phpVMS?

    Instead of;

    // make the cURL request
    $curl = curl_init('http://www.savamarkovic.com/loa.csv');
    curl_setopt($curl, CURLOPT_FAILonerror, true);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    $read = curl_exec($curl);
    

    try;

    $url = 'http://www.savamarkovic.com/loa.csv';
    $file = new CodonWebService();
    $read = @$file->get($url);
    

    I already post for that copy/paste this in your admin/modules/LoA/LoA.php

    <?php
    /**
    * Leave of Absence (LoA) v.1.0 Module
    *
    * phpVMS Module for pilots to submit a LoA request that is stored in a database
    * and an option for staff to view all the LoA requests through the admin panel
    * This module is released under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
    * You are free to redistribute and alter this work as you wish but you must keep the original 'copyright' information on all the places it comes in the original work.
    * You are not allowed to delete the copyright information and/or gain any profit by adopting or using this module.
    *
    * @author Sava Markovic - savamarkovic.com
    * @copyright Copyright (c) 2012, Sava Markovic
    * @link http://www.savamarkovic.com
    * @license http://creativecommons.org/licenses/by-nc-sa/3.0/
    */
    class LoA extends CodonModule {
    public $title = "Leave of Absence Admin";
    
    public function HTMLHead()
     {
    	 $this->set('sidebar', 'loa/loa_admin_sidebar.tpl');
     }
    public function NavBar ()
     {
    	 echo '<li><a href="'.SITE_URL.'/admin/index.php/LoA">LoA Admin</a></li>';
     }
    public function index ()
    {
     $version = '1.0';
     $leaves = LoAData::GetAllRequests(array());
     $this->set('all_leaves', $leaves);
     $this->render('loa/loa_admin_index.tpl');
     $this->check($version);
     }
     public function viewLOA()
     {
     $id = $this->get->id;	
     $getinfo = LoAData::GetInfoByID($id);
     $this->set('info', $getinfo);
     $this->render('loa/loa_admin_view_request.tpl');
     }
     public function confirmDeleteLOA()
     {
     $id = $this->get->id;	
     $getinfo = LoAData::GetInfoById($id);
     $this->set('info', $getinfo);
     $this->render('loa/loa_admin_confirm_delete_request.tpl');
     }
     public function deleteLOA()
     {
     $id = $this->get->id;
     $getinfo = LoAData::DeleteLoA($id);
    
     if (mysql_affected_rows() == -1)
     {
    	 $this->set('message', 'The LoA Reqest hasn\'t been deleted from the database for some reason. This isn\'t suppose to happen. Check the phpVMS forums for support.');
    	 $this->render('loa/loa_admin_delete_request.tpl');
     }
     else
     {
    
    	 $this->set('message', 'The LoA Reqest has been successfuly deleted from the database.');
    	 $this->render('loa/loa_admin_delete_request.tpl');
     }
    
     }
    protected function check ($version)
    			 {
    			 $version_to_check = $version;
    // make the cURL request
    $url = 'http://www.savamarkovic.com/loa.csv';
    $file = new CodonWebService();
    $read = @$file->get($url);
    			 if ($read[0] > $version_to_check && $read[2] == "1") { $critical = TRUE; } // If its 1, set ciritcal to true
    			 if ($read[0] > $version_to_check) { $update = TRUE; } // Anything other than 1 set update to true
    			 if ($read[0] == $version_to_check) {
    							 echo '<p id="success">Your version of this module is up to date. Wohooooo! )</p>';
    			 }else if ($critical) {
    											 echo '<h4>CRITICAL UPDATE FOUND!</h4>';
    											 echo '<p id="error">There is a critical update available! Here is the information associated with the update. <br/><b>Version:
    															 '.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
    			 }else if ($update){
    											 echo '<h4>NON CRITICAL UPDATE FOUND!</h4>';
    											 echo '<p id="error" style="background:#fffca7;border-color:orange">There is NON critical update available! Here is the information associated with the update. <br/><b>Version:
    															 '.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
    			 }
    }
    }
    

  8. phpVMS's acars map draws from the database and not from an xml file.

    Thanks for your reply, the map draws from json format and the link is:

    /action.php/acars/data

    I have found howto output in xml format. I have just make a php file echo rows in xml format. But maybe in ACARS module instead of use json_encode switch to saveXML() like this:

    //Creates XML string and XML document using the DOM
    $dom = new DomDocument('1.0', 'UTF-8');
    //add root == jukebox
    $jukebox = $dom->appendChild($dom->createElement('jukebox'));
    for ($i = 0; $i < count($arrayWithTracks); $i++) {
     //add track element to jukebox
     $track = $dom->createElement('track');
     $jukebox->appendChild($track);
     // Appending attributes to track
     $attr = $dom->createAttribute('source');
     $attr->appendChild($dom->createTextNode($arrayWithTracks[$i]['source']));
     $track->appendChild($attr);
     $attr = $dom->createAttribute('artist');
     $attr->appendChild($dom->createTextNode($arrayWithTracks[$i]['artist']));
     $track->appendChild($attr);
     $attr = $dom->createAttribute('album');
     $attr->appendChild($dom->createTextNode($arrayWithTracks[$i]['album']));
     $track->appendChild($attr);
     $attr = $dom->createAttribute('title');
     $attr->appendChild($dom->createTextNode($arrayWithTracks[$i]['title']));
     $track->appendChild($attr);
    }
    $dom->formatOutput = true; // set the formatOutput attribute of domDocument to true
    // save XML as string or file
    $test1 = $dom->saveXML(); // put string in test1
    $dom->save('test1.xml'); // save as file
    

  9. Ademar

    Have you this in ACARS.php module

    public function data()
    {
    $flights = ACARSData::GetACARSData();
    if(!$flights)
    $flights = array();
    $this->acarsflights = array();
    foreach($flights as $flight) {
    if($flight->route == '') {
    $flight->route_details = array();
    } else {
    # Jeff's fix for ACARS
    $params->deplat = $flight->deplat;
    $params->deplng = $flight->deplng;
    $params->route = $flight->route;
    $flight->route_details = NavData::parseRoute($params);
    //$flight->route_details = NavData::parseRouteACARS($params);
    }
    

  10. Works now:

    <?php
    $count = 0;
    //if(!$data)
    foreach($data as $l)
    {
    if (!$l->arrlat || !$l->arrlng || $l->arrlat == '' || $l->arrlng == '')
    {
    	 continue;
    	 }
    ?>
    

    Change:

    <script type="text/javascript">
    var pointer_<?php echo $count;?> = new google.maps.LatLng(<?php echo $l->arrlat?>, <?php echo $l->arrlng?>);
    var point_<?php echo $count;?> = new google.maps.Marker({
    position: pointer_<?php echo $count;?>,
    map: map,
    title: "<?php echo "$l->acregistration is at $l->arrname ($l->arricao)";?>",
    });
    var contentString = '<?php echo $l->acname;?> (<?php echo $l->acregistration;?>) is at <?php echo $l->arrname.'('.$l->arricao.')';?>';
    var infowindow_<?php echo $count;?> = new google.maps.InfoWindow({
    content: contentString
    });
    google.maps.event.addListener(point_<?php echo $count;?>, 'click', function() {
    infowindow_<?php echo $count;?>.open(map,point_<?php echo $count;?>);
    });
    </script>
    

    by:

    <script type="text/javascript">
    var pointer_<?php echo $count;?> = new google.maps.LatLng(<?php echo $l->arrlat?>, <?php echo $l->arrlng?>);
    var point_<?php echo $count;?> = new google.maps.Marker({
    position: pointer_<?php echo $count;?>,
    map: map,
    title: "<?php echo "$l->acregistration is at $l->arrname ($l->arricao)";?>",
    });
    var contentString = "<?php echo $l->acname;?> (<?php echo $l->acregistration;?>) is at <?php echo $l->arrname.'('.$l->arricao.')';?>";
    var infowindow_<?php echo $count;?> = new google.maps.InfoWindow({
    content: contentString
    });
    google.maps.event.addListener(point_<?php echo $count;?>, 'click', function() {
    infowindow_<?php echo $count;?>.open(map,point_<?php echo $count;?>);
    });
    </script>
    

    I have make the changes in your website

    Best Regards

    • Like 1
  11. Can you edit please your message and use "code balise" it's more clear to read for us.

    Original code is :

    <?php
    $count = 0;
    foreach($data as $l)
    {
    ?>
    

    your:

    <?php
    $count = 1;
    if($data)
    foreach($data as $l)
    {
    ?>
    

    Try this:

    <script type="text/javascript">
    var options = {
    zoom: 4,
    center: new google.maps.LatLng(<?php echo Config::Get('MAP_CENTER_LAT'); ?>, <?php echo Config::Get('MAP_CENTER_LNG'); ?>),
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    }
    var map = new google.maps.Map(document.getElementById("routemap"), options);
    </script>
    <?php
    $count = 0;
    //if(!$data)
    foreach($data as $l)
    {
    ?>
    <script type="text/javascript">
    var pointer_<?php echo $count;?> = new google.maps.LatLng(<?php echo $l->arrlat?>, <?php echo $l->arrlng?>);
    var point_<?php echo $count;?> = new google.maps.Marker({
    position: pointer_<?php echo $count;?>,
    map: map,
    title: "<?php echo "$l->acregistration is at $l->arrname ($l->arricao)";?>",
    });
    var contentString = '<?php echo $l->acname;?> (<?php echo $l->acregistration;?>) is at <?php echo $l->arrname.'('.$l->arricao.')';?>';
    var infowindow_<?php echo $count;?> = new google.maps.InfoWindow({
    content: contentString
    });
    google.maps.event.addListener(point_<?php echo $count;?>, 'click', function() {
    infowindow_<?php echo $count;?>.open(map,point_<?php echo $count;?>);
    });
    </script>
    <?php
    $count = 1 + $count;
    }
    ?>
    

  12. Thanks for u attention Sim.

    So, the live map in the home page, works good, showing the flight in real time.

    The second map in the flight tracker, is to show where is the plane, but dont show. If you click in the "view details" you will see the plane location on the third map in this page...

    If i open the Map.tpl here, is this problem on line 21:

    var pointer_<?php echo $count;?> = new google.maps.LatLng(<?php echo $l->arrlat?>, <?php echo $l->arrlng?>);

    I dont know why occours it.

    Thanks for help me.

    Hudson

    Can you paste here your code from map.tpl because You can see here in your gcmap missing the latest flight

    http://voeglobal.bes...cker/view/PPGLA

    /lib/skins/yourkins/vFleetTracker

    or

    /core/templates/vFleetTracker

  13. A few post up you can see

    http://forum.phpvms...._40#entry111780

    protected function check ($version)
    	 {
    	 $version_to_check = $version;
    // make the cURL request
    $curl = curl_init('http://www.savamarkovic.com/loa.csv');
    curl_setopt($curl, CURLOPT_FAILonerror, true);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    $read = curl_exec($curl);
    	 if ($read[0] > $version_to_check && $read[2] == "1") { $critical = TRUE; } // If its 1, set ciritcal to true
    	 if ($read[0] > $version_to_check) { $update = TRUE; } // Anything other than 1 set update to true
    	 if ($read[0] == $version_to_check) {
    			 echo '<p id="success">Your version of this module is up to date. Wohooooo! )</p>';
    	 }else if ($critical) {
    					 echo '<h4>CRITICAL UPDATE FOUND!</h4>';
    					 echo '<p id="error">There is a critical update available! Here is the information associated with the update. <br/><b>Version:
    							 '.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
    	 }else if ($update){
    					 echo '<h4>NON CRITICAL UPDATE FOUND!</h4>';
    					 echo '<p id="error" style="background:#fffca7;border-color:orange">There is NON critical update available! Here is the information associated with the update. <br/><b>Version:
    							 '.$read[0].' - '. $read[1].' <br /></b>Please send an email to ceo@airserbiavirtual.com to receive the updated version.</p>';
    	 }
    }
    

×
×
  • Create New...