Cell width: allows an attribute "width" to set the cell width (e.g. | or | ).
- * Line breaks: Line breaks can be specified by adding a < > tag. The new line will start at the left border of the PDF document.
- *
- *
- * Examples:
- *
- * Simple name+value lines:
- * In most cases you will just want to display a single line per attribute with its name and value.
- *
- * 'myAttribute' => 'AttrName12345'
- *
- * This will give the following PDF output:
- *
- * Attribute name: 12345
- *
- *
- * Multiline values:
- * Sometimes you have multivalued attributes where it is not applicable to write all values in one line but
- * where you want to list your values one below the other or show a table. This can be done by using the | tag.
- *
- * This example only uses one column but you can just use more | tags per tag to display more columns.
- *
- * 'myAttribute' => 'AttrName123 | 456 | 789 | '
- *
* @param string $typeId type id (user, group, host)
- * @return array PDF entries
+ * @return array PDF entries as key => label
*
* @see baseModule::get_metaData()
*/
diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc
index 0def3e64..a24350fa 100644
--- a/lam/lib/modules.inc
+++ b/lam/lib/modules.inc
@@ -409,25 +409,29 @@ function getHelp($module,$helpID,$scope='') {
* @return array PDF entries (field ID => field label)
*/
function getAvailablePDFFields($typeId) {
- $mods = $_SESSION['config']->get_AccountModules($typeId);
+ $typeManager = new TypeManager();
+ $_SESSION['pdfContainer'] = new accountContainer($typeManager->getConfiguredType($typeId), 'pdfContainer');
+ $_SESSION['pdfContainer']->initModules();
+ $mods = $_SESSION['pdfContainer']->getAccountModules();
$return = array();
- for ($i = 0; $i < sizeof($mods); $i++) {
- $module = moduleCache::getModule($mods[$i], \LAM\TYPES\getScopeFromTypeId($typeId));
+ foreach ($mods as $module) {
$fields = $module->get_pdfFields($typeId);
- $return[$mods[$i]] = array();
+ $moduleName = get_class($module);
+ $return[$moduleName] = array();
if (is_array($fields)) {
foreach ($fields as $fieldID => $fieldLabel) {
if (is_integer($fieldID)) {
// support old PDF field list which did not contain a label
- $return[$mods[$i]][$fieldLabel] = $fieldLabel;
+ $return[$moduleName][$fieldLabel] = $fieldLabel;
}
else {
- $return[$mods[$i]][$fieldID] = $fieldLabel;
+ $return[$moduleName][$fieldID] = $fieldLabel;
}
}
}
}
$return['main'] = array('dn' => _('DN'));
+ unset($_SESSION['pdfContainer']);
return $return;
}
@@ -803,7 +807,7 @@ class accountContainer {
/**
* Returns the included account modules.
*
- * @return array modules
+ * @return baseModule[] modules
*/
function getAccountModules() {
return $this->module;
@@ -1699,15 +1703,11 @@ class accountContainer {
/**
* This function will prepare the object for a new account.
*/
- function new_account() {
+ public function new_account() {
logNewMessage(LOG_DEBUG, "New account with type " . $this->type->getId());
$this->isNewAccount = true;
$this->lastLoadedProfile = 'default';
- $modules = $_SESSION['config']->get_AccountModules($this->type->getId());
- foreach ($modules as $module) {
- $this->module[$module] = new $module($this->type->getScope());
- $this->module[$module]->init($this->base);
- }
+ $this->initModules();
// sort module buttons
$this->sortModules();
$profile = \LAM\PROFILES\loadAccountProfile('default', $this->type->getId());
@@ -1729,6 +1729,17 @@ class accountContainer {
return 0;
}
+ /**
+ * Creates the account modules and initializes them.
+ */
+ public function initModules() {
+ $modules = $_SESSION['config']->get_AccountModules($this->type->getId());
+ foreach ($modules as $module) {
+ $this->module[$module] = new $module($this->type->getScope());
+ $this->module[$module]->init($this->base);
+ }
+ }
+
/**
* This function will save an account to the LDAP database.
*
|