Jump to content

Request: Flight Board


CrashGordon

Recommended Posts

Hey guys,

is it possible to set the time + 6 hours ?

The time is set to us time and i need the dutch time... :-)

Can i adjust anything in the php code?

Regards,

Lucas

You need to contact your host administrator who will set your php time clock to your time zone. my host is in the US but i'm in the UK so initially i was +5hrs now im set to GMT on my host server.

I'm working on displaying more statuses, such as on approach, final call, etc. I'm also trying to display these based on the number of minutes before and after the current time, rather than the hour.

to break it down into minutes i used:

if(($flight->arrtime - date('G:i')) <= 1 / 60 * 15) 
               { 
               echo 'On Long Finals'; 

It seems to work fine displaying "on Long finals" when 15 minutes out

HTH

Alex

Link to comment
Share on other sites

I tried the following, butIt appears some flights are not displaying.

Try not to laugh too hard at this code.

if(($flight->arrtime - date('G:i')) <= 1 / 60 * 5)  
           	{  
           	echo 'Landed';  
       	} 
       	else 


  		if(($flight->arrtime - date('G:i')) <= 1 / 60 * 15)  
           	{  
           	echo 'On Approach';  
       	} 
       	else

  		if(($flight->arrtime - date('G:i')) <= 1 / 60 * 30)  
           	{  
           	echo 'Holding Pattern';  
       	} 
       	else 

       	{ 
           	echo 'On Time'; 
       	}

Link to comment
Share on other sites

hmmm, looking at this, it seems that whenever my clock reaches the hour mark the flight board automatically shows the next hour.

eg.

time = 1800hrs the board shows all schedules in the 1900 - 2000hrs bracket.

time = 1900hrs the board shows all schedules in the 2000 - 2100hrs bracket. so my code from above does not appear to be working. apologies.

maybe simpilot can provide the correct coding?

Link to comment
Share on other sites

This one, just added the <=1/60*15 bits

     $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

I figured out that the reason the code for more that 2 categories didn't work is because while all had a <= none contained a >=. Ttherefore only the smallest category displayed.

I'll be working on that, today.

By the way, the flightboard is an excellent way to remind me I've scheduled more than on plane to depart or arrive at the same time.:D

flightboard.jpg

Link to comment
Share on other sites

I'm sorry. I tried as best I could with my limited knowledge of PHP, but the following code for departures only displays "Scheduled departure".

    	{ 
       	$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 / 60 * 5 and ($flight->deptime - date('G:i')) >= 1 / 60 * 14)
           	{   
           	echo 'Departing';   
           	}  
           	else  


           	if(($flight->deptime - date('G:i')) <= 1 / 60 * 15 and ($flight->deptime - date('G:i')) >= 1 / 60 * 29)
           	{   
           	echo 'Boarding/Loading';   
           	}  
           	else 

           	if(($flight->deptime - date('G:i')) <= 1 / 60 * 30 and ($flight->deptime - date('G:i')) >= 1 / 60 * 45)
           	{   
           	echo 'Departing Soon';   
           	}  
           	else  

           	{  
           	echo 'Scheduled Departure';  
           	}

And the following code for Arrivals only displays "On time".

    	if(($flight->arrtime + 0) > date('G:i')) 
           	{ 
   	if($count < 15) 
   	{ 
       	$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 / 60 * 5 and ($flight->arrtime - date('G:i')) >= 1 / 60 * 14)
           	{   
           	echo 'Landed';   
           	}  
           	else  


           	if(($flight->arrtime - date('G:i')) <= 1 / 60 * 15 and ($flight->arrtime - date('G:i')) >= 1 / 60 * 29)
           	{   
           	echo 'On Approach';   
           	}  
           	else 

           	if(($flight->arrtime - date('G:i')) <= 1 / 60 * 30 and ($flight->arrtime - date('G:i')) >= 1 / 60 * 45)
           	{   
           	echo 'Holding Pattern';   
           	}  
           	else  

           	{  
           	echo 'On Time';  
           	}

It's giaving me a headache, so I'm going to take a break for a while.:rolleyes:

Link to comment
Share on other sites

Just in relation to the Flight Board. Would it be possible to have a column showing if that particular departure was bid on and by whom,If it has not been bid on then a simple "add to bids" link.That way if a pilot has a limited time schedule he can instantly see if within say the next hour any flights are available?

Link to comment
Share on other sites

So far this is turning out to be very good. I like the suggestion of Alex. I would like to see a setting within this script which would allow you to filter the flights via airport. For example if I wanted to show departures and arrivals of my va out of a specific airport only, not all the va's flights.

Link to comment
Share on other sites

If you are relying on me, to come up with the code, I feel sorry for you. I just took an hour to see if I could get it to display departures and arrivals based on departure or arrival ICAO codes. The results...well, let's not talk about that.:lol:

Originally, I was looking for nothing but front page eye candy, since all the other features already existed in the pilot center. I'm still trying to come up with code that will occasionally report a flight as delayed or cancelled. I'm not having terribly good luck with that, either.:blink:

Link to comment
Share on other sites

If you are relying on me, to come up with the code, I feel sorry for you. I just took an hour to see if I could get it to display departures and arrivals based on departure or arrival ICAO codes. The results...well, let's not talk about that.:lol:

Originally, I was looking for nothing but front page eye candy, since all the other features already existed in the pilot center. I'm still trying to come up with code that will occasionally report a flight as delayed or cancelled. I'm not having terribly good luck with that, either.:blink:

I wonder if Nabeel or Simpilot could provide some pointers as to what the correct code should be?

Link to comment
Share on other sites

heres "some" progress but you can see the error from the image.

flight.jpg

heres my relevant code.

 $query = "SELECT * FROM phpvms_schedules ORDER BY deptime + 0 ASC"; 
$list = DB::get_results($query); 
echo '<h3>Expected Departures - Current Time is '.date('G:i').'</h3>'; 
echo '<table width="90%" border="1">'; 
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 < 5) 
       { 
               $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 / 60 * 15) 
               { 
               echo 'Final Call'; 
               } 

               if(($flight->deptime - date('G:i')) <= 1) 
               { 
               echo 'Proceed to Gate'; 
               } 

  else
               { 
               echo 'Scheduled Departure'; 
               } 
               echo '</td></tr>'; 
               $count++; 
       } 
       } 
} 
echo '</table>';

echo '<h3>Expected Arrivals - Current Time is '.date('G:i').'</h3>'; 
echo '<table width="90%" border="1">'; 
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 < 5) 
       { 
               $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 / 60 * 1) 
               { 
               echo 'Landed'; 
               }

               if(($flight->arrtime - date('G:i')) <= 1 / 60 * 15) 
               { 
               echo 'On Approach'; 
               } 
               else 
               { 
               echo 'On Time'; 
               } 
               echo '</td></tr>'; 
               $count++; 
       } 
       } 
} 
echo '</table>';  

you can see that the final call and proceed to gate messages are displayed at the same time as does landed and on approach?

Link to comment
Share on other sites

Where does it get the Depart and Arrivals From. I show nothing on my site. It shows no arrivals or departure status. I just has the headers. My Pilot us Kacars to log their flights so where does it get the info to show it on ARRv and DPRT Schedules?

Any help would be nice :rolleyes:

Link to comment
Share on other sites

Guest lorathon

If you know a bit about csv fies you can create a csv and import it directly into the table in phpvms. I do this all of the time.

this is the format you need

,icao,name,fullname,registration,downloadlink,imagelink,range,weight,cruise,maxpax,maxcargo,minrank,ranklevel,enabled

example

,B737,Boeing 737-700,Boeing 737-700,N3794N,,,5510,17100,514,149,25000,3,3,1

The above is a missing the download link and image link.

Hope this helps :D

Link to comment
Share on other sites

Looks good. I will give it a try.

BTW, the code I'm currently using for the flight board is this.

	$query = "SELECT * FROM phpvms_schedules ORDER BY deptime + 0 ASC"; <BR>$list = DB::get_results($query); <BR>echo '<h3>Departures - '.date('F j, Y G:i').'</h3>'; <BR>echo '<table width="90%" border="1" bordercolor="#ffffff" bgcolor="#B6C7DB">'; <BR>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>ID</b></td><td><b>Status</b></td></tr>'; <BR>echo '<SPAN CLASS="omega_flightboard">';<BR>$count = 0; <BR>foreach($list as $flight) <BR>{ <BR>    	if(($flight->deptime + 0) > date('G:i')) <BR>	{ </P><P>    	if($count < 15)<BR>    	{ <BR>        	$aircraft = OperationsData::getAircraftInfo($flight->aircraft); <BR>        	echo '<tr><td>'.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->deptime.'</td><td>'.$aircraft->name.'</td><td>'.$aircraft->registration.'</td>'; <BR>        	echo '<td>'; <BR> <BR>    	if(($flight->deptime - date('G:i')) <= 1)<BR>            	{  <BR>            	echo '<SPAN CLASS="omega_white">Departing Soon</SPAN>';  <BR>        	} <BR>        	else <BR>         	{ <BR>            	echo 'Scheduled Departure'; <BR>        	} <BR>        	echo '</td></tr></font>'; <BR>        	$count++; <BR>    	} <BR>	} <BR>} <BR>echo '</table>';<BR>echo '</span>';<BR>echo '<h3>Arrivals - '.date('F j, Y G:i').'</h3>'; <BR>echo '<table width="90%" border="1" bordercolor="#ffffff"  bgcolor="#B6C7DB">'; <BR>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>ID</b></td><td><b>Status</b></td></tr>'; <BR>$count = 0; <BR>foreach($list as $flight) <BR>{ <BR>    	if(($flight->arrtime + 0) > date('G:i')) <BR>            	{ <BR>    	if($count < 15) <BR>    	{ <BR>        	$aircraft = OperationsData::getAircraftInfo($flight->aircraft); <BR>        	echo '<tr><td>'.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->arrtime.'</td><td>'.$aircraft->name.'</td><td>'.$aircraft->registration.'</td>'; <BR>        	echo '<td>'; </P><P>       	if(($flight->arrtime - date('G:i')) <= 1)   <BR>            	{  <BR>            	echo '<SPAN CLASS="omega_white">Arriving Soon</SPAN>';  <BR>        	} <BR>        	else <BR> <BR>        	{ <BR>            	echo 'On Time'; <BR>        	} <BR>        	echo '</td></tr>'; <BR>        	$count++; <BR>    	} <BR>	} <BR>} <BR>echo '</table>';  <BR>

Note that you'll have to replace

<SPAN CLASS="omega_white">

with your own customization. I just dropped it into styles.css as this:

.omega_white {color:#ffffff;}

Link to comment
Share on other sites

Just wondering if the "elseif" command would work to get the exra "landed" or "holding" string?

My limited understanding of PHP is that elseif does extra code only when the preceding if statement is true. If that is so, then the result would still be to display both holding and landed.

I think what has to happen is that the first if statement has to be equal or less than x minutes and more than y minutes. The second if statement is similar to the first but uses a "lower" set of minutes. Then the else statement can display "on time" or whatever else you want..

I tried that once, but don't think I did it correctly. If the roller coaster ride that the stock market has become, calms down a bit, tomorrow, I'll give it another try.

Link to comment
Share on other sites

I'm not at my normal PC at the moment but after doing some searching i will try something like this later when i get home.

if(($flight->deptime - date('G:i')) <= 1 / 60 * 15)  
               {  
               echo 'Final Call';  
               }  

               if(($flight->deptime - date('G:i')) >= 1/60*15 && $flight->deptime - date('G:i') <=1)  
               {  
               echo 'Proceed to Gate';  
               }  

              if(($flight->deptime - date('G:i')) >= 1) 
               {  
               echo 'Scheduled to Depart On time';  
               } 

If anyone has any comments before i try it feel free.

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