Jump to content

TOPPilot beta 1.0


simpilot

Recommended Posts

  • Administrators

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!

Code hosted on Github - Link In Signature.

  • Like 13
Link to comment
Share on other sites

  • Administrators

Thanks Guys B)

Nice work styling the tables everyone.

Don't forget to create a free account and submit news releases about your va and your Pilots of the Month at simpilotgroup.com, we are moving up in the google ranks! :rolleyes:

Link to comment
Share on other sites

Hi,

as usually a very nice add-on ;). Just one short question: The old stats start with January 1970. Where can I edit this date & the names for the months. As we are a German airline we'd like to have the names in German, but I didn't find a way to change the names.

Once again thank you for those useful add-ons.

Kind regards

Bueno

Link to comment
Share on other sites

  • Administrators

Hi,

as usually a very nice add-on ;). Just one short question: The old stats start with January 1970. Where can I edit this date & the names for the months. As we are a German airline we'd like to have the names in German, but I didn't find a way to change the names.

Once again thank you for those useful add-ons.

Kind regards

Bueno

To change the month names to German,

Open tp_index.tpl

After the opening php tag of the file add

date_default_timezone_set('Europe/Berlin');
setlocale(LC_ALL, "de_DE", "de_DE@euro", "deu", "deu_deu", "german") ;

find around line 58

if(!$topflights) {$month = date( 'F', mktime(0, 0, 0, $today[mon])); echo 'No Pireps Filed For '.$month.' '.$today[year]; }
else {
   $month_name = date( 'F', mktime(0, 0, 0, $topflights[0]->month) );

and replace with

if(!$topflights) {$month = strftime( '%B', mktime(0, 0, 0, $today[mon])); echo 'No Pireps Filed For '.$month.' '.$today[year]; }
else {
   $month_name = strftime( '%B', mktime(0, 0, 0, $topflights[0]->month) );

find around line 136

$month_name = date( 'F', mktime(0, 0, 0, $startmonth) );

and replace with

$month_name = strftime( '%B', mktime(0, 0, 0, $startmonth) );

Save it and refresh

For the first month being Jan 1970 tells me that there is probably a pirep in your database with a submit date of 0000 00 00, as jan 1970 is the start of php/mysql time function. Look for a pirep with 0's for a submit date and fix the date, I think you will find it will correct itself at that point. B)

Link to comment
Share on other sites

You need to do some reading up on CSS to be able to apply styles to the tables. Once you get the basics sussed out in your mind, it's pretty easy to use CSS to good effect. The page is made up of tables, and the tables are split into table headers and table bodies. Each component of the table can be styled individually or collectively, by applying a style class. Here's a decent website that works through the basics of CSS, with examples:

http://www.w3schools.com/css/default.asp

There are also many other websites that offer CSS tutorials too. It's really worth getting to know CSS, as it allows you to make stylistic changes across your website very easily, with the use of a CSS stylesheet. It also helps to mess around with a stylesheet on a localhosted or live testing site, and make changes here and there to see what effect they have. That's how I got interested in CSS. I'm very far from an expert, but I do like experimenting.

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...
  • Moderators

You need to do some reading up on CSS to be able to apply styles to the tables. Once you get the basics sussed out in your mind, it's pretty easy to use CSS to good effect. The page is made up of tables, and the tables are split into table headers and table bodies. Each component of the table can be styled individually or collectively, by applying a style class. Here's a decent website that works through the basics of CSS, with examples:

http://www.w3schools.com/css/default.asp

There are also many other websites that offer CSS tutorials too. It's really worth getting to know CSS, as it allows you to make stylistic changes across your website very easily, with the use of a CSS stylesheet. It also helps to mess around with a stylesheet on a localhosted or live testing site, and make changes here and there to see what effect they have. That's how I got interested in CSS. I'm very far from an expert, but I do like experimenting.

+1 for me, guys just take the time to understand, hey im in my late 30's and i have learnt it and still am, check out that page it will help you loads http://www.w3schools.com/css/default.asp

Link to comment
Share on other sites

  • Moderators

Hi,

For some reason i have just noticed that my history stats show the same month, the only change i have made is the update to beta 2.1.910.

Clearly there have been some edits to the tpl but i removed all the added code and still get the same, any ideas on this one please?

Link to comment
Share on other sites

  • Administrators

Hi,

For some reason i have just noticed that my history stats show the same month, the only change i have made is the update to beta 2.1.910.

Clearly there have been some edits to the tpl but i removed all the added code and still get the same, any ideas on this one please?

Seemed to fix itself on my site :blink: Has your listings corrected themselves as well?

Link to comment
Share on other sites

  • 3 weeks later...

Excelent mod Simpilot, only one question, on Top Pilots All Time (Hours Flown)the code count the totalhours, in my case i have old data from the old site like tranferhours, whow can i include totalhours + transferhours.

Thanks and regards

Link to comment
Share on other sites

  • Administrators

Excelent mod Simpilot, only one question, on Top Pilots All Time (Hours Flown)the code count the totalhours, in my case i have old data from the old site like tranferhours, whow can i include totalhours + transferhours.

Thanks and regards

I will work on putting that together, should not be a big deal. I am working on my new VA this week but I should have something out by the weekend. B)

Link to comment
Share on other sites

I get this error:

Top Pilots All Time (Flights Flown)

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

Pilot Flights Flown

And also this:

Top Pilots All Time (Hours Flown)

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

Pilot Hours Flown

Line 24 is: foreach($all_flights as $all) {

Line 41 is: foreach($all_hours as $all) {

Not sure what I need to do to fix it. Here is the link to the page, if that helps:

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

Link to comment
Share on other sites

Ok, fixed the problem....

I had to change the references of : "phpvms_pireps" to my own database names (I don't use the "phpvms_" part but something else). :)

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

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