Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Dataroute Module v1.0
- * By Levi Costa [levicosta201]
- * http://code.voemercosul.com/
- * levicosta201 on phpVMS forums
- * Keep the credits! It's cool
- */
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
- <meta charset="utf-8">
- <title>Data Routes</title>
- <style>
- @charset"utf-8";
- html, body {
- height: 100%;
- margin: 0;
- padding: 0;
- background-color: #000;
- color: #000;
- font-size: 14px
- }
- p {
- color: #FFF;
- font-family: Arial, Helvetica, sans-serif;
- line-height: 20px;
- text-align: justify;
- margin-left: 75px;
- text-shadow: 5px 5px 5px#000000
- }
- p.um {
- font-size: 14px
- }
- p.dois {
- font-size: 18px
- }
- p.tres {
- font-size: 28px
- }
- #map-canvas {
- height: 100%;
- position: relative
- }
- @media print {
- html, body {
- height: auto;
- background-color: #000;
- color: #FFF
- }
- #map-canvas, #map-canvas {
- height: 100%;
- position: relative
- }
- }
- #form-oculto, #form-ocultoFade {
- font-family: "Arial Black", Gadget, sans-serif;
- color: #FFF;
- width: 40%;
- height: 100%;
- alignment-adjust: central;
- margin-left: 30%;
- margin-right: 10%;
- margin-top: 0;
- z-index: 30;
- position: absolute;
- background-color: rgba(0,0,0,0.7);
- background: rgba(0,0,0,0.7);
- position: absolute;
- z-index: 60;
- overflow: auto;
- }
- #menuPopulate {
- margin-top: 30px;
- font-family: "Arial Black", Gadget, sans-serif;
- color: #000;
- width: 30%;
- height: 3.5%;
- alignment-adjust: central;
- margin-right: 0;
- margin-left: 35%;
- z-index: 60;
- position: absolute;
- background-color: rgba(0,0,0,0.7);
- background: rgba(0,0,0,0.7) @font-face {
- font-family: "Segoe UI";
- src: url("Segoe.eot?") format("eot"), url("Segoe.woff") format("woff"), url("Segoe.ttf") format("truetype");
- }
- text-shadow: 1px 1px 3px #FFF;
- font-size: 20px;
- }
- div.active, div.activeFade {
- cursor: pointer;
- text-align: center;
- width: 100%;
- height: 15%;
- alignment-adjust: central;
- margin-left: 3%;
- z-index: 30;
- position: absolute
- }
- #aircraft {
- -webkit-border-radius: 60px 60px 60px 60px;
- border-radius: 60px 60px 60px 60px
- }
- #cssmenu {
- position: relative;
- height: 44px;
- background: #d1d1d1;
- width: auto;
- -webkit-box-shadow: 0 6px 30px 5px #000;
- box-shadow: 0 6px 25px 5px #000;
- }
- #cssmenu ul {
- list-style: none;
- padding: 0;
- margin: 0;
- line-height: 1
- }
- #cssmenu>ul {
- position: relative;
- display: block;
- background: #d1d1d1;
- height: 32px;
- width: 100%;
- z-index: 500
- }
- #cssmenu>ul>li {
- display: block;
- position: relative;
- float: left;
- margin: 0;
- padding: 0
- }
- #cssmenu>ul>#menu-button {
- display: none
- }
- #cssmenu ul li a {
- display: block;
- font-family: Helvetica, sans-serif;
- text-decoration: none
- }
- #cssmenu>ul>li>a {
- font-size: 14px;
- font-weight: bold;
- padding: 15px 20px;
- color: #7a8189;
- text-transform: uppercase;
- -webkit-transition: color 0.25s ease-out;
- -moz-transition: color 0.25s ease-out;
- -ms-transition: color 0.25s ease-out;
- -o-transition: color 0.25s ease-out;
- transition: color 0.25s ease-out
- }
- #cssmenu>ul>li.has-sub>a {
- padding-right: 32px
- }
- #cssmenu>ul>li:hover>a {
- color: #ffffff
- }
- #cssmenu li.has-sub::after {
- display: block;
- content: '';
- position: absolute;
- width: 0;
- height: 0
- }
- #cssmenu>ul>li.has-sub::after {
- right: 10px;
- top: 20px;
- border: 5px solid transparent;
- border-top-color: #7a8189
- }
- #cssmenu>ul>li:hover::after {
- border-top-color: #ffffff
- }
- #indicatorContainer {
- position: absolute;
- height: 12px;
- width: 100%;
- bottom: 0px;
- overflow: hidden;
- z-index: -1
- }
- #pIndicator {
- position: absolute;
- height: 0;
- width: 100%;
- border: 12px solid transparent;
- border-top-color: #2b2f3a;
- z-index: -2;
- -webkit-transition: left.25s ease;
- -moz-transition: left.25s ease;
- -ms-transition: left.25s ease;
- -o-transition: left.25s ease;
- transition: left.25s ease
- }
- #cIndicator {
- position: absolute;
- height: 0;
- width: 100%;
- border: 12px solid transparent;
- border-top-color: #2b2f3a;
- top: -12px;
- right: 100%;
- z-index: -2
- }
- #cssmenu ul ul {
- position: absolute;
- left: -9999px;
- top: 70px;
- opacity: 0;
- -webkit-transition: opacity.3s ease, top.25s ease;
- -moz-transition: opacity.3s ease, top.25s ease;
- -ms-transition: opacity.3s ease, top.25s ease;
- -o-transition: opacity.3s ease, top.25s ease;
- transition: opacity.3s ease, top.25s ease;
- z-index: 1000
- }
- #cssmenu ul ul ul {
- top: 37px;
- padding-left: 5px
- }
- #cssmenu ul ul li {
- position: relative
- }
- #cssmenu>ul>li:hover>ul {
- left: auto;
- top: 44px;
- opacity: 1
- }
- #cssmenu ul ul li:hover>ul {
- left: 170px;
- top: 0;
- opacity: 1
- }
- #cssmenu ul ul li a {
- width: 130px;
- border-bottom: 1px solid#eee;
- padding: 10px 20px;
- font-size: 12px;
- color: #9ea2a5;
- background: #fff;
- -webkit-transition: all.35s ease;
- -moz-transition: all.35s ease;
- -ms-transition: all.35s ease;
- -o-transition: all.35s ease;
- transition: all.35s ease
- }
- #cssmenu ul ul li:hover>a {
- background: #f6f6f6;
- color: #8c9195
- }
- #cssmenu ul ul li:last-child>a, #cssmenu ul ul li.last>a {
- border-bottom: 0
- }
- .submenuArrow {
- border: 6px solid transparent;
- width: 0;
- height: 0;
- border-bottom-color: #fff;
- position: absolute;
- top: -12px
- }
- #cssmenu ul ul li.has-sub::after {
- border: 4px solid transparent;
- border-left-color: #9ea2a5;
- right: 10px;
- top: 12px;
- -moz-transition: all.2s ease;
- -ms-transition: all.2s ease;
- -o-transition: all.2s ease;
- transition: all.2s ease;
- -webkit-transition: -webkit-transform 0.2s ease, right 0.2s ease
- }
- #cssmenu ul ul li.has-sub:hover::after {
- border-left-color: #fff;
- right: -5px;
- -webkit-transform: rotateY(180deg);
- -ms-transform: rotateY(180deg);
- -moz-transform: rotateY(180deg);
- -o-transform: rotateY(180deg);
- transform: rotateY(180deg)
- }
- @media all and(max-width:800px),
- only screen and(-webkit-min-device-pixel-ratio:2)and(max-width:1024px),
- only screen and(min--moz-device-pixel-ratio:2)and(max-width:1024px),
- only screen and(-o-min-device-pixel-ratio:2/1)and(max-width:1024px),
- only screen and(min-device-pixel-ratio:2)and(max-width:1024px),
- only screen and(min-resolution:192dpi)and(max-width:1024px),
- only screen and(min-resolution:2dppx)and(max-width:1024px) {
- #cssmenu {
- width:auto
- }
- #cssmenu ul {
- width:auto
- }
- #cssmenu.submenuArrow, #cssmenu#indicatorContainer {
- display:none
- }
- #cssmenu>ul {
- height:auto;
- display:block
- }
- #cssmenu>ul>li {
- float:none
- }
- #cssmenu li, #cssmenu>ul>li {
- display:none
- }
- #cssmenu ul ul, #cssmenu ul ul ul, #cssmenu ul>li:hover>ul, #cssmenu ul ul>li:hover>ul {
- position:relative;
- left:auto;
- top:auto;
- opacity:1;
- padding-left:0
- }
- #cssmenu ul.has-sub::after {
- display:none
- }
- #cssmenu ul li a {
- padding:12px 20px
- }
- #cssmenu ul ul li a {
- border:0;
- background:none;
- width:auto;
- padding:8px 35px
- }
- #cssmenu ul ul li:hover>a {
- background:none;
- color:#8c9195
- }
- #cssmenu ul ul ul a {
- padding:8px 50px
- }
- #cssmenu ul ul ul ul a {
- padding:8px 65px
- }
- #cssmenu ul ul ul ul ul a {
- padding:8px 80px
- }
- #cssmenu ul ul ul ul ul ul a {
- padding:8px 95px
- }
- #cssmenu>ul>#menu-button {
- display:block;
- cursor:pointer
- }
- #cssmenu#menu-button>a {
- padding:14px 20px
- }
- #cssmenu ul.open li, #cssmenu>ul.open>li {
- display:block
- }
- #cssmenu>ul.open>li#menu-button>a {
- color:#fff;
- border-bottom:1px solid rgba(150,150,150,0.1)
- }
- #cssmenu#menu-button::after {
- display:block;
- content:'';
- position:absolute;
- height:3px;
- width:22px;
- border-top:2px solid#7a8189;
- border-bottom:2px solid#7a8189;
- right:20px;
- top:15px
- }
- #cssmenu#menu-button::before {
- display:block;
- content:'';
- position:absolute;
- height:3px;
- width:22px;
- border-top:2px solid#7a8189;
- right:20px;
- top:25px
- }
- #cssmenu ul.open#menu-button::after, #cssmenu ul.open#menu-button::before {
- border-color:#fff
- }
- }
- </style>
- <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
- <script src='http://code.jquery.com/jquery.min.js' type='text/javascript'></script>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
- <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=geometry"></script>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
- <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
- <script src="//code.jquery.com/jquery-1.10.2.js"></script>
- <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
- </head>
- <body>
- <div class="mapcenter"align="center">
- <div id="menuPopulate"style="display:none;">
- <div id='cssmenu'>
- <ul>
- <?php Template::Show('core_navigation.tpl');?>
- </ul>
- </div>
- <br/>
- <form action="" name="search" method="post">
- <div class="ui-widget">
- <label for="tags">Flights From: </label>
- <input id="tags" name="icao">
- </div>
- <input type="submit" value="Search" />
- </form>
- </div>
- </div>
- <div id="form-oculto"style="display: none;">
- <?php
- //We will receive POST airport ICAO
- $icao = $_POST['icao'];
- //This query returns the departure airport, we will use the DISTINCT lest more of an equal airport
- $query = "SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'";
- //I wrote the query twice, but it is unnecessary, you can substitute the variable $query
- $q = mysql_query("SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'");
- //Gets the number of rows in result
- $c = mysql_num_rows($q);
- $d = $c;
- echo '<br/><br/>';
- echo ''.$d.' Flight from '.$icao.'';
- echo '<br/><br/>';
- //Run the query again
- $query = mysql_query($query);
- //We create a loop to separate the query
- while($dados = mysql_fetch_assoc($query)){
- //Now we split the query into the variable $dados and took the value *arricao*
- $data = $dados['arricao'];
- //This table has data from all airports in the world, it can be found here in the forum
- $latsql = "SELECT DISTINCT * FROM aeroportos_tw WHERE gps_code = '$data'";
- //Run the query
- $latQuery = mysql_query($latsql);
- $i=1;
- //We create a loop to get the name and aeroprto code that is in the database
- while($res = mysql_fetch_assoc($latQuery)){
- //echo '["'.$res['name'].'", '.$res['latitude_deg'].', '.$res['longitude_deg'].', '.$i++.', "'.$res['gps_code'].'"],';
- echo $res['name'].' ('.$res['gps_code'].')';
- echo '<br/><br/>';
- }
- }
- ?>
- </div>
- </div>
- <div id="map-canvas"></div>
- </div>
- <script type="text/javascript">
- var infowindow = null;
- //This is a javascript function that informs the start of the page and map
- function initialize(){
- jQuery(document).ready(function(){
- jQuery("div#menuPopulate").slideDown();
- jQuery("#botaoExibir").find('div').addClass('active')
- });
- var mapOptions = {
- zoom: 3,
- center: new google.maps.LatLng(0, -180),
- mapTypeId: google.maps.MapTypeId.TERRAIN
- };
- var map = new google.maps.Map(document.getElementById('map-canvas'),
- mapOptions);
- var flightPlanCoordinates = [
- <?php
- $icao = $_POST['icao'];
- $query = "SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'";
- $q = mysql_query("SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'");
- $c = mysql_num_rows($q);
- $query = mysql_query($query);
- while($dados = mysql_fetch_assoc($query)){
- $data = $dados['arricao'];
- $latsql = "SELECT DISTINCT latitude_deg, longitude_deg FROM aeroportos_tw WHERE gps_code = '$data'";
- $latQuery = mysql_query($latsql);
- while($res = mysql_fetch_assoc($latQuery)){
- echo 'new google.maps.LatLng('.$res['latitude_deg'].', '.$res['longitude_deg'].'), ';
- }
- if(isset($icao)){
- $latsql2 = "SELECT DISTINCT * FROM aeroportos_tw WHERE gps_code = '$icao'";
- $latQuery2 = mysql_query($latsql2);
- $i2=1;
- while($res2 = mysql_fetch_assoc($latQuery2)){
- echo 'new google.maps.LatLng('.$res2['latitude_deg'].', '.$res2['longitude_deg'].'), ';
- }
- }
- }
- ?>
- ];
- var flightPath = new google.maps.Polyline({
- path: flightPlanCoordinates,
- geodesic: true,
- strokeColor: '#FF0000',
- strokeOpacity: 0.7,
- strokeWeight: 1
- });
- flightPath.setMap(map);
- setMarkers(map, markersdat);
- infowindow = new google.maps.InfoWindow({
- content: "loading..."
- });
- var bikeLayer = new google.maps.BicyclingLayer();
- bikeLayer.setMap(map);
- }
- var markersdat = [
- <?php
- //Here there is no need to comment on the code again
- $icao = $_POST['icao'];
- $query = "SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'";
- $q = mysql_query("SELECT DISTINCT arricao FROM `phpvms_pireps` WHERE depicao = '$icao'");
- $c = mysql_num_rows($q);
- $query = mysql_query($query);
- while($dados = mysql_fetch_assoc($query)){
- $data = $dados['arricao'];
- $latsql = "SELECT DISTINCT * FROM aeroportos_tw WHERE gps_code = '$data'";
- $latQuery = mysql_query($latsql);
- $i=1;
- while($res = mysql_fetch_assoc($latQuery)){
- echo '["'.$res['name'].'", '.$res['latitude_deg'].', '.$res['longitude_deg'].', '.$i++.', "'.$res['gps_code'].'"],';
- }
- if(isset($icao)){
- $latsql2 = "SELECT DISTINCT * FROM aeroportos_tw WHERE gps_code = '$icao'";
- $latQuery2 = mysql_query($latsql2);
- $i2=1;
- while($res2 = mysql_fetch_assoc($latQuery2)){
- echo '["'.$res2['name'].'", '.$res2['latitude_deg'].', '.$res2['longitude_deg'].', '.$i2++.', "'.$res2['gps_code'].'"],';
- }
- }
- }
- ?>
- ];
- function setMarkers(map, markers) {
- if(markers.length > 1){
- for (var i = 0; i < markers.length; i++){
- var data = markers[i];
- var siteLatLng = new google.maps.LatLng(data[1], data[2]);
- var marker = new google.maps.Marker({
- position: siteLatLng,
- map: map,
- title: data[4],
- zIndex: data[3],
- html: data[3]
- });
- var contentString = "Some content";
- google.maps.event.addListener(marker, "click", function (){
- jQuery(document).ready(function(){
- jQuery("div#form-oculto").slideDown();
- jQuery("#botaoExibir").find('div').addClass('active')
- });
- jQuery(document).ready(function(){
- jQuery("div#menuPopulate").slideUp();
- jQuery("#botaoExibir").find('div').removeClass('active')
- });
- infowindow.setContent(this.html);
- infowindow.open(map, this);
- });
- google.maps.event.addListener(map, 'click', function(){
- jQuery(document).ready(function(){
- jQuery("div#form-oculto").slideUp();
- jQuery("#botaoExibir").find('div').removeClass('active')
- });
- jQuery(document).ready(function(){
- jQuery("div#menuPopulate").slideDown();
- jQuery("#botaoExibir").find('div').addClass('active')
- });
- });
- }
- }
- }
- google.maps.event.addDomListener(window, 'load', initialize);
- </script>
- <script>
- $(function() {
- var availableTags = [
- <?php
- //I will not comment all the code again, this is just a function that does the jQuery auto complete
- $icao = $_POST['icao'];
- $query = "SELECT DISTINCT depicao FROM `phpvms_pireps`";
- $query = mysql_query($query);
- while($dados = mysql_fetch_assoc($query)){
- echo '"'.$dados['depicao'].'",';
- }
- ?>
- ];
- $( "#tags" ).autocomplete({
- source: availableTags
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement