Tools HowTo



You can add your own tools easily. Please follow the following steps to create a custom tool. Tools are displayed in the tools menu in the upper right corner of LAM.

Create tool definition class

All tools contain a definition class and a separate PHP page that displays the content itself.
First, you need to create a new tool definition class in lib/tools. The file name does not need to follow any patterns but there must be a class included that implements the LAMTool interface.

Example:

/**
 * Server information
 * 
 * @package tools
 */ 
class toolServerInformation implements LAMTool {
    
    /**
     * Returns the name of the tool.
     * 
     * @return string name
     */
     function getName() {
         return _("Server information");
     }
    
    /**
     * returns a description text for the tool.
     * 
     * @return string description
     */
    function getDescription() {
        return _("Information about the LDAP server.");
    }
    
    /**
     * Returns a link to the tool page (relative to templates/).
     * 
     * @return string link
     */
    function getLink() {
        return "serverInfo.php";
    }
    
    /** 
     * Returns if the tool requires write access to LDAP.
     * 
     * @return boolean true if write access is needed
     */
    function getRequiresWriteAccess() {
        return false;
    }
    
    /**
     * Returns if the tool requires password change rights.
     * 
     * @return boolean true if password change rights are needed
     */
    function getRequiresPasswordChangeRights() {
        return true;
    }
    
    /**
     * Returns the link to the tool image (relative to graphics/)
     *
     * @return string image URL
     */
    function getImageLink() {
        return 'tree_info.png';
    }
    
    /**
     * Returns the preferred position of this tool on the tools page.
     * The position may be between 0 and 1000. 0 is the top position.
     *
     * @return int preferred position
     */
    function getPosition() {
        return 600;
    }
    
    /**
     * Returns a list of sub tools or an empty array.
     * 
     * @return array list of subtools (LAMTool)
     */
    function getSubTools() {
        return array();
    }
    
    /**
     * Returns if the tool is visible in the menu.
     *
     * @return boolean visible
     */
    function isVisible() {
        return true;
    }
    
&