diff --git a/lam/templates/tools.php b/lam/templates/tools.php index 26081333..8b2e26ed 100644 --- a/lam/templates/tools.php +++ b/lam/templates/tools.php @@ -32,6 +32,8 @@ $Id$ include_once("../lib/security.inc"); /** access to configuration options */ include_once("../lib/config.inc"); +/** tool definitions */ +include_once("../lib/tools.inc"); // start session startSecureSession(); @@ -48,55 +50,19 @@ echo ""; echo "\n"; -// list of tools and descriptions +// get tool list +$availableTools = getTools(); +// sort tools +$toSort = array(); +for ($i = 0; $i < sizeof($availableTools); $i++) { + $myTool = new $availableTools[$i](); + $toSort[$availableTools[$i]] = $myTool->getPosition(); +} +asort($toSort); $tools = array(); - -// profile editor -$pEditor = new LAMTool(); -$pEditor->name = _("Profile editor"); -$pEditor->description = _("Here you can manage your account profiles."); -$pEditor->link = "profedit/profilemain.php"; -$pEditor->requiresWriteAccess = true; -$tools[] = $pEditor; - -// file upload -$fUpload = new LAMTool(); -$fUpload->name = _("File upload"); -$fUpload->description = _("Creates accounts by uploading a CSV formated file."); -$fUpload->link = "masscreate.php"; -$fUpload->requiresWriteAccess = true; -$tools[] = $fUpload; - -// OU editor -$ouEditor = new LAMTool(); -$ouEditor->name = _("OU editor"); -$ouEditor->description = _("Manages OU objects in your LDAP tree."); -$ouEditor->link = "ou_edit.php"; -$ouEditor->requiresWriteAccess = true; -$tools[] = $ouEditor; - -// PDF editor -$pdfEditor = new LAMTool(); -$pdfEditor->name = _("PDF editor"); -$pdfEditor->description = _("This tool allows you to customize the PDF pages."); -$pdfEditor->link = "pdfedit/pdfmain.php"; -$pdfEditor->requiresWriteAccess = true; -$tools[] = $pdfEditor; - -// schema browser -$sBrowser = new LAMTool(); -$sBrowser->name = _("Schema browser"); -$sBrowser->description = _("Here you can browse LDAP object classes and attributes."); -$sBrowser->link = "schema/schema.php"; -$tools[] = $sBrowser; - -// tests -$tests = new LAMTool(); -$tests->name = _("Tests"); -$tests->description = _("Here you can test if certain LAM features work on your installation."); -$tests->link = "tests/index.php"; -$tests->requiresWriteAccess = true; -$tools[] = $tests; +foreach ($toSort as $key => $value) { + $tools[] = new $key(); +} echo "

 

\n"; @@ -105,21 +71,21 @@ echo "\n"; for ($i = 0; $i < sizeof($tools); $i++) { // check access level - if ($tools[$i]->requiresWriteAccess && !checkIfWriteAccessIsAllowed()) { + if ($tools[$i]->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) { continue; } - if ($tools[$i]->requiresPasswordChanges && !checkIfPasswordChangeIsAllowed()) { + if ($tools[$i]->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) { continue; } // print tool echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -131,29 +97,4 @@ echo "
   
"; - echo "link . "\" target=\"mainpart\">" . $tools[$i]->name . ""; + echo "getLink() . "\" target=\"mainpart\">getImageLink() . "\"> " . $tools[$i]->getName() . ""; echo "

     "; - echo $tools[$i]->description; + echo $tools[$i]->getDescription(); echo "   
\n"; echo "\n"; echo "\n"; -/** - * Represents a tool. - * - * @author Roland Gruber - * @package tools - */ -class LAMTool { - - /** name of the tool */ - public $name; - - /** description text */ - public $description; - - /** link to tool page (relative to templates/) */ - public $link; - - /** tool requires write access to LDAP */ - public $requiresWriteAccess = false; - - /** tool requires password change rights */ - public $requiresPasswordChanges = false; - -} - ?>