Jump to content
simpilot

TOPPilot beta 1.0

Recommended Posts

I'm having two small issues.

1 - In order to get our Staff of 3 to be able to see pretty much everything they need to see, we have given them an hours total of 40000 (40k). I have been able to have them NOT show in the pilot roster using the following in '/pl/pilots_list.php - starting about line 24.

<?php
foreach($pilots as $pilot)
{
 // following to not show Staff & Retired in Pilot Roster
 if($pilot->rankid == 23)  { continue; } //staff
 if($pilot->retired == 1) { continue; }
?>

While I can use the '... rankid == 23 ...' to made staff not show in Top Pilots All Time (Hours Flown), their hours are still taken into account there - hence I only see two non-staff pilots listed out of the possible five (3 staff + 2 non-staff = 5) for that area. Is it possible to not take the staff hours into account there? I'd like to display the top 5 non-staff pilots.

 

2. Top Pilots All Time (Hours Flown) is only showing total flight hours (I'm guessing a sum of all 'hours' from the 'top_flights' table) - but that's not including transfer hours (transfer hours is set to true in local.config.php). Is there a way to add in the transfer hours? Here's the code from that section of 'tp_index.php' - starting on about line 33.

echo '<center>';
echo '<b>Top Pilots All Time </b>(Hours Flown)';
echo '<table class="profiletop">';
echo '<tr>';
echo '<th>Pilot</th>';
echo '<th>Hours Flown</th>';
echo '</tr>';
$all_hours= TopPilotData::alltime_hours(5);
foreach($all_hours as $all) {
    $pilot = PilotData::GetPilotData($all->pilotid);
    echo '<tr>';
    echo '<td>'.$pilot->firstname.' '.$pilot->lastname.' - '.PilotData::GetPilotCode($pilot->code, $pilot->pilotid).'</td>';
    echo '<td>'.$all->totalhours.'</td>';
    echo '</tr>';

I have been successful in getting totalhours and transferhours to display there together, I have NO idea on how to make the SUM of totalhours and transferhours display.

Thanks in advance for any insight!

Edited by ProAvia

Share this post


Link to post
Share on other sites

As a follow up to my post above:

1. I was able to work-around this by changing $all_hours= TopPilotData::alltime_hours(5); to $all_hours= TopPilotData::alltime_hours(8); 

This effectively gives the display 5 non-staff pilots in the list.

2. After looking through a few other files, I came across a possible solution. In the second to last code line, I changed echo .$all->totalhours.'</td>' to echo '<td>'.Util::AddTime($pilot->totalhours, $pilot->transferhours).'</td>';

Whether that's the correct way to do it or not, I don't know.

 

But I did find another issue..... In #1 - the list from high to low is based on 'totalhours', not the SUM of 'totalhours' and 'transferhours'. As an example:

  • Pilot 1 total hours is 3360
  • Pilot 2 total hours is 4138
  • Pilot 3 total hours is 655
  • Pilot 4 total hours is 1874
  • Pilot 5 total hours is 872

I'd like the order from high to low

  • Pilot 2 - 4138
  • Pilot 1 - 3360
  • Pilot 4 - 1874
  • Pilot 5 - 872
  • Pilot 3 - 655

I attempted to place Util::AddTime($pilot->totalhours, $pilot->transferhours) - in several differing variations - in place of TopPilotData::alltime_hours  including the (8); . But it always showed an error.

 

Edited by ProAvia

Share this post


Link to post
Share on other sites

I have a small issue again. I have noticed that one pilot who is the top of the all time leaderboard is missing about 2,000 hours. On Top pilot he shows  2,327:05. On the Roster page and his signature he shows 4,196.05 which is the correct time. Any ideas whats wrong?

Share this post


Link to post
Share on other sites
14 hours ago, flyalaska said:

I have a small issue again. I have noticed that one pilot who is the top of the all time leaderboard is missing about 2,000 hours. On Top pilot he shows  2,327:05. On the Roster page and his signature he shows 4,196.05 which is the correct time. Any ideas whats wrong?

Was the missing 1869 hours equal to his transfer hours?

Share this post


Link to post
Share on other sites
1 hour ago, ProAvia said:

Was the missing 1869 hours equal to his transfer hours?

Since you mentioned it, I looked in admin. Yes he has 1869 hours transfered.

Share this post


Link to post
Share on other sites
1 hour ago, flyalaska said:

Since you mentioned it, I looked in admin. Yes he has 1869 hours transfered.

Yeah - that's the issue I had too. That column shows all time total hours (since hire or since in your phpVMS) - without adding in transfer hours.

Look at my possible work-around a few posts above. Although the result isn't sorted by hours - high to low - for combined all time hours + transfer hours. And I don't know how to sort the result from high to low.

Hoping someone chimes in with a better solution than I stumbled across.

Edited by ProAvia
clarification

Share this post


Link to post
Share on other sites

I got it working.  open TopPilotData.class.php

 

Line 58 replace

 

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

with 

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

 

Share this post


Link to post
Share on other sites

Excellent - thanks!

I had been working on that exact file - but was missing the AS totalhours part. Also added .round($all->totalhours, 2). to tp_index.php to round to two decimal places.

My TopPilotData.class.php is a little different. Here's the final result - starting on line 54

    public static function alltime_hours($howmany)
    {
        // return DB::get_results("SELECT pilotid, totalhours FROM " . TABLE_PREFIX . "pilots ORDER BY totalhours DESC LIMIT $howmany");
	return DB::get_results("SELECT pilotid, (totalhours + transferhours) AS totalhours FROM phpvms_pilots ORDER BY totalhours DESC LIMIT $howmany");
    }

 

  • Like 1

Share this post


Link to post
Share on other sites
On 4-3-2016 at 0:17 PM, aarbee said:

I wonder if there are special items in this Toppilot, because I noticed that I am missing hours of the present month,

Example: I did about 9 trips about half an hour each.

Some a bit shorter, others a bit longer.

I would expect to have 4 hours noted. But the system tells me 3. It even stays 3, after flying 2 trips of 35 minutes.

Is there another factor playing, like landing rate? I had 2 trips with a pretty high landing rate +/- 700.

Greetings RobB

I have the same problem, someone the solution for this ?

 

Thx

Kristof

Share this post


Link to post
Share on other sites

Hello Guys

after a long time without coding i need assistance on this module.

alle files are on the server and the SQL was included on the Database. Now i will show the Toppilots on the frontpage. Heres if i was maded to come up to the Site.

<?php Template::Show('tp_index.php'); ?>

when i look at the Site i will see this Error Message

 

Notice: The template file "/www/htdocs/w01501e7/lausitzair/core/templates/tp_index.php" doesn't exist in /www/htdocs/w01501e7/lausitzair/core/classes/TemplateSet.class.php on line 231

My Question: What have i to do, to display the Toppilot on the frontpage ?

Many thanks fpor your help.

 

Share this post


Link to post
Share on other sites

Could you please explain to us what would you like to display in your frontpage? Based on the template you are trying to display, it seems that you are trying to show all of the top pilot details. What is on your mind?

Share this post


Link to post
Share on other sites
1 minute ago, servetas said:

Could you please explain to us what would you like to display in your frontpage? Based on the template you are trying to display, it seems that you are trying to show all of the top pilot details. What is on your mind?

Hy

i will display the Toppilot of the Month, the Top Pilot (Hours Flown) and the Top Pilot (Miles flown)

And all 3 Things i will add in a table and will display on the frontpage.

Share this post


Link to post
Share on other sites

Anyone know how to have the module show whole hours including minutes rather than it rounding up. This is for the monthly Leaderboard. Our Top pilots hours are not matching the pilots hours for the month. I am hoping this is the reason.

 

Share this post


Link to post
Share on other sites
On 3/4/2016 at 3:17 AM, aarbee said:

I wonder if there are special items in this Toppilot, because I noticed that I am missing hours of the present month,

Example: I did about 9 trips about half an hour each.

Some a bit shorter, others a bit longer.

I would expect to have 4 hours noted. But the system tells me 3. It even stays 3, after flying 2 trips of 35 minutes.

Is there another factor playing, like landing rate? I had 2 trips with a pretty high landing rate +/- 700.

Greetings RobB

Did you ever get this fixed? I have the same issue.

Share this post


Link to post
Share on other sites

Hello Gentlemen , first of all thank you for developing this module, I have some problems

getting this error message.

 Deprecated: Non-static method TopPilotData::alltime_flights() should not be called statically, assuming $this from incompatible context in /homepages/10/d731413587/htdocs/ftv/core/templates/tp_index.php on line 23

What kind of problem is it ? If anyone experienced this before or know how to fix this , please help me.

http://flytaxiva.org/index.php/TopPilot/

Thank you very much in advance

Share this post


Link to post
Share on other sites

You will see these kinds of errors - usually when using modules that were written before phpVMS 5.5 was released. Lots of posts in the forums about this.

In ".../core/common/" open TopPilotData.class.php (use something like Notepad++ to open the file).

Change all "public function ...." to "public static function ..." . Save, re-upload to your server and see if that fixes it.

Edited by ProAvia

Share this post


Link to post
Share on other sites
1 hour ago, ProAvia said:

You will see these kinds of errors - usually when using modules that were written before phpVMS 5.5 was released. Lots of posts in the forums about this.

In ".../core/common/" open TopPilotData.class.php (use something like Notepad++ to open the file).

Change all "public function ...." to "public static function ..." . Save, re-upload to your server and see if that fixes it.

Thank you very much. This fixed all my problems. Great!

Share this post


Link to post
Share on other sites

Can you help me with how to show this Toppilot info table as a small table on my front page ? What codes do I need to do it ? 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×