Jump to content

Recommended Posts

  • 9 months later...
  • Administrators
Posted (edited)

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
  • Administrators
Posted (edited)

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
Posted

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?

  • Administrators
Posted
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?

  • Administrators
Posted (edited)
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
Posted

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

 

  • Administrators
Posted

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
  • 1 month later...
Posted
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

  • 7 months later...
Posted

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.

 

  • Moderators
Posted

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?

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

  • 2 months later...
Posted

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.

 

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

  • 1 year later...
Posted

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

  • Administrators
Posted (edited)

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
Posted
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!

  • 1 year later...
Posted

hi!! i have o problem and i don't know how to fix it.

Top Pilots All Time section its fine and works perfect

but in the month stats , is count all the pireps with rejected and i dont want this.

one more thing in the month stats, is show me only one pilot !!

 

I find this code to forum for current moth stats  (Miles Flown) and its work perfect.

<tbody>
<?php
$dbm="SELECT t1.pilotid,t1.distance,t2.firstname,t2.lastname FROM
(SELECT
pilotid, sum(distance) as distance
FROM phpvms_pireps
WHERE date_format(submitdate, '%Y-%m') = date_format(now(), '%Y-%m') AND accepted = 1
GROUP BY pilotid) t1
LEFT JOIN phpvms_pilots t2 ON t1.pilotid = t2.pilotid
ORDER BY distance DESC LIMIT 10";
$bstm = DB::get_results($dbm);
foreach ($bstm as $btm)
{
if($bstm == '')
{
?>
<tr><td align="center" colspan="2">No Records yet!</td></tr>
<?php } else { ?>
<tr><td><?php echo $btm->lastname ;?></td><td align="center"><?php echo $btm->distance ;?> NM</td></tr>
<?php } } ?>
</tbody>

 

Can anybody help me with other two stats ? 

current moth stats  (Flights Flown) and current moth stats  (Hours Flown) with this code ??

Because this code is count only the accept pireps and show me 5 pilots, no only one and its work perfect for me.

 

thanks!!

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