LDAPAccountManager/lam/templates/tools.php

104 lines
2.8 KiB
PHP
Raw Normal View History

2004-06-09 19:24:03 +00:00
<?php
2018-01-03 17:40:51 +00:00
namespace LAM\TOOLS\TESTS;
use \htmlResponsiveRow;
use \htmlTitle;
use \htmlOutputText;
use \htmlLink;
2004-06-09 19:24:03 +00:00
/*
$Id$
2009-10-27 18:47:12 +00:00
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
2018-01-02 20:42:02 +00:00
Copyright (C) 2003 - 2018 Roland Gruber
2004-06-09 19:24:03 +00:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
2017-02-11 16:11:37 +00:00
2004-06-09 19:24:03 +00:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
2017-02-11 16:11:37 +00:00
2004-06-09 19:24:03 +00:00
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Provides a list of tools like file upload or profile editor.
*
* @author Roland Gruber
2004-06-10 11:46:13 +00:00
* @package tools
2004-06-09 19:24:03 +00:00
*/
2006-03-26 17:51:25 +00:00
/** security functions */
include_once("../lib/security.inc");
2004-06-09 19:24:03 +00:00
/** access to configuration options */
include_once("../lib/config.inc");
2009-10-30 18:37:06 +00:00
/** tool definitions */
include_once("../lib/tools.inc");
2004-06-09 19:24:03 +00:00
// start session
2006-03-26 17:51:25 +00:00
startSecureSession();
2017-02-11 16:11:37 +00:00
enforceUserIsLoggedIn();
2004-06-09 19:24:03 +00:00
setlanguage();
2018-01-02 20:42:02 +00:00
include '../lib/adminHeader.inc';
2004-06-09 19:24:03 +00:00
2009-10-30 18:37:06 +00:00
// get tool list
$availableTools = getTools();
// sort tools
$toSort = array();
2018-01-07 16:19:28 +00:00
foreach ($availableTools as $availableTool) {
$myTool = new $availableTool();
$toSort[$availableTool] = $myTool->getPosition();
2009-10-30 18:37:06 +00:00
}
asort($toSort);
2004-06-09 19:24:03 +00:00
$tools = array();
2009-10-30 18:37:06 +00:00
foreach ($toSort as $key => $value) {
$tools[] = new $key();
}
2006-10-04 18:12:22 +00:00
2013-01-19 13:18:52 +00:00
echo "<div class=\"user-bright smallPaddingContent\">\n";
2004-06-09 19:24:03 +00:00
// print tools table
2018-01-02 20:42:02 +00:00
$container = new htmlResponsiveRow();
$container->add(new htmlTitle(_('Tools')), 12);
2012-07-21 09:15:50 +00:00
$toolSettings = $_SESSION['config']->getToolSettings();
2004-06-09 19:24:03 +00:00
2018-01-07 16:19:28 +00:00
foreach ($tools as $tool) {
2007-12-30 12:32:48 +00:00
// check access level
2018-01-07 16:19:28 +00:00
if ($tool->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) {
2007-12-30 12:32:48 +00:00
continue;
}
2018-01-07 16:19:28 +00:00
if ($tool->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) {
2007-12-30 12:32:48 +00:00
continue;
}
2011-05-19 16:25:07 +00:00
// check visibility
2018-01-07 16:19:28 +00:00
if (!$tool->isVisible()) {
2011-05-19 16:25:07 +00:00
continue;
}
2012-07-21 09:15:50 +00:00
// check if hidden by config
2018-01-07 16:19:28 +00:00
$className = get_class($tool);
2017-07-16 18:48:46 +00:00
$toolName = substr($className, strrpos($className, '\\') + 1);
if (isset($toolSettings['tool_hide_' . $toolName]) && ($toolSettings['tool_hide_' . $toolName] == 'true')) {
2012-07-21 09:15:50 +00:00
continue;
}
2010-10-16 16:56:29 +00:00
// add tool
2018-01-07 16:19:28 +00:00
$container->add(new htmlLink($tool->getName(), $tool->getLink(), '../graphics/' . $tool->getImageLink()), 12, 4);
$container->add(new htmlOutputText($tool->getDescription()), 12, 8);
2018-01-02 20:42:02 +00:00
$container->addVerticalSpacer('2rem');
2004-06-09 19:24:03 +00:00
}
2010-10-16 16:56:29 +00:00
$tabindex = 1;
parseHtml(null, $container, array(), true, $tabindex, 'user');
2004-06-09 19:24:03 +00:00
2010-10-16 16:56:29 +00:00
echo "</div>";
2004-06-09 19:24:03 +00:00
2018-01-03 17:03:00 +00:00
include '../lib/adminFooter.inc';
2004-06-09 19:24:03 +00:00
?>