Jump to content

Departure and Arrival showing


Industrialshadow

Recommended Posts

 $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>'; 

Link to comment
Share on other sites

  • Moderators

 $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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators
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!

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

  • 1 month later...

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); ?>

;)

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