LDAPAccountManager/lam/docs/devel/mod_pdf.htm

95 lines
3.6 KiB
HTML
Raw Permalink Normal View History

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>
2013-04-22 17:42:35 +00:00
2015-07-12 08:44:22 +00:00
2010-04-05 10:13:37 +00:00
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;">&nbsp;&nbsp;&nbsp; /**<br>
2004-11-01 16:53:58 +00:00
&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;
2010-04-05 10:13:37 +00:00
&nbsp;&nbsp;&nbsp; $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);">&nbsp;&nbsp;&nbsp;
2010-04-05 10:13:37 +00:00
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'macAddress' =&gt; _('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);">&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>
2015-07-12 08:44:22 +00:00
This is done with <span style="font-weight: bold;">get_pdfEntries()</span>. Please use one of <span style="font-style: italic;">baseModule::addSimplePDFField/addPDFKeyValue/addPDFTable() </span>for this task.<br>
2004-11-01 16:53:58 +00:00
<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;">&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>
2015-07-12 08:44:22 +00:00
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $this-&gt;addSimplePDFField($return, 'macAddress', _('MAC addresses'));<br>
2004-11-01 16:53:58 +00:00
&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>
2010-04-05 10:13:37 +00:00
</body></html>