MrAmsterdam Posted November 9, 2010 Report Share Posted November 9, 2010 Go to core/common/TouchdownStatsData.class.php Add this to the file: public function get_planemd11_stats($howmany) { $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps` WHERE landingrate < '0' AND Aircraft = '2' ORDER BY landingrate DESC LIMIT $howmany"; return DB::get_results($query); } planemd11 can be edited to the plane that you would like to show. AND Aircraft = '2' the 2 can be changed to the aircraft that you would like to show. (See the phpvms_aircraft table) So in my case the MD11 has ID '2' in the 'phpvms_aircraft' table. Next, you need to add the following rules to the core/modules/Touchdownstats/TouchdownStats.php public function planemd11_landings($howmany) { $this->set('stats', TouchdownStatsData::get_planemd11_stats($howmany)); $this->show('touchdownstats/touchdownstats_index.tpl'); } Again, please make sure that the planemd11 in both rules are the changed to the same name as used in the core/common/TouchdownStatsData.class.php file. When this is done, you can use this link to view the results: yoursite/index.php/TouchdownStats/planemd11_landings/20 (and again, planemd11 needs to be the same as in the two files we have edited. DEMO: http://serious-airlines.com/index.php/pages/aircraftstatistics It's my first little project... Regards Lucas Quote Link to comment Share on other sites More sharing options...
M-Queiroz Posted November 9, 2010 Report Share Posted November 9, 2010 Ola is very good yes the more it is better either welcome Quote Link to comment Share on other sites More sharing options...
Jon Posted November 9, 2010 Report Share Posted November 9, 2010 I'd prefer it with just a page with each aircraft's tables rather than each link. Jon Quote Link to comment Share on other sites More sharing options...
MrAmsterdam Posted November 10, 2010 Author Report Share Posted November 10, 2010 I'd prefer it with just a page with each aircraft's tables rather than each link. Jon OK. I'll just post it as i got it. You can create one page yourself. Shouldn't be that hard. I'll post it tomorrow i think. Regards Lucas Quote Link to comment Share on other sites More sharing options...
crnjola Posted November 11, 2010 Report Share Posted November 11, 2010 Great !! Thanks for sharing Quote Link to comment Share on other sites More sharing options...
MrAmsterdam Posted November 12, 2010 Author Report Share Posted November 12, 2010 for all of you interested. Quote Link to comment Share on other sites More sharing options...
CPC900 Posted November 30, 2010 Report Share Posted November 30, 2010 One question??? How do you combine the stats for ONE type of aircraft, when you have multiple registrations?? For instance, I have 5 different registration for the MD11. They do NOT show up under one total, for the purpose of the landing stats?! I tried to do: public function get_planemd11_stats($howmany) { $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps` WHERE landingrate < '0' AND Aircraft = '105,106,107,108,109' ORDER BY landingrate DESC LIMIT $howmany"; return DB::get_results($query); } Under the AND Aircraft = part, but it did not like that format. Is there a way to combine the same types?? Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted November 30, 2010 Report Share Posted November 30, 2010 Personally I would add a left join and then use the aircraft icao as a filter if the aircraft icao's are the same. This should work if your icao's on all of the MD-11's are the same. public function get_icao_land_stats($icao, $howmany) { $sql = 'SELECT p.* FROM '.TABLE_PREFIX.'pireps p LEFT JOIN '.TABLE_PREFIX.'aircraft a ON a.id = p.aircraft WHERE `landingrate` < \'0\' AND `icao` = \''.$icao.'\' ORDER BY landingrate DESC LIMIT '.$howmany ; $ret = DB::get_results($sql); return $ret; } Quote Link to comment Share on other sites More sharing options...
CPC900 Posted November 30, 2010 Report Share Posted November 30, 2010 Ok, that would be great, but how do I display the individual aircraft then? I would add what you just said into the "core/common/TouchdownStatsData.class.php" correct? Then what for the "core/modules/Touchdownstats/TouchdownStats.php" section? Sorry, I get lost too easy trying to follow Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted November 30, 2010 Report Share Posted November 30, 2010 Sorry but I am not using that module. What exactly are you looking for? Quote Link to comment Share on other sites More sharing options...
CPC900 Posted November 30, 2010 Report Share Posted November 30, 2010 What was said in the above mentioned part. I have multiple MD11's, lets say, with different registrations. The code Lucas mentioned at the top of this thread works, but only shows for ONE registration of MD11, for instance; it does not lump all the MD11's into one, as I would want, to show the proper stats for all. Does that not make sense?! Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted December 1, 2010 Report Share Posted December 1, 2010 If you want all pireps for the MD11 lumped into one array then the code I wrote is what you are looking for It will return ($howmany) pireps that have the aircraft flown as ($icao) Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted December 1, 2010 Report Share Posted December 1, 2010 Example We will assume that the code I wrote is in JeffData.class.php $icao = 'MD11'; $howmany = '10'; $pireps = JeffData::get_icao_land_stats($icao, $howmany); In the above example $pireps will be filled with 10 pireps. These pireps will be the 10 with the landing rate closest to zero but less than zero. All of the pireps in the array will have been flown with an aircraft that has an icao of "MD11". It would not matter what the registration number is. So if Billy flew MD-11 NX-12345 and landed at -50.50 and Tommy flew MD-11 NX-54321 and landed at -24.34 Both of these would be in the array. Tommy's would be first in line since his landing rate is closer to zero. You may want to add to the SELECT to retrieve more of the aircraft information for your table. a.registration, a.fullname, or a.* for all Quote Link to comment Share on other sites More sharing options...
CPC900 Posted December 1, 2010 Report Share Posted December 1, 2010 Thanks Jeff, as usual. Quote Link to comment Share on other sites More sharing options...
MrAmsterdam Posted December 8, 2010 Author Report Share Posted December 8, 2010 One question??? How do you combine the stats for ONE type of aircraft, when you have multiple registrations?? For instance, I have 5 different registration for the MD11. They do NOT show up under one total, for the purpose of the landing stats?! I tried to do: public function get_planemd11_stats($howmany) { $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps` WHERE landingrate < '0' AND Aircraft = '105,106,107,108,109' ORDER BY landingrate DESC LIMIT $howmany"; return DB::get_results($query); } Under the AND Aircraft = part, but it did not like that format. Is there a way to combine the same types?? Hi guys, I saw that the above issue was already resolved... i just wanted to say that for my 737-800 i used this code: ------------- public function get_plane738_stats($howmany) { $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps` WHERE landingrate < '0' AND Aircraft = '1' OR Aircraft = '3' OR Aircraft = '8' OR Aircraft = '9' OR Aircraft = '12' ORDER BY landingrate DESC LIMIT $howmany"; return DB::get_results($query); } ------------ To answer the above question. Bye! Lucas Quote Link to comment Share on other sites More sharing options...
CPC900 Posted December 9, 2010 Report Share Posted December 9, 2010 Thanks Lucas, that is what I wanted. Now, how would I add Average Landing rate per pilot, to your code? Quote Link to comment Share on other sites More sharing options...
MrAmsterdam Posted January 4, 2011 Author Report Share Posted January 4, 2011 Thanks Lucas, that is what I wanted. Now, how would I add Average Landing rate per pilot, to your code? So sorry for the late response (almost a month!!) I think your answer is in here, thanks to Simpilot.. http://forum.phpvms.net/topic/2989-touchdownstats-10/page__st__40 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.