Jump to content

Live Flight List


rpalmer800

Recommended Posts

Hi, Can somebody please help me out? I have been struggling with this for a while and cant figure it out. Below is the issue.

http://vdalairlines.com/index.php/ The en-route flights box doesnt seem to be working. Below is the code i used, if somebody could take a quick look and suggest a solution, that would be great. :)


<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"

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>
</tr>
</script>

Link to comment
Share on other sites

  • Administrators

You are missing the actual table from the script.

<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>
</tr>
</thead>
<tbody id="pilotlist"></tbody>
</table>

or if you do not want the headers for the table you could add

<table border = "0" width="100%" class="acarsmap>
<tbody id="pilotlist"></tbody>
</table>

Both go right before

<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"

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>
</tr>
</script>

Link to comment
Share on other sites

I ended up solving his problem - he wasn't missing the table, it was just not shown in the code he copied and pasted. I pulled the data from the database manually and date filtered it. I have attached the relevant code below:

<table border="0" width="100%" cellspacing="4" 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>Time Remaining</b></td>
  </tr>
  </thead>
  <tbody id="pilotlist">
<?
$q = "SELECT * FROM phpvms_acarsdata";
$l = DB::get_results($q);
foreach($l as $fl) {
  $lu = strtotime($fl->lastupdate);
  $min_u = strtotime(date("Y-m-d") - 900);
  if($lu > $min_u) {
  echo("<tr>");
  echo("<td>".$fl->pilotname."</td>");
  echo("<td>".$fl->flightnum."</td>");
  echo("<td>".$fl->depicao."</td>");
  echo("<td>".$fl->arricao."</td>");
  echo("<td>".$fl->phasedetail."</td>");
  echo("<td>".$fl->alt." feet</td>");
  echo("<td>".$fl->gs." knots</td>");
  echo("<td>".$fl->timeremaining."</td>");
  echo("</tr>");
  }
}
?>
  </tbody>
</table>

Link to comment
Share on other sites

  • 1 month later...

I have a similar problem and I'm struggling to find the issue. I have this for the popup bubble window...

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

   <div style="font-size: 9px; text-align: left; width: 100%; line-height: 15px;">

       <strong>Pilot In Command: </strong> <%=flight.pilotname%> <br />
       <strong>Callsign: </strong><%=flight.pilotid%> <br />
       <strong>Departure: </strong> <%=flight.depapt%> (<%=flight.depicao%>) <br />
       <strong>Arrival: </strong> <%=flight.arrapt%> (<%=flight.arricao%>) <br />
       <strong>Groundspeed: </strong> <%=flight.gs%> <br />
       <strong>Altitude: </strong> <%=flight.alt%> <br />
       <strong>Aircraft: </strong><%=flight.aircraftname%> <br />
       <strong>Status: </strong><%=flight.phasedetail%> <br />
       <strong>Distance/Time Remaining: </strong><%=flight.distremaining%> <?php echo Config::Get('UNITS');?> / <%=flight.timeremaining%><br />

   </div>

</script>

Pilot In Command is returned empty, while Callsign is merely '1000'. Any ideas?

Link to comment
Share on other sites

Why is the callsign set to the pilot ID? Should be:

<%=flight.flightnum%>

Because I'm trying to return the Pilot ID as the callsign :D Nevertheless, the flight number will be useful in the bubble anyway, thanks.

The template states the following:

<?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"

You can also use logic in the templating, if you so choose:
http://ejohn.org/blog/javascript-micro-templating/
*/
?>

Link to comment
Share on other sites

Still no luck on this, not sure what's wrong :( From what I can see, not many people actually tried editing their bubbles, but it doesn't work in the table either. Have some of these been deprecated in phpVMS or something, anyone? I'm struggling to find the cause of the issue.

EDIT: Decided to go for a phpVMS reinstall, and it works now.

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...