Merge branch 'develop' into seeddms-5.1.x

This commit is contained in:
Uwe Steinmann 2016-02-26 09:22:49 +01:00
commit 2a727b6204
2 changed files with 118 additions and 0 deletions

37
out/out.Hooks.php Normal file
View File

@ -0,0 +1,37 @@
<?php
// MyDMS. Document Management System
// Copyright (C) 2010 Matteo Lucarelli
//
// 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.
//
// 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.
//
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
include("../inc/inc.Settings.php");
include("../inc/inc.Language.php");
include("../inc/inc.Init.php");
include("../inc/inc.Extension.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php");
if (!$user->isAdmin()) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'settings'=>$settings));
if($view) {
$view($_GET);
exit;
}

View File

@ -0,0 +1,81 @@
<?php
/**
* Implementation of Hooks view
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Include parent class
*/
require_once("class.Bootstrap.php");
/**
* Class which outputs the html page for Hooks view
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2016 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_View_Hooks extends SeedDMS_Bootstrap_Style {
/**
* List all registered hooks
*
*/
function list_hooks() { /* {{{ */
if(!isset($GLOBALS['SEEDDMS_HOOKS']))
return;
echo "<table class=\"table\">\n";
echo "<thead>";
echo "<tr><th>Type</th><th>Name of hook</th><th>Name of class</th><th>File</th></tr>\n";
echo "</thead>";
echo "<tbody>";
foreach(array('controller', 'view') as $type) {
if(isset($GLOBALS['SEEDDMS_HOOKS'][$type])) {
foreach($GLOBALS['SEEDDMS_HOOKS'][$type] as $name=>$objects) {
$first = true;
foreach($objects as $object) {
$reflector = new ReflectionClass(get_class($object));
$methods = $reflector->getMethods();
array_walk($methods, function (&$v) { $v = $v->getName()."();"; });
if($first)
echo "<tr><td>".$type."</td><td>".$name."</td><td>".get_class($object)."<p>Methods: ".implode(" ", $methods)."</p></td><td>".$reflector->getFilename()."</td></tr>";
else
echo "<tr><td colspan=\"2\"></td><td>".get_class($object)."<p>Methods: ".implode("; ", $methods)."</p></td><td>".$reflector->getFilename()."</td></tr>";
$first = false;
}
}
}
}
echo "</tbody>";
echo "</table>\n";
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
$this->contentHeading("Hooks");
self::list_hooks();
$this->htmlEndPage();
} /* }}} */
}