<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Type HowTo - Custom list view</title> <link rel="stylesheet" type="text/css" href="style/layout.css"> <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"> </head> <body> <div style="text-align: center;"> <h1>Type HowTo - Custom list view<br> </h1> <br> <br> <div style="text-align: left;"><br> <h2>1. Default list attributes<br> </h2> Here you can specify what attributes are shown as default in the list view.<br> <br> The <span style="font-style: italic;">default attributes</span> are specified with <span style="font-weight: bold;">getDefaultListAttributes()</span><span style="font-weight: bold;"></span>.<br> <br> <span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;"> <br> Our <span style="font-style: italic;">smbDomain</span> type will show the attributes "#sambaDomainName;#sambaSID" by default.<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 the default attribute list for this account type.<br> *<br> * @return string attribute list<br> */<br> <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">getDefaultListAttributes()</span> {<br> return "#sambaDomainName;#sambaSID";<br> }<br> </td> </tr> </tbody> </table> <br> <br> <h2>2. Pretranslated attribute descriptions<br> </h2> You can provide translated descriptions for common attributes. This way the user only specifies the attributes and LAM will show a description for each language.<br> <br> The descriptions are specified with <span style="font-weight: bold;">getListAttributeDescriptions()</span><span style="font-weight: bold;"></span>.<br> <br> <span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;"> <br> Our <span style="font-style: italic;">smbDomain</span> type has descriptions for sambaSID and sambaDomainName.<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 attributes which have a translated description.<br> * This is used for the head row in the list view.<br> *<br> * @return array list of descriptions<br> */<br> <span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">getListAttributeDescriptions()</span> {<br> return array(<br> "sambaSID" => _("Domain SID"),<br> "sambaDomainName" => _("Domain name")<br> );<br> }<br> </td> </tr> </tbody> </table> <br> <br> <br> <h2>3. Specifying a custom list view</h2> The default list view has only very generic labels for the buttons and navigation bar. So you should at least provide some new labels which fit to your type.<br> <br> The class name of your list view is specified with <span style="font-weight: bold;">getListClassName()</span><span style="font-weight: bold;"></span>.<br> <br> <span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;"> <br> Our <span style="font-style: italic;">smbDomain</span> type sets the list view class to <span style="font-style: italic;">lamSmbDomainList</span>. The list class is defined in the same file as your type class (smbDomain.inc in this case).<br> The labels are set in the constructor. Do not forget to call the parent constructor first.<br> <br> If you want to change more than just the labels, take a look at <span style="font-weight: bold;">lib/lists.inc</span> and <span style="font-weight: bold;">lib/types/user.inc</span>. When a list is displayed then the <span style="font-weight: bold;">showPage()</span> function is called. You can overwrite this function to display a completly new list or just one of the other functions.<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 the class name for the list object.<br> *<br> * @return string class name<br> */<br> function <span style="color: rgb(255, 0, 0);">getListClassName()</span> {<br> return "lamSmbDomainList";<br> }<br> <br> <br> /**<br> * Generates the list view.<br> *<br> * @package lists<br> * @author Roland Gruber<br> * <br> */<br> class <span style="color: rgb(255, 0, 0);">lamSmbDomainList</span> extends <span style="font-weight: bold;">lamList</span> {<br> <br> /**<br> * Constructor<br> *<br> * @param string $type account type<br> * @return lamList list object<br> */<br> function lamSmbDomainList($type) {<br> parent::lamList($type);<br> $this->labels = array(<br> 'nav' => _("%s domain(s) found"),<br> 'error_noneFound' => _("No domains found!"),<br> 'newEntry' => _("New domain"),<br> 'deleteEntry' => _("Delete domain"),<br> 'createPDF' => _("Create PDF for selected domain(s)"),<br> 'createPDFAll' => _("Create PDF for all domains"));<br> }<br> <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>