Jump to content

Last Arrival & Depart Pireps by Airport - Anyone figure it out?


stuartpb

Recommended Posts

I've expanded on the airport table add on, by adding seperate pages for each airport in the airport table. You just click on the ICAO code in each table row to open a new page with the airport details. I've put the total departures (total pireps by depicao) and total arrivals (total pireps by arricao) from the given airport in the airport details page, but I want to be able to show links to the last pirep filed both from and to the airport. So the links would be "show last departure" and "show last arrival", and the links would go to the relevant PIREP. Could anyone shed any light on this for me please? I've spent all day trying to get it to work, without success.

Here's the airport table:

http://execair.org/index.php/airports

Cheers,

Stuart

Link to comment
Share on other sites

Guest lorathon

Try this....

<?php
$icao = 'KLAX';

$params = array(
          'depicao'   => $icao,
          'accepted'  => '1'
         );

$pireps = PIREPData::findPIREPS($params, 1);
$deppirep = $pireps[0];

$params = array(
          'arricao'   => $icao,
          'accepted'  => '1'
         );

$pireps = PIREPData::findPIREPS($params, 1);
$arrpirep = $pireps[0];
?>


Last Departure:
<a href="<?php echo SITE_URL?>/index.php/pireps/viewreport/<?php echo $deppirep->pirepid;?>">
  <?php echo $deppirep->code.$deppirep->flightnum.' ('.$deppirep->depicao.'-'.$deppirep->arricao.') '.$deppirep->firstname.' '.$deppirep->lastname?>
</a>
<br />

Last Arrival:
<a href="<?php echo SITE_URL?>/index.php/pireps/viewreport/<?php echo $arrpirep->pirepid;?>">
  <?php echo $arrpirep->code.$arrpirep->flightnum.' ('.$arrpirep->depicao.'-'.$arrpirep->arricao.') '.$arrpirep->firstname.' '.$arrpirep->lastname?>
</a>

Change the $icao to dynamic and it will work. It will pull the last PIREP and only accepted. If it pulls the first then you will need to change the order of your PIREP's in the local.config file

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