Jump to content

% complete flight


fsx

Recommended Posts

In the CSS example I gave the link to, it suggests using a defined list container, like so:

<dd>
<span><em style="left:100px">50%</em></span>
</dd>

That would place a static value of 50% for the progress bar. To have it update dynamically with the real value from the percent of the flight left you simply need to use the

<%=flight.percomplete%>

Like so:

<dd>
<span><em style="left:<%=flight.percomplete%>px"><%=flight.percomplete%></em></span>
</dd>

There are simpler ways, and I prefer using divs instead of defined lists. The left px value will be the percentage, and then the text shown in the span will show the percentage too. As well as using CSS, there is js available too. For my progress bar, it is pure CSS though.

Stuart, I have tried using that one but you need to have 2x the % in the <em style="left:<%=flight.percomplete%>px">. So if the flight was 50% completed, the px would have to be 100px.SO to use that one, you would have to add

$multiply = 2;
$total = '.percomplete.';
$totalpx = $total * ($multiply); 

into acars.php then use

<dd>
       <span><em style="left:<%=flight.totalpx%>px"><%=flight.percomplete%></em></span>
</dd>

EDIT: Ok ignore my post, Stuart just changed his

Edited by James142
Link to comment
Share on other sites

<div class="progress-container">      	
<div style="<%=flight.percomplete%>%"><%=flight.percomplete%>%</div>
</div>

That should put the number in the bar.

That is correct, but its was not what I had in mind, because it puts the bar straight away to the end :lol:

Regards,

Cor

Link to comment
Share on other sites

EDIT: Forget that, I think I ballsed the code up. For a really quick and easy way to get a progress bar that looks good, and is easy to modify:

http://blog.leetsoft.com/2006/8/22/super-simple-css-bars

I got all of that, but the bar doesn't show up on Firefox. Only on IE. The % shows on FF, just not the bar. is there something I missed?

  • Like 1
Link to comment
Share on other sites

Daniel,

It is working now. Thank you for your help.

@Jeff, this is the code I have in the Acars.tpl and it works in IE and firefox.

<script type="text/html" id="acars_map_row">

<tr bgcolor=#FFFFFF class="<%=flight.trclass%>">

<td><a href="<?php echo url('/profile/view');?>/<%=flight.pilotid%>"><%=flight.pilotid%> - <%=flight.pilotname%></a></td>

<td><%=flight.flightnum%></td>

<td><%=flight.depicao%></td>

<td><%=flight.arricao%></td>

<td><%=flight.phasedetail%></td>

<td><%=flight.alt%></td>

<td><%=flight.gs%></td>

<td><%=flight.distremaining%> <?php echo Config::Get('UNITS');?> / <%=flight.timeremaining%></td>

<td><div class="progress-container">

<div style="width: <%=flight.percomplete%>%"><%=flight.percomplete%>%</div>

</div>

</td>

</tr>

</script>

Hope this will help.

Regards,

Cor

Link to comment
Share on other sites

  • 2 weeks later...

I have two problems with the progress indicator:

1. 0% is not in the left side of the bar - see image

2. how can I make the % to be vertically centered?

LE

1. is solved partially, I used in the template <center> and this moved it. Now the bar starts from the left, but the % value is also moved to the left.

2. still an issue.

post-163-021080300 1310391385_thumb.png

Link to comment
Share on other sites

I have two problems with the progress indicator:

1. 0% is not in the left side of the bar - see image

2. how can I make the % to be vertically centered?

LE

1. is solved partially, I used in the template <center> and this moved it. Now the bar starts from the left, but the % value is also moved to the left.

2. still an issue.

Instead of using <center> you could use .css. so:

in your style.css file

.example { padding-bottom: 4px;
                       	font-size:10px } 

then this in your acars_map.tpl

<div class="example"> YOUR PRECENTAGE CODE HERE</div>

In my opinion this works for me better but you will have to edit the padding etc to work with your site.

Link to comment
Share on other sites

hmm i think i do something wrong,

i see on my acars page the percentage. but no image.

this code are on the acars page:

<div class="example style="width: <%=flight.percomplete%>%"><%=flight.percomplete%>%</div>

in my css file are:

.example { padding-bottom: 4px;

font-size:10px }

does anyone know what im doing wrong.

