Jump to content

Live flight Count


lanousbh

Recommended Posts

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;

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...