diff options
Diffstat (limited to 'src/xhtml/HTMLNavbarController.php')
-rw-r--r-- | src/xhtml/HTMLNavbarController.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/xhtml/HTMLNavbarController.php b/src/xhtml/HTMLNavbarController.php index 85114588..20bfb894 100644 --- a/src/xhtml/HTMLNavbarController.php +++ b/src/xhtml/HTMLNavbarController.php @@ -56,7 +56,28 @@ class HTMLNavbarController extends HTMLController return $trail_html; } + /** + * Get the URL for the last active tab of a particular tab bar. + * + * @param string $section + * + * @return null|mixed + */ + public function getLastTabURL($section) + { + //$data = $this->getDatabaseAccessor(); + + $tabs = $this->misc->getNavTabs($section); + if (isset($_SESSION['webdbLastTab'][$section], $tabs[$_SESSION['webdbLastTab'][$section]])) { + $tab = $tabs[$_SESSION['webdbLastTab'][$section]]; + } else { + $tab = \reset($tabs); + } + // $this->prtrace(['section' => $section, 'tabs' => $tabs, 'tab' => $tab]); + + return isset($tab['url']) ? $tab : null; + } /** * Get the URL for the last active tab of a particular tab bar. * @@ -99,7 +120,6 @@ class HTMLNavbarController extends HTMLController if (!\is_array($_SESSION['webdbLastTab'])) { $_SESSION['webdbLastTab'] = [$alltabs => $activetab]; } - if (\is_string($alltabs)) { $_SESSION['webdbLastTab'][$alltabs] = $activetab; $alltabs = $this->misc->getNavTabs($alltabs); |