Jump to content

<p>Using the API to filter PIREPs and Schedules</p>


Nabeel
  • Search for Schedules

    A generic find function for schedules. For parameters, and example would be

    $params = array( 
    's.depicao' => 'value',
    's.arricao' => array ('multiple', 'values'),
    );
    
    $schedules = SchedulesData::findSchedules($params);
    

    For example, from HTML post in a module, an example would be:

    $params = array( 
    's.depicao' => $this->post->depicao,
    );
    
    // The 10 will return the first 10 results found
    $schedules = SchedulesData::findSchedules($params, 10);
    

    Syntax is ('s.columnname' => 'value'), where value can be an array is multiple values, or with a SQL wildcard (%) if that's what is desired.

    Columns from the schedules table should be prefixed by 's.', the aircraft table as 'a.', so searches on related information can be done.

    You can also pass offsets ($start and $count) in order to facilitate pagination.

    /* Find any flights departing from either KJFK or LFPG
    and arriving at either KBOS or KIAD */
    $params = array(
    's.depicao' => array ('KJFK', 'LFPG'),
    's.arricao' => array ('KBOS', 'KIAD'),
    's.enabled' => 1,
    );
    
    $schedules = SchedulesData::findSchedules($params);
    
    /* Find any flights using B747-400s and departing from KJFK,
    with a flight distance of more than 100 */
    $params = array(
    'a.name' => 'B747-400',
    's.depicao' => 'KJFK',
    's.distance' => '> 100',
    );
    
    $schedules = SchedulesData::findSchedules($params);
    
    // You can then do:
    
    foreach($schedules as $sched)
    {
    echo "Flight is {$sched->code}{$sched->flightnum}";
    // do whatever else you want in here
    }
    

    Search for PIREPS

    There is a function, which works the same as above:

    $pireps = PIREPData::findPIREPS($params);
    

Using the API to filter PIREPs and Schedules


User Feedback

Recommended Comments

There are no comments to display.



Join the conversation

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

Guest
Add a comment...

×   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...