Jump to content

Recommended Posts

Posted

TOPPilot beta 1.0

phpVMS module to extract monthly flight statistics for individual pilots from your phpVMS based virtual airline.

Developed by:

simpilot

www.simpilotgroup.com

Developed on:

phpVMS 2.0.874

php 5.2.11

mysql 5.0.51

apache 2.2.11

Included files:

readme.txt

top_flight.sql

TopPilot.php

TpPilotData.class.php

tp_index.tpl

tp_previous.tpl

Install:

-Download the attached package.

-unzip the package and place the files as structured in your root phpVMS install.

-use the top_flights.sql file to create the table needed in your sql database using phpmyadmin or similar.

-after the initial install point your browser to yoursite/index.php/TopPilot/refresh_pilot_stats one time. This will populate the database table with any data available.

-to view the main TopPilot index create a link yoursite/index.php/TopPilot

-everytime a pirep is filed the module will recalculate the pilot stats and update the database

There are three main display functions within the TopPilotData class that you can configure to use in various parts of your site.

Flights flown - TopPilotData::top_pilot_flights($month, $year, 5)
Hours flown -  TopPilotData::top_pilot_hours($month, $year, 5)
Miles flown - TopPilotData::top_pilot_miles($month, $year, 5)

$month should be the two digit month id of the month you want data from – ie 06 = June

$year is the four digit year you are pulling – ie 2010

5 – can be changed to how many records you want returned.

Excluding PIREPS that are not accepted yet.

TopPilot.php line 52.

Uncomment the trailing section and the module will not include unapproved PIREPS. Doing this will cause the module not to display any newly accepted PIREPS in the TopPilot data listings until after another PIREP is filed although you can refresh the stats at anytime using – yoursite/index.php/TopPilot/refresh_pilot_stats

Although this script carries no limits of use a link back to www.simpilotgroup.com would be greatly appreciated!

Have fun!

Can someone explain to me in layman's terms on how to create a table using phpmyadmin, I don't think I understand how it actually works, I am very new to doing these kinda things.

Posted

Can someone explain to me in layman's terms on how to create a table using phpmyadmin, I don't think I understand how it actually works, I am very new to doing these kinda things.

What you do is log into your database with phpmyadmin or something similar and then you import the top_flights.sql file. It will then automatically create the needed tables for this module. Hope this helps.

Posted

What you do is log into your database with phpmyadmin or something similar and then you import the top_flights.sql file. It will then automatically create the needed tables for this module. Hope this helps.

Would it be placed in the

www/core/modules
folder or where?
  • Administrators
Posted

I notice from today that the months are messed up again :(

I think it is something to do with the end of the month and the time difference from the server and GMT... It always seems to correct itself after the 1st of the month, on my site anyway. I have not messed with this mod for a bit, I am not sure what or if I tracked it down.

  • Administrators
Posted

BUMP :)

My other question is.....can transferred hours be accounted for in the Top Pilots Hours Flown??

I did not respond to it as it did not make sense to me to include transfered hours every month to a pilots stats. If you want to, you can:

Open TopPilotData.class.php

find line 54

$totaltime=0;

and change to

$totaltime=$pilot->transferhours;

That will add the transfer hours to the pilots time each month.

B)

  • Administrators
Posted

This question got skipped for reply, still need answer if you have one. (^5 posts up^)

The sql file is to create the needed table in your database. You need to go into phpMyAdmin and either import it into your database with the import function or copy the text of the file into the sql box and run it that way. The file does not need to be on your server, once you have loaded it into the database you should not need it again.

Posted

I did not respond to it as it did not make sense to me to include transfered hours every month to a pilots stats. If you want to, you can:

Open TopPilotData.class.php

find line 54

$totaltime=0;

and change to

$totaltime=$pilot->transferhours;

That will add the transfer hours to the pilots time each month.

B)

Sorry, I guess I meant for the TOTAL numbers for the pilots, not the monthly ones. But I see your point. I just wanted the total hours to add the transferred hours in for that...not for the month totals. Thanks. :)

Posted

I see you meant TopPilot.php :)

See, now I just want to add the transfer hours to the ONE total of "public function alltime_hours ($howmany) {" on Line 57 of TopPilotDataClass.php....I think?! But not having much luck. I don't want to screw up any of the monthly stuff....just that ONE total is all.

  • Administrators
Posted

I see you meant TopPilot.php :)

See, now I just want to add the transfer hours to the ONE total of "public function alltime_hours ($howmany) {" on Line 57 of TopPilotDataClass.php....I think?! But not having much luck. I don't want to screw up any of the monthly stuff....just that ONE total is all.

To include transfer hours in the totals ->

open TopPilotData.class.php

find line 58

$query = "SELECT pilotid, totalhours FROM phpvms_pilots ORDER BY totalhours DESC LIMIT $howmany";

and change to

$query = "SELECT pilotid, totalhours, transferhours FROM phpvms_pilots ORDER BY totalhours DESC LIMIT $howmany";

Open tp_index.tpl

find line 70

echo $row->totalhours;

and change to

echo ($row->totalhours + $row->transferhours);

Posted

I re-installed the module, but now I have a problem with this:

"Warning: Invalid argument supplied for foreach() in /home/woodsdom/public_html/CPC/core/templates/tp_index.tpl on line 24"

Line 24 is:

"foreach($all_flights as $all) {"

I don't understand where this went wrong. Nothing was edited except for pointing to the correct database in the "TopPilotDataClass.php file". It was working fine the other day!

http://www.canadianclassicairlines.com/CPC/index.php/TopPilot

Posted

*Bump*

Please let me know what is wrong here?! The monthly stuff workis fine, but I get the error for the all time totals, and I can't figure out why.

  • Administrators
Posted

*Bump*

Please let me know what is wrong here?! The monthly stuff workis fine, but I get the error for the all time totals, and I can't figure out why.

My guess is that you are not using the standard phpvms_ table prefix in your db. If this is the case, you will have to change the sql commands on lines 52 & 58 in TopPilotData.class.php in root/core/common/ to reflect your db prefix, or you could insert the TABLE_PREFIX command, which I should have done in the first place...

  • Administrators
Posted

In "tp_index.tpl" I don't have a line that says "echo $row->totalhours;". Line 70 says " foreach ($topflights as $top) {" ?!?

My bad - it is actually line 45.

I was looking at a customized version of the custom module of a ... .... errr...... you get the idea. Way too many files floating around on my box, time to start deleting some I think. B)

  • 4 weeks later...
Posted

I just noticed that my top pilot lists the last 6 months as:

January - 2010

March - 2010

March - 2010

April - 2010

May - 2010

June - 2010

The first march stats are actually February?! But I can't find where/why it list March twice?!

  • 3 months later...
Posted

Good day

guys I'm having trouble installing the module TopPilot.

let the following description of the error that this showing me

Ouvir

Ler foneticamente:

Warning: Invalid argument supplied for foreach() in /home/vhosts/kaflyportugal.noads.biz/core/templates/tp_index.tpl on line 24

please help me!

thanks

  • Administrators
Posted

Could be a number of things:

Did you load the sql tables to your database?

If so, did you run the "refresh_pilot_stats" command?

Are there any contents in the db after running that?

Also, if the va has no pireps the module will not work.

Posted

my friend

I have already approved the flights go, and already ran the command you mentioned, but stays the same.

I put the contents in the right folders on the server!

a question:

if command is executed in the browser or phpmyadmin?

thanks

  • Administrators
Posted

I have already approved the flights go, and already ran the command you mentioned, but stays the same.

I put the contents in the right folders on the server!

a question:

if command is executed in the browser or phpmyadmin?

The sql files would be loaded using phpmyadmin and the refresh command would be used in your browser address bar, but you say you already did this, right?

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