documentation update

This commit is contained in:
Roland Gruber 2004-06-20 19:23:04 +00:00
parent 1da244e2b3
commit fb0c424d88
1 changed files with 83 additions and 32 deletions

View File

@ -20,17 +20,26 @@ $Id$
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Interface between modules and other parts of LAM.
*/ */
/**
* Interface between modules and other parts of LAM.
*
* @package modules
* @author Tilo Lutz
* @author Michael Duergner
* @author Roland Gruber
*/
/** LDAP caches */
include_once("cache.inc"); include_once("cache.inc");
/** some helper functions */
include_once("account.inc"); include_once("account.inc");
/** parent class of account modules */ /** parent class of account modules */
include_once("baseModule.inc"); include_once("baseModule.inc");
/* We have to include all modules /**
* before start session * This includes all module files.
*/ */
// Get Lampath, needed 4 includes // Get Lampath, needed 4 includes
$stay=0; $stay=0;
@ -60,17 +69,24 @@ function getModuleAlias($name, $scope) {
return $module->get_alias(); return $module->get_alias();
} }
// returns if the module is a base module /**
// $name: the module name * Returns true if the module is a base module
// $scope: the account type ("user", "group", "host") *
* @param string $name the module name
* @param string $scope the account type ("user", "group", "host")
* @return boolean true if base module
*/
function is_base_module($name, $scope) { function is_base_module($name, $scope) {
$module = new $name($scope); $module = new $name($scope);
return $module->is_base_module(); return $module->is_base_module();
} }
// returns a LDAP filter used by the account lists /**
// return value is of type "(...)" * Returns the LDAP filter used by the account lists
// $scope: the account type ("user", "group", "host") *
* @param string $scope the account type ("user", "group", "host")
* @return string LDAP filter
*/
function get_ldap_filter($scope) { function get_ldap_filter($scope) {
$mods = getAvailableModules($scope); $mods = getAvailableModules($scope);
$filters = array(); $filters = array();
@ -97,11 +113,16 @@ function get_ldap_filter($scope) {
else return "(&" . implode("", $filters['and']) . ")"; else return "(&" . implode("", $filters['and']) . ")";
} }
// returns a hash array (module name => dependencies) of all user module dependencies /**
// dependencies contains an array with two sub arrays: depends, conflicts * Returns a hash array (module name => dependencies) of all user module dependencies
// the elements of depends are either module names or an array of module names (OR-case) *
// the elements of conflicts are module names * "dependencies" contains an array with two sub arrays: depends, conflicts
// $scope: user, group, host, .... * <br>The elements of "depends" are either module names or an array of module names (OR-case).
* <br>The elements of conflicts are module names.
*
* @param string $scope the account type (user, group, host)
* @return array dependencies
*/
function getModulesDependencies($scope) { function getModulesDependencies($scope) {
$mods = getAvailableModules($scope); $mods = getAvailableModules($scope);
$deps = array(); $deps = array();
@ -113,11 +134,14 @@ function getModulesDependencies($scope) {
} }
// checks if there are missing dependencies between modules /**
// $selected is an array of selected module names * Checks if there are missing dependencies between modules.
// $deps is an array of module dependencies *
// returns false if no misssing dependency was found * @param array $selected selected module names
// returns an array of array(selected module, depending module) if missing dependencies were found * @param array $deps module dependencies
* @return mixed false if no misssing dependency was found,
* otherwise an array of array(selected module, depending module) if missing dependencies were found
*/
function check_module_depends($selected, $deps) { function check_module_depends($selected, $deps) {
$ret = array(); $ret = array();
for ($m = 0; $m < sizeof($selected); $m++) { // check selected modules for ($m = 0; $m < sizeof($selected); $m++) { // check selected modules
@ -151,11 +175,14 @@ function check_module_depends($selected, $deps) {
else return false; else return false;
} }
// checks if there are conflicts between modules /**
// $selected is an array of selected module names * Checks if there are conflicts between modules
// $deps is an array of module dependencies *
// returns false if no conflict was found * @param array $selected selected module names
// returns an array of array(selected module, conflicting module) if conflicts were found * @param array $deps module dependencies
* @return false if no conflict was found,
* otherwise an array of array(selected module, conflicting module) if conflicts were found
*/
function check_module_conflicts($selected, $deps) { function check_module_conflicts($selected, $deps) {
$ret = array(); $ret = array();
for ($m = 0; $m < sizeof($selected); $m++) { for ($m = 0; $m < sizeof($selected); $m++) {
@ -189,7 +216,12 @@ function getAvailableModules($scope) {
return $return; return $return;
} }
// $scope = user, group, host, ... /**
* Returns the elements for the profile page.
*
* @param string $scope account type (user, group, host)
* @return array profile elements
*/
function getProfileOptions($scope) { function getProfileOptions($scope) {
// create new account container if needed // create new account container if needed
if (! isset($_SESSION["profile_account_$scope"])) { if (! isset($_SESSION["profile_account_$scope"])) {
@ -200,9 +232,13 @@ function getProfileOptions($scope) {
return $_SESSION["profile_account_$scope"]->getProfileOptions(); return $_SESSION["profile_account_$scope"]->getProfileOptions();
} }
// checks if the profile options are valid /**
// $scope: user, group, host, ... * Checks if the profile options are valid
// $options: an hash array containing all options (name => array(...)) *
* @param string $scope account type (user, group, host)
* @param array $options hash array containing all options (name => array(...))
* @return array list of error messages
*/
function checkProfileOptions($scope, $options) { function checkProfileOptions($scope, $options) {
$return = array(); $return = array();
$modules = getAvailableModules($scope); $modules = getAvailableModules($scope);
@ -213,12 +249,23 @@ function checkProfileOptions($scope, $options) {
return $return; return $return;
} }
// get the single help entry array for help identifier $helpID from module $module /**
* Returns a help entry from an account module.
*
* @param string $helpID help identifier
* @param string $module module name
* @return array help entry
*/
function getHelp($module,$helpID) { function getHelp($module,$helpID) {
return call_user_func(array($module, "get_help"), $helpID); return call_user_func(array($module, "get_help"), $helpID);
} }
// $scope = user, group, host, ... /**
* Returns a list of available PDF entries.
*
* @param string $scope account type (user, group, host)
* @return array PDF entries
*/
function getAvailablePDFFields($scope) { function getAvailablePDFFields($scope) {
// create new account container if needed // create new account container if needed
if (! isset($_SESSION["profile_account_$scope"])) { if (! isset($_SESSION["profile_account_$scope"])) {
@ -229,7 +276,11 @@ function getAvailablePDFFields($scope) {
return $_SESSION["profile_account_$scope"]->getAvailablePDFFields(); return $_SESSION["profile_account_$scope"]->getAvailablePDFFields();
} }
/**
* This class includes all modules and attributes of an account.
*
* @package modules
*/
class accountContainer { class accountContainer {
// Constructor // Constructor
function accountContainer($type, $base) { function accountContainer($type, $base) {