Maksim Posted March 30, 2020 Report Posted March 30, 2020 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}"; ?> Quote
web541 Posted March 30, 2020 Report Posted March 30, 2020 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). Quote
Maksim Posted March 31, 2020 Author Report Posted March 31, 2020 (edited) Thank you so much, it worked, I didn't know that I needed a different code. One more question, how to add the name of the airport? {$last_location->arrname} doesn't work. Edited March 31, 2020 by Maksim Quote
web541 Posted March 31, 2020 Report Posted March 31, 2020 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; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.