Administrators simpilot Posted September 14, 2009 Administrators Report Posted September 14, 2009 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. Quote
Administrators Nabeel Posted September 14, 2009 Administrators Report Posted September 14, 2009 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! Quote
Moderators joeri Posted September 14, 2009 Moderators Report Posted September 14, 2009 again it looks verry nice. i want it ;D Quote
Administrators simpilot Posted September 14, 2009 Author Administrators Report Posted September 14, 2009 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 Quote
Guest chikolol Posted September 15, 2009 Report Posted September 15, 2009 Once again you are the MAN! thank you Quote
mobitu Posted September 15, 2009 Report Posted September 15, 2009 Thanks again Simpilot !!! Great work just one thing... in: <?php VastatsData::totalmilesflown(); ?> I get 0. any ideas? Quote
Administrators simpilot Posted September 15, 2009 Author Administrators Report Posted September 15, 2009 Have you refreshed your PIREP distances lately using admin->site & settings -> Maintenance options -> Recalculate Distances ? Quote
mobitu Posted September 15, 2009 Report Posted September 15, 2009 that was it !!! i just done it and works perfect !!! thanks again man Quote
mobitu Posted September 16, 2009 Report Posted September 16, 2009 Hi again, is there a way to put in a stats page the top routes flown and the top aircraft uesd by the pilots? Quote
Administrators simpilot Posted September 16, 2009 Author Administrators Report Posted September 16, 2009 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. Quote
mobitu Posted September 16, 2009 Report Posted September 16, 2009 mmmm, it does not work for me... :- i get <?php StatsData::AircraftUsage(5); ?> and it does not work... did i made anything wrong? Quote
Administrators Nabeel Posted September 16, 2009 Administrators Report Posted September 16, 2009 Would you like me to roll this into the official? It will be "StatsData::..." instead Quote
Administrators simpilot Posted September 16, 2009 Author Administrators Report Posted September 16, 2009 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. Quote
Administrators simpilot Posted September 16, 2009 Author Administrators Report Posted September 16, 2009 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. Quote
Administrators Nabeel Posted September 16, 2009 Administrators Report Posted September 16, 2009 Cool, if you can do it in StatsData I can just roll them up that way. And it won't break going forward Quote
Administrators simpilot Posted September 16, 2009 Author Administrators Report Posted September 16, 2009 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 Quote
Administrators Nabeel Posted September 16, 2009 Administrators Report Posted September 16, 2009 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. Quote
Administrators Nabeel Posted September 16, 2009 Administrators Report Posted September 16, 2009 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 Quote
gosox116 Posted September 20, 2009 Report Posted September 20, 2009 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(); ?> Quote
Administrators simpilot Posted September 20, 2009 Author Administrators Report Posted September 20, 2009 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(); ?> These three stats were built by Nabeel and are already in the app, you would not have to run the sql file to use those. If you want to use the other commands you would have to use the sql file and update your db using phpmyadmin. The vastats options will be included in future release I believe. Quote
gosox116 Posted September 21, 2009 Report Posted September 21, 2009 I put down the wrong stats. Could you give me step by step instructions on how to run the sql file and put those extra stats you came up with on my frontpage. I'm not very good with php, so thanks for all of your help! Quote
Administrators simpilot Posted September 21, 2009 Author Administrators Report Posted September 21, 2009 Get into the phpmyadmin for your db and select the database that your trying to modify. Select the sql tab and paste the sql query into the window. Hit go. You should then get a message that the query executed sucsessfully. Done. The commands that are at the beginning of this thread can just be pasted into your site where you want them to appear and then echo the data to get the number. Quote
Kingfisher Virtual Posted September 22, 2009 Report Posted September 22, 2009 hey thank's man... saved me a whole lot of ordeal of doing it myself. good luck with your va Quote
gosox116 Posted September 23, 2009 Report Posted September 23, 2009 I'm sorry but how exactly can I access phpmyadmin? I found a website called www.phpmyadmin.net, but even if that's where to go, I don't know what to do from there. My VA's website is http://www.swava.net. Quote
Administrators simpilot Posted September 23, 2009 Author Administrators Report Posted September 23, 2009 I'm sorry but how exactly can I access phpmyadmin? I found a website called www.phpmyadmin.net, but even if that's where to go, I don't know what to do from there. My VA's website is http://www.swava.net. Do you have access to the cpanel(or something similar) for your site? You should have phpmyadmin as an option from there in the database section. If you do not have access to the backend of the site you will have to write a quick script to insert it through a php file or the like. How did you originally set up your database, you, or someone had to have access to some sort of a database manager. Quote
Kingfisher Virtual Posted September 23, 2009 Report Posted September 23, 2009 I'm sorry but how exactly can I access phpmyadmin? I found a website called www.phpmyadmin.net, but even if that's where to go, I don't know what to do from there. My VA's website is http://www.swava.net. You should ask your webhost.. im sure they ill guide on how to access phpmyadmin Quote
gosox116 Posted September 23, 2009 Report Posted September 23, 2009 I believe I do have access to the server. I'm using godaddy.com to host my site. Quote
mobitu Posted September 24, 2009 Report Posted September 24, 2009 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. hello again, could you pls explain how to create this module... I think first i have to create a module and put somehow: case 'stats': Template::Set('toproutes', StatsData::TopRoutes(1)); Template::Set('topaircraft', StatsData::AircraftUsage(5)); Template::Show('stats_operations.tpl'); and then add to stats_operations.tpl <?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 } ?> for top routes for example. I think i have all mess up ! sorry :-[ 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.