Jump to content

Recommended Posts

  • Administrators
Posted

Thank you, worked a treat.

Hope you don't mind but im going to put your group icon on my home page, i get quote a lot of traffic so hopefully you will get some of it :)

That would be great Mark B) Glad the change worked for you.

  • 2 weeks later...
Posted

TopPilot/refresh_pilot_stats did not add anything from the pireps into the top_flights database. It appears to work from in the browser although it doesn't say it imported anything. It just results in a basic template with nothing else. Not sure what to do to get the previously filed pireps into the system. Thanks, Brian.

Never mind... had to change the database.... as I read from some of the other posts... sorry for the post.

  • Moderators
Posted

Ok find this,

//current month stats
echo '<h3 align="left">Current Month Stats</h3>';
echo '<table width="100%" border="0" cellspacing="0" cellpadding="1"><tr><td width="30%" valign="top">';
echo '<center>';
$topflights = TopPilotData::top_pilot_flights($today[mon], $today[year], 10);
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) );

   echo '<b>Top Pilot for '.$month_name.' '.$topflights[0]->year.' </b><br />Flights Flown';

   echo '<table cellspacing="1" cellpadding="1" border="1">';
   echo '<tr>';
   echo '<th><div align="left">Pilot</div></th>';
   echo '<th><div align="center">Flights</div></th>';
   echo '</tr>';
foreach ($topflights as $top) {
       $pilot = PilotData::GetPilotData($top->pilot_id);
       echo '<tr>';
       echo '<td><div align="left">'.$pilot->firstname.' '.$pilot->lastname.' - '.PilotData::GetPilotCode($pilot->code, $pilot->pilotid).'</div></td>';
       echo '<td><div align="center">'.$top->flights.'</div></td>';
       echo '</tr>';
   }

   echo '</table>';
   echo '</center>';

   echo '</td><td width="30%" valign="top">';
   echo '<center>';

   //top hours flown

   $tophours = TopPilotData::top_pilot_hours($today[mon], $today[year], 10);

   echo '<b>Top Pilot for '.$month_name.' '.$tophours[0]->year.' </b><br />Hours Flown';
   echo '<table cellspacing="1" cellpadding="1" border="1">';
   echo '<tr>';
   echo '<th><div align="left">Pilot</div></th>';
   echo '<th><div align="center">Hours</div></th>';
   echo '</tr>';
   foreach ($tophours as $top) {
       $pilot = PilotData::GetPilotData($top->pilot_id);
       echo '<tr>';
       echo '<td><div align="left">'.$pilot->firstname.' '.$pilot->lastname.' - '.PilotData::GetPilotCode($pilot->code, $pilot->pilotid).'</div></td>';
       echo '<td><div align="center">'.$top->hours.'</div></td>';
       echo '</tr>';
   }
   echo '</table>';
   echo '</center>';
   echo '</td><td width="30%" valign="top">';
   echo '<center>';

   //top miles flown

   $topmiles = TopPilotData::top_pilot_miles($today[mon], $today[year], 10);

   echo '<b>Top Pilot for '.$month_name.' '.$tophours[0]->year.' </b><br />Miles Flown';
   echo '<table cellspacing="1" cellpadding="1" border="1">';
   echo '<tr>';
   echo '<th><div align="left">Pilot</div></th>';
   echo '<th><div align="center">Miles</div></th>';
   echo '</tr>';
   foreach ($topmiles as $top) {
       $pilot = PilotData::GetPilotData($top->pilot_id);
       echo '<tr>';
       echo '<td><div align="left">'.$pilot->firstname.' '.$pilot->lastname.' - '.PilotData::GetPilotCode($pilot->code, $pilot->pilotid).'</div></td>';
       echo '<td><div align="center">'.$top->miles.'</div></td>';
       echo '</tr>';
   }
   echo '</table>';

   echo '</td></tr>';

}
echo '</center></table>';
?>

and comment out this section

/*
   //top hours flown

   $tophours = TopPilotData::top_pilot_hours($today[mon], $today[year], 10);

   echo '<b>Top Pilot for '.$month_name.' '.$tophours[0]->year.' </b><br />Hours Flown';
   echo '<table cellspacing="1" cellpadding="1" border="1">';
   echo '<tr>';
   echo '<th><div align="left">Pilot</div></th>';
   echo '<th><div align="center">Hours</div></th>';
   echo '</tr>';
   foreach ($tophours as $top) {
       $pilot = PilotData::GetPilotData($top->pilot_id);
       echo '<tr>';
       echo '<td><div align="left">'.$pilot->firstname.' '.$pilot->lastname.' - '.PilotData::GetPilotCode($pilot->code, $pilot->pilotid).'</div></td>';
       echo '<td><div align="center">'.$top->hours.'</div></td>';
       echo '</tr>';
   }
   echo '</table>';
   echo '</center>';
   echo '</td><td width="30%" valign="top">';
   echo '<center>';
*/

Just like that

  • 4 weeks later...
Posted

Hi guys,

I have added top pilot to our site today, the sql database is in and has been populated, all the relevent parts have now been placed into the root core files etc.. :)

I have created a new page on the site - http://5starvirtualaviation.com/phpvms/index.php/pages/toppilotstats - where I would like the info to display.

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

but how do I do I this part, I dont have much of a clue about, php,css or much else, just managing to get by with all the great work these guys have created. :D

