Commit da8d1cdc authored by Franco Fichtner's avatar Franco Fichtner

menu: sort by description, closes #362

parent 85c8e361
...@@ -206,16 +206,16 @@ class ControllerBase extends ControllerRoot ...@@ -206,16 +206,16 @@ class ControllerBase extends ControllerRoot
$ifarr = array(); $ifarr = array();
foreach ($cnf->object()->interfaces->children() as $key => $node) { foreach ($cnf->object()->interfaces->children() as $key => $node) {
$ifarr[$key] = $node; $ifarr[$key] = $node->descr ? $node->descr->__toString() : strtoupper($key);
} }
ksort($ifarr); natcasesort($ifarr);
$ordid = 0; $ordid = 0;
foreach ($ifarr as $key => $node) { foreach ($ifarr as $key => $descr) {
$menu->appendItem('Interfaces', $key, array( $menu->appendItem('Interfaces', $key, array(
'url' => '/interfaces.php?if='. $key, 'url' => '/interfaces.php?if='. $key,
'order' => ($ordid++), 'visiblename' => '[' . $descr . ']',
'visiblename' => $node->descr ? $node->descr : strtoupper($key),
'cssclass' => 'fa fa-sitemap', 'cssclass' => 'fa fa-sitemap',
'order' => $ordid++,
)); ));
} }
unset($ifarr); unset($ifarr);
......
...@@ -73,16 +73,16 @@ $menu = new OPNsense\Base\Menu\MenuSystem(); ...@@ -73,16 +73,16 @@ $menu = new OPNsense\Base\Menu\MenuSystem();
$cnf = OPNsense\Core\Config::getInstance(); $cnf = OPNsense\Core\Config::getInstance();
$ifarr = array(); $ifarr = array();
foreach ($cnf->object()->interfaces->children() as $key => $node) { foreach ($cnf->object()->interfaces->children() as $key => $node) {
$ifarr[$key] = $node; $ifarr[$key] = $node->descr ? $node->descr->__toString() : strtoupper($key);
} }
ksort($ifarr); natcasesort($ifarr);
$ordid = 0; $ordid = 0;
foreach ($ifarr as $key => $node) { foreach ($ifarr as $key => $descr) {
$menu->appendItem('Interfaces', $key, array( $menu->appendItem('Interfaces', $key, array(
'url' => '/interfaces.php?if=' . $key, 'url' => '/interfaces.php?if=' . $key,
'order' => ($ordid++), 'visiblename' => '[' . $descr . ']',
'visiblename' => $node->descr ? $node->descr : strtoupper($key),
'cssclass' => 'fa fa-sitemap', 'cssclass' => 'fa fa-sitemap',
'order' => $ordid++,
)); ));
} }
unset($ifarr); unset($ifarr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment