TAV1702 Posted May 1, 2011 Report Posted May 1, 2011 Hi. You should read through the various pages in this thread. There is a way to make it show only the last X amount of months stats. I don't recall what page it is on though. I know for a fact it works. I use it on my site. Quote
Moderators mark1million Posted May 1, 2011 Moderators Report Posted May 1, 2011 It shouldn't be displaying since php ie 1970 lol, you can use javascript to add to a dropdown, like ^ he said, its in the forums here. http://forum.phpvms.net/topic/2225-toppilot-beta-10/page__view__findpost__p__29144 Quote
SkilledPilotA320 Posted May 9, 2011 Report Posted May 9, 2011 Warning: Invalid argument supplied for foreach() in /home1/akariyou/public_html/aivirtual/core/templates/tp_index.tpl on line 24 Warning: Invalid argument supplied for foreach() in /home1/akariyou/public_html/aivirtual/core/templates/tp_index.tpl on line 42 What is this?.. please help me! Quote
fsx Posted June 16, 2011 Report Posted June 16, 2011 hello, I have installed phpvms to have many automated, but I have seen that to obtain the best I have to use php and phpmyadmin. In the readme you write "use the file to create the table top_flights.sql needed in your sql database using phpmyadmin or similar." I understand that it is not a course in phpmyadmin but you can tell me the steps to do this, preferably with pictures? I installed the application without this step and this is the result http://www.tcaf.it/phpvms/index.php/toppilot So without pirep although flights have been made and accepted pirep thanks thanks thanks edit: SOLVED sorry Quote
Moderators Parkho Posted August 16, 2011 Moderators Report Posted August 16, 2011 Hello All I have a question. Is it possible to get the pilot of the month by landing rate? Thanks Quote
Administrators simpilot Posted August 16, 2011 Author Administrators Report Posted August 16, 2011 You could try something like this in your data class; public function get_monthly_landingrate($month, $year, $howmany) { $query = "SELECT * FROM ".TABLE_PREFIX."pireps WHERE MONTH(submitdate) = '$month' AND YEAR(submitdate) = '$year' ORDER BY landingrate DESC LIMIT '$howmany'"; return DB::get_results($query); } Just wrote this and did not test it you may have to adjust it a little. Quote
Moderators Parkho Posted August 16, 2011 Moderators Report Posted August 16, 2011 You could try something like this in your data class; public function get_monthly_landingrate($month, $year, $howmany) { $query = "SELECT * FROM ".TABLE_PREFIX."pireps WHERE MONTH(submitdate) = '$month' AND YEAR(submitdate) = '$year' ORDER BY landingrate DESC LIMIT '$howmany'"; return DB::get_results($query); } Just wrote this and did not test it you may have to adjust it a little. Thank you Simpilot Is it possible to implement this into TouchdownStats module? Cheers 1 Quote
Administrators simpilot Posted August 17, 2011 Author Administrators Report Posted August 17, 2011 You can put it in any of the data class models really, where ever you would like it. If you put it in the touchdowndata.class.php file you can then just call it in your controller or view using; <?php $variable = TouchdownStatsData::get_monthly_landingrate('month', 'year', 'howmany'); ?> Then the $variable will be filled with your array to build your table with. Quote
Moderators Parkho Posted August 17, 2011 Moderators Report Posted August 17, 2011 You can put it in any of the data class models really, where ever you would like it. If you put it in the touchdowndata.class.php file you can then just call it in your controller or view using; <?php $variable = TouchdownStatsData::get_monthly_landingrate('month', 'year', 'howmany'); ?> Then the $variable will be filled with your array to build your table with. Thanks a lot I'll give it a try see what happens. Quote
Moderators Parkho Posted August 17, 2011 Moderators Report Posted August 17, 2011 Thanks a lot I'll give it a try see what happens. Hi Simpilot ok here is what I did: 1. I added the public function to TouchDownStats.class.data 2. The I changed the code of my table to the following: <?php $stats = TouchdownStatsData::get_monthly_landingrate($month, $year, '2'); <====== Here! foreach($stats as $stat) { $pilot = PilotData::getPilotData($stat->pilotid); $aircraft = OperationsData::getAircraftInfo($stat->aircraft); echo '<tr>'; echo '<td align="center">'.$pilot->firstname.' '.$pilot->lastname.'</td>'; echo '<td align="center">'.$aircraft->name.'</td>'; echo '<td align="center"><font color="red">'.$stat->landingrate.' ft/m</font></td>'; echo '</tr>'; } ?> But I get this error: Warning: Invalid argument supplied for foreach() in /home/alvandai/domains/alvandair.com/public_html/lib/skins/aqua/frontpage_main.tpl on line 204 and the table is empty. I don't know where I'm doing it wrong! Quote
Administrators simpilot Posted August 17, 2011 Author Administrators Report Posted August 17, 2011 Are you passing the month and year to the $month and $year variables? If so, are there any PIREPS with landing rates for the month and year you are passing? Quote
Moderators Parkho Posted August 18, 2011 Moderators Report Posted August 18, 2011 Are you passing the month and year to the $month and $year variables? If so, are there any PIREPS with landing rates for the month and year you are passing? Well I just added the function to the Class and called it in my .tpl, does it mean that I have to assign the month and the year in the module? Quote
Administrators simpilot Posted August 20, 2011 Author Administrators Report Posted August 20, 2011 When you call it in your template, you will need to assign data to the $month and $year variable -> ie '8', '2011' Quote
Moderators Parkho Posted August 20, 2011 Moderators Report Posted August 20, 2011 When you call it in your template, you will need to assign data to the $month and $year variable -> ie '8', '2011' Ok thanks I'll see what i can do. Quote
Moderators mark1million Posted August 20, 2011 Moderators Report Posted August 20, 2011 As an example i display then using the current month in php so, Template Code <h3>Top 10 Landings for <?php echo date("F Y");?></h3> <?php MainController::Run('TouchdownStats', 'top_landing_this_month'); ?><br /> Module code //added By Mark Grant 03-02-2011 public function get_stats_by_cur_month () { $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps` WHERE landingrate < '0' AND MONTH(submitdate)=MONTH(now()) AND YEAR(submitdate)=YEAR(now()) ORDER BY landingrate DESC LIMIT 10"; return DB::get_results($query); } Quote
Sham Posted August 31, 2011 Report Posted August 31, 2011 Hello All... I searched the forum for a reply...guess i was not able to find it... I get the following error: Warning: Invalid argument supplied for foreach() in ..../public_html/PIREP/core/templates/tp_index.tpl when i go to ..../PIREP/index.php/TopPilot Any suggestions much appreciated Thank you Quote
Administrators simpilot Posted September 1, 2011 Author Administrators Report Posted September 1, 2011 It could be a couple of things. - Did you rn the function to populate the table with data initially? - Are any of your pireps recorded using an ACARS client? It will not calculate manual PIREPs. Quote
Sham Posted September 2, 2011 Report Posted September 2, 2011 It could be a couple of things. - Did you rn the function to populate the table with data initially? - Are any of your pireps recorded using an ACARS client? It will not calculate manual PIREPs. Thank you for your reply... I guess since i am not using this php for FG, i am not using ACARS, It is more of manual PIREPs. As such i guess that is why it did not work. Thank you for your replies http://www.cresdernixrof.com/PIREP cheers Quote
Tylor Eddy Posted September 16, 2011 Report Posted September 16, 2011 G'day Simpilot, I can't get this module to populate the table withing my database, im using phpvms v2.1.934 When i go to (mysite Qantas VA)/index.php/TopPilot/refresh_pilot_stats, it just shoes a blank page, i seen that this was initially created for 2.0.874, is that the reason it isn't working? If that's the case, how's v2.0 coming along Cheers Tylor Quote
Administrators simpilot Posted September 16, 2011 Author Administrators Report Posted September 16, 2011 All you should get when you refresh the stats is a blank page, all it is doing is populating the database. When you go back to the top pilot index the data should be showing as long as their are ACARS submitted PIREPs in the database. Quote
Tylor Eddy Posted September 16, 2011 Report Posted September 16, 2011 G'day Simpilot, Ok i found the problem, i have custom database names, so i needed to redirect it to them, now i am having trouble displaying info, i want to display the top 5 pilots with the greatest number of hours for a month i have this, but am sure the syntax is wrong <?php echo TopPilotData::top_pilot_flights(08, 2011, 5) ?> my other question. Is it possible to have automatically start display statistics for the previous month, so i don't have to go in and change it every month, i am aiming of showing the previous month's stats. Thanks Tylor Quote
PIAS2011 Posted October 9, 2011 Report Posted October 9, 2011 2.0 coming along Hi When is this version coming ? Thanks Quote
PIAS2011 Posted October 9, 2011 Report Posted October 9, 2011 getting this error Warning: Invalid argument supplied for foreach() in /****/*****/*******/******/core/templates/tp_index.tpl on line 24 Warning: Invalid argument supplied for foreach() in /****/*****/*******/******/core/templates/tp_index.tpl on line 41 Quote
PIAS2011 Posted October 11, 2011 Report Posted October 11, 2011 bump please someone kindly respond to my error that i am receiving. Quote
Moderators mark1million Posted October 11, 2011 Moderators Report Posted October 11, 2011 Have you got any data? that error usually happens when there are no pireps or its missing a required number to calculate. Quote
Administrators simpilot Posted October 11, 2011 Author Administrators Report Posted October 11, 2011 bump please someone kindly respond to my error that i am receiving. This has been addressed a number of times in this thread. Some possibilities include; Did you run the script to populate the table as in the directions? Do you have any PIREPS recorded in the database? Did you install the new mysql table in your database? Quote
PIAS2011 Posted October 11, 2011 Report Posted October 11, 2011 This has been addressed a number of times in this thread. Some possibilities include; Did you run the script to populate the table as in the directions? Do you have any PIREPS recorded in the database? Did you install the new mysql table in your database? 1. YES 2. YES 3. YES But my phpvms sql has a different prefix Quote
Moderators mark1million Posted October 11, 2011 Moderators Report Posted October 11, 2011 Then if that is the problem you will need to edit the following to your prefix, Core Common TopPilotData.class.php Look at the top and change, FROM phpvms_pireps to your prefix or for a universal fix, FROM `" . TABLE_PREFIX . <?php //by:simpilot //www.simpilotgroup.com class TopPilotData extends CodonData $query = "SELECT * FROM phpvms_pireps { public function get_monthly_stats($month, $year) { $query = "SELECT * FROM phpvms_pireps WHERE MONTH(submitdate) = '$month' AND YEAR(submitdate) = '$year'"; return DB::get_results($query); } public function record_stats($pilot_id, $totalflights, $totaltime, $totalmiles, $startmonth, $startyear) { $query = "INSERT INTO top_flights (pilot_id, flights, hours, miles, month, year) VALUES('$pilot_id', '$totalflights', '$totaltime', '$totalmiles', '$startmonth', '$startyear')"; DB::query($query); } public function clear_table() { $query = "TRUNCATE TABLE top_flights"; DB::query($query); } public function top_pilot_flights($month, $year, $howmany) { $query = "SELECT * FROM top_flights WHERE month='$month' AND year='$year' ORDER BY flights DESC LIMIT $howmany"; return DB::get_results($query); } public function top_pilot_hours($month, $year, $howmany) { $query = "SELECT * FROM top_flights WHERE month='$month' AND year='$year' ORDER BY hours DESC LIMIT $howmany"; return DB::get_results($query); } public function top_pilot_miles($month, $year, $howmany) { $query = "SELECT * FROM top_flights WHERE month='$month' AND year='$year' ORDER BY miles DESC LIMIT $howmany"; return DB::get_results($query); } public function alltime_flights ($howmany) { $query = "SELECT pilotid, totalflights FROM phpvms_pilots ORDER BY totalflights DESC LIMIT $howmany"; return DB::get_results($query); } public function alltime_hours ($howmany) { $query = "SELECT pilotid, totalhours FROM phpvms_pilots ORDER BY totalhours DESC LIMIT $howmany"; return DB::get_results($query); } } Quote
Administrators simpilot Posted October 12, 2011 Author Administrators Report Posted October 12, 2011 Still getin the same error! Did you try to populate the database again after changing the table prefix? If so, is there anything in the new top_pilots table? If there is, do a print_r or var_dump in the template for the variable and see what comes out. That will show if there is any data available and guide you on where to look for the problem. Quote
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.