Jump to content

Live Flight Board Problem [Solved]


FiveStar

Recommended Posts

Hi I have query for problem-solver which is when you go to ACARS Map page there is Option on Acars data table OF AC means Aircraft Name will show up there right so when i am putting variable to show Aircraft name there which is <%=flight.aircraftname%> it wont showing any thing on ACARS MAP table Blank and when i put <%=flight.aircraft%> It shows the result but only Digits Like 1, 15 ,29

.......................

now i have also implemented Live Flight board on my Front Page taken code from this post POST Again here it wont showing Aircraft type on Front Page the Row was blank instead of showing Aircraft name like B737. ATR i hope you understand Come back to me with some suggestion or fix...... :(

I have seen on Forum member: Mark1Million VA on his front page there it was showing Aircraft name Correctly and if i am not wrong he has the same flight board redesigned for his skin.... :)

Help would be much Appreciated need Exact details...... ;)

Regards

Asmara

Link to comment
Share on other sites

I believe if you use acars or xacars it is not going to show aircraft. you have to use KACARS. I think it works correctly for fsfk....I could be wrong. And it will not show any details at all for anything on the flight board for fs passengers.

So to put it in a blunt manner, use KACARS. It is your best option when testing your code. Well, for that matter, it is probably the best option to use any way you look at it. ;)

Link to comment
Share on other sites

Thanks for your reply and suggestion TAV i have checked it with kACARS and it was showing Aircraft name on my ACARS MAP and on Flight Board also but i also wanted to show Aircraft name while using FSACARS our main Flight Reporting Systems are kACARS and Fsacars so KACARS is Working Fully But FSCARAS is not Showing The AIRCRAFT name or Type so if someone could help me in this i will really appreciate it in any Manners i have seen this working on Many sites under PHPVMS Even i Think mark1million also have it working and maybe TOM and others have the working Flight Board...........

Hope some one will come with Suggestion and FIX ? :(

Link to comment
Share on other sites

  • Administrators

Oh Nabeel Thank-You Once again for your kind reply i thought maybe you forgot about this issue it was a good idea to FIX in next version but is there any possibility if you can do it now Please just asking :rolleyes:

I don't think so, when I get a chance to look into it completely. I don't like doing changes in between versions, esp since so much has changed internally for 3.0

Link to comment
Share on other sites

  • Moderators

Hi I have query for problem-solver which is when you go to ACARS Map page there is Option on Acars data table OF AC means Aircraft Name will show up there right so when i am putting variable to show Aircraft name there which is <%=flight.aircraftname%> it wont showing any thing on ACARS MAP table Blank and when i put <%=flight.aircraft%> It shows the result but only Digits Like 1, 15 ,29

.......................

now i have also implemented Live Flight board on my Front Page taken code from this post POST Again here it wont showing Aircraft type on Front Page the Row was blank instead of showing Aircraft name like B737. ATR i hope you understand Come back to me with some suggestion or fix...... :(

I have seen on Forum member: Mark1Million VA on his front page there it was showing Aircraft name Correctly and if i am not wrong he has the same flight board redesigned for his skin.... :)

Help would be much Appreciated need Exact details...... ;)

Regards

Asmara

Hi i created this board myself so i cant comment on how other have done it or what code your using in yours.

Basically all you need to do is access the api and read the data from your acars table which will translate in to your board.

This is the code to access the entries in the table,

