| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html lang="en"><head><title>Module HowTo - PDF output</title> |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | <link rel="stylesheet" type="text/css" href="style/layout.css"> |
| 9 | <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"></head><body> |
| 10 | <div style="text-align: center;"> |
| 11 | <h1>Module HowTo - PDF output<br> |
| 12 | </h1> |
| 13 | <br> |
| 14 | <br> |
| 15 | <div style="text-align: left;"><br> |
| 16 | <h2>1. Defining possible PDF values<br> |
| 17 | </h2> |
| 18 | The first step to PDF output is defining what values your module |
| 19 | provides. This is needed for the PDF editor, otherwise the user will |
| 20 | not be able to select values from your module.<br> |
| 21 | <br> |
| 22 | The PDF values are specified with <span style="font-weight: bold;">get_pdfFields()</span> |
| 23 | or <span style="font-weight: bold;">meta['PDF_fields']</span>.<br> |
| 24 | <br> |
| 25 | <span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;"> |
| 26 | <br> |
| 27 | The <span style="font-style: italic;">ieee802Device</span> |
| 28 | module has only one attribute and therefore one PDF value: the MAC |
| 29 | address.<br> |
| 30 | <br> |
| 31 | <div class="mod-code"> |
| 32 | * Returns meta data that is interpreted by parent |
| 33 | class<br> |
| 34 | *<br> |
| 35 | * @return array array with meta data<br> |
| 36 | */<br> |
| 37 | <span style="font-weight: bold;">function</span> |
| 38 | get_metaData() {<br> |
| 39 | $return = array();<br> |
| 40 | [...]<br> |
| 41 | // available PDF fields<br> |
| 42 | <span style="color: rgb(255, 0, 0);"> |
| 43 | $return['PDF_fields'] = array(</span><br style="color: rgb(255, 0, 0);"> |
| 44 | <span style="color: rgb(255, 0, 0);"> |
| 45 | 'macAddress' => _('MAC address')</span><br style="color: rgb(255, 0, 0);"> |
| 46 | <span style="color: rgb(255, 0, 0);"> |
| 47 | );</span><br style="color: rgb(255, 0, 0);"> |
| 48 | return $return;<br> |
| 49 | }<br> |
| 50 | <br> |
| 51 | </div> |
| 52 | <br> |
| 53 | <br> |
| 54 | <h2>2. Providing data to put into the PDF file<br> |
| 55 | </h2> |
| 56 | When the user wants to create a PDF file the LDAP account is loaded and |
| 57 | you module is asked for data to put into the PDF file.<br> |
| 58 | <br> |
| 59 | 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> |
| 60 | <br> |
| 61 | <span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;"> |
| 62 | <br> |
| 63 | The <span style="font-style: italic;">ieee802Device</span> |
| 64 | module will return the MAC address list of the account.<br> |
| 65 | <br> |
| 66 | <div class="mod-code"> |
| 67 | * Returns a list of PDF entries<br> |
| 68 | */<br> |
| 69 | function get_pdfEntries() {<br> |
| 70 | $return = array();<br> |
| 71 | $this->addSimplePDFField($return, 'macAddress', _('MAC addresses'));<br> |
| 72 | return $return;<br> |
| 73 | }<br> |
| 74 | </div> |
| 75 | <br> |
| 76 | <br> |
| 77 | <br> |
| 78 | <br> |
| 79 | </div> |
| 80 | </div> |
| 81 | </body></html> |