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;
}
/**
* Returns if a tool may be hidden by configuration in the LAM server profile.
*
* @return boolean hideable
*/
function isHideable() {
return true;
}
}
The functions are quite self-descriptive.
LAM Pro provides multiple access levels. The functions
getRequiresWriteAccess()/getRequiresPasswordChangeRights() can restrict the visibility of the tool.
You will also need a logo for your tool. This can be any image in the folder
graphics.
Sometimes you may want to create a submenu to group multiple tools. This is possible by using the function
getSubTools(). It returns a list of LAMSubTool objects.
Create the tool page
Each tool definition provides the path to its tool page with the function
getLink(). The tool page can be any PHP page inside the directory
templates.
This is all that you need to create your own tool for LAM. :)