For other users:
Lanoush did it a different way himself but if you want to implement it into your ACARSData class you can use this.
if you want to implement it into your ACARSData you can add this to your ACARSData.class.php
public static function getLiveFlightCount($cot = '') { // make sure its not using flights that havent been updated by using cutoff time
$cutofftime = (empty($cutofftime)) ? Config::Get('ACARS_LIVE_TIME') : $cot; //ternary operator instead of if argument to reduce lines
$sql = 'SELECT COUNT(*) as total FROM ' . TABLE_PREFIX . 'acarsdata';
$sql .= ($cutofftime !== 0) ? ' WHERE DATE_SUB(NOW(), INTERVAL ' .$cutofftime .' MINUTE) <= `lastupdate`': '';
$result = DB::get_row($sql);
return $result->total;
}
then on any page you could use
echo ACARSData::getLiveFlightCount();
or you could of course add it to any of your pages as a variable in the module itself:
$this->set('liveFlightCount',ACARSData::getLiveFlightCount());
// on the page then you could do:
echo $liveFlightCount;