From 47d857ba812387ceb4ec59cc4b3c7a85068f6516 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 19 Jun 2005 09:40:30 +0000 Subject: [PATCH] fixed reading of possible PDF entries --- lam/docs/modules-specification.htm | 4 +--- lam/lib/baseModule.inc | 2 +- lam/lib/modules.inc | 25 +++++++------------------ 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/lam/docs/modules-specification.htm b/lam/docs/modules-specification.htm index 074a184a..319c5b44 100644 --- a/lam/docs/modules-specification.htm +++ b/lam/docs/modules-specification.htm @@ -579,15 +579,13 @@ section 4. "Help entry syntax".
function get_PDF_Entries($scope)
+ style="font-weight: bold;">function get_PDF_Entries()

This function is called when a PDF is to be created.
-$scope is the account type -("user", "group", "host" at this time).
It returns the fields which are printed in the PDF file for the specified account type. At the monent there is no (easy) possibility for the user to decide which fields are to be displayed. Perhaps there diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index b3c53743..1d8ba526 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -439,7 +439,7 @@ class baseModule { * @param string $scope account type * @return array list of available fields for PDF output */ - function get_pdfFields($scope = 'user') { + function get_pdfFields() { return ((isset($this->meta['PDF_fields'])) ? $this->meta['PDF_fields'] : array()); } diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index 55b67fcd..efa21da5 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -362,12 +362,14 @@ function getHelp($module,$helpID,$scope='') { * @return array PDF entries */ function getAvailablePDFFields($scope) { - // create new account container if needed - if (! isset($_SESSION["profile_account_$scope"])) { - $_SESSION["profile_account_$scope"] = new accountContainer($scope, "profile_account_$scope"); + $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_pdfFields(); } - // get options - return $_SESSION["profile_account_$scope"]->getAvailablePDFFields(); + $return['main'] = array('dn'); + return $return; } /** @@ -1607,18 +1609,5 @@ class accountContainer { return $return; } - /** - * - * - * @return - */ - function getAvailablePDFFields() { - $return = array(); - foreach($this->module as $moduleName => $module) { - $return[$moduleName] = $module->get_pdfFields($this->type); - } - $return['main'] = array( 'dn'); - return $return; - } } ?>