1. Defining possible PDF values
The first step to PDF output is defining what values your module
provides. This is needed for the PDF editor, otherwise the user will
not be able to select values from your module.
The PDF values are specified with
get_pdfFields()
or
meta['PDF_fields'].
Example:
The
ieee802Device
module has only one attribute and therefore one PDF value: the MAC
address.
/**
* Returns meta data that is interpreted by parent
class
*
* @return array array with meta data
*/
function
get_metaData() {
$return = array();
[...]
// available PDF fields
$return['PDF_fields'] = array(
'macAddress'
);
return $return;
}
|
2. Providing data to put into the PDF file
When the user wants to create a PDF file the LDAP account is loaded and
you module is asked for data to put into the PDF file.
This is done with
get_pdfEntries().
Example:
The
ieee802Device
module will return the MAC address list of the account.
/**
* Returns a list of PDF entries
*/
function get_pdfEntries() {
$return = array();
if
(sizeof($this->attributes['macAddress']) > 0) {
$return['ieee802Device_macAddress'] = '<block><key>' .
_('MAC address list') . '</key><value>' . implode(', ',
$this->attributes['macAddress']) . '</value></block>';
}
return $return;
}
|