2004-11-01 16:53:58 +00:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
2010-04-05 10:13:37 +00:00
|
|
|
<html><head><title>Module HowTo - PDF output</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-11-01 16:53:58 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="style/layout.css">
|
2010-04-05 10:13:37 +00:00
|
|
|
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"></head><body>
|
2004-11-01 16:53:58 +00:00
|
|
|
<div style="text-align: center;">
|
|
|
|
<h1>Module HowTo - PDF output<br>
|
|
|
|
</h1>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<div style="text-align: left;"><br>
|
|
|
|
<h2>1. Defining possible PDF values<br>
|
|
|
|
</h2>
|
|
|
|
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.<br>
|
|
|
|
<br>
|
|
|
|
The PDF values are specified with <span style="font-weight: bold;">get_pdfFields()</span>
|
|
|
|
or <span style="font-weight: bold;">meta['PDF_fields']</span>.<br>
|
|
|
|
<br>
|
2010-04-05 10:13:37 +00:00
|
|
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
|
2004-11-01 16:53:58 +00:00
|
|
|
<br>
|
|
|
|
The <span style="font-style: italic;">ieee802Device</span>
|
|
|
|
module has only one attribute and therefore one PDF value: the MAC
|
|
|
|
address.<br>
|
|
|
|
<br>
|
2010-04-05 10:13:37 +00:00
|
|
|
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
|
2004-11-01 16:53:58 +00:00
|
|
|
<tbody>
|
|
|
|
<tr>
|
2004-11-14 15:09:19 +00:00
|
|
|
<td style="vertical-align: top;"> /**<br>
|
2004-11-01 16:53:58 +00:00
|
|
|
* Returns meta data that is interpreted by parent
|
|
|
|
class<br>
|
|
|
|
*<br>
|
|
|
|
* @return array array with meta data<br>
|
|
|
|
*/<br>
|
|
|
|
<span style="font-weight: bold;">function</span>
|
|
|
|
get_metaData() {<br>
|
|
|
|
$return = array();<br>
|
|
|
|
[...]<br>
|
|
|
|
// available PDF fields<br>
|
|
|
|
<span style="color: rgb(255, 0, 0);">
|
2010-04-05 10:13:37 +00:00
|
|
|
$return['PDF_fields'] = array(</span><br style="color: rgb(255, 0, 0);">
|
2004-11-01 16:53:58 +00:00
|
|
|
<span style="color: rgb(255, 0, 0);">
|
2010-04-05 10:13:37 +00:00
|
|
|
'macAddress' => _('MAC address')</span><br style="color: rgb(255, 0, 0);">
|
2004-11-01 16:53:58 +00:00
|
|
|
<span style="color: rgb(255, 0, 0);">
|
|
|
|
);</span><br style="color: rgb(255, 0, 0);">
|
|
|
|
return $return;<br>
|
|
|
|
}<br>
|
|
|
|
<br>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<h2>2. Providing data to put into the PDF file<br>
|
|
|
|
</h2>
|
|
|
|
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.<br>
|
|
|
|
<br>
|
|
|
|
This is done with <span style="font-weight: bold;">get_pdfEntries()</span>.<br>
|
|
|
|
<br>
|
2010-04-05 10:13:37 +00:00
|
|
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
|
2004-11-01 16:53:58 +00:00
|
|
|
<br>
|
|
|
|
The <span style="font-style: italic;">ieee802Device</span>
|
|
|
|
module will return the MAC address list of the account.<br>
|
|
|
|
<br>
|
2010-04-05 10:13:37 +00:00
|
|
|
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
|
2004-11-01 16:53:58 +00:00
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td style="vertical-align: top;"> /**<br>
|
|
|
|
* Returns a list of PDF entries<br>
|
|
|
|
*/<br>
|
|
|
|
function get_pdfEntries() {<br>
|
|
|
|
$return = array();<br>
|
|
|
|
if
|
|
|
|
(sizeof($this->attributes['macAddress']) > 0) {<br>
|
|
|
|
|
|
|
|
$return['ieee802Device_macAddress'] = '<block><key>' .
|
|
|
|
_('MAC address list') . '</key><value>' . implode(', ',
|
|
|
|
$this->attributes['macAddress']) . '</value></block>';<br>
|
|
|
|
}<br>
|
|
|
|
return $return;<br>
|
|
|
|
}<br>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<span style="font-weight: bold;"></span>
|
|
|
|
<h2><span style="font-weight: bold;"></span></h2>
|
|
|
|
</div>
|
|
|
|
</div>
|
2010-04-05 10:13:37 +00:00
|
|
|
</body></html>
|