From fec1e628f36f11e7209521e92db0b779e852d94c Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Sat, 28 Sep 2024 13:01:22 +0200 Subject: [PATCH] autosort navigation --- www/lib/class.erpapi.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index 5be8c239..157c08d3 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -7209,6 +7209,20 @@ title: 'Abschicken', $navarray['menu']['admin'][$menu]['sec'][] = array('Wiedervorlage','wiedervorlage','list'); $navarray['menu']['admin'][$menu]['sec'][] = array('Wiki','wiki','list'); $navarray['menu']['admin'][$menu]['sec'][] = array('Zeiterfassung','zeiterfassung','create'); + + foreach ($navarray['menu']['admin'] as $key => $menuitem) { + usort($menuitem['sec'], function ($a, $b) { + $a_val = $a[0]; + $b_val = $b[0]; + + if($a_val > $b_val) return 1; + if($a_val < $b_val) return -1; + return 0; + }); + $navarray['menu']['admin'][$key] = $menuitem; + } + + // Always the last entry $navarray['menu']['admin'][$menu]['sec'][] = array('Abmelden','welcome','logout'); return $this->CalculateNavigation($navarray);