hide profile options if no quotas can be read

This commit is contained in:
Roland Gruber 2010-12-19 13:35:42 +00:00
parent 3c6a1692ce
commit a8de4aa682
1 changed files with 5 additions and 0 deletions

View File

@ -453,6 +453,7 @@ class quota extends baseModule {
*/ */
function get_profileOptions() { function get_profileOptions() {
$return = new htmlTable(); $return = new htmlTable();
$optionsAvailable = false;
// get list of lamdaemon servers // get list of lamdaemon servers
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers()); $lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
for ($s = 0; $s < sizeof($lamdaemonServers); $s++) { for ($s = 0; $s < sizeof($lamdaemonServers); $s++) {
@ -482,6 +483,7 @@ class quota extends baseModule {
} }
$dirs = array_values($dirs); $dirs = array_values($dirs);
if (sizeof($dirs) < 1) continue; // stop if no quota directories were found if (sizeof($dirs) < 1) continue; // stop if no quota directories were found
$optionsAvailable = true;
$return->addElement(new htmlSubTitle($description), true); $return->addElement(new htmlSubTitle($description), true);
$return->addElement(new htmlOutputText('&nbsp;' . _('Mountpoint') . '&nbsp;', false)); $return->addElement(new htmlOutputText('&nbsp;' . _('Mountpoint') . '&nbsp;', false));
$return->addElement(new htmlOutputText('&nbsp;' . _('Soft block limit') . '&nbsp;', false)); $return->addElement(new htmlOutputText('&nbsp;' . _('Soft block limit') . '&nbsp;', false));
@ -517,6 +519,9 @@ class quota extends baseModule {
$return->addNewLine(); $return->addNewLine();
} }
} }
if (!$optionsAvailable) {
return null;
}
return $return; return $return;
} }