lorlandi Posted June 15, 2010 Report Posted June 15, 2010 Hi, just a little question, wich is the code to insert into footer.tpl for show flight this month. Thanks and sorry for this kind of questions. Regards Quote
lorlandi Posted June 22, 2010 Author Report Posted June 22, 2010 Well, after some test finaly the code is working good for to show the total flights on current month, for expert this is easy but for me is a great thing, i added following code on StatsData.class on line 782. /** * Return the total number of Flights current Month * * */ public static function Totalflightsmonth() { $key = 'total_flights_month'; if($airline_code != '') { $key .= '_'.$airline_code; } $total = CodonCache::read($key); if($total === false) { $sql = 'SELECT COUNT(*) AS `total` FROM '.TABLE_PREFIX.'pireps p WHERE month(p.submitdate) = month(now()) AND year(p.submitdate) = year(now())'; $result = DB::get_row($sql); if(!$result) { $total = 0; } else { $total = $result->total; } CodonCache::write($key, $total, '15minute'); } return $total; } Best regards Quote
Rickisani Posted March 24, 2011 Report Posted March 24, 2011 Well, after some test finaly the code is working good for to show the total flights on current month, for expert this is easy but for me is a great thing, i added following code on StatsData.class on line 782. /** * Return the total number of Flights current Month * * */ public static function Totalflightsmonth() { $key = 'total_flights_month'; if($airline_code != '') { $key .= '_'.$airline_code; } $total = CodonCache::read($key); if($total === false) { $sql = 'SELECT COUNT(*) AS `total` FROM '.TABLE_PREFIX.'pireps p WHERE month(p.submitdate) = month(now()) AND year(p.submitdate) = year(now())'; $result = DB::get_row($sql); if(!$result) { $total = 0; } else { $total = $result->total; } CodonCache::write($key, $total, '15minute'); } return $total; } Best regards and how, or where will the be displayed Quote
Jeff Posted March 24, 2011 Report Posted March 24, 2011 You can add it anywhere you want to by calling it with the following: <p><strong>Flights This Month: </strong><?php echo StatsData::Totalflightsmonth(); ?></p> 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.