VastatsData.class.php

Hello everyone,

I am in process of finishng up a new class for phpVMS that details statistics for your VA. I have attached a screenie from my development server with the stats that are built so far. Anyone have any suggestions for anything else you think a VA would like to have stats for?

Total - Flights, Pilots, and Hours are already built into the phpVMS app. The rest come out of the new class I am building.

If you want, I can integrate this into the class which already exists - StatsData.class.php, for the next release. The user’s online will be included as well since there’s now session tracking.

Looks good though!

again it looks verry nice. i want it ;D

want it tooooooo please!

Me want to !!!

Test Release… Tested with beta 741

Place the VastatsData.class.php in your core/common folder and run the sql file within the database that phpVMS is using.

Functions already built into phpVMS by Nabeel 

<?php echo StatsData::PilotCount(); ?>
<?php echo StatsData::TotalFlights(); ?>
<?php echo StatsData::TotalHours(); ?>

Additional functions available through VastatsData.class

<?php VastatsData::totalflightstoday(); ?>
<?php VastatsData::totalpaxcarried(); ?>
<?php VastatsData::totalfuelburned(); ?>
<?php VastatsData::totalmilesflown(); ?>
<?php VastatsData::totalaircraftinfleet(); ?>
<?php VastatsData::totalschedules(); ?>
<?php VastatsData::totalnewsitems(); ?>
<?php VastatsData::pagecounter(); ?>
<?php VastatsData::usersonline(); ?>

The next phpVMS release is to use sessions so the users online will be better served through that function when it comes available.

Post any issues or if you need help, please avoid pm’s as there may be others that have the same problem and can be helped by an open post 

I also have to say Thank You to Nabeel -> The phpVMS system is well written and fun to work with!

Have Fun and GO FLY!

[Vastats.zip](< base_url >/applications/core/interface/file/attachment.php?id=63)

Thanks again Simpilot !!! Great work

just one thing… in:

<?php VastatsData::totalmilesflown(); ?>

I get 0.

any ideas?

Have you refreshed your PIREP distances lately using admin->site & settings -> Maintenance options -> Recalculate Distances ?

that was it !!! i just done it and works perfect !!!

thanks again man

Hi again, is there a way to put in a stats page the top routes flown and the top aircraft uesd by the pilots?

Hi again, is there a way to put in a stats page the top routes flown and the top aircraft uesd by the pilots?

These two functions are built into the existing StatsData.class in phpvms. You can use ->

StatsData::TopRoutes(1)
StatsData::AircraftUsage(5)

The number behind each one determines how many records you want returned. 

mmmm, it does not work for me…  :-

i get

<?php StatsData::AircraftUsage(5); ?>

and it does not work…

did i made anything wrong?

Would you like me to roll this into the official? It will be “StatsData::…” instead

Would you like me to roll this into the official? It will be “StatsData::…” instead

Sure 

I am also working on a couple of more I will send along when they are done.

mmmm, it does not work for me…  :-

i get

<?php StatsData::AircraftUsage(5); ?>

and it does not work…

did i made anything wrong?

That is returning an array of data which you then need to convert and display however you would like on your site. I use a module where for the case ‘stats’ I declare,

case 'stats':

Template::Set('toproutes', StatsData::TopRoutes(1));
Template::Set('topaircraft', StatsData::AircraftUsage(5));
Template::Show('stats_operations.tpl');

Then in my stats_operations.tpl to display the data I want to see for top aircraft ->

<?php
if(!$topaircraft)
{
echo 'No Top Aircraft';
return;
}
foreach($topaircraft as $topa)
{
?>
<tr>
<td align="center"><?php echo $topa->aircraft; ?></ td>
<td align="center"><?php echo $topa->registration; ?></ td>
</tr>
<?php 
}
?> 

and for top routes ->

<?php
if(!$toproutes)
{
echo 'No Top Routes Exist';
return;
}
foreach($toproutes as $report)
{
?>
<tr>
<td align="center"><?php echo $report->code; ?><?php echo $report->flightnum; ?></td>
<td align="center"><?php echo $report->depicao; ?></td>
<td align="center"><?php echo $report->arricao; ?></td>
<td align="center"><?php echo $report->distance; ?></td>
</tr>
<?php 
}
?> 

These pieces you need to build into your app and display in your template the way you would like to see it. 

Cool, if you can do it in StatsData I can just roll them up that way. And it won’t break going forward

Cool, if you can do it in StatsData I can just roll them up that way. And it won’t break going forward

Ill do it - Have it to you soon

Cool. I’m going through the code, I will optimize it where I see, and also I’ll be returning values instead of echoing out (Any *Data classes should be returning data). I’ll post it once I do that for you to check out.

I’ve attached the latest StatsData (haven’t commited it yet). You can see some of the changes I made (mainly using the SUM() function, and using a column name on counts instead of * which is faster)

I’ll implement the pilots online, once that’s completed.

Great job, thanks!

[StatsData.class.zip](< base_url >/applications/core/interface/file/attachment.php?id=65)

How to I run the .sql file? Also, when I do so, can I just copy theses lines into my code to get the stats?

<?php echo StatsData::PilotCount(); ?>

<?php echo StatsData::TotalFlights(); ?>

<?php echo StatsData::TotalHours(); ?>