[Nagvis-checkins] SF.net Git: nagvis: Sorting hostgroups in on-demand header menu
Brought to you by:
larsi-
From: lars <la...@us...> - 2013-08-22 11:15:15
|
Author: Lars Michelsen <lm...@la...> Date: Thu Aug 22 13:13:30 2013 +0200 Committer: Lars Michelsen <lm...@la...> Commit-Date: Thu Aug 22 13:13:30 2013 +0200 Sorting hostgroups in on-demand header menu --- .../nagvis-js/classes/NagVisHeaderMenu.php | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php b/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php index 9bc3574..4e3dd66 100644 --- a/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php +++ b/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php @@ -269,6 +269,7 @@ class NagVisHeaderMenu { if ($this->templateName == 'on-demand-filter') { global $_BACKEND; $this->aMacros['hostgroups'] = $_BACKEND->getBackend($_GET['backend_id'])->getObjects('hostgroup', '', ''); + usort($this->aMacros['hostgroups'], Array($this, 'sortHostgroups')); array_unshift($this->aMacros['hostgroups'], array('name1' => '', 'name2' => '')); $default = ''; @@ -281,6 +282,10 @@ class NagVisHeaderMenu { } } + private function sortHostgroups($a, $b) { + return strnatcasecmp($a['name1'], $b['name1']); + } + /** * Checks if a documentation is available for the current language. * It either returns the language tag for the current language when a |