<?php
       $flights = ACARSData::GetACARSData();
       if ($flights OR $fsfk > 0) {
           if($flights) {
           foreach($flights as $flight) {
                  $pid = $flight->pilotid + 100;?>

Then all you do is access the table row names with,

<?php echo $flight->aircraftname?>

Use the $flight->yourtablename?> and it will show.

Hope that helps.

Link to comment
Share on other sites

I have checked your code but Still no result BRO i have did little research on this i have noticed when i have gone to phpmyadmin in phpvms_schedules there are some rows and under aircraft row it was just showing text like 1,13,15,12 not showing aircraft names or not either REG number and when i have pasted your given code

<td align="center"><font color="#010854"><?php echo $flight->aircraftname;?> <?php echo $flight->aircraft;?></td>

it was just showing Digit 1 under Aircraft Row on my front page flight board

Awaiting.......... :rolleyes:

Link to comment
Share on other sites

Mark here are the Pics of my database and flight Board where do i change the names in CSV file under Aircraft Row i am putting Aircraft REG numbers attaching my Schedules example file please redit and tell me where to do the changes...........

Image Removed

Awaiting you...... :rolleyes:

Edited by Asmara Kamran
Link to comment
Share on other sites

  • Administrators

The acars data only records the db id of the aircraft in flight, no other data. You need to convert that id into the aircraft data using the built in functions of the operations data class. A simple example for a front page flight board would be:

Live Flights In Progress
       <table>
                   <tr>
                       <th>Flight #</th>
                       <th>Pilot</th>
                       <th>Aircraft</th>
                       <th>Departure</th>
                       <th>Arrival</th>
                       <th>Altitude</th>
                       <th>Phase</th>
                   </tr>
                   <?php
                   $flights = ACARSData::GetACARSData();
                   if ($flights) {
                       foreach ($flights as $flight) {
                           $plane = OperationsData::getAircraftByReg($flight->aircraft);
                           echo '<tr>';
                           echo '<td>' . $flight->flightnum . '</td>';
                           echo '<td>' . $flight->pilotname . '</td>';
                           echo '<td>' . $plane->fullname . '</td>';
                           echo '<td>' . $flight->depicao . '</td>';
                           echo '<td>' . $flight->arricao . '</td>';
                           echo '<td>' . $flight->alt . 'ft</td>';
                           echo '<td>' . $flight->phasedetail . '</td>';
                           echo '</tr>';
                       }
                   } else {
                       echo '<tr><td colspan="7">No Flights At This Time</td></tr>';
                   }
                   ?>
               </table>

Notice the data extraction on line 16 and how it is used on line 20.

You can apply the same concept to the acars map but will need to change the sql function or add the data to the variable within the acars module.

Link to comment
Share on other sites

Dear Simpilot First of all Thank you so much for your suggestion secondly i have used your given code but again it was not showing Aircraft Name Blank Row here is my code used for flight board please suggest code from it.

<h2 style="text-align: center;">Flight Departures Board</h2>

     <?php

     if(!$lastbids) {

     echo '<p align="center">There are currently no booked flights!</p></div>';

     return;

     }



     ?>

     <center>

<table class="flight" width="100%" style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
<tr>

   <th align="center" style="background-color: #171717; width: 5%;"> </th>
   <th width="10%" align="center" style="background-color: #171717;">Flight</th>
   <th width="20%" align="center" style="background-color: #171717;">Departure</th>
   <th width="20%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="20%" align="center" style="background-color: #171717;">Pilot Name</th>
   <th width="10%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="20%" align="center" style="background-color: #171717;">Status</th>
</tr>
<?php
$params = $$lastbid->pilotid;

$pilot = PilotData::GetPilotData($params);
$pname = $pilot->firstname;
$psurname = $pilot->lastname;
?>

<?php

$results = ACARSData::GetACARSData();

if (count($results) > 0)
  {
  foreach($results as $flight)
     {
$plane = OperationsData::getAircraftByReg($flight->aircraft);
        ?>


     <tr>
         <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; } elseif($flight->phasedetail == "Taxiing to Runway") { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ONAPPROCH.gif'>"; } elseif($flight->phasedetail == "Taking Off") { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; } elseif($flight->phasedetail == "Climbing") { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; } elseif($flight->phasedetail == "Cruise") { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ONAPPROCH.gif'>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ARRIVED.gif'>"; } elseif($flight->phasedetail == "Descending") { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; }  elseif($flight->phasedetail == "Level Flight") { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ONAPPROCH.gif'>"; } elseif($flight->phasedetail == "Taxiing to Gate") { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/images/Boarding1.gif'>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ARRIVED.gif'>"; }?></td>
         <td align="center"><?php echo $flight->flightnum;?></td>
         <td align="center"><?php echo $flight->depname;?></td>
         <td align="center"><?php echo $flight->arrname;?></td>
         <td align="center"><?php echo $flight->pilotname;?></td>
         <td align="center"><?php echo $plane->fullname;?></td>
         <td align="center"><?php if($flight->phasedetail
   != 'Paused') { echo $flight->phasedetail; }
   else { echo "Cruise"; }?></font></td>

     </tr>

 <?php          
               }

           } else { ?>
               <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #ff961e;">No Flights in Progress!</td></tr>
           <?php
           }
           ?>
</table>
<p><i>The table will be updated every <?php echo Config::Get('ACARS_LIVE_TIME') ?> minutes.<br /></p>

Can we use this command ---> $sql = "SELECT * FROM `phpvms_aircraft` LIMIT 0, 30 ";

for your reference this is ow Operation Data class showing aircraft names

	/**
 * Get an aircraft according to registration
 */
public static function getAircraftByReg($registration)
{
	$registration = DB::escape(strtoupper($registration));

	$sql = 'SELECT * 
			FROM ' . TABLE_PREFIX .'aircraft 
			WHERE `registration`=\''.$registration.'\'';

	return DB::get_row($sql);
}

/**
 * Get an aircraft by name
 */
public static function getAircraftByName($name)
{
	$name = DB::escape(strtoupper($name));

	$sql = 'SELECT * 
			FROM ' . TABLE_PREFIX .'aircraft 
			WHERE UPPER(`name`)=\''.$name.'\'';

	return DB::get_row($sql);
}

Awaiting you.......... :rolleyes:

Edited by Asmara Kamran
Link to comment
Share on other sites

  • Administrators

Not sure what all you have going on there, looks like a live flight board with remenants of a current bids board....

I changed your code to show the live flight board and it works on my test site. If you are still getting a blank in the "Name" section for the aircraft my guess would be that you have not assigned a full name to the aircraft in your admin panel.

<table>
<?php

$results = ACARSData::GetACARSData();

if (count($results) > 0)
  {
  foreach($results as $flight)
     {
       $plane = OperationsData::getAircraftByReg($flight->aircraft);
        ?>
   <tr>
         <td align="center">
               <?php
               if($flight->phasedetail == "Boarding")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; }
               elseif($flight->phasedetail == "Taxiing to Runway")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ONAPPROCH.gif'>"; }
               elseif($flight->phasedetail == "Taking Off")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; }
               elseif($flight->phasedetail == "Climbing")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; }
               elseif($flight->phasedetail == "Cruise")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ONAPPROCH.gif'>"; }
               elseif($flight->phasedetail == "Arrived")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ARRIVED.gif'>"; }
               elseif($flight->phasedetail == "Descending")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; }
               elseif($flight->phasedetail == "Level Flight")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; }
               elseif($flight->phasedetail == "On Approach")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ONAPPROCH.gif'>"; }
               elseif($flight->phasedetail == "Taxiing to Gate")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/images/Boarding1.gif'>"; }
               else    { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ARRIVED.gif'>"; }
               ?>
         </td>
         <td align="center"><?php echo $flight->flightnum;?></td>
         <td align="center"><?php echo $flight->depname;?></td>
         <td align="center"><?php echo $flight->arrname;?></td>
         <td align="center"><?php echo $flight->pilotname;?></td>
         <td align="center"><?php echo $plane->fullname;?></td>
         <td align="center"><?php echo $flight->phasedetail; ?></td>
      </tr>
    <?php
         }
           } else { ?>
               <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #ff961e;">No Flights in Progress!</td></tr>
           <?php
           }
           ?>
