Tato123 Posted May 23, 2013 Report Share Posted May 23, 2013 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 Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted May 24, 2013 Administrators Report Share Posted May 24, 2013 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. Quote Link to comment Share on other sites More sharing options...
Tato123 Posted May 25, 2013 Author Report Share Posted May 25, 2013 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.