Jump to content

Award in pilot list


Tato123

Recommended Posts

Hello guys,

I would like to display the award in my pilot list.

I added this code

<?php

if(!$allawards)

{

echo '<center><img src="http://www.voegolv.n...g_recusado.png" border="0" /><br><font face="Trebuchet MS" size="2">Pilota non iscritto al roster online.</font></center>';

}

else

{

/* To show the image:

<img src="<?php echo $award->image?>" alt="<?php echo $award->descrip?>" />

*/

?>

<?php foreach($allawards as $award){ ?>

<img src="<?php echo $award->image?>" alt="<?php echo $award->name ?> - <?php echo $award->descrip?>" />

<?php } ?>

<?php

}

?>

and in the pilot.php:

public function index()

{

// Get all of our hubs, and list pilots by hub

$allhubs = OperationsData::GetAllHubs();

if(!$allhubs) $allhubs = array();

foreach($allhubs as $hub)

{

$this->set('title', $hub->name);

$this->set('icao', $hub->icao);

$this->set('allawards', AwardsData::GetPilotAwards($userinfo->pilotid));

$this->set('allpilots', PilotData::findPilots(array('p.hub'=>$hub->icao)));

$this->set('allawards', AwardsData::GetPilotAwards($userinfo->pilotid));

$this->render('pilots_list.tpl');

}

$nohub = PilotData::findPilots(array('p.hub'=>''));

if(!$nohub)

{

return;

}

$this->set('allawards', AwardsData::GetPilotAwards($userinfo->pilotid));

$this->set('title', 'No Hub');

$this->set('icao', '');

$this->set('allpilots', $nohub);

$this->render('pilots_list.tpl');

}

I don't show any award.

Anyone can help me?

Thanks

Link to comment
Share on other sites

  • Administrators

You are going to need to add a join statement to the pilot data call as it only gets the data out of the pilot table the way it is written in the default version.

$this->set('allpilots', PilotData::findPilots(array('p.hub'=>$hub->icao)));

Best bet may be to write your own custom query for this and join an array of the pilots awards to each pilot.

Link to comment
Share on other sites

i try

$allhubs = OperationsData::GetAllHubs();

if(!$allhubs) $allhubs = array();

foreach($allhubs as $hub)

{

$this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid));

$this->set('title', $hub->name);

$this->set('icao', $hub->icao);

$this->set('allawards', AwardsData::GetPilotAwards(Auth::$userinfo->pilotid));

$this->set('allpilots', PilotData::findPilots(array('p.hub'=>$hub->icao)));

$this->set('userinfo', Auth::$userinfo);

$this->render('pilots_list.tpl');

}

$nohub = PilotData::findPilots(array('p.hub'=>''));

if(!$nohub)

{

return;

}

$this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid));

$this->set('allawards', AwardsData::GetPilotAwards(Auth::$userinfo->pilotid));

$this->set('userinfo', Auth::$userinfo);

$this->set('title', 'No Hub');

$this->set('icao', '');

$this->set('allpilots', $nohub);

$this->render('pilots_list.tpl');

}

public function reports($pilotid='')

{

if($pilotid == '')

{

$this->set('message', 'No pilot specified!');

$this->render('core_error.tpl');

return;

}

$this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid));

$this->set('userinfo', Auth::$userinfo);

$this->set('allawards', AwardsData::GetPilotAwards(Auth::$userinfo->pilotid));

$this->set('pireps', PIREPData::GetAllReportsForPilot($pilotid));

$this->render('pireps_viewall.tpl');

Now i show the pilot award but for all pilot is the same. I show only my award because i'm logged.

If i enter without pilot i show for all pilot the pilot award logged in the site

Please help me

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