From 0bf870276318f94f3adf163bb989f86a40f9c54d Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 26 Dec 2016 18:41:22 +0100 Subject: [PATCH] new type API --- lam/lib/tools/ouEditor.inc | 51 +++++++++++++++++---------------- lam/lib/tools/pdfEdit.inc | 51 +++++++++++++++++---------------- lam/lib/tools/profileEditor.inc | 51 +++++++++++++++++---------------- lam/templates/ou_edit.php | 22 ++++++++++---- 4 files changed, 94 insertions(+), 81 deletions(-) diff --git a/lam/lib/tools/ouEditor.inc b/lam/lib/tools/ouEditor.inc index 81769e63..5f49143f 100644 --- a/lam/lib/tools/ouEditor.inc +++ b/lam/lib/tools/ouEditor.inc @@ -1,20 +1,21 @@ get_ActiveTypes()) > 0); } - + /** * Returns if a tool may be hidden by configuration in the LAM server profile. - * + * * @return boolean hideable */ function isHideable() { return true; } - + } ?> \ No newline at end of file diff --git a/lam/lib/tools/pdfEdit.inc b/lam/lib/tools/pdfEdit.inc index f3c36650..ed321650 100644 --- a/lam/lib/tools/pdfEdit.inc +++ b/lam/lib/tools/pdfEdit.inc @@ -1,20 +1,21 @@ get_ActiveTypes()) > 0); } - + /** * Returns if a tool may be hidden by configuration in the LAM server profile. - * + * * @return boolean hideable */ function isHideable() { return true; } - + } ?> \ No newline at end of file diff --git a/lam/lib/tools/profileEditor.inc b/lam/lib/tools/profileEditor.inc index 1771c4e4..36f88eed 100644 --- a/lam/lib/tools/profileEditor.inc +++ b/lam/lib/tools/profileEditor.inc @@ -1,20 +1,21 @@ get_ActiveTypes()) > 0); } - + /** * Returns if a tool may be hidden by configuration in the LAM server profile. - * + * * @return boolean hideable */ function isHideable() { return true; } - + } ?> \ No newline at end of file diff --git a/lam/templates/ou_edit.php b/lam/templates/ou_edit.php index 76207a73..aa9a2f72 100644 --- a/lam/templates/ou_edit.php +++ b/lam/templates/ou_edit.php @@ -1,4 +1,15 @@ get_ActiveTypes(); - // check if deletion was canceled if (isset($_POST['abort'])) { display_main(null, null); @@ -166,13 +175,14 @@ function display_main($message, $error) { $container->addElement($msg, true); } + $typeManager = new \LAM\TYPES\TypeManager(); + $typeList = $typeManager->getConfiguredTypes(); $types = array(); - $typeList = $_SESSION['config']->get_ActiveTypes(); - for ($i = 0; $i < sizeof($typeList); $i++) { - if (isAccountTypeHidden($typeList[$i]) || !checkIfWriteAccessIsAllowed($typeList[$i])) { + foreach ($typeList as $type) { + if ($type->isHidden() || !checkIfWriteAccessIsAllowed($type->getId())) { continue; } - $types[$typeList[$i]] = LAM\TYPES\getTypeAlias($typeList[$i]); + $types[$type->getId()] = $type->getAlias(); } natcasesort($types); $options = array();