CrashGordon Posted May 12, 2010 Author Report Posted May 12, 2010 Lucas, Unless I misunderstand things, the current code gets the time from your host's server, however, if the time can be manipulated (as it currently is at midnight), it should be possible. I'm looking for a way to set it to UTC. Quote
Alex Posted May 17, 2010 Report Posted May 17, 2010 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 Quote
Guest lorathon Posted May 17, 2010 Report Posted May 17, 2010 You should be able to set the server time through the php.ini file I set ours to ZULU using the following inside of the php.ini date.timezone = "ZULU" Additional options at http://php.net/timezones Quote
CrashGordon Posted May 17, 2010 Author Report Posted May 17, 2010 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'; } Quote
Alex Posted May 19, 2010 Report Posted May 19, 2010 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? Quote
CrashGordon Posted May 19, 2010 Author Report Posted May 19, 2010 There's a lot of code posted in this thread. Which were you using? Quote
Alex Posted May 20, 2010 Report Posted May 20, 2010 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>'; Quote
CrashGordon Posted May 20, 2010 Author Report Posted May 20, 2010 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. Quote
CrashGordon Posted May 20, 2010 Author Report Posted May 20, 2010 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. Quote
Alex Posted May 21, 2010 Report Posted May 21, 2010 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? Quote
CrashGordon Posted May 21, 2010 Author Report Posted May 21, 2010 Anything is possible, but I can't even get it to display more than two conditions for arrivals and departures, so I won't be the one to do it. Quote
gehatz Posted May 21, 2010 Report Posted May 21, 2010 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. Quote
CrashGordon Posted May 22, 2010 Author Report Posted May 22, 2010 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. 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. Quote
Alex Posted May 23, 2010 Report Posted May 23, 2010 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. 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. I wonder if Nabeel or Simpilot could provide some pointers as to what the correct code should be? Quote
CrashGordon Posted May 23, 2010 Author Report Posted May 23, 2010 That would be nice, but it also turns it into something other than a flight board. Quote
Alex Posted May 24, 2010 Report Posted May 24, 2010 heres "some" progress but you can see the error from the image. 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? Quote
CrashGordon Posted May 24, 2010 Author Report Posted May 24, 2010 That is because the first and second conditions are both true. In other words, equal or less than hour is also equal or less than 15 minutes. I tried adding code that made it eqal or less than an hour and equal or greater than 16 minutes, but couldn't get it to work. Quote
llju1 Posted May 24, 2010 Report Posted May 24, 2010 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 Quote
CrashGordon Posted May 24, 2010 Author Report Posted May 24, 2010 The information comes out of your schedules, not who is flying. Quote
CrashGordon Posted May 24, 2010 Author Report Posted May 24, 2010 By the way, I have been fooling around with this and now have this. This adds a new batch of work, because I must now enter more aircraft into the system so the same tail number doesn't appear twice. Quote
Moderators mark1million Posted May 24, 2010 Moderators Report Posted May 24, 2010 I have over 200 ac if you like ill put the code on my site to test for you Good work btw. Quote
CrashGordon Posted May 25, 2010 Author Report Posted May 25, 2010 I just wish there were an easy way to enter multiple aircraft with a list of tail numbers, at the same time, instead of having to enter all the data for each. But, I'm nowhere near proficient enough a coder to cobble that together. Quote
Guest lorathon Posted May 25, 2010 Report Posted May 25, 2010 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 Quote
CrashGordon Posted May 25, 2010 Author Report Posted May 25, 2010 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;} Quote
Alex Posted May 25, 2010 Report Posted May 25, 2010 Just wondering if the "elseif" command would work to get the exra "landed" or "holding" string? Quote
CrashGordon Posted May 26, 2010 Author Report Posted May 26, 2010 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. Quote
Alex Posted May 27, 2010 Report Posted May 27, 2010 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. Quote
CrashGordon Posted May 27, 2010 Author Report Posted May 27, 2010 I'll give it a try. Unfortunately, that produces Proceed to GateScheduled to Depart On time Quote
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.