Jump to content

Greased Landings Box with V2


gosox116

Recommended Posts

  • Administrators

EDIT - Download removed

This function is now included in version 2.0. You can just use a sql select to gather the data out of the pireps table and then sort and display as you would like.

1. Download the attached package

2. unzip and place the files in the paths as defined in the package

3. use the landing_stats.sql file to create the two new columns in your database using phpmyadmin or similar.

4. file a pirep, manual or automated, it does not mattter, even if it is a test and you will delete it later. This will populate the DB for the first time. After the initial run of the module it will re-run each time a pirep is filed and update the listings.

5. Place the following code where you want the table to display.

<?php MainController::Run('Landingstats', 'display_landingstats', '8'); ?>

6. Done

This should produce something like this ->

top.jpg

Link to comment
Share on other sites

  • Administrators

No I did not, but I have not gotten the default landingstat to work on any of my sites yet. The column is always a zero. I looked through the PirepData and can not find the code where it should be pulling the stat out - All i see is around line 580 where it is looking for it and setting it to 0 if it is not there.... So i modified my old code to work with the newer version. I will take it down until I figure it out.

Link to comment
Share on other sites

  • Administrators

No I did not, but I have not gotten the default landingstat to work on any of my sites yet. The column is always a zero. I looked through the PirepData and can not find the code where it should be pulling the stat out - All i see is around line 580 where it is looking for it and setting it to 0 if it is not there.... So i modified my old code to work with the newer version. I will take it down until I figure it out.

It's in the individual acars connector files in core/modules/acars

Link to comment
Share on other sites

  • 2 weeks later...

I'm confused on this one.  :o

I have the code put where I want it but nothing shows up.  I see the landing rates in the pireps but none of the landingstats tpl files are included in the new release.  I'm guessing I need to download them but the attachment is gone stating that everything is included in the new release?

So, as you can see, I'm confused.  :-[ 

Link to comment
Share on other sites

What are the .tpl files called so I can find the varibles and replace them?  This is where I'm confused.  Are they included in this release or are you talking about changing the below.

Change this

<?php MainController::Run('Landingstats', 'display_landingstats', '8'); ?>

to

<?php MainController::Run('Landingrate', 'display_landingrate', '8'); ?>

Link to comment
Share on other sites

  • 4 months later...

Hiya

I would like to use the Greased Landings, but like some other noobs here I have limited knowledge of php and mysql.

I can see the downloads have been removed due to version 2 having it "pre-installed".... does the following code

<?php MainController::Run('Landingstats', 'display_landingstats', '8'); ?>
do this or is there other

coding required?

Sorry to ask a silly question but after hours of reading these postings I'm on the verge of being very confused.....

Thanks for you time

Steve

Link to comment
Share on other sites

Yep, it will. You don't get Live Map ability with FSPax.

Keith

Yeah, unfortunately, I knew that already and accounted the fact that I just completely removed the Live Map link from my site since FSPassengers is all we use anyways. I now just use google maps to show routes instead of current flights in progress.

Link to comment
Share on other sites

  • Administrators

I have

<?php MainController::Run('Landingstats', 'display_landingstats', '8'); ?>

on my frontpage.tpl But it just shows

Top Ten Landings

Pilot ID Arrival Field Touchdown Rate

0000 ft/min

so what am I missing?

Looks like you have the old LandingStats module which does not work with 2.1 without some modification. There is a link to a newer TouchdownStats module eariler in the thread that works with 2.1 B)

  • Like 1
Link to comment
Share on other sites

Looks like you have the old LandingStats module which does not work with 2.1 without some modification. There is a link to a newer TouchdownStats module eariler in the thread that works with 2.1 B)

I have found this link http://forum.phpvms....chdownstats-10/ in the earlier thread and it works for a separate Landing stats page What do I need to display it in a box on my fronpage.i.e. just to show the PID the Airport and the landing rate. :) I am sure some it must be simple to do but I am old and confused :D

I guess is how do I show in on my front page tpl like you have at Westjets?

Edited by llju1
Link to comment
Share on other sites

  • Administrators

You should be able to just use ->

<?php MainController::Run('TouchdownStats', 'top_landings', '5'); ?>

within your template and it will show the table. You can adjust the view in the touchdownstats_index.tpl file as to what/how you want to see things. B)

Link to comment
Share on other sites

You should be able to just use ->

<?php MainController::Run('TouchdownStats', 'top_landings', '5'); ?>

within your template and it will show the table. You can adjust the view in the touchdownstats_index.tpl file as to what/how you want to see things. B)

Thanks I knew it was something simple like that. I had some of it worked out but could not get it all worked out. :blink:

Again thanks

Link to comment
Share on other sites

one Last(I hope :D ) silly question. How do I sort by month or can I? I am sure that it must be a mod of these lines in the core/TouchdownStats.php

public function top_landings($howmany)  {
       $this->set('stats', TouchdownStatsData::get_stats($howmany));
       $this->show('touchdownstats/touchdownstats_index.tpl');
   }

I am sure it must be by changing the ($howmany ) to month or something. :)

Thanks in advance

Lloyd

Link to comment
Share on other sites

  • Administrators

The stats module on WestJets is actually a very modified version of the the orignal VAStatsData module I put together about a year ago. I dont think it would be wise to post that code as it is connected to other custom classes and db tables within WestJets and would be a mess.

What you could/should do is add another sql query to TouchdownStatsData.class.php to pull the unique month you want and then sort as you wish. Dont forget to add the year into the query as well, or you will have a mess when you get to looking at a month that has stats for multiple years. B)

Link to comment
Share on other sites

Ok here is what I now have on the TopPilotData.class.php.

<?php
//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full license text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/

class TouchdownStatsData extends CodonData  {

   public function get_all_stats() {
       $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`
                   WHERE landingrate < '0'
                   ORDER BY landingrate DESC";

       return DB::get_results($query);
   }

    public function get_stats($howmany) {
       $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`
                   WHERE landingrate < '0'
                   ORDER BY landingrate DESC
                   LIMIT $howmany";

       return DB::get_results($query);
   }
public function get_stats($month,$year) {
       $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`
                   WHERE landingrate < '0'
                   ORDER BY landingrate DESC
                   LIMIT $month,$year";

       return DB::get_results($query);
   }



}

And on the TouchdownStats.php I have this.

<?php
//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full license text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/

class TouchdownStats extends CodonModule {

   public function index() {
       $this->set('stats', TouchdownStatsData::get_all_stats());
       $this->show('touchdownstats/touchdownstats_index.tpl');
   }

   public function top_landings($howmany)  {
       $this->set('stats', TouchdownStatsData::get_stats($howmany));
       $this->show('touchdownstats/touchdownstats_index.tpl');
   }

public function top_landings($month,$year)  {
       $this->set('stats', TouchdownStatsData::get_stats($month,$year));
       $this->show('touchdownstats/touchdownstats_index.tpl');
   }

}

and I get this error. Fatal error: Cannot redeclare TouchdownStats::top_landings() in /hermes/web06b/b338/pow.llju1/htdocs/core/modules/TouchdownStats/TouchdownStats.php on line 24

so what am I doing wrong?

thanks in advance :)

Lloyd

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