Feature Wiki

Information about planned and released features

Tabs

Routing for Plug-Ins

1 Requirements

While developing plug-ins one of the reoccuring problems is to introduce a GUI class into the control flow of ILIAS. For example: If you want to add a tab with functionality to a course we need to add a new GUI class wich would preferrably be called by the ilObjCourseGUI. However this is not possible as the course GUI does not know our plug-in and will not forward any commands even if we add a "CalledBy" to the plug-in's GUI. To solve this problem we introduced a new service into most of our ILIAS installations called "ilRouterGUI". This service just forwards the command by default and does nothing else.
So in our example the link to the new Tab can be generated over the ilRouterGUI and will receive the command flow. For full functionality the plug-ins GUI has to check the permissions again as it no longer inherits the permission check of the course GUI class and has to rebuild the header.
 
We introduced this new router service a while ago and it turned out to be very straight forward to use and helped out in a wide variaty of situiations. Even though it just forwards a command to any GUI class the security is not an issue as it still checks whether the called class explicitly declared a "CalledBy ilRouterGUI" in it's header.

Router Service

Service/Router:

<?xml version = "1.0" encoding = "UTF-8"?>
<service xmlns="http://www.w3.org" version="$Id$" id="rtg">
<baseclasses>
<baseclass name="ilRouterGUI" dir="classes" />
</baseclasses>
</service>
<?php
require_once('./Services/UIComponent/classes/class.ilUIHookProcessor.php');
/**
* Service ilRouterGUI
*
* @author Fabian Schmid <fs@studer-raimann.ch>
* @version $Id:
*
* @ingroup ServicesRouter
*/

class ilRouterGUI {
function __construct() {
global $lng, $tpl, $ilCtrl;
/**
* @var $tpl ilTemplate
* @var $ilCtrl ilCtrl
* @var $ilLog ilLog
*/

$this->lng =& $lng;
$this->tpl =& $tpl;
$this->ctrl =& $ilCtrl;
$this->tpl->getStandardTemplate();
new ilUIHookProcessor('Services/Router', 'router', array( 'router' => $this ));
}
 
function executeCommand() {
$next_class = $this->ctrl->getNextClass($this);
switch ($next_class) {
default:
$class_file = $this->ctrl->lookupClassPath($next_class);
if (is_file($class_file)) {
include_once($class_file);
$gui = new $next_class();
$this->ctrl->forwardCommand($gui);
} else {
ilUtil::sendFailure('Plugin GUI-Class not found! ('.$next_class.')');
}
break;
}
$this->tpl->show();
}
}
 
?>

2 Status

  • Scheduled for: Release 5.0 (will be set by Jour Fixe)
  • Funding: Already developed
  • Maintainer: Alex Killing
  • Implementation of the feature is done by sr.solutions
  • Contract settled: Yes
  • Tested by / status: (name, e-mail), (status information set after implementation)

3 Additional Information

Contact the following persons if you want to know more about this feature, its implementation or funding:

  • Information about concept: Oskar Truffer <ot@studer-raimann.ch>
  • Information about funding: Oskar Truffer <ot@studer-raimann.ch>
  • Information about implementation: Oskar Truffer <ot@studer-raimann.ch>

4 Discussion

JF 28 Oct 2013: We appreciate this extension and would make it part of the existing UI plugin slot and schedule it for 4.5. Please contact Alex on details (naming).

5 Implementation

OT 22 Sep 2014: It's implemented in the trunk Revision #53204. The service is accessible under the name: UIPluginRouterGUI. Remember to check for the user's permissions as the UIPluginRouterGUI does not check for any permissions. Furthermore it's important to notice that the UIPluginRouterGUI does not load any language module nor does it initialize the ILIAS default template opposed to the suggestion mentioned in this feature request. You have to use $tpl->getStandardTemplate() yourself if you want to render your plugin in the ILIAS layout.

Last edited: 15. Dec 2021, 09:09, Schmid, Fabian [fschmid]