Oxymoron290 Posted December 10, 2012 Report Posted December 10, 2012 (edited) Hey Guys! So we were doing some development at woava.net tonight and came up with this little puppy. Thought you guys would like it. It checks weather the selected user is in a flight or not, if the user is in a flight it displays the current status of a flight, (parked, pushing back, taking off, etc...), Their departure to arrival in the format of DEPICAO -> ARRICO, (ex, kdfw -> klax), and the precentage currently based on distance from the flight. You can also base it on time using the variables <?php $acars->deptime; $acars->timeremaining; //and $acars->arrtime; ?> Anyways, enjoy! <?php /** ==================VVVV Checking Current logged in user VVVV================== **/ $acarsdata = ACARSData::GetACARSData(); if($acarsdata != null || !empty($acarsdata)){ foreach($acarsdata as $acars){ if($acars->pilotid == Auth::$userinfo->pilotid){ echo '<br />You are currently in a flight!'; echo '<br />Status: '.$acars->phasedetail; //echo '<br />Departure: '.$acars->depicao.' ';//.$acars->depname; //echo '<br />Arrival: '.$acars->arricao.' ';//.$acars->arrname; echo '<br />'.$acars->depicao .' -> '. $acars->arricao; $totalDistance = OperationsData::getAirportDistance($acars->depicao, $acars->arricao); $remainingDistance = $acars->distremain; $precent = ($remainingDistance/$totalDistance)*100; // Counts down precentage. 100%, 99%, 98%, etc... $precent = abs($precent-100); // Counts up precentage. 0%, 1%, 2%, etc... echo '<br />Precentage: ' . round($precent) . '%'; }else{ echo '<br />You are NOT currently in a flight!'; } } }else{ echo '<br />You are NOT currently in a flight!'; } /** ==================^^^^ Checking Current logged in user ^^^^================== **/ /** ===================================VVVV Pilot Public Profile dot tee pee elle VVVV============================= **/ $acarsdata = ACARSData::GetACARSData(); if($acarsdata != null || !empty($acarsdata)){ foreach($acarsdata as $acars){ if($acars->pilotid == $pilot->pilotid){ echo '<br />Pilot is currently in a flight!'; echo '<br />Status: '.$acars->phasedetail; //echo '<br />Departure: '.$acars->depicao.' ';//.$acars->depname; //echo '<br />Arrival: '.$acars->arricao.' ';//.$acars->arrname; echo '<br />'.$acars->depicao .' -> '. $acars->arricao; $totalDistance = OperationsData::getAirportDistance($acars->depicao, $acars->arricao); $remainingDistance = $acars->distremain; $precent = ($remainingDistance/$totalDistance)*100; // Counts down precentage. 100%, 99%, 98%, etc... $precent = abs($precent-100); // Counts up precentage. 0%, 1%, 2%, etc... echo '<br />Precentage: ' . round($precent) . '%'; }else{ echo '<br />Pilot is NOT currently in a flight!'; } }else{ echo '<br />Pilot is NOT currently in a flight!'; } /** ===================================^^^^ Pilot Public Profile dot tee pee elle ^^^^============================= **/ ?> Any improvements? comments? questions? feel free to ask! P.S. This goes on the pilot_public_profile.tpl <?php $usersOnline = StatsData::UsersOnline(); $check = false; if($usersOnline != null || !empty($usersOnline)){ foreach($usersOnline as $user){ if($user->pilotid == $pilot->pilotid){ $check = true; }else{ $check = false; } if($check){ break; } } if($check){ echo 'Pilot is currently Online'; }else{ echo 'Pilot is currently Offline'; } }else{ echo 'Pilot is currently Offline'; } ?> Edit: Had to add in the if($acarsdata != null || !empty($acarsdata)) to prevent errors when there are no flights in progress. Edited December 10, 2012 by Oxymoron290 3 Quote
warpennys Posted December 10, 2012 Report Posted December 10, 2012 Innovative! I Say, Innovative! Love it! Quote
stelioc Posted December 10, 2012 Report Posted December 10, 2012 echo '<br />Precentage: ' . round($precent) . '%'; }else{ echo '<br />Pilot is NOT currently in a flight!'; } }else{ echo '<br />Pilot is NOT currently in a flight!'; } /** ===================================^^^^ Pilot Public Profile dot tee pee elle ^^^^============================= **/ ?> needs to be like echo '<br />Precentage: ' . round($precent) . '%'; }else{ echo '<br />Pilot is NOT currently in a flight!'; } } } /** ===================================^^^^ Pilot Public Profile dot tee pee elle ^^^^============================= **/ ?> becau it gives me errors thanks Quote
loplo Posted December 25, 2012 Report Posted December 25, 2012 On the public profile, I'm getting "Pilot is currently Offline", no matter what. Quote
Moderators Parkho Posted January 4, 2013 Moderators Report Posted January 4, 2013 What if someone uses fspax as their acars? Quote
Heliguy Posted January 13, 2013 Report Posted January 13, 2013 @Warpennys Hello!, Its Heliguy back from the days of Aeronet!. Quote
warpennys Posted January 13, 2013 Report Posted January 13, 2013 lol. Good to see you. Come say hello @ http://wingsonair.net... find my ts3 link and connect. Quote
Oxymoron290 Posted January 16, 2013 Author Report Posted January 16, 2013 What if someone uses fspax as their acars? I havn't used FSPAX, however it determines the users online status by the ACARS module, which i would assume, fspax ties into, as would any acars system. Quote
Taran Posted July 7, 2014 Report Posted July 7, 2014 Where does this go? <?php /** ==================VVVV Checking Current logged in user VVVV================== **/ $acarsdata = ACARSData::GetACARSData(); if($acarsdata != null || !empty($acarsdata)){ foreach($acarsdata as $acars){ if($acars->pilotid == Auth::$userinfo->pilotid){ echo '<br />You are currently in a flight!'; echo '<br />Status: '.$acars->phasedetail; //echo '<br />Departure: '.$acars->depicao.' ';//.$acars->depname; //echo '<br />Arrival: '.$acars->arricao.' ';//.$acars->arrname; echo '<br />'.$acars->depicao .' -> '. $acars->arricao; $totalDistance = OperationsData::getAirportDistance($acars->depicao, $acars->arricao); $remainingDistance = $acars->distremain; $precent = ($remainingDistance/$totalDistance)*100; // Counts down precentage. 100%, 99%, 98%, etc... $precent = abs($precent-100); // Counts up precentage. 0%, 1%, 2%, etc... echo '<br />Precentage: ' . round($precent) . '%'; }else{ echo '<br />You are NOT currently in a flight!'; } } }else{ echo '<br />You are NOT currently in a flight!'; } /** ==================^^^^ Checking Current logged in user ^^^^================== **/ /** ===================================VVVV Pilot Public Profile dot tee pee elle VVVV============================= **/ $acarsdata = ACARSData::GetACARSData(); if($acarsdata != null || !empty($acarsdata)){ foreach($acarsdata as $acars){ if($acars->pilotid == $pilot->pilotid){ echo '<br />Pilot is currently in a flight!'; echo '<br />Status: '.$acars->phasedetail; //echo '<br />Departure: '.$acars->depicao.' ';//.$acars->depname; //echo '<br />Arrival: '.$acars->arricao.' ';//.$acars->arrname; echo '<br />'.$acars->depicao .' -> '. $acars->arricao; $totalDistance = OperationsData::getAirportDistance($acars->depicao, $acars->arricao); $remainingDistance = $acars->distremain; $precent = ($remainingDistance/$totalDistance)*100; // Counts down precentage. 100%, 99%, 98%, etc... $precent = abs($precent-100); // Counts up precentage. 0%, 1%, 2%, etc... echo '<br />Precentage: ' . round($precent) . '%'; }else{ echo '<br />Pilot is NOT currently in a flight!'; } }else{ echo '<br />Pilot is NOT currently in a flight!'; } /** ===================================^^^^ Pilot Public Profile dot tee pee elle ^^^^============================= **/ ?> 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.