LDAPAccountManager/lam/docs/devel/mod_pdf.htm

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;">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
/**<br>
&nbsp;&nbsp;&nbsp; * Returns meta data that is interpreted by parent
class<br>
&nbsp;&nbsp;&nbsp; *<br>
&nbsp;&nbsp;&nbsp; * @return array array with meta data<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; <span style="font-weight: bold;">function</span>
get_metaData() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br>
[...]<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // available PDF fields<br>
<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; $return['PDF_fields'] = array(</span><br
style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'macAddress'</span><br
style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; );</span><br style="color: rgb(255, 0, 0);">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return $return;<br>
&nbsp;&nbsp;&nbsp; }<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;">&nbsp; &nbsp; /**<br>
&nbsp;&nbsp;&nbsp; * Returns a list of PDF entries<br>
&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp; function get_pdfEntries() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $return = array();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if
(sizeof($this-&gt;attributes['macAddress']) &gt; 0) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
$return['ieee802Device_macAddress'] = '&lt;block&gt;&lt;key&gt;' .
_('MAC address list') . '&lt;/key&gt;&lt;value&gt;' . implode(', ',
$this-&gt;attributes['macAddress']) . '&lt;/value&gt;&lt;/block&gt;';<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return $return;<br>
&nbsp;&nbsp;&nbsp; }<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>