sort available types

This commit is contained in:
Roland Gruber 2010-04-04 12:52:20 +00:00
parent 0d57acbb53
commit 7a2eb18348
1 changed files with 10 additions and 7 deletions

View File

@ -3,7 +3,7 @@
$Id$ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2004 - 2009 Roland Gruber Copyright (C) 2004 - 2010 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -104,8 +104,11 @@ $allTypes = getTypes();
$activeTypes = $conf->get_ActiveTypes(); $activeTypes = $conf->get_ActiveTypes();
$availableTypes = array(); $availableTypes = array();
for ($i = 0; $i < sizeof($allTypes); $i++) { for ($i = 0; $i < sizeof($allTypes); $i++) {
if (!in_array($allTypes[$i], $activeTypes)) $availableTypes[] = $allTypes[$i]; if (!in_array($allTypes[$i], $activeTypes)) {
$availableTypes[$allTypes[$i]] = getTypeAlias($allTypes[$i]);
}
} }
natcasesort($availableTypes);
echo $_SESSION['header']; echo $_SESSION['header'];
@ -210,12 +213,12 @@ echo "<tr><td><br><br>\n";
if (sizeof($availableTypes) > 0) { if (sizeof($availableTypes) > 0) {
echo "<fieldset><legend><b>" . _("Available account types") . "</b></legend>\n"; echo "<fieldset><legend><b>" . _("Available account types") . "</b></legend>\n";
echo "<table>\n"; echo "<table>\n";
for ($i = 0; $i < sizeof($availableTypes); $i++) { foreach ($availableTypes as $key => $value) {
$icon = '<img alt="' . $availableTypes[$i] . '" src="../../graphics/' . $availableTypes[$i] . '.png">&nbsp;'; $icon = '<img alt="' . $value . '" src="../../graphics/' . $key . '.png">&nbsp;';
echo "<tr>\n"; echo "<tr>\n";
echo "<td>$icon<b>" . getTypeAlias($availableTypes[$i]) . ": </b></td>\n"; echo "<td>$icon<b>" . $value . ": </b></td>\n";
echo "<td>" . getTypeDescription($availableTypes[$i]) . "</td>\n"; echo "<td>" . getTypeDescription($key) . "</td>\n";
echo "<td><input type=\"submit\" name=\"add_" . $availableTypes[$i] ."\" title=\"" . _("Add") . "\" value=\" \"" . echo "<td><input type=\"submit\" name=\"add_" . $key ."\" title=\"" . _("Add") . "\" value=\" \"" .
" style=\"background-image: url(../../graphics/add.png);background-position: 2px center;background-repeat: no-repeat;width:24px;height:24px;background-color:transparent\"></td>\n"; " style=\"background-image: url(../../graphics/add.png);background-position: 2px center;background-repeat: no-repeat;width:24px;height:24px;background-color:transparent\"></td>\n";
echo "</tr>\n"; echo "</tr>\n";
} }