Link to comment
Share on other sites

Instead of using <center> you could use .css. so:

in your style.css file

.example { padding-bottom: 4px;
                       	font-size:10px } 

then this in your acars_map.tpl

<div class="example"> YOUR PRECENTAGE CODE HERE</div>

In my opinion this works for me better but you will have to edit the padding etc to work with your site.

Thanks, I'll give it a try.

hmm i think i do something wrong,

i see on my acars page the percentage. but no image.

this code are on the acars page:

<div class="example style="width: <%=flight.percomplete%>%"><%=flight.percomplete%>%</div>

in my css file are:

.example { padding-bottom: 4px;

font-size:10px }

does anyone know what im doing wrong.

This is the end of my CSS file

div.progress-container {
 border: 1px solid #ccc; 
 width: 100px; 
 margin: 2px 5px 2px 0; 
 padding: 1px; 
 float: center; 
 background: white;
}

div.progress-container > div {
 background-color: #0FF; 
 height: 20px;
 vertical-align:middle;
}

I hope it helps.

Link to comment
Share on other sites

Thanks, I'll give it a try.

This is the end of my CSS file

div.progress-container {
 border: 1px solid #ccc; 
 width: 100px; 
 margin: 2px 5px 2px 0; 
 padding: 1px; 
 float: center; 
 background: white;
}

div.progress-container > div {
 background-color: #0FF; 
 height: 20px;
 vertical-align:middle;
}

I hope it helps.

thank you! it works now fine!!

Link to comment
Share on other sites

but does someone know how it comes that a pilot are on the gate. but he says its just 87% flown? and not 100%?

The distance is calculated on the distance between latitude and longitude coordinates of the destination and arrival airports. If the gate is some distance away from the coordinate given, then the % shown will be inaccurate. For example, when I fly to Charles De Gaul, the gate I was allocated was some distance from the coordinates for the centre of the airport, and it showed 98% completed.

How long was the flight in question, in nautical miles?

Link to comment
Share on other sites

oke thank you stuard, i cant find the information how long the flight was..?

but i see on my acars page, that the progress bar are always on 100%... also when i just have completed 38% of my flights.

see attachment.

i use this code:

<div class="progress-container">

<div style="width: <%=flight.percomplete%>%"><%=flight.percomplete%>%</div>

</div>

post-2172-086751800 1310550776_thumb.jpg

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

Hi all,

After alot of messing around with code last night I have managed to get this working with the coloured bar.

here is my code hope it helps someone else.

This goes in your ACARS.php file

<?php
/**
* phpVMS - Virtual Airline Administration Software
* Copyright (c) 2008 Nabeel Shahzad
* For more information, visit www.phpvms.net
*      Forums: http://www.phpvms.net/forum
*      Documentation: http://www.phpvms.net/docs
*
* phpVMS is licenced under the following license:
*   Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
*   View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/
*
* @author Nabeel Shahzad
* @copyright Copyright (c) 2008, Nabeel Shahzad
* @link http://www.phpvms.net
* @license http://creativecommons.org/licenses/by-nc-sa/3.0/
*/

class ACARS extends CodonModule
{
       public $title = 'ACARS';
       public $acarsflights;

       public function index()
       {
               $this->viewmap();

       }

       public function viewmap()
       {
               $this->title = 'ACARS Map';
               $this->set('acarsdata', ACARSData::GetACARSData());
               $this->render('acarsmap.tpl');

       }

       /**
        *  We didn't list a function for each ACARS client,
        *      so call this, which will include the acars peice in
        */
       public function __call($name, $args)
       {
               $acars_action = $args[0];

               // clean the name...
               $name = preg_replace("/[^a-z0-9-]/", "", strtolower($name));
               if(dirname(__FILE__).DS.$name.'.php')
               {
                       include_once dirname(__FILE__).DS.$name.'.php';
                       return;
               }
       }

       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
                       {
                               $flight->route_details = NavData::parseRoute($flight->route);
                       }

                       $c = (array) $flight; // Convert the object to an array

                       $c['pilotid'] = PilotData::GetPilotCode($c['code'], $c['pilotid']);
					$totaldistance = round(SchedulesData::distanceBetweenPoints($flight->deplat, $flight->deplng, $flight->arrlat, $flight->arrlng));
$percomplete = ABS(number_format(((($totaldistance - $flight->distremain) / $totaldistance) * 100), 2));
$c['percomplete'] = $percomplete;

