adding flight data template to test output from the database, adjusting the
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 19 Jan 2017 13:27:39 +0000 (08:27 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 19 Jan 2017 13:27:39 +0000 (08:27 -0500)
flight class file to pull from CIU instead of PLN

class_flight.php
flight-data.php [new file with mode: 0644]

index a7d5dd5..b3e9325 100644 (file)
@@ -61,7 +61,7 @@ include_once($_SERVER['DOCUMENT_ROOT'].'/wp-config.php' );
                {
 //                     $this->toolbox = &$toolbox;
 //                     $this->DB =& $toolbox->DB;
-                       $this->airports = array('DTW'=>'Detroit Metro','PLN'=>'Pellston');
+                       $this->airports = array('DTW'=>'Detroit Metro','CIU'=>'Chippewa County');
                        $this->time_codes = array('A'=>'Actual','E'=>'Estimated','D'=>'Descision','S'=>'Scheduled','R'=>'In-range');
                }
 
@@ -133,7 +133,7 @@ include_once($_SERVER['DOCUMENT_ROOT'].'/wp-config.php' );
                function get_arr_flight_data()
                {
             global $wpdb;
-                       $query = "select *, name AS airline from glm_flight, glm_airlines where flt_orig_date = current_date and flt_leg_dest = 'PLN' and glm_airlines.code = flt_airline order by cur_in_time;";
+                       $query = "select *, name AS airline from glm_flight, glm_airlines where flt_orig_date = current_date and flt_leg_dest = 'CIU' and glm_airlines.code = flt_airline order by cur_in_time;";
            
                        if( $data = $wpdb->get_results( $query, ARRAY_A ) )
                        {
@@ -150,7 +150,7 @@ include_once($_SERVER['DOCUMENT_ROOT'].'/wp-config.php' );
                function get_dep_flight_data()
                {
             global $wpdb;
-                       $query = "select *, name AS airline from glm_flight, glm_airlines where flt_orig_date = current_date and flt_leg_orig = 'PLN' and glm_airlines.code = flt_airline order by cur_dep_time;";
+                       $query = "select *, name AS airline from glm_flight, glm_airlines where flt_orig_date = current_date and flt_leg_orig = 'CIU' and glm_airlines.code = flt_airline order by cur_dep_time;";
                        if( $data = $wpdb->get_results( $query, ARRAY_A ) )
                        {
                                $this->dep_data = $data;
diff --git a/flight-data.php b/flight-data.php
new file mode 100644 (file)
index 0000000..4ff9753
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+/*
+Template Name: Flight Data Template
+*/
+?>
+<?php include 'class_flight.php'; ?>
+<?php        $flight = new glm_flight(); ?>
+<?php        $flight->get_flight_data(); ?>
+<?php get_header(); ?>
+
+    <!-- kitchensink check - delete me before going live -->
+        <div id="content-wrapper">
+    <div id="arrival" class="row">
+            <div class="small-12 columns">
+                <h1>Arrivals:</h1>
+                <?php echo $flight->build_arrivals(); ?>
+<!--
+                <table class="footable arrival">
+                    <thead>
+                        <tr>
+                            <th> From </th>
+                            <th> Flight </th>
+                            <th> Time </th>
+                            <th> Status </th>
+                        </tr>
+                    </thead>
+                        <tr>
+                            <td>DETROIT METROPOLITAN WAYNE COUNTY DETROIT, MI</td>
+                            <td>SKY WEST AIRLINES 7434</td>
+                            <td>1:10 PM Scheduled</td>
+                            <td><nobr>On Time</nobr></td>
+                        </tr>
+                        <tr>
+                            <td>DETROIT METROPOLITAN WAYNE COUNTY DETROIT, MI</td>
+                            <td>SKY WEST AIRLINES 7364</td>
+                            <td>8:59 PM Scheduled</td>
+                            <td><nobr>On Time</nobr></td>
+                        </tr>
+                </table>
+-->
+            </div>
+        </div>
+        <div id="depart" class="row">
+            <div class="small-12 columns">
+                <h1>Departures:</h1>
+                <?php echo $flight->build_departures(); ?>
+<!--
+                <table class="footable departure">
+                    <thead>
+                        <tr>
+                            <th> From </th>
+                            <th> Flight </th>
+                            <th> Time </th>
+                            <th> Status </th>
+                        </tr>
+                    </thead>
+                       <tr>
+                            <td>DETROIT METROPOLITAN WAYNE COUNTY DETROIT, MI</td>
+                            <td>SKY WEST AIRLINES<br>7411</td>
+                            <td>6:50 AM Actual</td>
+                            <td><nobr>Departed</nobr></td>
+                      </tr>
+                </table>
+-->
+                <?php echo $flight->last_updated; ?>
+            </div>
+        </div>  
+        </div>
+<?php get_footer(); ?>
\ No newline at end of file