<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head> <meta content="text/html; charset=ISO-8859-15" http-equiv="content-type"> <title>Tools HowTo</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> <h1 style="text-align: center;">Tools HowTo<br> </h1> <div style="text-align: center;"><br> </div> <div style="text-align: center;"><br> <div style="text-align: left;">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.<br> <br> <h2>Create tool definition class</h2> All tools contain a definition class and a separate PHP page that displays the content itself.<br> First, you need to create a new tool definition class in <span style="font-weight: bold;">lib/tools</span>. The file name does not need to follow any patterns but there must be a class included that implements the <span style="font-weight: bold;">LAMTool</span> interface.<br> <br> Example:<br> <br> <pre>/**</pre> <pre> * Server information</pre> <pre> * </pre> <pre> * @package tools</pre> <pre> */ </pre> <pre>class toolServerInformation implements LAMTool {</pre> <pre> </pre> <pre> /**</pre> <pre> * Returns the name of the tool.</pre> <pre> * </pre> <pre> * @return string name</pre> <pre> */</pre> <pre> function getName() {</pre> <pre> return _("Server information");</pre> <pre> }</pre> <pre> </pre> <pre> /**</pre> <pre> * returns a description text for the tool.</pre> <pre> * </pre> <pre> * @return string description</pre> <pre> */</pre> <pre> function getDescription() {</pre> <pre> return _("Information about the LDAP server.");</pre> <pre> }</pre> <pre> </pre> <pre> /**</pre> <pre> * Returns a link to the tool page (relative to templates/).</pre> <pre> * </pre> <pre> * @return string link</pre> <pre> */</pre> <pre> function getLink() {</pre> <pre> return "serverInfo.php";</pre> <pre> }</pre> <pre> </pre> <pre> /** </pre> <pre> * Returns if the tool requires write access to LDAP.</pre> <pre> * </pre> <pre> * @return boolean true if write access is needed</pre> <pre> */</pre> <pre> function getRequiresWriteAccess() {</pre> <pre> return false;</pre> <pre> }</pre> <pre> </pre> <pre> /**</pre> <pre> * Returns if the tool requires password change rights.</pre> <pre> * </pre> <pre> * @return boolean true if password change rights are needed</pre> <pre> */</pre> <pre> function getRequiresPasswordChangeRights() {</pre> <pre> return true;</pre> <pre> }</pre> <pre> </pre> <pre> /**</pre> <pre> * Returns the link to the tool image (relative to graphics/)</pre> <pre> *</pre> <pre> * @return string image URL</pre> <pre> */</pre> <pre> function getImageLink() {</pre> <pre> return 'tree_info.png';</pre> <pre> }</pre> <pre> </pre> <pre> /**</pre> <pre> * Returns the prefered position of this tool on the tools page.</pre> <pre> * The position may be between 0 and 1000. 0 is the top position.</pre> <pre> *</pre> <pre> * @return int prefered position</pre> <pre> */</pre> <pre> function getPosition() {</pre> <pre> return 600;</pre> <pre> }</pre> <pre> </pre> <pre> /**</pre> <pre> * Returns a list of sub tools or an empty array.</pre> <pre> * </pre> <pre> * @return array list of subtools (LAMTool)</pre> <pre> */</pre> <pre> function getSubTools() {</pre> <pre> return array();</pre> <pre> }</pre> <pre> </pre> <pre> /**</pre> <pre> * Returns if the tool is visible in the menu.</pre> <pre> *</pre> <pre> * @return boolean visible</pre> <pre> */</pre> <pre> function isVisible() {</pre> <pre> return true;</pre> <pre> }</pre> <pre> </pre> <pre> /**</pre> <pre> * Returns if a tool may be hidden by configuration in the LAM server profile.</pre> <pre> * </pre> <pre> * @return boolean hideable</pre> <pre> */</pre> <pre> function isHideable() {</pre> <pre> return true;</pre> <pre> }</pre> <pre> </pre> <pre>}</pre> The functions are quite self-descriptive.<br> LAM Pro provides multiple access levels. The functions <span style="font-weight: bold;">getRequiresWriteAccess()/getRequiresPasswordChangeRights()</span> can restrict the visibility of the tool.<br> <br> You will also need a logo for your tool. This can be any image in the folder <span style="font-weight: bold;">graphics</span>.<br> <br> Sometimes you may want to create a submenu to group multiple tools. This is possible by using the function <span style="font-weight: bold;">getSubTools()</span>. It returns a list of LAMSubTool objects.<br> <br> <h2>Create the tool page</h2> Each tool definition provides the path to its tool page with the function <span style="font-weight: bold;">getLink()</span>. The tool page can be any PHP page inside the directory <span style="font-weight: bold;">templates</span>.<br> <br> This is all that you need to create your own tool for LAM. :)<br> </div> </div> </body></html>