Jump to content

Recommended Posts

Posted
  On 3/10/2010 at 4:02 PM, simpilot said:

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!

Hi, I have installed everything, but the current month's statistics are not published, says that I have nothing filed, how I can fix this please?

sorry for the picture in spanish, but my website is in spanish.

post-813-013699100 1288454192_thumb.png

  • 2 weeks later...
Posted
  On 11/7/2010 at 4:17 PM, simpilot said:

Do you have PIREPS filed for the month?

I have a question, the reports is filed is when are approved, or as it is cheap is archived?

and if that's not the way to archive, as it should do please?

  • Administrators
Posted
  On 11/8/2010 at 5:06 AM, El Macara said:

I have a question, the reports is filed is when are approved, or as it is cheap is archived?

and if that's not the way to archive, as it should do please?

Not exactly sure what you are asking but I think you are asking if the counts are made before or after the PIREP is accepted. The module currently counts all PIREPS that are pending or approved, the instructions and consequences are in the initial post of this thread.

  • 2 weeks later...
  • Administrators
Posted
  On 11/17/2010 at 6:13 PM, Daniel said:

http://www.pashairvirtual.co.uk/index.php/TopPilot/get_old_stats?month=10&year=2010

Would it be possible to tell me which file i can put the <div class="mcright"> to align the stats.

thanks

Daniel

I dont know much about the template you are using but you seemed to have solved it back on the 28th of October here -> http://forum.phpvms.net/topic/2225-toppilot-beta-10/page__view__findpost__p__26295

There is also some good css tutorials pointed out by other users eariler in this thread starting here -> http://forum.phpvms.net/topic/2225-toppilot-beta-10/page__view__findpost__p__14916

  • 3 weeks later...
Posted

Hi. This is a really nice addon, really usefull, congrats!

I saw someone asked to translate months to german. I would like to make the same but translating it to spanish. the code to change it to german was change 'F' to '%B'. Which is the code to translate it to spanish?

Thanks you!!

Posted

Well I am fine with English though I might consider supporting Spanish in the future. The "german" post says nothing about historical data. Somewhere it is suggested that the 1970 is because there is a PIREP with data set to 0 but I checked my database and there are no PIREP records (no flights have been filed yet).

My TopPilot table is also empty so I don't know at the moment where it gets that December 1969 as start year.

What I have done was to add this to your tp_index.tpl just before the while statement in the last part where it generates the historical data list. I don't know if it is correct because as I said, I have no pireps in my system. I just want to list the past 6 months. Now (dec. 2010) with no PIREPS I only get a single item (December 2010) listed in the historical data section.

// @DEGT Fixed problem with TopPilot returning data from 1969.
$monthsHistoryOffset = 6;	// up to 6 months back
$startyear = $today[year];
if ($today[mon] < $monthsHistoryOffset)
{
   $startyear--;
   $startmonth = 12 - $today[mon];
}

Perhaps it would be nice to make this configurable somewhere in the module. BTW is it the same to use $this->set(x,y) and Template::Set(x,y) ?

  • Administrators
Posted

The module is looking for the first filed pireps and when it does not find one it reverts back to the start of Unix time stamps which is 1/1/70, but with the 20 plus years of php experience you have previously thrown in my face I imagine you understand that. As far as supporting Spanish, that is up to you to modify, once again a veteran of your caliber should be able to accomplish this.

Posted
  On 12/9/2010 at 6:24 PM, simpilot said:

The module is looking for the first filed pireps and when it does not find one it reverts back to the start of Unix time stamps which is 1/1/70, but with the 20 plus years of php experience you have previously thrown in my face I imagine you understand that. As far as supporting Spanish, that is up to you to modify, once again a veteran of your caliber should be able to accomplish this.

Indeed! only I haven't used PHP in a long long long time (so long I do not wish to remember :-) at a time in my life I left PHP and Unix behind and was lured into the dark waters of .NET and never came back to PHP (or Linux for that matter) until now. Just trying to get my VA up & running asap without having to spend much time coding. Many years ago I used VAdmin but it was poorly coded and incomplete and ended up ditching the project after I had recruited some 5 pilots.

Anyway, thanks for the modules, they have saved me quite some time, otherwise I think I would have simply forgotten about starting a VA again. A time saver indeed. I hope to share some of my simple modules when I get my other site up again (same reasons, I hate coding these days).

  • 5 weeks later...
Posted
  On 6/1/2010 at 3:43 AM, simpilot said:

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";

Hello Dave,

I am busy with this one, but the problem is that it is orderd by totalhours instead of the the total sum of totalhours + transferhours.

How can I change?

Thank you in advange,

Regards,

Cor

  • Administrators
Posted

Something like

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

will work. You can leave the

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

on line 70 of tp_index as

echo $row->totalhours;

because the sql call will already be adding and sorting the hours for you.

Posted

Hello Dave,

It working almost. It adds the two times but then exactly. I have a total time now of 3540:99 (36:48 + 3514:51) So just a little adjustment needed and i will work like a charme.

Thank you in advange,

regards,

Cor

  • Administrators
Posted

The easiest fix would be to just round the number using number format

echo number_format($row->totalhours);

Or an equation could be written to collapse the tenths to minutes and add an hour to the total etc....

Posted

Hi ya Dave. Long time no chit chat man. Hope all is well your way. I really need to fire up MSN one of these days and say hello.

Anyhow, was just curious how 2.0 was looking in the future? I know it has been some time since you posted about it. I figure a few months was time enough to allow a friendly bump on the topic. :D Anyway, like I said, I was just curious is all.

Thanks for all the hard work you have done and do Dave. Much appreciated.

Ray

Posted

Hey Dave,

Run into a little problem. I get for hours flown a total time of 9.68 ??. What do I need to change.

Tnx,

Regards,

Cor

  • Administrators
Posted

Are you using the Util::AddTime function? I thought that was supposed to change it all to minutes. Looks like it is in tenths to me, or the addition function is off.

Posted

Hi Dave,

I haven´t change anything in the scripts. Also in the database top_flight it says 9.68. i am in the dark now :rolleyes:

Regards,

Cor

  • Administrators
Posted

Looking at the module the times are added as if they were tenths. It has been a while since I put this one together, looking at my install that must be why I round all the numbers for display. You will have to do some work to intergrate the native add time function into the module, but that would probably clear up the minutes versus tenths issue.

  • 2 weeks later...
Posted

Dave,

Found it. I have changed line 60 of toppilot.php into

  Quote
$totaltime = Util::AddTime($totaltime, $pirep->flighttime);

regards,

Cor

  • Administrators
Posted

You could replace the table and the php loop with this and it will give you a drop down with a go button;

<script type="text/javascript">
function submitForm() {
var list = document.navList.subMenu;
var page = list.options[ list.selectedIndex ].value;
if (page != "home")
window.location = page;
return false;
}
</script>

<form name="navList" onsubmit="return submitForm();">
<select name="subMenu">
<option value="home">Current Month</option>
<?php
           while ($startyear <= $today[year]):
               {
                   $month_name = date( 'F', mktime(0, 0, 0, $startmonth) );
                   echo '<option value="'.url('/TopPilot/get_old_stats?month='.$startmonth.'&year='.$startyear.'').'">'.$month_name.' - '.$startyear.'</option>';

                   //advance dates
       if ($startmonth == $today[mon] && $startyear == $today[year])
       {
           break;
       }
       if ($startmonth == 12)
       {
           $startyear++;
           $startmonth = 01;
       }
       else
       {
           $startmonth++;
                   }
           }
           endwhile;
           ?>
</select>
<input type="submit" value="Go" />
</form>

An example is at the bottom of the page here -> http://www.virtualaca.net/index.php/TopPilot

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.

×
×
  • Create New...