Jump to content

Getting a pilot's last location


Nabeel

Recommended Posts

For example:

Pilot Center

<?php
$last_location = PIREPData::getLastReports($pilotcode, 1, PIREP_ACCEPTED);

echo "This pilot's last location is: {$last_location->arricao}";
?>

$pilotcode returns the pilot ID (works in pilot center only)

Pilot List (Roster)

<?php
$last_location = PIREPData::getLastReports($pilot->pilotid, 1, PIREP_ACCEPTED);

echo "This pilot's last location is: {$last_location->arricao}";
?>

$pilot->pilotid  returns the pilotid varible for the $pilot array.

Link to comment
Share on other sites

I used this after MANY trials and errors.  It was the "($pilot->pilotid, 1, PIREP_ACCEPTED);" part that was catching me.  I know it seems dumb now that I was having a real bottleneck there.  Thanks for help!

<td><?php $last_location = PIREPData::getLastReports($pilot->pilotid, 1, PIREP_ACCEPTED);

        echo $last_location->arricao;  ?></td>

Link to comment
Share on other sites

Sorry to be a pain here.

I've tried

 <?php $last_pirep = PIREPData::getLastReports($pilotcode, 1, PIREP_ACCEPTED); ?>
         <li><strong>Your Location:</strong><?php echo $lastpirep->arricao.'-'.$lastpirep->arrname; ?></li>

and

<?php
$last_location = PIREPData::getLastReports($pilotcode, 1, PIREP_ACCEPTED);

echo "This pilot's last location is: {$last_location->arricao}";
?>

in the pilot center and it never shows my last location.  I filed a manual PIREP after I inserted the code and it didn't work then either. 

Any ideas I can try?

Link to comment
Share on other sites

  • Administrators

Try changing $pilotcode to $userinfo->pilotid like this ->

<?php
     $last_location = PIREPData::getLastReports($userinfo->pilotid, 1, PIREP_ACCEPTED);
     echo "This pilot's last location is: {$last_location->arricao}";
?>

This works for me in the pilot center.  ;)

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
Guest lorathon

Yes.

We have a search by last location function. A pilot will see all flights originating from where they are.

I have also put a last location tag on each filed PIREP so that we can check to be sure that they did fly from the last. Also a pair of images attached to filed PIREP's. If a green plane is attached to the PIREP that pilot flew from last arrival airport. If is red then the pilot did not.

Link to comment
Share on other sites

  • 2 weeks later...

Yes.

We have a search by last location function. A pilot will see all flights originating from where they are.

I have also put a last location tag on each filed PIREP so that we can check to be sure that they did fly from the last. Also a pair of images attached to filed PIREP's. If a green plane is attached to the PIREP that pilot flew from last arrival airport. If is red then the pilot did not.

Hi lorathon

Would it be possible to share that code you have created?

Thanks

Selwyn

Link to comment
Share on other sites

Guest lorathon

Hi lorathon

Would it be possible to share that code you have created?

Thanks

Selwyn

I can try and give you some pieces. The code is all over the place.

This is at the top of the pirep_pending.tpl in the admin templates. Right below Flight:

<?php
    			$last_location = PIREPData::getLastReports($pirep->pilotid, 1, PIREP_ACCEPTED);
    			echo "Pilots last location: {$last_location->arricao}";
    	?>

This is at the bottom of the pirep_pending.tpl in the admin templates. Right after the cancel

<?php
		if ($last_location->arricao == $pirep->depicao)
		{
		echo "<img src='<?php echo SITE_URL?>/lib/images/inair.png'></a>";
		}
		else
		{
		echo "<img src='<?php echo SITE_URL?>/lib/images/onground.png'></a>";
		}
	?>


Link to comment
Share on other sites

  • 3 weeks later...

In the pilot roster a table in which the last location (current location) is indicated should appear.

In addition I have in the pilots_list.tpl following code:

<table width="789" class="tablesorter" id="tabledlist">
 <thead>
<tr bgcolor="#336699">
  <th>Pilot ID</th>
  <th width="25%">Name</th>
  <th width="10%">Rank</th>
  <th width="16%">Flights</th>
  <th width="23%">Hours</th>
  <th>Location</th>
  </tr>
</thead>
<?php foreach($roster as $pilot) { ?>
<tr align="left" valign="middle" bgcolor="#DFF4FF">
  <td width="9%" align="right" nowrap>
      <img src="<?php echo Countries::getCountryImage($pilot->location);?>"
        alt="<?php echo Countries::getCountryName($pilot->location);?>" />
 <a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>">
        <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
  </td>
  <td nowrap="nowrap">


     <left><?php echo $pilot->firstname.' '.$pilot->lastname?></center>
  </td>
  <center><td align="center"><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td></center>
  <center><td><?php echo $pilot->totalflights?></td></center>
  <center><td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td></center>
  <td colspan="2"><center>
    <?php
$last_location = PIREPData::getLastReports($pilot->pilotid, 1, PIREP_ACCEPTED);

echo "This pilot's last location is: {$last_location->arricao}";
?>
  </tbody>
</table>

Then I get the error message in the browser:

Parse error: syntax error, unexpected $end in /kunden/265414_32756/html/phpvms/core/templates/pilots_list.tpl  on line 45

Where is the mistake?

Greetings

Thomas

Link to comment
Share on other sites

What is your line 45?

ah sorry

   
37     <center><td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td></center>
38     <td colspan="2"><center>
39       <?php
40  $last_location = PIREPData::getLastReports($pilot->pilotid, 1, PIREP_ACCEPTED);
41
42  echo "This pilot's last location is: {$last_location->arricao}";
43  ?>
44   </tbody>
45   </table>

Link to comment
Share on other sites

  • 3 months later...

I can try and give you some pieces. The code is all over the place.

This is at the top of the pirep_pending.tpl in the admin templates. Right below Flight:

<?php
    			$last_location = PIREPData::getLastReports($pirep->pilotid, 1, PIREP_ACCEPTED);
    			echo "Pilots last location: {$last_location->arricao}";
    	?>

This is at the bottom of the pirep_pending.tpl in the admin templates. Right after the cancel

<?php
		if ($last_location->arricao == $pirep->depicao)
		{
		echo "<img src='<?php echo SITE_URL?>/lib/images/inair.png'></a>";
		}
		else
		{
		echo "<img src='<?php echo SITE_URL?>/lib/images/onground.png'></a>";
		}
	?>


I don't see a pirep_pending.tpl in my templates folder under the admin subfolder. I looked in the folder that I uploaded to my ftp and have found that it was not there.

Link to comment
Share on other sites

  • 2 years later...

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