                       $totaldistance = round(SchedulesData::distanceBetweenPoints($flight->deplat, $flight->deplng, $flight->arrlat, $flight->arrlng));
$percomplete = ABS(number_format(((($totaldistance - $flight->distremain) / $totaldistance) * 100), 2));
$c['percomplete'] = $percomplete;

                       // Normalize the data
                       if($c['timeremaining'] == '')
                       {
                               $c['timeremaining'] ==  '-';
                       }

                       if(trim($c['phasedetail']) == '')
                       {
                               $c['phasedetail'] = 'Enroute';
                       }

                       /* If no heading was passed via ACARS app then calculate it
                               This should probably move to inside the ACARSData function, so then
                                the heading is always there for no matter what the calcuation is
                               */
                       if($flight->heading == '')
                       {
                               /* Calculate an angle based on current coords and the
                                       destination coordinates */

                               $flight->heading = intval(atan2(($flight->lat - $flight->arrlat), ($flight->lng - $flight->arrlng)) * 180 / 3.14);
                               //$flight->heading *= intval(180/3.14159);

                               if(($flight->lng - $flight->arrlng) < 0)
                               {
                                       $flight->heading += 180;
                               }

                               if($flight->heading < 0)
                               {
                                       $flight->heading += 360;
                               }
                       }

                       // Little one-off fixes to normalize data
                       $c['distremaining'] = $c['distremain'];
                       $c['pilotname'] = $c['firstname'] . ' ' . $c['lastname'];

                       unset($c['messagelog']);

                       $this->acarsflights[] = $c;

                       continue;
               }

               CodonEvent::Dispatch('refresh_acars', 'ACARS');

               echo json_encode($this->acarsflights);
       }

       public function routeinfo()
       {               
               if($this->get->depicao == '' || $this->get->arricao == '')
                       return;

               $depinfo = OperationsData::GetAirportInfo($this->get->depicao);
               if(!$depinfo)
               {
                       $depinfo = OperationsData::RetrieveAirportInfo($this->get->depicao);
               }

               $arrinfo = OperationsData::GetAirportInfo($this->get->arricao);
               if(!$arrinfo)
               {
                       $arrinfo = OperationsData::RetrieveAirportInfo($this->get->arricao);
               }

               // Convert to json format
               $c = array();
               $c['depapt'] = (array) $depinfo;
               $c['arrapt'] = (array) $arrinfo;

               echo json_encode($c);
       }

       public function fsacarsconfig()
       {
               $this->write_config('fsacars_config.tpl', Auth::$userinfo->code.'.ini');
       }

       public function fspaxconfig()
       {
               $this->write_config('fspax_config.tpl', Auth::$userinfo->code.'_config.cfg');
       }

       public function xacarsconfig()
       {
               $this->write_config('xacars_config.tpl', 'xacars.ini');
       }

       /**
        * Write out a config file to the user, give the template name and
        *      the filename to save the template as to the user
        *
        * @param mixed $template_name Template to use for config (fspax_config.tpl)
        * @param mixed $save_as File to save as (xacars.ini)
        * @return mixed Nothing, sends the file to the user
        *
        */
       public function write_config($template_name, $save_as)
       {
               if(!Auth::LoggedIn())
               {
                       echo 'You are not logged in!';
                       break;
               }

               $this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid));
               $this->set('userinfo', Auth::$userinfo);

               $acars_config = Template::GetTemplate($template_name, true);
               $acars_config = str_replace("\n", "\r\n", $acars_config);

               Util::downloadFile($acars_config, $save_as);
	}
}

Then in your acarsmap.tpl file should look like this.

