Jump to content

Recommended Posts

Posted

Got it to show, but now its old flights. I want live. I had the database prefixes wrong.

I might talk over my head now, but you can try to change the "from" clause in the SQL you are using to acarsdata.

SELECT * FROM acarsdata ORDER BY deptime + 0 ASC

And see if you get any...

Perhaps also after $list = DB::get_results($query);

if (empty($list))
{
echo "No one is flying to day";
exit;
}

But you are on your own here...

Posted

What I don't understand is why people are pulling data from the schedules table in the first place. This isn't making sense, it doesn't seem to update correctly. Why wouldn't you pull it from the acarsdata table??

I tried all day and its obvious that i suck at php......

Posted

What I don't understand is why people are pulling data from the schedules table in the first place. This isn't making sense, it doesn't seem to update correctly. Why wouldn't you pull it from the acarsdata table??

I tried all day and its obvious that i suck at php......

Don't know, guess they want to see upcoming flights? I would choose from both, and perhaps even bids.

Did it work?

  • Administrators
Posted

I think this thread has gotten combined together with a thread looking for a board that shows live flights, which would come from the acars data table. This was originally a request to have a table that would display upcoming arrivals and departures fromt he schedules database.

  • 1 month later...
Posted

The php.ini file is usually located in the root folder, at least mine is :D.

I cannot seem to find this php.ini file. Does anyone know the exact location of this file?

  • 11 months later...
Posted

I bumped into this thread via google and added it. I also have the time issue and although i found my php.ini and have set the timezone to Europe/Amsterdam it still goes 2 hours ahead, while my server is in the correct timezone.

Any clues on this?

  • 5 weeks later...
Posted

Depending on what setup your host has, try going to your control panel. Look for something that says PHP Configuration. Select central php.ini to be placed in your root directory. Activate those settings. You may find the file is named php.ini.default. Edit the file by finding the time zone setting and change it to Zulu. Save the file and rename it to php.ini. Your system will then be on UTC.

I am using Fivedev but still can't find the php.ini

  • 7 months later...
Posted

Got it working to show CEST instead of EDT!! Without going into the php.ini. It iis also showing the correct time for my timezone.

<?php
date_default_timezone_set('Europe/Berlin');
$query = "SELECT * FROM phpvms_schedules ORDER BY deptime + 0 ASC";
$list = DB::get_results($query);
echo '<h3>Expected Departures - Current Time is '.date('D M j H:i:s T Y').'</h3>';

Hope this helps peeps.

THANKS!!!

  • 3 weeks later...
Posted

This is the code i'm using but nothing is showing in the status fro arrivals????

<?php

date_default_timezone_set('europe/london');

$query = "SELECT * FROM phpvms_schedules ORDER BY deptime + 0 ASC";

$list = DB::get_results($query);

echo '<h3>Expected Departures - Current Time is '.date('D M j H:i:s T Y').'</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 < 10)

{

$aircraft = OperationsData::getAircraftInfo($flight->aircraft);

echo '<tr><td>'.$flight->code.$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')) <= 2 / 120 * 15)

{

echo 'Final Call';

}

if(($flight->deptime - date('G:i')) <= 2 / 120 * 30)

{

echo 'Boarding';

}

if(($flight->deptime - date('G:i')) <= 2)

{

echo 'Check-In open';

}

else

{

echo '';

}

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 < 10)

{

$aircraft = OperationsData::getAircraftInfo($flight->aircraft);

echo '<tr><td>'.$flight->code.$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 Time';

}

echo '</td></tr>';

$count++;

}

}

}

echo '</table>';

?>

  • 1 month later...
Posted

How do I add to this so it only displays flights that fly on the day?

Also, my statuses weirdly are not working. It just always says 'On Time' for Arrivals or 'Departed' as Departures.

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

               elseif(($flight->arrtime - date('G:i')) >= 1 / 60 * 10)
               {
                   echo 'Landing';
               }

               elseif(($flight->arrtime - date('G:i')) <= 10)
               {
                   echo 'On Time';
               }

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

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

               elseif(($flight->deptime - date('G:i')) <= 1 / 60 * 25)
               {
                   echo 'Boarding';
               }

               elseif(($flight->deptime - date('G:i')) <= 2)
               {
                   echo 'Check In Open';
               }

               else
               {
                   echo 'Scheduled Departure';
               } 

  • 2 weeks later...
Posted

Hi, i dont understand the install instrucctions, Can someone help me please?

I make a .txt, paste the code and after change de .txt extension by .php extension, after i copy the code in a new page, in phpvms, and up the file .php that i did in hosting, but i have a error.

http://www.argavirtual.xtrweb.com/core/modules/Schedules/Schedules%20board.php

Fatal error: Class 'DB' not found in /home/u131375289/public_html/core/modules/Schedules/Schedules board.php on line 3

<?php
$query = "SELECT * FROM phpvms_schedules ORDER BY arrtime + 0 ASC";
$list = DB::get_results($query);
echo '<h3>Upcoming Arrivals - Current Time is '.date('G:i').'</h3>';
echo '<table width="100%" border="1">';
echo '<tr><td>Departure</td><td>Arrival</td><td>Arrival Time</td><td>Aircraft</td><td>Status</td></tr>';
$count = 0;
foreach($list as $flight)
{
    if(($flight->arrtime + 0) > date('G:i'))
    {
		    if($count < 5)
		    {
				    $aircraft = OperationsData::getAircraftInfo($flight->aircraft);
				    echo '<tr><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 'In Flight';
				    }
				    echo '</td></tr>';
				    $count++;
		    }
    }
}
echo '</table>';
?>
  • 3 weeks later...
  • Moderators
Posted

Here is how it works my way:

1. Create a class file like GetSchedules.class.php and paste the following in there and save it. Then upload into your core/common folder:

<?php
class GetSchedules extends CodonData
{
    publicfunction getscheds()
	 {
          $sql = SELECT * FROM phpvms_schedules ORDER BY arrtime + 0 ASC";
          return DB::get_results($sql);
	 }
}
?>

2. Use a table where you want to show the pulled out data like this:

<?php
$list = GetSchedules::getscheds();
?>
Upcoming Arrivals - Current Time is <?php echo date('G:i') ;?></h3>
<table width="100%" border="1">
<tr>
<td>Departure</td>
<td>Arrival</td>
<td>Arrival Time</td>
<td>Aircraft</td>
<td>Status</td>
</tr>

<?php
$count = 0;
foreach($list as $flight)
{
if(($flight->arrtime + 0) > date('G:i'))
{
if($count < 5)
 {
$aircraft = OperationsData::getAircraftInfo($flight->aircraft);
?>
 <tr>
	 <td><?php echo $flight->depicao ;?></td>
	 <td><?php echo $flight->arricao ;?></td>
	 <td><?php echo $flight->arrtime ;?></td>
	 <td><?php echo $aircraft->fullname ;?></td>
 </tr>
 <tr>
	 <td>
	 <?php
	 if(($flight->arrtime - date('G:i')) <= 1)
	 {
		 echo 'Arriving Soon';
	 }
	 else
	 {
		 echo 'In Flight';
	 }
	 $count++;
	 ?>
	 </td>
 </tr>
 }
}
}
</table>

Posted

Here is how it works my way:

1. Create a class file like GetSchedules.class.php and paste the following in there and save it. Then upload into your core/common folder:

<?php
class GetSchedules extends CodonData
{
 publicfunction getscheds()
	 {
$sql = SELECT * FROM phpvms_schedules ORDER BY arrtime + 0 ASC";
return DB::get_results($sql);
	 }
}
?>

2. Use a table where you want to show the pulled out data like this:

<?php
$list = GetSchedules::getscheds();
?>
Upcoming Arrivals - Current Time is <?php echo date('G:i') ;?></h3>
<table width="100%" border="1">
<tr>
<td>Departure</td>
<td>Arrival</td>
<td>Arrival Time</td>
<td>Aircraft</td>
<td>Status</td>
</tr>

<?php
$count = 0;
foreach($list as $flight)
{
if(($flight->arrtime + 0) > date('G:i'))
{
if($count < 5)
 {
$aircraft = OperationsData::getAircraftInfo($flight->aircraft);
?>
 <tr>
	 <td><?php echo $flight->depicao ;?></td>
	 <td><?php echo $flight->arricao ;?></td>
	 <td><?php echo $flight->arrtime ;?></td>
	 <td><?php echo $aircraft->fullname ;?></td>
 </tr>
 <tr>
	 <td>
	 <?php
	 if(($flight->arrtime - date('G:i')) <= 1)
	 {
		 echo 'Arriving Soon';
	 }
	 else
	 {
		 echo 'In Flight';
	 }
	 $count++;
	 ?>
	 </td>
 </tr>
 }
}
}
</table>

Hi Parkho, I did that, created with notepad of windows with the first code, and after rename it as "GetSchedules.class.php" (extension included), after i uploaded to core/common folder via ftp.

The table was created in admin options "Add new page". i think i did something wrong. this is the result:

http://www.argavirtual.xtrweb.com/pruebas/index.php/pages/schedules2

  • Moderators
Posted

Small modification:

<?php
class GetSchedules extends CodonData
{
	 public function getscheds()
			 {
$sql = "SELECT * FROM phpvms_schedules ORDER BY arrtime + 0 ASC";
return DB::get_results($sql);
			 }
}
?>

The .tpl:


<?php
$list = GetSchedules::getscheds();
?>
Upcoming Arrivals - Current Time is <?php echo date('G:i') ;?></h3>
<table width="100%" border="1">
<tr>
<td>Departure</td>
<td>Arrival</td>
<td>Arrival Time</td>
<td>Aircraft</td>
<td>Status</td>
</tr>

<?php
$count = 0;
foreach($list as $flight)
{
if(($flight->arrtime + 0) > date('G:i'))
{
if($count < 5)
	 {
$aircraft = OperationsData::getAircraftInfo($flight->aircraft);
?>
	 <tr>
			 <td><?php echo $flight->depicao ;?></td>
			 <td><?php echo $flight->arricao ;?></td>
			 <td><?php echo $flight->arrtime ;?></td>
			 <td><?php echo $aircraft->fullname ;?></td>
			 <td>
			 <?php
			 if(($flight->arrtime - date('G:i')) <= 1)
			 {
					 echo 'Arriving Soon';
			 }
			 else
			 {
					 echo 'In Flight';
			 }
			 $count++;
			 ?>
			 </td>
	 </tr>
<?php
	 }
}
}
?>
</table>

Screen Shot:

res.png

  • 2 years later...
Posted

Hi,

i'have a problem with the order

my code

 public static function getscheddep() {
    $sql = "SELECT *
 FROM phpvms_schedules
 ORDER BY arrtime + 0 ASC";
 return DB::get_results($sql);
   }

The system order only the hours and not the minute.

Any suggestion?

Thanks and happy new year at all

  • 7 months later...
Posted

Hello i have includet this on my Index. But i have the Problem i dont see the Departure and Arrival Airports. I use this script

<!-- Begin Company News --> 
<div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout-wrapper layout-item-0">
<div class="art-content-layout layout-item-1">
<div class="art-content-layout-row">
<div class="art-layout-cell layout-item-2" style="width: 100%" >
<div class="art-blockheader">
<h3 class="t">Departure/Arrival Board</h3>
</div>
<div align="center">
<table align="center" width="100%" border="0">
 <tr>
   <td><?php

#
#
$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 align="center" width="90%" border="0" bgcolor="#99FF00" >';
#
		    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);
								    $depname = OperationsData::RetrieveAirportInfo($flight->depicao);
								    $arrname = OperationsData::RetrieveAirportInfo($flight->arricao);
#
								    echo '<tr><td>'.$flight->flightnum.'</td><td>'.$depname->name.'</td><td>'.$arrname->name.'</td><td>'.$flight->deptime.'</td><td>'.$aircraft->fullname.'</td>';
#
								    echo '<td>';
#
								    $minutes = explode(':', $flight->deptime);
#
								    if($minutes['0'] <= date('G')) {
#
										    if(($minutes['1'] - date('i')) <= 0) {
#
												    echo 'Departed';
#
										    }
#
										    elseif(($minutes['1'] - date('i')) <= 15 && ($minutes['1'] - date('i')) >= 1) {
#
												    echo 'Final Call';
#
										    }
#
										    elseif(($minutes['1'] - date('i')) >= 30 && ($minutes['1'] - date('i')) <= 20) {
#
												    echo 'Proceed to Gate';
#
										    }
#
										    else {
#
												    echo 'Scheduled Departure';
#
										    }
#
								    }
#
								    else {
#
										    echo 'Scheduled Departure';
#
								    }
#
								    echo '</td></tr>';
#
								    $count++;
#
						    }
#
				    }
#
		    }
#
		    echo '</table>';
#

#
		    echo '<h3>Expected Arrivals - Current Time is '.date('G:i').'</h3>';
#
		    echo '<table align="center" width="90%" border="1" bgcolor="#99FF00" >';
#
		    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);
								    $depname = OperationsData::RetrieveAirportInfo($flight->depicao);
								    $arrname = OperationsData::RetrieveAirportInfo($flight->arricao);
#
								    echo '<tr><td>'.$flight->flightnum.'</td><td>'.$depname->name.'</td><td>'.$arrname->name.'</td><td>'.$flight->arrtime.'</td><td>'.$aircraft->fullname.'</td>';
#
								    echo '<td>';
#
								    $minutes2 = explode(':', $flight->arrtime);
#
								    if($minutes2['0'] <= date('G')) {
#
										    if($minutes2['1'] - (date('i')) >= 30) {
#
												    echo 'On Time';
#
										    }
#
										    elseif(($minutes2['1'] - date('i')) >= 1 && ($minutes2['1'] - date('i')) <= 30) {
#
												    echo 'On Approach';
#
										    }
#
										    else {
#
												    echo 'Landed';
#
										    }
#

#
								    }
#
								    else {
#
										    echo 'On Time';
#
								    }
#
								    echo '</td></tr>';
#
								    $count++;
#
						    }
#
				    }
#
		    }
#
		    echo '</table>';



		    $flights = PIREPData::getRecentReportsByCount(10);																																	   
		    $string = "";
		    foreach($flights as $flight)
		    {		 
					 $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
		    }																																		 
		    ?></td>
 </tr>
</table>
<div align="center">
 <!-- End Company News -->

SO have anybody a idea to solve this Problem?

Cheers

  • 2 weeks later...
  • Members
Posted

Try this Code

<!-- Begin Company News -->
<div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout-wrapper layout-item-0">
<div class="art-content-layout layout-item-1">
<div class="art-content-layout-row">
<div class="art-layout-cell layout-item-2" style="width: 100%" >
<div class="art-blockheader">
<h3 class="t">Departure/Arrival Board</h3>
</div>
<div align="center">
<table align="center" width="100%" border="0">
 <tr>
    <td><?php
#
#
$query = "SELECT * FROM phpvmsSIM_schedules ORDER BY deptime + 0 ASC";
#
						    $list = DB::get_results($query);
#
						    echo '<h3>Expected Departures - Current Time is '.date('G:i').'</h3>';
#
						    echo '<table align="center" width="90%" border="0" bgcolor="#99FF00" >';
#
						    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);
																		    $depname = OperationsData::getAirportInfo($flight->depicao);

																		    $arrname = OperationsData::getAirportInfo($flight->arricao);
#
																		    echo '<tr><td>'.$flight->flightnum.'</td><td>'.$depname->name.'</td><td>'.$arrname->name.'</td><td>'.$flight->deptime.'</td><td>'.$aircraft->fullname.'</td>';
#
																		    echo '<td>';
#
																		    $minutes = explode(':', $flight->deptime);
#
																		    if($minutes['0'] <= date('G')) {
#
																						    if(($minutes['1'] - date('i')) <= 0) {
#
																										    echo 'Departed';
#
																						    }
#
																						    elseif(($minutes['1'] - date('i')) <= 15 && ($minutes['1'] - date('i')) >= 1) {
#
																										    echo 'Final Call';
#
																						    }
#
																						    elseif(($minutes['1'] - date('i')) >= 30 && ($minutes['1'] - date('i')) <= 20) {
#
																										    echo 'Proceed to Gate';
#
																						    }
#
																						    else {
#
																										    echo 'Scheduled Departure';
#
																						    }
#
																		    }
#
																		    else {
#
																						    echo 'Scheduled Departure';
#
																		    }
#
																		    echo '</td></tr>';
#
																		    $count++;
#
														    }
#
										    }
#
						    }
#
						    echo '</table>';
#
#
						    echo '<h3>Expected Arrivals - Current Time is '.date('G:i').'</h3>';
#
						    echo '<table align="center" width="90%" border="1" bgcolor="#99FF00" >';
#
						    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);
																		    $depname = OperationsData::getAirportInfo($flight->depicao);
																		    $arrname = OperationsData::getAirportInfo($flight->arricao);
#
																		    echo '<tr><td>'.$flight->flightnum.'</td><td>'.$depname->name.'</td><td>'.$arrname->name.'</td><td>'.$flight->arrtime.'</td><td>'.$aircraft->fullname.'</td>';
#
																		    echo '<td>';
#
																		    $minutes2 = explode(':', $flight->arrtime);
#
																		    if($minutes2['0'] <= date('G')) {
#
																						    if($minutes2['1'] - (date('i')) >= 30) {
#
																										    echo 'On Time';
#
																						    }
#
																						    elseif(($minutes2['1'] - date('i')) >= 1 && ($minutes2['1'] - date('i')) <= 30) {
#
																										    echo 'On Approach';
#
																						    }
#
																						    else {
#
																										    echo 'Landed';
#
																						    }
#
#
																		    }
#
																		    else {
#
																						    echo 'On Time';
#
																		    }
#
																		    echo '</td></tr>';
#
																		    $count++;
#
														    }
#
										    }
#
						    }
#
						    echo '</table>';



						    $flights = PIREPData::getRecentReportsByCount(10);																																																																		
						    $string = "";
						    foreach($flights as $flight)
						    {			   
											 $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
						    }																																																																			   
						    ?></td>
 </tr>
</table>
<div align="center">
 <!-- End Company News -->

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