CPC900 Posted January 27, 2010 Report Share Posted January 27, 2010 6 - In admin/templates find and open pireps_list.tpl Find Line 51: Flight Time: <?php echo $report->flighttime; ?><br /> I am trying to install and test this module, but I don't have that line AT ALL to change. I went in order in the instructions, but don't have that line of code to edit in "Admin/Templates/pireps_list.tpl" Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted January 27, 2010 Author Administrators Report Share Posted January 27, 2010 Hey - I am guessing you are using the latest version - 2+. The module was built prior to that and is no longer needed, it has been built into the new version by Nabeel. The base phpVMS system now calculates all the info and places it in a column named landingstat in the pireps table so it just becomes a coding function to get the data and display it how you would like to on your pages. - I will be marking the thread as deprecated as well. Quote Link to comment Share on other sites More sharing options...
CPC900 Posted January 27, 2010 Report Share Posted January 27, 2010 Well, that makes sense now Quote Link to comment Share on other sites More sharing options...
TennShadow Posted February 13, 2010 Report Share Posted February 13, 2010 Hi, I'm running the latest beta on my dev site and I get the below error message immediately after I file a manual PIREP. I don't notice it any other time. Warning: Invalid argument supplied for foreach() in /home/www/dev.flypatriotva.com/core/common/LandingstatsData.class.php on line 23 BTW, the landing stats module works fine otherwise. Any ideas on how to correct? Thanks, Keith Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted February 14, 2010 Author Administrators Report Share Posted February 14, 2010 That is an odd error as the foreach is actually back on line 20 in my version.... Have you modified the file at all, or maybe has it gotten corrupted? The other side is in using the latest version you do not really need this module anymore. The code was built into the system by Nabeel and it populates a new column in the table called landingstat. Quote Link to comment Share on other sites More sharing options...
TennShadow Posted February 14, 2010 Report Share Posted February 14, 2010 Have you modified the file at all, or maybe has it gotten corrupted? Yes, the DB column name you were using was not the same as what Nabeel called it so I had to search change the name. The other side is in using the latest version you do not really need this module anymore. The code was built into the system by Nabeel and it populates a new column in the table called landingstat. See, that was confusing me when I first tried to install. Nabeel told me he only included the landing states DB info and that I still had to install the module to actually to get it to work. That is when I edited the files to match the new DB column name and everything worked. It appears that people still need to install the module as well as edit it to get it to work. From Nabeel ---It should be populating in the landingrate column. I think this addon needs to be updated.Just change instances of 'landing_stat' to 'landingrate' The addon isn't included, only the back-end data collection peice. The rest, with the front-page display, isn't. I'm not sure what tpls they are, I imagine they'd be as part of the download. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted February 21, 2010 Report Share Posted February 21, 2010 I read all of this and have tried various things and can not get a table to display. I am running the latest version. I added a page using the admin screen and then copied and pasted the code from this site on there and keep getting errors. Can someone please tell me how this is done now that it is incorporated into the main download. Thanks in advance Quote Link to comment Share on other sites More sharing options...
TennShadow Posted February 21, 2010 Report Share Posted February 21, 2010 I read all of this and have tried various things and can not get a table to display. I am running the latest version. I added a page using the admin screen and then copied and pasted the code from this site on there and keep getting errors. Can someone please tell me how this is done now that it is incorporated into the main download. Thanks in advance Have you installed the module and all the .tpl files? Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted February 21, 2010 Report Share Posted February 21, 2010 Have you installed the module and all the .tpl files? yes....i am pretty sure i have....i will recheck Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted February 21, 2010 Report Share Posted February 21, 2010 I redid it and this is the error i get Warning: Invalid argument supplied for foreach() in /home2/phoenjh5/public_html/core/pages/testing.htm on line 10 Pilot Arrival Field Aircraft Touchdown Rate Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted February 21, 2010 Report Share Posted February 21, 2010 I changed the following Landingstats.Class.php - landing_stat to landingrate lstats.tpl - landing_stat to landingrate Same error. What am I doing wrong? I must be missing something Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted February 21, 2010 Author Administrators Report Share Posted February 21, 2010 Hey Guys, Nabeel has built this function into version 2. You really do not need the module anymore, it has simply become an excercise in pulling the data created by the system and then displaying it. The first thing is, check the db and see if there are any prieps with fsacars logs. If not, then there will be no data to populate the landingrate column. If there is log data, is there any data in the landingrate column? If so, try the following. If you do want to use the existing module to use the functions for displaying the data, everywhere you see "landing_stat" in any of the files including the data class and module php file will have to be changed to "landingrate" For example in the LandingStatsData.class.php file public static function get_landingstats($howmany) { $query = "SELECT * FROM phpvms_pireps WHERE landing_stat <'0' ORDER BY landing_stat DESC LIMIT $howmany;"; return DB::get_results($query); } would change to public static function get_landingstats($howmany) { $query = "SELECT * FROM phpvms_pireps WHERE landingrate <'0' ORDER BY landingrate DESC LIMIT $howmany;"; return DB::get_results($query); } And in the lstat.tpl file $row->landing_stat would change to $row->landingrate If i can get time today I will post the new files in a new thread. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted February 21, 2010 Report Share Posted February 21, 2010 Thanks simpilot. But if you notice my post I did all of that and still ended with the same result. I checked the db and I have flights recorded with landing data and they were flown after i but in the files. I have gone over and over the code and just can't see what is wrong. Since this is incorporated in the new version can you explain how to grab the data now? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted February 21, 2010 Author Administrators Report Share Posted February 21, 2010 The above is working for me, are you sure there is anything in the landingrate column in the table? on your test page try -> <?php $test = LandingStatsData::get_landingstats(10); print_r($test); ?> and post what is displayed. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted February 21, 2010 Report Share Posted February 21, 2010 this is what i get Array ( [0] => stdClass Object ( [pirepid] => 3 [pilotid] => 3 => PVA [arricao] => KCMH [landingrate] => -645 ) ) Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted February 21, 2010 Author Administrators Report Share Posted February 21, 2010 Looks like you must only have one pirep that has any landingrate data but the function is working... You can now display the data returned by the LandingStatsData call using a foreach and some echos, maybe like -> <?php foreach($test as $row) { echo $row->landingrate; } ?> This is a very simple example but you can add any info that is coming back from the call into your data to display and format it however you would like. $row->"column you want to display" if you are using the module to display the data you need to change the lstats.tpl file to reflect this -> <center> <table> <tr> <td>Pilot ID</td> <td>Arrival Field</td> <td>Touchdown Rate</td> </tr> <?php foreach ($lstats as $row) { echo '<tr><td><b>'; echo PilotData::GetPilotCode($row->code, $row->pilotid); echo '</b></td>'; echo '<td><b>'; echo $row->arricao; echo '</b></td><td>'; echo '<b>'; echo $row->landingrate; echo ' ft/min'; echo '</b></td></tr>'; } ?> </table> </center> Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted February 22, 2010 Report Share Posted February 22, 2010 Thank you. I figured it out. This was the problem Original Code: <?php $test = LandingStatsData::get_landingstats(10); print_r($test); ?> Modified Code: <?php $test = LandingstatsData::get_landingstats(10); print_r($test); ?> Original = LandingStatsData Modified = LandingstatsData Quote Link to comment Share on other sites More sharing options...
Artjom Posted April 13, 2010 Report Share Posted April 13, 2010 Who can I download atached file? Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted April 13, 2010 Author Administrators Report Share Posted April 13, 2010 The module is really not in use since the release of version 2.0 as the function is built into the fsacars module and deposits the stat in the database. I am not sure if the function is working with kACARS, but if it is not it probably would not be a big deal to adjust it. it is just a matter of extracting the info from the database and displaying it as you wish. Quote Link to comment Share on other sites More sharing options...
Artjom Posted April 13, 2010 Report Share Posted April 13, 2010 The module is really not in use since the release of version 2.0 as the function is built into the fsacars module and deposits the stat in the database. I am not sure if the function is working with kACARS, but if it is not it probably would not be a big deal to adjust it. it is just a matter of extracting the info from the database and displaying it as you wish. Thanks! Quote Link to comment Share on other sites More sharing options...
MrAmsterdam Posted May 3, 2010 Report Share Posted May 3, 2010 I have got the latest update installed.. but i can't find the way to get this table on my website.. www.serious-airlines.com Any help so i know where to start? :-) thanks all! Quote Link to comment Share on other sites More sharing options...
Jeff Posted May 26, 2010 Report Share Posted May 26, 2010 I have created a module to extract and display the touchdown rate for landings for pilots submitting a pirep via fsacars and looking for some active airlines to test it and give feedback. To install; 1 - Download attached folder and unzip 2 - Place the Landingstats module folder in core/modules/ 3 - Place the LandingstatsData.class.php file in core/common/ 4 - Place the lstats.tpl file in core/templates or your skin folder 5 - Use phpmyadmin (or similar) to run the landing_stats.sql file in your airline database. It will add two fields to the pireps table, stat_calculated and landing_stat 6 - In admin/templates find and open pireps_list.tpl Find Line 51: Flight Time: <?php echo $report->flighttime; ?><br /> Add a new blank line after line 51 and insert: Landing Rate: <?php echo $report->landing_stat; ?> ft/min<br /> Save file **You will have to have at least one pirep filed (of any type) after installing the module for the module to go back and calculate the landing stat for all the old pireps. From then on it will calculate the landing rate for each pirep filed and insert it into the database. You will be able to see the landing rate (for pireps filed using fsacars) in the admin panel when reviewing new pireps for approval. If you want a chart showing the best landing rates on your site you can use the other function built into Landingstats to call a table -> <?php MainController::Run('Landingstats', 'display_landingstats', '8'); ?> It will output -> The '8' in the call for the table tells it how many rows you want returned. It is set to return the best rate first and then decending through the rest so if you only call for one row, you will get only the best landing rate currently filed. *The lstats.tpl file is very basic and will need to be skinned into your template *tested with beta778 in it's current form with no issues Please let me know of any issues in your installation that you have with the module. Where is the download link for this addon? I don't see it posted, but apparently it was there at one time. 1 Quote Link to comment Share on other sites More sharing options...
MrAmsterdam Posted June 2, 2012 Report Share Posted June 2, 2012 Hey guys, this is what my LandingstatsData.class.php looks like and it works fine.... <?php //by: simpilot //www.simpilotgroup.com class LandingstatsData { public static function get_landingstats($howmany) { $query = "SELECT * FROM phpvms_pireps WHERE landingrate <'0' AND submitdate > '2012-01-01 00:00:00' 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; } public static function calculate_landingstats() { $query = "SELECT pirepid, log FROM phpvms_pireps WHERE stat_calculated='0'"; $data = DB::get_results($query); foreach($data as $pireps) { if (!$pireps->log) { $upd = "UPDATE phpvms_pireps SET stat_calculated=1 WHERE pirepid='$pireps->pirepid'"; DB::query($upd); } else { $row_info = explode('*', $pireps->log); foreach ($row_info as $row_info2) { $row_info3 = (preg_split('/\s+/', $row_info2)); if ($row_info3[1] == 'TouchDown:Rate') { $upd = "UPDATE phpvms_pireps SET stat_calculated=1 WHERE pirepid='$pireps->pirepid'"; DB::query($upd); $upd2="UPDATE phpvms_pireps SET landingrate=$row_info3[2] WHERE pirepid='$pireps->pirepid'"; DB::query($upd2); } } } } } } ?> } } ?> I would like to add a rule that shows only a few aircrafts... i have 2 helicopters in my company but i do not want to show them in the top landingrates... what should i add to do that.... ? Regards, Lucas Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted June 3, 2012 Author Administrators Report Share Posted June 3, 2012 If you are on any of the version 2 builds, including the latest stable build this module is really not needed. Nabeel built this function into the core system and the landing rate field is automatically filled in when a PIREP is submitted if it available in the log. I wrote a newer module to get the data from the database and display it. -> http://forum.phpvms....chdownstats-10/ I would start using that module and adjust the data class to ignore the aircraft id's of the helicopters in your fleet. Adding something like WHERE $aircraft->id !='1' AND WHERE $aircraft->id !='2' Quote Link to comment Share on other sites More sharing options...
mattia Posted June 3, 2012 Report Share Posted June 3, 2012 hi all, sorry but where dowload this module? thx Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted June 3, 2012 Moderators Report Share Posted June 3, 2012 It's no longer used, simpilot made a new module, link here: http://forum.phpvms.net/topic/2989-touchdownstats-10/ Quote Link to comment Share on other sites More sharing options...
mattia Posted June 3, 2012 Report Share Posted June 3, 2012 a okok thx kyle 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.