Industrialshadow Posted April 10, 2012 Report Share Posted April 10, 2012 Good Evening. A little Question. I have found on a Websit a script? module? who show up the actually Departures and Arrival Picture Attached How can make anybody a module? or where can i get a code of this Quote Link to comment Share on other sites More sharing options...
mattia Posted April 10, 2012 Report Share Posted April 10, 2012 $query = "SELECT * FROM phpvms_schedules ORDER BY deptime + 0 ASC"; $list = DB::get_results($query); echo '<h3>Upcoming Departures - Current Time is '.date('G:i').'</h3>'; echo '<table width="80%" border="0">'; echo '<tr><td><b>Flight Number</b></td><td><b>Departure</b></td><td><b>Arrival</b></td><td><b>Departure Time</b></td><td><b>Aircraft</b></td><td><b>Status</b></td></tr>'; $count = 0; foreach($list as $flight) { if(date('G:i') >= '23') {$time = '0';} else {$time = date('G:i');} if(($flight->deptime + 0) > $time) { if($count < 10) { $aircraft = OperationsData::getAircraftInfo($flight->aircraft); echo '<tr><td>'.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->deptime.'</td><td>'.$aircraft->fullname.'</td>'; echo '<td>'; if(($flight->deptime - date('G:i')) <= 1) { echo 'Now Boarding'; } else { echo 'Scheduled Departure'; } echo '</td></tr>'; $count++; } } } echo '</table>'; echo '<h3>Upcoming Arrivals - Current Time is '.date('G:i').'</h3>'; echo '<table width="80%" border="0">'; echo '<tr><td><b>Flight Number</b></td><td><b>Departure</b></td><td><b>Arrival</b></td><td><b>Arrival Time</b></td><td><b>Aircraft</b></td><td><b>Status</b></td></tr>'; $count = 0; foreach($list as $flight) { if(date('G:i') >= '23') {$time = '0';} else {$time = date('G:i');} if(($flight->arrtime + 0) > $time) { if($count < 10) { $aircraft = OperationsData::getAircraftInfo($flight->aircraft); echo '<tr><td>'.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->arrtime.'</td><td>'.$aircraft->fullname.'</td>'; echo '<td>'; if(($flight->arrtime - date('G:i')) <= 1) { echo 'Arriving Soon'; } else { echo 'On Time'; } echo '</td></tr>'; $count++; } } } echo '</table>'; Quote Link to comment Share on other sites More sharing options...
Industrialshadow Posted April 10, 2012 Author Report Share Posted April 10, 2012 Hi where mut put in this code? I have tried this on my site, but i become a failure??? Can you help me a little bit more? see the picture Quote Link to comment Share on other sites More sharing options...
mseiwald Posted April 11, 2012 Report Share Posted April 11, 2012 Put.. <?php on Top of the whole code ?> below....then it works (null) Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted April 11, 2012 Moderators Report Share Posted April 11, 2012 $query = "SELECT * FROM phpvms_schedules ORDER BY deptime + 0 ASC"; $list = DB::get_results($query); echo '<h3>Upcoming Departures - Current Time is '.date('G:i').'</h3>'; echo '<table width="80%" border="0">'; echo '<tr><td><b>Flight Number</b></td><td><b>Departure</b></td><td><b>Arrival</b></td><td><b>Departure Time</b></td><td><b>Aircraft</b></td><td><b>Status</b></td></tr>'; $count = 0; foreach($list as $flight) { if(date('G:i') >= '23') {$time = '0';} else {$time = date('G:i');} if(($flight->deptime + 0) > $time) { if($count < 10) { $aircraft = OperationsData::getAircraftInfo($flight->aircraft); echo '<tr><td>'.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->deptime.'</td><td>'.$aircraft->fullname.'</td>'; echo '<td>'; if(($flight->deptime - date('G:i')) <= 1) { echo 'Now Boarding'; } else { echo 'Scheduled Departure'; } echo '</td></tr>'; $count++; } } } echo '</table>'; echo '<h3>Upcoming Arrivals - Current Time is '.date('G:i').'</h3>'; echo '<table width="80%" border="0">'; echo '<tr><td><b>Flight Number</b></td><td><b>Departure</b></td><td><b>Arrival</b></td><td><b>Arrival Time</b></td><td><b>Aircraft</b></td><td><b>Status</b></td></tr>'; $count = 0; foreach($list as $flight) { if(date('G:i') >= '23') {$time = '0';} else {$time = date('G:i');} if(($flight->arrtime + 0) > $time) { if($count < 10) { $aircraft = OperationsData::getAircraftInfo($flight->aircraft); echo '<tr><td>'.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->arrtime.'</td><td>'.$aircraft->fullname.'</td>'; echo '<td>'; if(($flight->arrtime - date('G:i')) <= 1) { echo 'Arriving Soon'; } else { echo 'On Time'; } echo '</td></tr>'; $count++; } } } echo '</table>'; Is this looking for the Bids or just picks up some random flights? Can you explain how it works? Quote Link to comment Share on other sites More sharing options...
Industrialshadow Posted April 11, 2012 Author Report Share Posted April 11, 2012 its working fine. Thanks for this code. parkho i thinks its random flights Quote Link to comment Share on other sites More sharing options...
mseiwald Posted April 11, 2012 Report Share Posted April 11, 2012 Is this looking for the Bids or just picks up some random flights? Can you explain how it works? it is supposed to show the upcoming departures and arrivals based on your schedule. So it shows all flights in your shedule sorted by dep time. However i don`t have it officially linked on my site as the times aren`t sorted correctly as you can see here: http://www.crazycreatives.com/hellenicnew/index.php/pages/actualflights there was a seperate forum topic for this thing. I just can`t find the link at the moment. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted April 11, 2012 Moderators Report Share Posted April 11, 2012 it is supposed to show the upcoming departures and arrivals based on your schedule. So it shows all flights in your shedule sorted by dep time. However i don`t have it officially linked on my site as the times aren`t sorted correctly as you can see here: http://www.crazycreatives.com/hellenicnew/index.php/pages/actualflights there was a seperate forum topic for this thing. I just can`t find the link at the moment. So! It shows all the schedules on that date? or on a time period? Cause I pasted the code in a separate page and noticed it doesn't make sense! Quote Link to comment Share on other sites More sharing options...
mseiwald Posted April 11, 2012 Report Share Posted April 11, 2012 I think it shows all flights in your schedules only sorted by dep time but it doesn't look for the days. Thats why all flights are mixed up. Most of my flights operate only on specific weekdays but this Code shows all of them every day. Also like i said for some Reason it doesn't sort the dep Times correct. (null) Quote Link to comment Share on other sites More sharing options...
mseiwald Posted April 11, 2012 Report Share Posted April 11, 2012 Btw. I think it was this topic http://forum.phpvms.net/topic/2811-request-flight-board/ (null) Quote Link to comment Share on other sites More sharing options...
animalking Posted May 30, 2012 Report Share Posted May 30, 2012 I found the problem en solved it for the expected departures, that it isn't sorted correctly. Just change the query to the following code: <?php $query = 'SELECT * FROM '.TABLE_PREFIX.'schedules ORDER BY deptime,arrtime + 0'; $list = DB::get_results($query); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.