Oxymoron290 Posted December 10, 2012 Report Share 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 Link to comment Share on other sites More sharing options...
warpennys Posted December 10, 2012 Report Share Posted December 10, 2012 Innovative! I Say, Innovative! Love it! Quote Link to comment Share on other sites More sharing options...
stelioc Posted December 10, 2012 Report Share 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 Link to comment Share on other sites More sharing options...
warpennys Posted December 11, 2012 Report Share Posted December 11, 2012 ROGER! See that. Thanks! Quote Link to comment Share on other sites More sharing options...
Oxymoron290 Posted December 12, 2012 Author Report Share Posted December 12, 2012 I beg to differ Quote Link to comment Share on other sites More sharing options...
loplo Posted December 25, 2012 Report Share Posted December 25, 2012 On the public profile, I'm getting "Pilot is currently Offline", no matter what. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted January 4, 2013 Moderators Report Share Posted January 4, 2013 What if someone uses fspax as their acars? Quote Link to comment Share on other sites More sharing options...
warpennys Posted January 9, 2013 Report Share Posted January 9, 2013 Good Question.... Oxy? Quote Link to comment Share on other sites More sharing options...
Heliguy Posted January 13, 2013 Report Share Posted January 13, 2013 @Warpennys Hello!, Its Heliguy back from the days of Aeronet!. Quote Link to comment Share on other sites More sharing options...
warpennys Posted January 13, 2013 Report Share Posted January 13, 2013 lol. Good to see you. Come say hello @ http://wingsonair.net... find my ts3 link and connect. Quote Link to comment Share on other sites More sharing options...
Oxymoron290 Posted January 16, 2013 Author Report Share 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 Link to comment Share on other sites More sharing options...
FSVKenny Posted June 14, 2014 Report Share Posted June 14, 2014 Where does this coding go?? Quote Link to comment Share on other sites More sharing options...
Strider Posted June 16, 2014 Report Share Posted June 16, 2014 It tells you in the code. Quote Link to comment Share on other sites More sharing options...
Taran Posted July 7, 2014 Report Share 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 Link to comment Share on other sites More sharing options...
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.