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
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
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
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
totalFROM '.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
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>
thank you