1. Default list attributes
Here you can specify what attributes are shown as default in the list
view.
The 
default attributes are
specified
with 
getDefaultListAttributes().
Example:
Our 
smbDomain type will show
the attributes "#sambaDomainName;#sambaSID" by default.
  
    
      | /** * Returns the default attribute list for this
account type.
 *
 * @return string attribute list
 */
 function getDefaultListAttributes() {
 return
"#sambaDomainName;#sambaSID";
 }
 
 | 
  
2. Pretranslated attribute descriptions
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.
The descriptions are specified with 
getListAttributeDescriptions().
Example:
Our 
smbDomain type has
descriptions for sambaSID and sambaDomainName.
  
    
      | /** * Returns a list of attributes which have a
translated description.
 * This is used for the head row in the list view.
 *
 * @return array list of descriptions
 */
 function getListAttributeDescriptions() {
 return array(
 "sambaSID"
=> _("Domain SID"),
 "sambaDomainName" => _("Domain name")
 );
 }
 
 | 
  
3. Specifying a custom list view
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.
The class name of your list view is specified with 
getListClassName().
Example:
Our 
smbDomain type sets the
list view class to 
lamSmbDomainList.
The list class is defined in the same file as your type class
(smbDomain.inc in this case).
The labels are set in the constructor. Do not forget to call the parent
constructor first.
If you want to change more than just the labels, take a look at 
lib/lists.inc and 
lib/types/user.inc. When a list is
displayed then the 
showPage()
function is called. You can overwrite this function to display a
completely new list or just one of the other functions.
  
    
      | /** * Returns the class name for the list object.
 *
 * @return string class name
 */
 function getListClassName()
{
 return "lamSmbDomainList";
 }
 
 
 /**
 * Generates the list view.
 *
 * @package lists
 * @author Roland Gruber
 *
 */
 class lamSmbDomainList
extends lamList {
 
 /**
 * Constructor
 *
 * @param string $type account type
 * @return lamList list object
 */
 function lamSmbDomainList($type) {
 parent::lamList($type);
 $this->labels = array(
 'nav' =>
_("%s domain(s) found"),
 'error_noneFound' => _("No domains found!"),
 'newEntry'
=> _("New domain"),
 'deleteEntry'
=> _("Delete domain"),
 'createPDF'
=> _("Create PDF for selected domain(s)"),
 'createPDFAll'
=> _("Create PDF for all domains"));
 }
 
 }
 
 |