Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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 pilot_stats($pilotid) {
- $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`
- WHERE landingrate < '0'
- AND pilotid = '$pilotid'
- ORDER BY landingrate DESC";
- return DB::get_results($query);
- }
- public function pilot_average($pilotid) {
- $stats = self::pilot_stats($pilotid);
- $total = 0;
- $count = 0;
- foreach ($stats as $stat)
- {
- $total = $total + $stat->landingrate;
- $count++;
- }
- $average = $total / $count;
- return $average;
- }
- public function airline_average() {
- $stats = self::get_all_stats();
- $total = 0;
- $count = 0;
- foreach ($stats as $stat)
- {
- $total = $total + $stat->landingrate;
- $count++;
- }
- $average = $total / $count;
- return $average;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement