Jump to content

Recommended Posts

Posted

Hi man, i would like to have a pilot roser without Hub separations. I would like a single list.

I have insert this code in Pilots.php, but i have this error in roster page: Warning: Invalid argument supplied for foreach() in /home/hfrjgrdn/sites/phpvms/core/templates/pilots_list.php on line 33.

Can you help me?

  • Members
Posted

Replace

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('allpilots', PilotData::findPilots(array('p.hub'=>$hub->icao)));

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

$nohub = PilotData::findPilots(array('p.hub'=>''));
if(!$nohub)
{
return;
}

$this->set('title', 'No Hub');
$this->set('icao', '');
$this->set('allpilots', $nohub);
$this->render('pilots_list.tpl');
}

With

public function index()
{
$this->set('allpilots', PilotData::getAllpilots());
$this->render('pilots_list.tpl');
			 }

In /core/modules/Pilots/Pilots.php

  • 1 year later...
Posted

Not sure which one he has used, but I have this one working on a 5.5.x version

public function index() {
   $this->set('pilot_list', PilotData::getAllPilots());
   $this->render('pilots_list.tpl');
}

I believe the code is for the old .tpl version which still had the $allpilots variable whereas the 5.5.x version has the newer $pilot_list variable

Posted
  On 9/10/2016 at 8:05 PM, web541 said:

Not sure which one he has used, but I have this one working on a 5.5.x version

public function index() {
$this->set('pilot_list', PilotData::getAllPilots());
$this->render('pilots_list.tpl');
}

I believe the code is for the old .tpl version which still had the $allpilots variable whereas the 5.5.x version has the newer $pilot_list variable

Can you post your whole Pilots.php? I get an error on my index.

Parse error: syntax error, unexpected '$nohub' (T_VARIABLE), expecting function (T_FUNCTION) Line 32

Posted

Working on my end with the default template file.

Pilots.php

  Reveal hidden contents

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.

×
×
  • Create New...