/** * Load tabs for the logged-in user. * * @param $id \b id of tab * @param $load_all \b true loads all user tabs, false only loads requested tab */ public function tabs($id = null, $load_all = true) { if ($this->tabs === null) { //use the default tabset if user is PortaLord /* if( $_SESSION['generic_user_type'] == 'portalord' ) { // @todo this shouldn't overwrite $this->tabs every time, it should add to the array if we're not loading all $this->tabs = !$load_all && $id ? array(MyUserTab::fetch($id)) : MyUserTab::getUserTabs( 0 ); }else { */ // @todo this shouldn't overwrite $this->tabs every time, it should add to the array if we're not loading all $this->tabs = !$load_all && $id ? array(MyUserTab::fetch($id)) : MyUserTab::getUserTabs($this->person); // } foreach ($this->tabs as $tab) { $tab->parent($this); } } if ($id !== null) { foreach ($this->tabs as $tab) { if ($tab->id == $id || $tab->slug == $id) { return $tab; } } return false; } return $this->tabs; }