108 lines
3.7 KiB
HTML
108 lines
3.7 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<title>Module HowTo - PDF output</title>
|
|
<link rel="stylesheet" type="text/css" href="style/layout.css">
|
|
</head>
|
|
<body>
|
|
<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>
|
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
|
|
style="font-weight: bold; text-decoration: underline;">
|
|
<br>
|
|
The <span style="font-style: italic;">ieee802Device</span>
|
|
module has only one attribute and therefore one PDF value: the MAC
|
|
address.<br>
|
|
<br>
|
|
<table style="width: 100%; text-align: left;" class="mod-code"
|
|
border="0" cellpadding="2" cellspacing="2">
|
|
<tbody>
|
|
<tr>
|
|
<td style="vertical-align: top;">
|
|
/**<br>
|
|
* 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);">
|
|
$return['PDF_fields'] = array(</span><br
|
|
style="color: rgb(255, 0, 0);">
|
|
<span style="color: rgb(255, 0, 0);">
|
|
'macAddress'</span><br
|
|
style="color: rgb(255, 0, 0);">
|
|
<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>
|
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br
|
|
style="font-weight: bold; text-decoration: underline;">
|
|
<br>
|
|
The <span style="font-style: italic;">ieee802Device</span>
|
|
module will return the MAC address list of the account.<br>
|
|
<br>
|
|
<table style="width: 100%; text-align: left;" class="mod-code"
|
|
border="0" cellpadding="2" cellspacing="2">
|
|
<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>
|
|
</body>
|
|
</html>
|