Advertisement
levicosta2015

Untitled

Jul 18th, 2016
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 16.67 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Dataroute Module v1.0
  4.  * By Levi Costa [levicosta201]
  5.  * http://code.voemercosul.com/
  6.  * levicosta201 on phpVMS forums
  7.  * Keep the credits! It's cool
  8.  */  
  9.  ?>
  10. <!DOCTYPE html>
  11. <html>
  12.     <head>
  13.         <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  14.         <meta charset="utf-8">
  15.         <title>Data Routes</title>
  16.         <style>
  17.             @charset"utf-8";
  18.         html, body {
  19.             height: 100%;
  20.             margin: 0;
  21.             padding: 0;
  22.             background-color: #000;
  23.             color: #000;
  24.             font-size: 14px
  25.         }
  26.         p {
  27.             color: #FFF;
  28.             font-family: Arial, Helvetica, sans-serif;
  29.             line-height: 20px;
  30.             text-align: justify;
  31.             margin-left: 75px;
  32.             text-shadow: 5px 5px 5px#000000
  33.         }
  34.         p.um {
  35.             font-size: 14px
  36.         }
  37.         p.dois {
  38.             font-size: 18px
  39.         }
  40.         p.tres {
  41.             font-size: 28px
  42.         }
  43.         #map-canvas {
  44.             height: 100%;
  45.             position: relative
  46.         }
  47.         @media print {
  48.             html, body {
  49.                 height: auto;
  50.                 background-color: #000;
  51.                 color: #FFF
  52.             }
  53.             #map-canvas, #map-canvas {
  54.                 height: 100%;
  55.                 position: relative
  56.             }
  57.         }
  58.         #form-oculto, #form-ocultoFade {
  59.             font-family: "Arial Black", Gadget, sans-serif;
  60.             color: #FFF;
  61.             width: 40%;
  62.             height: 100%;
  63.             alignment-adjust: central;
  64.             margin-left: 30%;
  65.             margin-right: 10%;
  66.             margin-top: 0;
  67.             z-index: 30;
  68.             position: absolute;
  69.             background-color: rgba(0,0,0,0.7);
  70.             background: rgba(0,0,0,0.7);
  71.             position: absolute;
  72.             z-index: 60;
  73.             overflow: auto;
  74.         }
  75.         #menuPopulate {
  76.             margin-top: 30px;
  77.             font-family: "Arial Black", Gadget, sans-serif;
  78.             color: #000;
  79.             width: 30%;
  80.             height: 3.5%;
  81.             alignment-adjust: central;
  82.             margin-right: 0;
  83.             margin-left: 35%;
  84.             z-index: 60;
  85.             position: absolute;
  86.             background-color: rgba(0,0,0,0.7);
  87.                 background: rgba(0,0,0,0.7)  @font-face {
  88.                     font-family: "Segoe UI";
  89.                     src: url("Segoe.eot?") format("eot"),  url("Segoe.woff") format("woff"),  url("Segoe.ttf") format("truetype");
  90.                 }
  91.             text-shadow: 1px 1px 3px #FFF;
  92.             font-size: 20px;
  93.         }
  94.         div.active, div.activeFade {
  95.             cursor: pointer;
  96.             text-align: center;
  97.             width: 100%;
  98.             height: 15%;
  99.             alignment-adjust: central;
  100.             margin-left: 3%;
  101.             z-index: 30;
  102.             position: absolute
  103.         }
  104.         #aircraft {
  105.             -webkit-border-radius: 60px 60px 60px 60px;
  106.             border-radius: 60px 60px 60px 60px
  107.         }
  108.         #cssmenu {
  109.             position: relative;
  110.             height: 44px;
  111.             background: #d1d1d1;
  112.             width: auto;
  113.             -webkit-box-shadow: 0 6px 30px 5px #000;
  114.             box-shadow: 0 6px 25px 5px #000;
  115.         }
  116.         #cssmenu ul {
  117.             list-style: none;
  118.             padding: 0;
  119.             margin: 0;
  120.             line-height: 1
  121.         }
  122.         #cssmenu>ul {
  123.             position: relative;
  124.             display: block;
  125.             background: #d1d1d1;
  126.             height: 32px;
  127.             width: 100%;
  128.             z-index: 500
  129.         }
  130.         #cssmenu>ul>li {
  131.             display: block;
  132.             position: relative;
  133.             float: left;
  134.             margin: 0;
  135.             padding: 0
  136.         }
  137.         #cssmenu>ul>#menu-button {
  138.             display: none
  139.         }
  140.         #cssmenu ul li a {
  141.             display: block;
  142.             font-family: Helvetica, sans-serif;
  143.             text-decoration: none
  144.         }
  145.         #cssmenu>ul>li>a {
  146.             font-size: 14px;
  147.             font-weight: bold;
  148.             padding: 15px 20px;
  149.             color: #7a8189;
  150.             text-transform: uppercase;
  151.             -webkit-transition: color 0.25s ease-out;
  152.             -moz-transition: color 0.25s ease-out;
  153.             -ms-transition: color 0.25s ease-out;
  154.             -o-transition: color 0.25s ease-out;
  155.             transition: color 0.25s ease-out
  156.         }
  157.         #cssmenu>ul>li.has-sub>a {
  158.             padding-right: 32px
  159.         }
  160.         #cssmenu>ul>li:hover>a {
  161.             color: #ffffff
  162.         }
  163.         #cssmenu li.has-sub::after {
  164.             display: block;
  165.             content: '';
  166.             position: absolute;
  167.             width: 0;
  168.             height: 0
  169.         }
  170.         #cssmenu>ul>li.has-sub::after {
  171.             right: 10px;
  172.             top: 20px;
  173.             border: 5px solid transparent;
  174.             border-top-color: #7a8189
  175.         }
  176.         #cssmenu>ul>li:hover::after {
  177.             border-top-color: #ffffff
  178.         }
  179.         #indicatorContainer {
  180.             position: absolute;
  181.             height: 12px;
  182.             width: 100%;
  183.             bottom: 0px;
  184.             overflow: hidden;
  185.             z-index: -1
  186.         }
  187.         #pIndicator {
  188.             position: absolute;
  189.             height: 0;
  190.             width: 100%;
  191.             border: 12px solid transparent;
  192.             border-top-color: #2b2f3a;
  193.             z-index: -2;
  194.             -webkit-transition: left.25s ease;
  195.             -moz-transition: left.25s ease;
  196.             -ms-transition: left.25s ease;
  197.             -o-transition: left.25s ease;
  198.             transition: left.25s ease
  199.         }
  200.         #cIndicator {
  201.             position: absolute;
  202.             height: 0;
  203.             width: 100%;
  204.             border: 12px solid transparent;
  205.             border-top-color: #2b2f3a;
  206.             top: -12px;
  207.             right: 100%;
  208.             z-index: -2
  209.         }
  210.         #cssmenu ul ul {
  211.             position: absolute;
  212.             left: -9999px;
  213.             top: 70px;
  214.             opacity: 0;
  215.             -webkit-transition: opacity.3s ease, top.25s ease;
  216.             -moz-transition: opacity.3s ease, top.25s ease;
  217.             -ms-transition: opacity.3s ease, top.25s ease;
  218.             -o-transition: opacity.3s ease, top.25s ease;
  219.             transition: opacity.3s ease, top.25s ease;
  220.             z-index: 1000
  221.         }
  222.         #cssmenu ul ul ul {
  223.             top: 37px;
  224.             padding-left: 5px
  225.         }
  226.         #cssmenu ul ul li {
  227.             position: relative
  228.         }
  229.         #cssmenu>ul>li:hover>ul {
  230.             left: auto;
  231.             top: 44px;
  232.             opacity: 1
  233.         }
  234.         #cssmenu ul ul li:hover>ul {
  235.             left: 170px;
  236.             top: 0;
  237.             opacity: 1
  238.         }
  239.         #cssmenu ul ul li a {
  240.             width: 130px;
  241.             border-bottom: 1px solid#eee;
  242.             padding: 10px 20px;
  243.             font-size: 12px;
  244.             color: #9ea2a5;
  245.             background: #fff;
  246.             -webkit-transition: all.35s ease;
  247.             -moz-transition: all.35s ease;
  248.             -ms-transition: all.35s ease;
  249.             -o-transition: all.35s ease;
  250.             transition: all.35s ease
  251.         }
  252.         #cssmenu ul ul li:hover>a {
  253.             background: #f6f6f6;
  254.             color: #8c9195
  255.         }
  256.         #cssmenu ul ul li:last-child>a, #cssmenu ul ul li.last>a {
  257.             border-bottom: 0
  258.         }
  259.         .submenuArrow {
  260.             border: 6px solid transparent;
  261.             width: 0;
  262.             height: 0;
  263.             border-bottom-color: #fff;
  264.             position: absolute;
  265.             top: -12px
  266.         }
  267.         #cssmenu ul ul li.has-sub::after {
  268.             border: 4px solid transparent;
  269.             border-left-color: #9ea2a5;
  270.             right: 10px;
  271.             top: 12px;
  272.             -moz-transition: all.2s ease;
  273.             -ms-transition: all.2s ease;
  274.             -o-transition: all.2s ease;
  275.             transition: all.2s ease;
  276.             -webkit-transition: -webkit-transform 0.2s ease, right 0.2s ease
  277.         }
  278.         #cssmenu ul ul li.has-sub:hover::after {
  279.             border-left-color: #fff;
  280.             right: -5px;
  281.             -webkit-transform: rotateY(180deg);
  282.             -ms-transform: rotateY(180deg);
  283.             -moz-transform: rotateY(180deg);
  284.             -o-transform: rotateY(180deg);
  285.             transform: rotateY(180deg)
  286.         }
  287.         @media all and(max-width:800px),
  288.         only screen and(-webkit-min-device-pixel-ratio:2)and(max-width:1024px),
  289.         only screen and(min--moz-device-pixel-ratio:2)and(max-width:1024px),
  290.         only screen and(-o-min-device-pixel-ratio:2/1)and(max-width:1024px),
  291.         only screen and(min-device-pixel-ratio:2)and(max-width:1024px),
  292.         only screen and(min-resolution:192dpi)and(max-width:1024px),
  293.         only screen and(min-resolution:2dppx)and(max-width:1024px) {
  294.             #cssmenu {
  295.                 width:auto
  296.             }
  297.             #cssmenu ul {
  298.                 width:auto
  299.             }
  300.             #cssmenu.submenuArrow, #cssmenu#indicatorContainer {
  301.                 display:none
  302.             }
  303.             #cssmenu>ul {
  304.                 height:auto;
  305.             display:block
  306.             }
  307.             #cssmenu>ul>li {
  308.                 float:none
  309.             }
  310.             #cssmenu li, #cssmenu>ul>li {
  311.                 display:none
  312.             }
  313.             #cssmenu ul ul, #cssmenu ul ul ul, #cssmenu ul>li:hover>ul, #cssmenu ul ul>li:hover>ul {
  314.                 position:relative;
  315.                 left:auto;
  316.                 top:auto;
  317.                 opacity:1;
  318.                 padding-left:0
  319.             }
  320.             #cssmenu ul.has-sub::after {
  321.                 display:none
  322.             }
  323.             #cssmenu ul li a {
  324.                 padding:12px 20px
  325.             }
  326.             #cssmenu ul ul li a {
  327.                 border:0;
  328.                 background:none;
  329.                 width:auto;
  330.                 padding:8px 35px
  331.             }
  332.             #cssmenu ul ul li:hover>a {
  333.                 background:none;
  334.                 color:#8c9195
  335.             }
  336.             #cssmenu ul ul ul a {
  337.                 padding:8px 50px
  338.             }
  339.             #cssmenu ul ul ul ul a {
  340.                 padding:8px 65px
  341.             }
  342.             #cssmenu ul ul ul ul ul a {
  343.                 padding:8px 80px
  344.             }
  345.             #cssmenu ul ul ul ul ul ul a {
  346.                 padding:8px 95px
  347.             }
  348.             #cssmenu>ul>#menu-button {
  349.                 display:block;
  350.                 cursor:pointer
  351.             }
  352.             #cssmenu#menu-button>a {
  353.                 padding:14px 20px
  354.             }
  355.             #cssmenu ul.open li, #cssmenu>ul.open>li {
  356.                 display:block
  357.             }
  358.             #cssmenu>ul.open>li#menu-button>a {
  359.                 color:#fff;
  360.                 border-bottom:1px solid rgba(150,150,150,0.1)
  361.             }
  362.             #cssmenu#menu-button::after {
  363.                 display:block;
  364.                 content:'';
  365.                 position:absolute;
  366.                 height:3px;
  367.                 width:22px;
  368.                 border-top:2px solid#7a8189;
  369.                 border-bottom:2px solid#7a8189;
  370.                 right:20px;
  371.                 top:15px
  372.             }
  373.             #cssmenu#menu-button::before {
  374.                 display:block;
  375.                 content:'';
  376.                 position:absolute;
  377.                 height:3px;
  378.                 width:22px;
  379.                 border-top:2px solid#7a8189;
  380.                 right:20px;
  381.                 top:25px
  382.             }
  383.             #cssmenu ul.open#menu-button::after, #cssmenu ul.open#menu-button::before {
  384.                 border-color:#fff
  385.             }
  386.         }
  387.         </style>
  388.     <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
  389.     <script src='http://code.jquery.com/jquery.min.js' type='text/javascript'></script>
  390.     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  391.     <script type="text/javascript"   src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=geometry"></script>
  392.     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
  393.     <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  394.     <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  395.     <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  396.     </head>
  397.     <body>
  398.         <div class="mapcenter"align="center">
  399.             <div id="menuPopulate"style="display:none;">
  400.                 <div id='cssmenu'>
  401.                     <ul>
  402.                         <?php Template::Show('core_navigation.tpl');?>
  403.                     </ul>
  404.                 </div>
  405.                 <br/>
  406.                 <form action="" name="search" method="post">
  407.                     <div class="ui-widget">
  408.                         <label for="tags">Flights From: </label>
  409.                         <input id="tags" name="icao">
  410.                     </div>
  411.                     <input type="submit" value="Search" />
  412.                 </form>
  413.             </div>
  414.         </div>
  415.         <div id="form-oculto"style="display: none;">
  416.             <?php  
  417.                 //We will receive POST airport ICAO
  418.                 $icao = $_POST['icao'];
  419.                 //This query returns the departure airport, we will use the DISTINCT lest more of an equal airport
  420.                 $query = "SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'";
  421.                 //I wrote the query twice, but it is unnecessary, you can substitute the variable $query
  422.                 $q = mysql_query("SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'");
  423.                 //Gets the number of rows in result
  424.                 $c = mysql_num_rows($q);
  425.                 $d = $c;
  426.                 echo '<br/><br/>';
  427.                 echo ''.$d.' Flight from '.$icao.'';
  428.                 echo '<br/><br/>';
  429.                 //Run the query again
  430.                 $query = mysql_query($query);
  431.                     //We create a loop to separate the query
  432.                     while($dados = mysql_fetch_assoc($query)){
  433.                         //Now we split the query into the variable $dados and took the value *arricao*
  434.                         $data = $dados['arricao'];
  435.                         //This table has data from all airports in the world, it can be found here in the forum
  436.                         $latsql = "SELECT DISTINCT * FROM aeroportos_tw WHERE gps_code = '$data'";
  437.                         //Run the query
  438.                         $latQuery = mysql_query($latsql);  
  439.                         $i=1;
  440.                             //We create a loop to get the name and aeroprto code that is in the database
  441.                             while($res = mysql_fetch_assoc($latQuery)){
  442.                                 //echo '["'.$res['name'].'", '.$res['latitude_deg'].', '.$res['longitude_deg'].', '.$i++.', "'.$res['gps_code'].'"],';
  443.                                 echo $res['name'].' ('.$res['gps_code'].')';
  444.                                 echo '<br/><br/>';
  445.                             }
  446.                     }
  447.                 ?>
  448.         </div>
  449.         </div>
  450.         <div id="map-canvas"></div>
  451.         </div>     
  452.         <script type="text/javascript">
  453.         var infowindow = null;
  454.             //This is a javascript function that informs the start of the page and map
  455.             function initialize(){
  456.                 jQuery(document).ready(function(){
  457.                     jQuery("div#menuPopulate").slideDown();
  458.                     jQuery("#botaoExibir").find('div').addClass('active')
  459.                 });
  460.                 var mapOptions = {
  461.                     zoom: 3,
  462.                     center: new google.maps.LatLng(0, -180),
  463.                     mapTypeId: google.maps.MapTypeId.TERRAIN
  464.                 };
  465.                 var map = new google.maps.Map(document.getElementById('map-canvas'),
  466.                 mapOptions);
  467.                 var flightPlanCoordinates = [
  468.                     <?php
  469.                         $icao = $_POST['icao'];
  470.                         $query = "SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'";
  471.                         $q = mysql_query("SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'");
  472.                         $c = mysql_num_rows($q);
  473.                         $query = mysql_query($query);
  474.                             while($dados = mysql_fetch_assoc($query)){
  475.                                 $data = $dados['arricao'];
  476.                                 $latsql = "SELECT DISTINCT latitude_deg, longitude_deg FROM aeroportos_tw WHERE gps_code = '$data'";
  477.                                 $latQuery = mysql_query($latsql);
  478.                                     while($res = mysql_fetch_assoc($latQuery)){
  479.                                         echo 'new google.maps.LatLng('.$res['latitude_deg'].', '.$res['longitude_deg'].'), ';
  480.                                     }
  481.                                         if(isset($icao)){  
  482.                                             $latsql2 = "SELECT DISTINCT * FROM aeroportos_tw WHERE gps_code = '$icao'";
  483.                                             $latQuery2 = mysql_query($latsql2);
  484.                                             $i2=1;
  485.                                                 while($res2 = mysql_fetch_assoc($latQuery2)){          
  486.                                                     echo 'new google.maps.LatLng('.$res2['latitude_deg'].', '.$res2['longitude_deg'].'), ';
  487.                                                 }
  488.                                         }
  489.                             }
  490.                     ?>
  491.                 ];
  492.                 var flightPath = new google.maps.Polyline({
  493.                     path: flightPlanCoordinates,
  494.                     geodesic: true,
  495.                     strokeColor: '#FF0000',
  496.                     strokeOpacity: 0.7,
  497.                     strokeWeight: 1
  498.                 });
  499.                 flightPath.setMap(map);
  500.                 setMarkers(map, markersdat);
  501.                 infowindow = new google.maps.InfoWindow({
  502.                         content: "loading..."
  503.                 });
  504.                 var bikeLayer = new google.maps.BicyclingLayer();
  505.                     bikeLayer.setMap(map);
  506.             }  
  507.             var markersdat = [
  508.                 <?php
  509.                     //Here there is no need to comment on the code again
  510.                     $icao = $_POST['icao'];    
  511.                     $query = "SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'";                   
  512.                     $q = mysql_query("SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'");
  513.                     $c = mysql_num_rows($q);       
  514.                     $query = mysql_query($query);              
  515.                         while($dados = mysql_fetch_assoc($query)){         
  516.                             $data = $dados['arricao'];         
  517.                             $latsql = "SELECT DISTINCT * FROM aeroportos_tw WHERE gps_code = '$data'";
  518.                             $latQuery = mysql_query($latsql);  
  519.                             $i=1;
  520.                             while($res = mysql_fetch_assoc($latQuery)){                
  521.                                 echo '["'.$res['name'].'", '.$res['latitude_deg'].', '.$res['longitude_deg'].', '.$i++.', "'.$res['gps_code'].'"],';                   
  522.                             }
  523.                             if(isset($icao)){  
  524.                                 $latsql2 = "SELECT DISTINCT * FROM aeroportos_tw WHERE gps_code = '$icao'";
  525.                                 $latQuery2 = mysql_query($latsql2);
  526.                                 $i2=1;
  527.                                     while($res2 = mysql_fetch_assoc($latQuery2)){              
  528.                                         echo '["'.$res2['name'].'", '.$res2['latitude_deg'].', '.$res2['longitude_deg'].', '.$i2++.', "'.$res2['gps_code'].'"],';
  529.                                     }
  530.                             }
  531.                         }  
  532.                 ?>
  533.             ];
  534.             function setMarkers(map, markers) {
  535.                 if(markers.length > 1){
  536.                     for (var i = 0; i < markers.length; i++){
  537.                         var data = markers[i];
  538.                         var siteLatLng = new google.maps.LatLng(data[1], data[2]);
  539.                         var marker = new google.maps.Marker({
  540.                             position: siteLatLng,
  541.                             map: map,
  542.                             title: data[4],
  543.                             zIndex: data[3],
  544.                             html: data[3]
  545.                         });
  546.                         var contentString = "Some content";
  547.                         google.maps.event.addListener(marker, "click", function (){            
  548.                             jQuery(document).ready(function(){
  549.                                 jQuery("div#form-oculto").slideDown();
  550.                                 jQuery("#botaoExibir").find('div').addClass('active')
  551.                             });
  552.                             jQuery(document).ready(function(){
  553.                                 jQuery("div#menuPopulate").slideUp();
  554.                                 jQuery("#botaoExibir").find('div').removeClass('active')
  555.                             });
  556.                             infowindow.setContent(this.html);
  557.                             infowindow.open(map, this);
  558.                         });            
  559.                         google.maps.event.addListener(map, 'click', function(){
  560.                             jQuery(document).ready(function(){
  561.                                 jQuery("div#form-oculto").slideUp();
  562.                                 jQuery("#botaoExibir").find('div').removeClass('active')
  563.                             });
  564.                             jQuery(document).ready(function(){
  565.                                 jQuery("div#menuPopulate").slideDown();
  566.                                 jQuery("#botaoExibir").find('div').addClass('active')
  567.                             });
  568.    
  569.                         });
  570.                     }  
  571.                 }
  572.             }
  573.             google.maps.event.addDomListener(window, 'load', initialize);
  574.         </script>
  575.         <script>
  576.             $(function() {
  577.                 var availableTags = [
  578.                     <?php  
  579.                         //I will not comment all the code again, this is just a function that does the jQuery auto complete
  580.                         $icao = $_POST['icao'];    
  581.                         $query = "SELECT DISTINCT depicao FROM `phpvms_pireps`";
  582.                         $query = mysql_query($query);              
  583.                         while($dados = mysql_fetch_assoc($query)){ 
  584.                             echo '"'.$dados['depicao'].'",';                   
  585.                         }
  586.                     ?>    
  587.                 ];    
  588.                 $( "#tags" ).autocomplete({
  589.                     source: availableTags
  590.                 });
  591.             });
  592.         </script>
  593. </body>
  594. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement