Jump to content

Help correct the code for the module vFleetTracker!!!


bass

Recommended Posts

vFleetTracker

I try to make so that page (indeks.tpl) shows the status of each aircraft.

- This plane is not booked

- This plane is booked

- The aircraft in flight

- You do not have access to this aircraft.

If the aircraft is free - it is possible to click and see which flight you can do it in view of what he's airport.

<?php
$data = OperationsData::getAllAircraft();
$online = ACARSData::GetACARSData();
$lastbid = ACARSData::GetACARSData();
$airports = array();
foreach(OperationsData::getAllAirports() as $aircraft) $airports[$aircraft->icao] = $aircraft;
foreach($data as $aircraft){
 if($aircraft->charter == 0) {

 if($aircraft->icao != 'SU95') continue;
$_online = false;
if($aircraft->enabled == 0 && $online)
 foreach($online as $fullname)
$fullname->aircraft == $aircraft->registration and $fullname->phasedetail != 'Arrived' and $_online = true;
$sujet = $sujet +1;
 }
 }
 foreach($data as $aircraft){ if($aircraft->icao != 'T204') continue;
 if($aircraft->charter == 0) {
$_online = false;
if($aircraft->enabled == 0 && $online)
 foreach($online as $lastbid)
$lastbid->aircraft == $aircraft->registration and $lastbid->phasedetail != 'Arrived' and $_online = true;
$bong = $bong +1;
 }
 }
 ?><div class="ras">
<table width="95%" class="tablesorter" id="tabledlist">
<thead>
<tr>
<th class="regul" colspan="11"><div align="center"><img class="le" src="<?php echo SITE_URL?>/lib/skins/red/images/H3.png" />   Авиапарк   <img class="pr" src="<?php echo SITE_URL?>/lib/skins/red/images/H3.png" /></div></th>
</tr>
<tr>
<th>Модель самолета </th>
<th>Суперджет 100</th>
<th>Ту 204-100 </th>
<th>А330</th>
<th>А321</th>
<th>А320</th>
<th>А319</th>
</tr>
</thead>
<tbody><tr class="mod">
<td align="center">Количество самолетов </td>
<td align="center"><?php echo $sujet?></td>
<td align="center"><?php echo $bong?></td>
<td align="center"><?php echo $airbigit?></td>
<td align="center"><?php echo $airmmal?></td>
<td align="center"><?php echo $airsmal?></td>
<td align="center"><?php echo $airmal?></td>
</tr>
</tbody>
</table>

<div class="park-wrap">

<div class="tt">
<div class="box_craft">
				 <img class="tt12" src="/lib/skins/red/images/craft/t204.jpg">
	 <br><br>
	 <h99 class="blue"><span class=parks>Ту 204-100 </span></h99>
	 <br><br>
	 <table class="list" width="100%">
		 <colgroup><col width="23"><col width="58"><col><col width="40"><col width="70"></colgroup>
		 <tbody><tr><td class="h"></td><td class="h">tail</td><td class="h">type</td><td class="h">now</td><td class="h">status</td></tr>
		 <?php
foreach($data as $aircraft){
if($aircraft->icao != 'T204') continue;
$_online = false;
if($aircraft->enabled == 0 && $online)
 foreach($online as $lastbid)
$lastbid->aircraft == $aircraft->registration and $lastbid->phasedetail != 'Arrived' and $_online = true;
if($aircraft->delplane == 0) { ?>
										 <tr>
				 <td class="vac_img" title="Red Wings"><img src="/lib/skins/red/images/H3.png"></td>
				 <td class="light" nowrap=""><a href="<?php echo url('/vFleetTracker/view/'.$aircraft->registration);?>" class="blue"><?php echo $aircraft->registration?></a></td>
				 <td class="light" nowrap="" align="center"><?php echo $aircraft->fullname?></td>
				 <td class="light" title="<?php echo $airports[$aircraft->now]->name.', '.$airports[$aircraft->now]->country ?>"><?php echo $aircraft->now ?></td>
				 <td class="light" nowrap="">
				 <?php
 if($aircraft->enabled == 1) {
if(Auth::LoggedIn()) { ?>
<a href="<?php echo url('/schedules?depicao='.$aircraft->now.'&ac='.$aircraft->id);?>" style="color: green;">Свободен</a>
<?php }else{ ?>
<div style="color:#FF0000;">Нет допуска </div>
<?php }
 }else {
 if($_online){ ?>
 <div style="color:royalblue;">В полете </div>
 <?php }else { ?>
<div style="color:#FF0000;">Занят</div>
<?php }
 } ?>
		 </td>
			 </tr>
			 <?php
			 }
}
 ?>
		 </tbody></table>
 </div></div>

	 <div class="tt">
<div class="box_craft">
				 <img class="tt12" src="/lib/skins/red/images/craft/ssj.jpg">
	 <br><br><h99 class="blue"><span class=parks>SSJ-100</span></h99><br><br>
	 <table class="list" width="100%">
		 <colgroup><col width="23"><col width="58"><col><col width="40"><col width="70"></colgroup>
		 <tbody><tr><td class="h"></td><td class="h">tail</td><td class="h">type</td><td class="h">now</td><td class="h">status</td></tr>
		 <?php
foreach($data as $aircraft){
if($aircraft->icao != 'SU95') continue;
$_online = false;
if($aircraft->enabled == 0 && $online)
 foreach($online as $fullname)
$fullname->aircraft == $aircraft->registration and $fullname->phasedetail != 'Arrived' and $_online = true;
?>
										 <tr>
				 <td class="vac_img" title="Red wings"><img src="/lib/skins/red/images/H3.png"></td>
				 <td class="light" nowrap=""><a href="<?php echo url('/vFleetTracker/view/'.$aircraft->registration);?>" class="blue"><?php echo $aircraft->registration?></a></td>
				 <td class="light" nowrap="" align="center"><?php echo $aircraft->fullname?></td>

 <td class="light" title="<?php echo $airports[$aircraft->now]->name.', '.$airports[$aircraft->now]->country ?>"><img src="<?php echo SITE_URL;?>/lib/images/countries/<?php echo strtolower($imgicao);?>.png" onmouseover="return overlib('<?php echo $lastlocation.' - '.$country->name.' - '.$country->country;?>');" onmouseout="return nd();"> <?php echo $lastlocation;?></td>
				 <td class="light" nowrap="">
				 <?php
 if($aircraft->enabled == 1) {
if(Auth::LoggedIn()) { ?>
<a href="<?php echo url('/schedules?depicao='.$aircraft->now.'&ac='.$aircraft->id);?>" style="color: green;">Свободен</a>
<?php }else{ ?>
<div style="color:#FF0000;">Нет допуска </div>
<?php }
 }else {
 if($_online){ ?>
 <div style="color:royalblue;">В полете </div>
 <?php }else { ?>
<div style="color:#FF0000;">Занят</div>
<?php }
 } ?>
		 </td>
			 </tr>
			 <?php
}
 ?>
		 </tbody></table>
	 </div></div>
 <table width="100%" height="21" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td> </td>
</tr>
</table> </div></div>


</div>
</div>

Link to comment
Share on other sites

As in the code to add the variable "Airplane free"?

This code is now displays "Airplane BUSY" and when the plane free, in the table there is no output.

<?php
// loop to create the column headers
$lastbids = SchedulesData::GetLatestBids();
if ($lastbids) {
foreach($lastbids as $lastbid)
{
if($lastbid->registration != $aircraft->registration)
{
$count = 0;
while ($count <= $lastbid):
$img = '--';
   $count++;
endwhile;
 }
if($lastbid->registration == $aircraft->registration)
{
$params = $lastbid->pilotid;
$pilot = PilotData::GetPilotData($params);
$pname = $pilot->firstname;
$psurname = $pilot->lastname;
$count = 0;
while ($count <= $lastbid):
$img = 'Занят';
$count++;

endwhile;
echo $img;
}
}
}
?>

Link to comment
Share on other sites

I still suffer with this code, now I have it turns out that in one cell at once shows the two values

1. Plane free

2. Aircraft busy

I can not do normal code (

2016-04-05_010450.jpg

<?php
// loop to create the column headers
$lastbids = SchedulesData::GetLatestBids();
if ($lastbids) {
foreach($lastbids as $lastbid)
{if($lastbid->registration != $aircraft->registration)
{
$params = $lastbid->pilotid;
$pilot = PilotData::GetPilotData($params);
$pname = $pilot->firstname;
$psurname = $pilot->lastname;
$count = 1;
while ($count <= $lastbid):$imges = 'Свободен';
$count++;
endwhile;
echo $imges; }
if($lastbid->registration == $aircraft->registration)
{
$params = $lastbid->pilotid;
$pilot = PilotData::GetPilotData($params);
$pname = $pilot->firstname;
$psurname = $pilot->lastname;
$count = 0;
while ($count <= $lastbid):$img = '<div style="color:#FF0000;">Занят</div>';
$count++;

endwhile;
echo $img;
}
}
}
?>

Link to comment
Share on other sites

Long sought help, and could not help me ... in a few weeks I'll make this alteration module now all works)))

It shows the free or not the aircraft.

2016-04-12_214108.jpg

And even made a list of flights that shows the status of the aircraft at the airport.

Free flight

Busy flight

Aircraft at the airport there.

What would the pilots were unable to do bet on the flight if it has no aircraft.

2016-04-12_214443.jpg

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