fixed reading of possible PDF entries

This commit is contained in:
Roland Gruber 2005-06-19 09:40:30 +00:00
parent 697893fbc0
commit 47d857ba81
3 changed files with 9 additions and 22 deletions

View File

@ -579,15 +579,13 @@ section 4. "Help entry syntax".<br>
<tbody> <tbody>
<tr> <tr>
<td style="vertical-align: top; text-align: center;"><span <td style="vertical-align: top; text-align: center;"><span
style="font-weight: bold;">function get_PDF_Entries($scope)</span><br> style="font-weight: bold;">function get_PDF_Entries()</span><br>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<br> <br>
This function is called when a PDF is to be created.<br> This function is called when a PDF is to be created.<br>
<span style="font-weight: bold;">$scope</span> is the account type
("user", "group", "host" at this time).<br>
It returns the fields which are printed in the PDF file for the It returns the fields which are printed in the PDF file for the
specified account type. At the monent there is no (easy) possibility specified account type. At the monent there is no (easy) possibility
for the user to decide which fields are to be displayed. Perhaps there for the user to decide which fields are to be displayed. Perhaps there

View File

@ -439,7 +439,7 @@ class baseModule {
* @param string $scope account type * @param string $scope account type
* @return array list of available fields for PDF output * @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()); return ((isset($this->meta['PDF_fields'])) ? $this->meta['PDF_fields'] : array());
} }

View File

@ -362,12 +362,14 @@ function getHelp($module,$helpID,$scope='') {
* @return array PDF entries * @return array PDF entries
*/ */
function getAvailablePDFFields($scope) { function getAvailablePDFFields($scope) {
// create new account container if needed $mods = $_SESSION['config']->get_AccountModules($scope);
if (! isset($_SESSION["profile_account_$scope"])) { $return = array();
$_SESSION["profile_account_$scope"] = new accountContainer($scope, "profile_account_$scope"); for ($i = 0; $i < sizeof($mods); $i++) {
$module = new $mods[$i]($scope);
$return[$mods[$i]] = $module->get_pdfFields();
} }
// get options $return['main'] = array('dn');
return $_SESSION["profile_account_$scope"]->getAvailablePDFFields(); return $return;
} }
/** /**
@ -1607,18 +1609,5 @@ class accountContainer {
return $return; 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;
}
} }
?> ?>