And got to ask, any further news on when 2 will be ready?

Posted

Thanks TAV1702

I looked at the urls, but when I instered the link nothing came up, I tried to put the link in as you said above as well but all I got was modules does not exist, checked the file and I know they are all there.

I am stumped at this time.

will have another look at it later and see what I am doing wrong.

  • Administrators
Posted

Thanks TAV1702

I looked at the urls, but when I instered the link nothing came up, I tried to put the link in as you said above as well but all I got was modules does not exist, checked the file and I know they are all there.

I am stumped at this time.

will have another look at it later and see what I am doing wrong.

You have phpvms in a sub folder named phpvms so it would be;

http://5starvirtualaviation.com/phpvms/index.php/toppilot

Like This

  • 3 weeks later...
Posted

Hey fellers, I am curious to know if it is at all remotely possible for this to keep track of all time miles flown too. I was looking and there is nothing for all time miles in PilotDataClass.php from phpVMS. Curious if it would be possible to tweak Top Pilot module to keep track instead or what.

Has anyone else pulled this off? And if so, care to share maybe? I figured since it is able to track all time hours and flights, why not miles too. That would be the cats meow! :D

  • Moderators
Posted

Stat Detail

Totals

Total Fuel Burned (kg)

49018719

Total Miles Flown

5136168

Total Aircraft

302

Total Schedules

1788

Total News Items

98

Total Pilots

768

Total Flights

9278

Total Flights Today

33

Total Flight Hours

17240.08

Total PAX Carried

1400430

Average Landing Rate

-399.43

This is a table i have in the top pilots module by Dave ffs lol thats the thread we in :lol: Its late here thats my excuse :)

Posted

Any way at all to make it pull stats for each pilot?

Like now it has 2 tables. Top Pilots All Time (Hours Flown) and Top Pilots All Time (Flights Flown) and in those it lists the pilots stats accordingly.

I am curious if we can pull the miles and make it in to an Top Pilots All Time (Miles Flown) and have it list the pilots totals like it does for the other two. ;)

And on a side note, can your table above tell the difference between actual passengers hauled and cargo hauled? Right now the stats I have on my front page are counting cargo loads as passengers too. Now that I added cargo flights, my passengers hauled has went through the roof. I posted in another thread about that though so I'll be quiet about that in this thread. :D

Posted

Well, lets see who can beat who to it. lol I am not a pro at php at all. I am in my first php class at school as we speak. So it takes me a while to come up with stuff on my own. I hate being a newbie still after 9 years of doing this kind of stuff. :blink:

  • Moderators
Posted

I had a pop earlier and yes, basically add a new sql function to Core->Common->TopPilotData.Class.php its very similar to the

   public function top_pilot_flights($month, $year, $howmany)    {
       $query = "SELECT * FROM top_flights WHERE month='$month' AND year='$year' ORDER BY flights DESC LIMIT $howmany";

       return DB::get_results($query);
   }

Function but just remove the month, and call it something else like top_pilot_flights_year get rid of the month selection and just use the year.

Posted

Well, lets see who can beat who to it. lol I am not a pro at php at all. I am in my first php class at school as we speak. So it takes me a while to come up with stuff on my own. I hate being a newbie still after 9 years of doing this kind of stuff. :blink:

Maybe not the cleanest way but this works for me ....

Add this to TopPilotData.class

public function alltime_miles ($howmany) {

$query = "SELECT pilot_id, SUM(miles)AS 'total' FROM top_flights GROUP BY pilot_id ORDER BY total DESC LIMIT $howmany";

return DB::get_results($query);

}

Then in tp_index I added ..

$all_miles= TopPilotData::alltime_miles(5);

foreach($all_miles as $all) {

$pilot = PilotData::GetPilotData($all->pilot_id);

echo '<tr>';

echo '<td align="center">'.$pilot->firstname.' '.$pilot->lastname.' - '.PilotData::GetPilotCode($pilot->code, $pilot->pilotid).'</td>';

echo '<td align="center">'.$all->total.'</td>';

echo '</tr>';

Hope this helps

  • Like 1
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

While I understand this code and I know what it does, I am kind of lost where to put it. I found the loop and table, but it is all being echo because it is inside php. Do I simply end the php from the regular stats and then add this little ditty of code here after?

  • Moderators
Posted

While I understand this code and I know what it does, I am kind of lost where to put it. I found the loop and table, but it is all being echo because it is inside php. Do I simply end the php from the regular stats and then add this little ditty of code here after?

Just replace the code at the bottom on the tpl where you can see the function to list all the dates.

Posted

Thanks mark. It took my blond haired self a minute to figure out what you guys were saying. Works a treat.

Now I know when creating a form in the action statement we can use

<?php echo $_SERVER['PHP_SELF']; ?>

which will open called info back on to the same page from which it was opened. I am curious if that is possible in this situation. I see no action at all in the form in which to use this code. The only place I see anything related is it says Home in the script.

In the end, I guess it would be sweet if I could open up historic tables UNDER the current stats instead of opening up a new page. ;)

  • 2 weeks later...
Posted

What do you mean by inital install in the instructions.

I put the files in the folder in root and than executed the query but when I direct to site/index.php/toppilot it says The module "TOPPILOT" doesn't exist!

eDIT; managed to do it but how to add a link from the menu to the 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.

Loading...
×
×
  • Create New...