</table>

And your reference to me using the wrong code to get the ac name, look at what you have posted - getAircraftBYname - You are wanting the name because you dont have it, so how are you going to find it by name? Nor do you have the registration, you only have the db id of the aircraft from acars data.

Link to comment
Share on other sites

Dear sir this table is which you have seen is from phpvms_aircrafts table not phpvms_acars table my latest acars table is this

Image Removed

When i put $flight->aircraft it shows the same digits in this pic like this

Image Removed

there is a ID row you can see it?

Edited by Asmara Kamran
Link to comment
Share on other sites

  • Administrators

Do this then,

<table>
<?php
$results = ACARSData::GetACARSData();
if (count($results) > 0)
  {
  foreach($results as $flight)
     { 
       if($flight->client == 'FSACARS')
       {$plane = OperationsData::getAircraftInfo($flight->aircraft);}
       else
       {$plane = OperationsData::getAircraftByReg($flight->aircraft);}
        ?>
   <tr>
         <td align="center">
               <?php
               if($flight->phasedetail == "Boarding")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; }
               elseif($flight->phasedetail == "Taxiing to Runway")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ONAPPROCH.gif'>"; }
               elseif($flight->phasedetail == "Taking Off")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; }
               elseif($flight->phasedetail == "Climbing")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; }
               elseif($flight->phasedetail == "Cruise")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ONAPPROCH.gif'>"; }
               elseif($flight->phasedetail == "Arrived")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ARRIVED.gif'>"; }
               elseif($flight->phasedetail == "Descending")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; }
               elseif($flight->phasedetail == "Level Flight")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/Boarding1.gif'>"; }
               elseif($flight->phasedetail == "On Approach")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ONAPPROCH.gif'>"; }
               elseif($flight->phasedetail == "Taxiing to Gate")
                       { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/images/Boarding1.gif'>"; }
               else    { echo "<img style='padding-left:3px;' src='http://www.vpia.org/VirtualPIA/lib/skins/brilliancev1/images/ARRIVED.gif'>"; }
               ?>
         </td>
         <td align="center"><?php echo $flight->flightnum;?></td>
         <td align="center"><?php echo $flight->depname;?></td>
         <td align="center"><?php echo $flight->arrname;?></td>
         <td align="center"><?php echo $flight->pilotname;?></td>
         <td align="center"><?php echo $plane->fullname;?></td>
         <td align="center"><?php echo $flight->phasedetail; ?></td>
      </tr>
    <?php
         }
           } else { ?>
               <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #ff961e;">No Flights in Progress!</td></tr>
           <?php
           }
           ?>
</table>

  • Like 4
Link to comment
Share on other sites

Oh Man You are a Genius this WORD is also to Small i have just heard your name in PHP Masters but now have seen it from my eyes it was working like a CHARM guys i was looking for this thing from almost 1 month and Simpilot has done it got a success WOW :D:lol: So so so so Happy

simpilot thank you so much from bottom of my heart really you are a very special man in phpvms god bless you dear Thanks thanks alot............

guys who wanted now to show Aircraft name on Flight board use this Special code From Simpilot it will show Aircrafts Name VIA FSACARS Client......

SIMPILOT ROCKS ;) +1

Post ***SOLVED**

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