<?php 
/**
* These are some options for the ACARS map, you can change here
* 
* By default, the zoom level and center are ignored, and the map 
* will try to fit the all the flights in. If you want to manually set
* the zoom level and center, set "autozoom" to false.
* 
* You can use these MapTypeId's:
* http://code.google.com/apis/maps/documentation/v3/reference.html#MapTypeId
* 
* Change the "TERRAIN" to the "Constant" listed there - they are case-sensitive
* 
* Also, how to style the acars pilot list table. You can use these style selectors:
* 
* table.acarsmap { }
* table.acarsmap thead { }
* table.acarsmap tbody { }
* table.acarsmap tbody tr.even { }
* table.acarsmap tbody tr.odd { } 
*/
?>
<script type="text/javascript">
<?php 
/* These are the settings for the Google map. You can see the
Google API reference if you want to add more options.

There's two options I've added:

autozoom: This will automatically center in on/zoom 
  so all your current flights are visible. If false,
  then the zoom and center you specify will be used instead

refreshTime: Time, in seconds * 1000 to refresh the map.
  The default is 10000 (10 seconds)
*/
?>
var acars_map_defaults = {
autozoom: true,
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.TERRAIN,
   refreshTime: 10000
};
</script>
<div class="mapcenter" align="center">
<div id="acarsmap" style="width:<?php echo  Config::Get('MAP_WIDTH');?>; height: <?php echo Config::Get('MAP_HEIGHT')?>"></div>
</div>
<?php
/* See below for details and columns you can use in this table */
?>
</div>
<table border = "0" width="100%" class="acarsmap">
<thead>
<tr>
	<td><b>Pilot</b></td>
	<td><b>Flight Number</b></td>
	<td><b>Departure</b></td>
	<td><b>Arrival</b></td>
	<td><b>Status</b></td>
	<td><b>Altitude</b></td>
	<td><b>Speed</b></td>
	<td><b>Distance/Time Remain</b></td>
       <td><b>Percent Complete</b></td>
</tr>
</thead>
<tbody id="pilotlist"></tbody>
</table>
<script type="text/javascript" src="<?php echo fileurl('/lib/js/acarsmap.js');?>"></script>
<?php
/* This is the template which is used in the table above, for each row. 
Be careful modifying it. You can simply add/remove columns, combine 
columns too. Keep each "section" (<%=...%>) intact

Variables you can use (what they are is pretty obvious)

Variable:							Notes:
<%=flight.pilotid%>
<%=flight.firstname%>
<%=flight.lastname%>
<%=flight.pilotname%>				First and last combined
<%=flight.flightnum%>
<%=flight.depapt%>					Gives the airport name
<%=flight.depicao%>
<%=flight.arrapt%>					Gives the airport name
<%=flight.arricao%>
<%=flight.phasedetail%>
<%=flight.heading%>
<%=flight.alt%>
<%=flight.gs%>
<%=flight.disremaining%>
<%=flight.timeremaning%>
<%=flight.aircraft%>				Gives the registration
<%=flight.aircraftname%>			Gives the full name
<%=flight.client%>					FSACARS/Xacars/FSFK, etc
<%=flight.trclass%>					"even" or "odd"
   <%=flight.percomplete%>

You can also use logic in the templating, if you so choose:
http://ejohn.org/blog/javascript-micro-templating/
*/
?>
<script type="text/html" id="acars_map_row">
<tr class="<%=flight.trclass%>">
<td><a href="<?php echo url('/profile/view');?>/<%=flight.pilotid%>"><%=flight.pilotid%> - <%=flight.pilotname%></a></td>
<td><%=flight.flightnum%></td>
<td><%=flight.depicao%></td>
<td><%=flight.arricao%></td>
<td><%=flight.phasedetail%></td>
<td><%=flight.alt%></td>
<td><%=flight.gs%></td>
<td><%=flight.distremaining%> <?php echo Config::Get('UNITS');?> / <%=flight.timeremaining%></td>
<td><div class="progress-container">

<div style="width: <%=flight.percomplete%>%"><%=flight.percomplete%>%</div>

</div>

</td>
</tr>
</script>

<?php
/*	This is the template for the little map bubble which pops up when you click on a flight
Same principle as above, keep the <%=...%> tags intact. The same variables are available
to use here as are available above.
*/
?>
<script type="text/html" id="acars_map_bubble">
<span style="font-size: 10px; text-align:left; width: 100%" align="left">
<a href="<?php echo url('/profile/view');?>/<%=flight.pilotid%>"><%=flight.pilotid%> - <%=flight.pilotname%></a><br />
<strong>Flight <%=flight.flightnum%></strong> (<%=flight.depicao%> to <%=flight.arricao%>)<br />
<strong>Status: </strong><%=flight.phasedetail%><br />
<strong>Dist/Time Remain: </strong><%=flight.distremaining%> <?php echo Config::Get('UNITS');?> / <%=flight.timeremaining%><br />
</span>
</script>

