Jump to content

Pilots last location on Schedules page


Maksim

Recommended Posts

 

Hello, I want to show the current location of the pilot on the schedule page (/index.php/schedules). As I know, I use the correct code, but on the Schedules page it does not show anything except the words "This pilot's last location is". But on other pages (Pilot Center, profile) with this code everything works fine.

<?php
     $last_location = PIREPData::getLastReports($userinfo->pilotid, 1, PIREP_ACCEPTED);
     echo "This pilot's last location is: {$last_location->arricao}";
?>

 

Link to comment
Share on other sites

If you are only going to use it for when the pilot is logged in, then try this:

<?php
     $last_location = PIREPData::getLastReports(Auth::$userinfo->pilotid, 1, PIREP_ACCEPTED);
     echo "This pilot's last location is: {$last_location->arricao}";
?>

As the $userinfo variable is only populated in some modules within phpVMS and isn't entirely global (e.g. some places it may be $pilot->pilotid or otherwise).

Link to comment
Share on other sites

11 hours ago, Maksim said:

One more question, how to add the name of the airport? {$last_location->arrname} doesn't work.

Try just name

 

{$last_location->name}

or (if the table isn't joined), try this

$airport = OperationsData::getAirportInfo($last_location->arricao);
echo $airport->name;

 

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