Jump to content

Regional Stats?


Taran

Recommended Posts

Does anybody know a way for me to get the stats for a certain region?

We're wanting to run our airline by Regions instead of HUBS (our Regions would obviously consist of a large part of a continent).

Is there a way for us to get the stats for different regions (like you can do with HUBs)?

Maybe a code to get the stats for multiple airports and have them all add together?

Please help!

Thanks in advance,

Taran

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
  • Administrators

Tom has a robust Hub Stats class here -> https://github.com/t...erritt/HubStats

Why not use that and call the airports you want to include in a region and just add them together on the fly?

<?php
$flights = (HubStats::CountFlights(ABCD) + HubStats::CountFlights(EFGH) + HubStats::CountFlights(IJKL));
?>

Link to comment
Share on other sites

  • 1 year later...
  • Moderators

I'm trying to get the stats for multiple hubs to add automatically and show as one number. i.e. our North American region has 3 hubs (KATL,KBOS,KSEA) I want the stats for those hubs to be pulled as one. when I try it the way simpilot said it just shows nothing.

Try this...

<?php echo (HubStats::CountFlights(KATL) + HubStats::CountFlights(KBOS) + HubStats::CountFlights(KSEA));?>

Link to comment
Share on other sites

  • Moderators

Awesome! How about if I want to get the entire roster of pilots within this region? would it be the same?

Here's the counting function for the pilots...

<?php echo (HubStats::CountPilots(KATL) + HubStats::CountPilots(KBOS) + HubStats::CountPilots(KSEA));?>

Cheers! ;)

Link to comment
Share on other sites

  • Moderators

Sorry, for the late response.

Here's the code how you would get the pilot list... ;)

<?php $hubpilots = HubStats::Pilots(KATL);?>
<?php if(!$hubpilots)
{
 echo 'There are no pilots in this hub!';
 return;
}
else
{
?>
<table id="tabledlist" class="tablesorter">
<thead>
<tr>
<th>Pilot ID</th>
<th>Name</th>
<th>Rank</th>
<th>Flights</th>
<th>Hours</th>
</tr>
</thead>
<tbody>
<?php
foreach($hubpilots as $pilot)
{
/*
 To include a custom field, use the following example:
 <td>
  <?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?>
 </td>
 For instance, if you added a field called "IVAO Callsign":
  echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign');
 */
 // To skip a retired pilot, uncomment the next line:
 //if($pilot->retired == 1) { continue; }
?>
<tr>
<td width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>">
  <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
</td>
<td>
 <img src="<?php echo Countries::getCountryImage($pilot->location);?>"
  alt="<?php echo Countries::getCountryName($pilot->location);?>" />
 <?php echo $pilot->firstname.' '.$pilot->lastname?>
</td>
<td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
<td><?php echo $pilot->totalflights?></td>
<td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>
<?php
}
?>
</tbody>
</table>
<?php
}
?>

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