From 6f6f9607e89b4f3f4312f36f6478331a47c352f1 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 28 Oct 2004 19:37:40 +0000 Subject: [PATCH] removed unneeded functions from accountContainer --- lam/lib/modules.inc | 86 ++++++++++----------------------------------- 1 file changed, 19 insertions(+), 67 deletions(-) diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index e3edc929..9f18c1ed 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -261,13 +261,13 @@ function getAvailableModules($scope) { * @return array profile elements */ function getProfileOptions($scope) { - // create new account container if needed - if (! isset($_SESSION["profile_account_$scope"])) { - $_SESSION["profile_account_$scope"] = new accountContainer($scope, "profile_account_$scope"); - $_SESSION["profile_account_$scope"]->new_account(); + $mods = $_SESSION['config']->get_AccountModules($scope); + $return = array(); + for ($i = 0; $i < sizeof($mods); $i++) { + $module = new $mods[$i]($scope); + $return[$mods[$i]] = $module->get_profileOptions(); } - // get options - return $_SESSION["profile_account_$scope"]->getProfileOptions(); + return $return; } /** @@ -278,13 +278,14 @@ function getProfileOptions($scope) { * @return array list of error messages */ function checkProfileOptions($scope, $options) { - // create new account container if needed - if (! isset($_SESSION["profile_account_$scope"])) { - $_SESSION["profile_account_$scope"] = new accountContainer($scope, "profile_account_$scope"); - $_SESSION["profile_account_$scope"]->new_account(); + $mods = $_SESSION['config']->get_AccountModules($scope); + $return = array(); + for ($i = 0; $i < sizeof($mods); $i++) { + $module = new $mods[$i]($scope); + $temp = $module->check_profileOptions($options); + $return = array_merge($return, $temp); } - // get options - return $_SESSION["profile_account_$scope"]->checkProfileOptions($options); + return $return; } /** @@ -395,13 +396,13 @@ function getAvailableScopes() { * @return array column list */ function getUploadColumns($scope) { - // create new account container if needed - if (! isset($_SESSION["profile_account_$scope"])) { - $_SESSION["profile_account_$scope"] = new accountContainer($scope, "profile_account_$scope"); - $_SESSION["profile_account_$scope"]->new_account(); + $mods = $_SESSION['config']->get_AccountModules($scope); + $return = array(); + for ($i = 0; $i < sizeof($mods); $i++) { + $module = new $mods[$i]($scope); + $return[$mods[$i]] = $module->get_uploadColumns(); } - // get options - return $_SESSION["profile_account_$scope"]->get_uploadColumns(); + return $return; } /** @@ -1223,33 +1224,6 @@ class accountContainer { return 0; } - /** - * Returns an hash array containing all profile options - */ - function getProfileOptions() { - $return = array(); - $modules = array_keys($this->module); - foreach ($modules as $singlemodule) { - $return[$singlemodule] = $this->module[$singlemodule]->get_profileOptions(); - } - return $return; - } - - /** - * Checks the input values of an account profile. - * - * @param array $options list of input values - * @return array list of error messages - */ - function checkProfileOptions($options) { - $return = array(); - $modules = array_keys($this->module); - foreach ($modules as $singlemodule) { - $temp = $this->module[$singlemodule]->check_profileOptions($options); - $return = array_merge($return, $temp); - } - return $return; - } // TODO remove this function? function proccess_profile($post) { @@ -1546,27 +1520,5 @@ class accountContainer { $return['main'] = array( 'dn'); return $return; } - - /** - * Returns an array containing all input columns for the file upload. - * - * Syntax: - *
array( - *
string: name, // fixed non-translated name which is used as column name (should be of format: _) - *
string: description, // short descriptive name - *
string: help, // help ID - *
string: example, // example value - *
boolean: required // true, if user must set a value for this column - *
) - * - * @return array column list - */ - function get_uploadColumns() { - $return = array(); - foreach($this->module as $moduleName => $module) { - $return[$moduleName] = $module->get_uploadColumns(); - } - return $return; - } } ?>