<?php
/*	This is a small template for information about a navpoint popup 

Variables available:

<%=nav.title%>
<%=nav.name%>
<%=nav.freq%>
<%=nav.lat%>
<%=nav.lng%>
<%=nav.type%>	2=NDB 3=VOR 4=DME 5=FIX 6=TRACK
*/
?>
<script type="text/html" id="navpoint_bubble">
<span style="font-size: 10px; text-align:left; width: 100%" align="left">
<strong>Name: </strong><%=nav.title%> (<%=nav.name%>)<br />
<strong>Type: </strong>
<?php	/* Show the type of point */ ?>
<% if(nav.type == 2) { %> NDB <% } %>
<% if(nav.type == 3) { %> VOR <% } %>
<% if(nav.type == 4) { %> DME <% } %>
<% if(nav.type == 5) { %> FIX <% } %>
<% if(nav.type == 6) { %> TRACK <% } %>
<br />
<?php	/* Only show frequency if it's not a 0*/ ?>
<% if(nav.freq != 0) { %>
<strong>Frequency: </strong><%=nav.freq%>
<% } %>
</span>
</script>

Then in your default.css file add this to the end of the file.

div.progress-container {
 border: 1px solid #000000; 
 width: 150px; 
 margin: 0px 0px 0px 0px; 
 padding: 1px; 
 float: middle; 
 background: #F6358A;
}

div.progress-container > div {
 background-color: #6698FF; 
 height: 25px;
 vertical-align:right;
}

This is how I display it all on my frontpage.tpl

<?php 
/**
* These are some options for the ACARS map, you can change here
* 
* By default, the zoom level and center are ignored, and the map 
* will try to fit the all the flights in. If you want to manually set
* the zoom level and center, set "autozoom" to false.
* 
* You can use these MapTypeId's:
* http://code.google.com/apis/maps/documentation/v3/reference.html#MapTypeId
* 
* Change the "TERRAIN" to the "Constant" listed there - they are case-sensitive
* 
* Also, how to style the acars pilot list table. You can use these style selectors:
* 
* table.acarsmap { }
* table.acarsmap thead { }
* table.acarsmap tbody { }
* table.acarsmap tbody tr.even { }
* table.acarsmap tbody tr.odd { } 
*/
?>
<script type="text/javascript">
<?php 
/* These are the settings for the Google map. You can see the
Google API reference if you want to add more options.

There's two options I've added:

autozoom: This will automatically center in on/zoom 
  so all your current flights are visible. If false,
  then the zoom and center you specify will be used instead

refreshTime: Time, in seconds * 1000 to refresh the map.
  The default is 10000 (10 seconds)
*/
?>
var acars_map_defaults = {
autozoom: true,
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.TERRAIN,
   refreshTime: 10000
};
</script>
<div class="mapcenter" align="center">
<div id="acarsmap" style="width:<?php echo  Config::Get('MAP_WIDTH');?>; height: <?php echo Config::Get('MAP_HEIGHT')?>"></div>
</div>
<?php
/* See below for details and columns you can use in this table */
?>
</div>
<table border = "1" width="700" class="acarsmap">
<thead>
<tr>
	<td width="184"><b>Pilot</b></td>
	<td width="61"><b>Flight Number</b></td>
	<td width="76"><b>Departure</b></td>
	<td width="49"><b>Arrival</b></td>
	<td width="49"><b>Status</b></td>
	<td width="58"><b>Altitude</b></td>
	<td width="49"><b>Speed</b></td>
	<td width="112"><b>Distance/Time Remain</b></td>
       <td width="73"><b>Percent Complete</b></td>

</tr>
</thead>
<tbody id="pilotlist"></tbody>
</table>
<script type="text/javascript" src="<?php echo fileurl('/lib/js/acarsmap.js');?>"></script>
<?php
/* This is the template which is used in the table above, for each row. 
Be careful modifying it. You can simply add/remove columns, combine 
columns too. Keep each "section" (<%=...%>) intact

Variables you can use (what they are is pretty obvious)

Variable:							Notes:
<%=flight.pilotid%>
<%=flight.firstname%>
<%=flight.lastname%>
<%=flight.pilotname%>				First and last combined
<%=flight.flightnum%>
<%=flight.depapt%>					Gives the airport name
<%=flight.depicao%>
<%=flight.arrapt%>					Gives the airport name
<%=flight.arricao%>
<%=flight.phasedetail%>
<%=flight.heading%>
<%=flight.alt%>
<%=flight.gs%>
<%=flight.disremaining%>
<%=flight.timeremaning%>
<%=flight.aircraft%>				Gives the registration
<%=flight.aircraftname%>			Gives the full name
<%=flight.client%>					FSACARS/Xacars/FSFK, etc
<%=flight.trclass%>					"even" or "odd"
   <%=flight.percomplete%>

You can also use logic in the templating, if you so choose:
http://ejohn.org/blog/javascript-micro-templating/
*/
?>
<script type="text/html" id="acars_map_row">
<tr class="<%=flight.trclass%>">
<td><a href="<?php echo url('/profile/view');?>/<%=flight.pilotid%>"><%=flight.pilotid%> - <%=flight.pilotname%></a></td>
<td><%=flight.flightnum%></td>
<td><%=flight.depicao%></td>
<td><%=flight.arricao%></td>
<td><%=flight.phasedetail%></td>
<td><%=flight.alt%></td>
<td><%=flight.gs%></td>
<td><%=flight.distremaining%> <?php echo Config::Get('UNITS');?> / <%=flight.timeremaining%></td>
<td><div class="progress-container">

<div style="30: <%=flight.percomplete%>%"><%=flight.percomplete%>%</div>

</div>

</td>
</tr>
</script>

<?php
/*	This is the template for the little map bubble which pops up when you click on a flight
Same principle as above, keep the <%=...%> tags intact. The same variables are available
to use here as are available above.
*/
?>
<script type="text/html" id="acars_map_bubble">
<span style="font-size: 10px; text-align:left; width: 100%" align="left">
<a href="<?php echo url('/profile/view');?>/<%=flight.pilotid%>"><%=flight.pilotid%> - <%=flight.pilotname%></a><br />
<strong>Flight <%=flight.flightnum%></strong> (<%=flight.depicao%> to <%=flight.arricao%>)<br />
<strong>Status: </strong><%=flight.phasedetail%><br />
<strong>Dist/Time Remain: </strong><%=flight.distremaining%> <?php echo Config::Get('UNITS');?> / <%=flight.timeremaining%><br />
</span>
</script>

<?php
/*	This is a small template for information about a navpoint popup 

Variables available:

<%=nav.title%>
<%=nav.name%>
<%=nav.freq%>
<%=nav.lat%>
<%=nav.lng%>
<%=nav.type%>	2=NDB 3=VOR 4=DME 5=FIX 6=TRACK
*/
?>
<script type="text/html" id="navpoint_bubble">
<span style="font-size: 10px; text-align:left; width: 100%" align="left">
<strong>Name: </strong><%=nav.title%> (<%=nav.name%>)<br />
<strong>Type: </strong>
<?php	/* Show the type of point */ ?>
<% if(nav.type == 2) { %> NDB <% } %>
<% if(nav.type == 3) { %> VOR <% } %>
<% if(nav.type == 4) { %> DME <% } %>
<% if(nav.type == 5) { %> FIX <% } %>
<% if(nav.type == 6) { %> TRACK <% } %>
<br />
<?php	/* Only show frequency if it's not a 0*/ ?>
<% if(nav.freq != 0) { %>
<strong>Frequency: </strong><%=nav.freq%>
<% } %>
</span>
</script>

The only thing I am having a problem with is how to align the numbers in the progress bar and how to get the coloured bar to move with the progress of the flight any help would be great.

Thanks for the great code I in no way take credit for this I have just compiled all the code into one post.

credit should go to the original posters.

If I have got any of the code wrong please let me know.

Scott

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • 1 month later...

I did it like this

$totaldistance = round(SchedulesData::distanceBetweenPoints($flight->deplat, $flight->deplng, $flight->arrlat, $flight->arrlng));
$percomplete = ABS(number_format(((($totaldistance - $flight->distremain) / $totaldistance) * 100), 2));
$c['percomplete'] = $percomplete;

This will give you a nice number to work with.

where did place that?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...