Jump to content

simpilot

Administrators
  • Posts

    2773
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by simpilot

  1. Add this to TouchdownstatsData -> 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; } Then where you want to show a pilots average do -> <?php echo 'Pilot average landing rate '.TouchdownStatsData::pilot_average('pilot#'); ?> and replace pilot# with the database id for the pilot you want to show the stat for - ie in pilot_public_profile it would be $userinfo->pilotid or for the VA's average -> <?php echo 'VA average landing rate '.TouchdownStatsData::airline_average(); ?>
  2. @maiochine To use the limit with your database table you will need to change the function within TouchdownStats.php -> This -> 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); } Needs to change to -> public function get_stats($howmany) { $query = "SELECT * FROM flights WHERE TouchDownVertSpeedFt < '0' ORDER BY TouchDownVertSpeedFt DESC LIMIT $howmany"; return DB::get_results($query); }
  3. Have you assigned the pilots to a hub? - I built in a qualifier in the index template to put the pilot at their hub if they have never filed a PIREP. $location = RealScheduleLiteData::get_pilot_location(Auth::$userinfo->pilotid); if(!$location) { $icao = Auth::$userinfo->hub; } else { $icao = $location->arricao; } Make sure that has not been modified out of your template and also check to see if the pilot has a hub assigned in the pilots table of the database.
  4. To round the number and remove the decimal use -> <p><strong>Fuel Burned (lbs.): </strong><?php echo round(StatsData::TotalFuelBurned(), 0); ?></p> As far as pax count it is pulling the load figure from each PIREP that has a flighttype of "P" -> $params = array( 'table' => TABLE_PREFIX.'pireps', 'fields' => 'SUM(`load`) as `total`', 'where' => array( 'accepted' => PIREP_ACCEPTED, 'flighttype' => 'P' ), I would check to see if your cargo flights are being recorded with the correct identifier in the flighttype column of the pireps table.
  5. instead of <?php echo PilotData::GetFieldValue($pilot->userinfo, 'Vatsim ID'); ?> try <?php echo PilotData::GetFieldValue($userinfo->pilotid, 'Vatsim ID'); ?>
  6. It is possible to do, I have the module bringing all the data back - you can extend the code to include some more stats and functions if you would like. You can do a print_r to see what is coming back in your tpl file for you to use in your stats equations.
  7. @maiochine You have me lost at this point - who's code are you using? What I supplied to you for your custom pirep system or what Jeff gave you, which would be for the native pirep system. The limited number listings will have to be modified for your custom system, but if you are using the native system with the code from Jeff what is built in to the module will work.
  8. If you downloaded the files from this thread and are running vms ver 2.x it will not run, which I believe is what you have at this point. The link to AIRMail 2.x is a few posts up on this page. Delete everything for AIRMail 1.0 and install the 2.x version.
  9. There is part of the issue - not sure why but your db has the table named readstate not read_state. It looks like when you loaded the file for some reason it removed all the underscores. These all need to be changed. Dump the table and use this. -- -------------------------------------------------------- -- -- Table structure for table `airmail` -- CREATE TABLE IF NOT EXISTS `airmail` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `who_to` varchar(20) NOT NULL, `who_from` varchar(20) NOT NULL, `date` date NOT NULL DEFAULT '0000-00-00', `time` time NOT NULL DEFAULT '00:00:00', `read_state` smallint(1) unsigned NOT NULL DEFAULT '0', `deleted_state` smallint(4) NOT NULL DEFAULT '0', `sent_state` smallint(4) NOT NULL DEFAULT '0', `subject` varchar(20) NOT NULL DEFAULT '', `message` text NOT NULL, `notam` smallint(6) NOT NULL DEFAULT '0', `sender_folder` int(11) DEFAULT '0', `reciever_folder` int(11) DEFAULT '0', PRIMARY KEY (`id`), FULLTEXT KEY `subject` (`subject`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=175 ; This is the same as the download, it is probably going to do the same thing. If it does you will need to go in the table and rename al the columns to match the sql commands above. It must be something with your db and how it is configured, or you are opening the file in an editor that does not support underscores and it is dropping them which would probably make more sense as the other table is correct with underscores.
  10. Doh! Line 79 then -> 'code' => $this->post->code, to 'code' => 'ABC', ABC being your airline prefix code.
  11. Remove the selection from your tpl file and in registration.php file find line 81 -> 'hub' => $this->post->hub, and change it to -> 'hub' => 'ICAO', using the icao of the hub you want them to be assigned to. ie - KJFK etc
  12. Turn on error reporting and see if anything shows up in the error log, also does anything else related to the database and changing it work, ie can a pilot register or file a pirep and have it inserted into the database?
  13. The use of the limited function is within the first post of this thread. TouchdownStatsData::get_stats('10') This will only fill the variable with 10 listings, you can change the 10 to whatever you would like. You can use this in your module that calls the page (prefered) or within the template itself. or quite simply call the built in page of the module -> www.yoursite.com/index.php/TouchdownStats/top_landings/10
  14. Wait - how did Jeff's code work, I thought you were using the custom PIREP system and table. If that code is working then you must be using the native format and all the other functions will work as they are, no modification is needed.
  15. Try uploading all the files again and be sure everything is in the correct path as it is structured in the download.
  16. If there are no errors being shown my guess at this point would be a corrupted file or something. Hard to tell without access. It seems that the files are in the proper tree as they show on your site and the database seems correct. What version of phpvms are you running?
  17. Your PIREP system does not record pilotid or the aircraft id so you are not going to be able to use the native phpVMS functions for callsigns and getting aircraft data from the db. Without having a db in front of me to work with it looks like the best you may do is something like this -> <?php foreach($stats as $stat) { echo '<tr>'; echo '<td>'.$stat->PilotName.'</td>'; echo '<td>'.$stat->AircraftName.'</td>'; echo '<td>'.$stat->ArrivalIcaoName.'</td>'; echo '<td>'.$stat->TouchDownVertSpeedFt.'</td>'; echo '<td>'.$stat->datestamp.'</td>'; echo '</tr>'; } ?> also, how do you get a landing rate of +63 ft/min thats taking off isnt it? lol
  18. Post a shot of the database with the tables and structure.
  19. Has anyone sent you a message?
  20. simpilot

    Airport Tables

    flights to or from? If Adamm approves I can extend the code a bit...
  21. No, you should not have to run the update if it is a new install. Have you checked the db to see if the airmail tables do actually exsist?
  22. My mistake on this-> Config::Get('RUN_MODULE') should be-> MainController::$activeModule
  23. The easiest way is to open up your db using phpmyadmin, or similar, and use the built in import function in the tabs across the top to import the file into your database from there, it will create everything automatically at that point.
  24. You can add a WHERE statement to the sql call to only pull data that matches the month you want. something like -> public function get_all_stats($month) { $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps` WHERE landingrate < '0' AND MONTH(submitdate) = '$month' ORDER BY landingrate DESC"; return DB::get_results($query); } $month would be the numerical representation of the month you want. Probably will want to name the year as well or you will get the data from that month for every year that is in the db. If I write another version I will include some monthly stats capability.
  25. @maiochine You will have to make some changes to the data class to start (TouchdownData.class.php) this -> 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); } would change to something like -> public function get_all_stats() { $query = "SELECT * FROM flights WHERE TouchDownVertSpeedFt < '0' ORDER BY TouchDownVertSpeedFt DESC"; return DB::get_results($query); } You can leave touchdownstats.php as it is and make changes to your tpl file to reflect the new db column names. For example in touchdownstats_index.tpl this-> echo '<td>'.$stat->landingrate.'</td>'; would change to -> echo '<td>'.$stat->TouchDownVertSpeedFt.'</td>'; All the other variable names will need to be changed to match the db table as well.
×
×
  • Create New...