Jump to content

Recommended Posts

  • Administrators
Posted

$last_location = PIREPData::getLastReports([PILOT_ID], 1, PIREP_ACCEPTED);

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

Of course, replacing the [PILOT ID] with the variable holding the pilot's ID

Posted

HI

please check below code :

$last_location = PIREPData::getLastReports($pilotid,1, PIREP_ACCEPTED);
echo $last_location->arricao;

I put that in Pilot_list , But doesn't show Pilot current location !

  • Administrators
Posted

Depends where you're using it. Look in that template file to see where else a pilot ID is being used and mimic it. It could be $pilot->pilotid, or $userinfo->pilotid

Posted

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.

Posted

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>

Posted

Full Code for Pilot Center (with all the code set up for it):

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

Posted

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?

  • Administrators
Posted

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

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

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.

  • 2 weeks later...
Posted

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

Guest lorathon
Posted

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>";
		}
	?>


  • 3 weeks later...
Posted

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

Posted

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>

  • 3 months later...
Posted

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.

Guest lorathon
Posted

The pirep_pending.tpol has been discontinued. The new template for pireps in the admin section is pireps_list.tpl.

  • 2 years later...
Posted

Hi All,

I am new here, sorry is a stupid question, I searched and this was the closest topic that fit what I am loking for....

...is there a way to get the pilot's last location to show on the Live Map, as a static icon with label until the next flight?

Thanks

Marmus

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