1<?php
2require_once('./Services/UIComponent/classes/class.ilUIHookProcessor.php');
3
4/**
5 * Class ilUIPluginRouterGUI
6 *
7 * This service is used by plugins. It allows any plugin to get called by a http request without dependencies to a
8 * certain module or service other than this.
9 *
10 * @author  Fabian Schmid <fs@studer-raimann.ch>, Oskar Truffer <ot@studer-raimann.ch>
11 */
12class ilUIPluginRouterGUI
13{
14
15    /**
16     * @var ilCtrl
17     */
18    protected $ctrl;
19
20
21    public function __construct()
22    {
23        global $DIC;
24        $this->ctrl = $DIC->ctrl();
25    }
26
27
28    /**
29     * The only thing this execute Command does is forward the command in the command chain.
30     */
31    public function executeCommand()
32    {
33        $next_class = $this->ctrl->getNextClass($this);
34        switch ($next_class) {
35            default:
36                $class_file = $this->ctrl->lookupClassPath($next_class);
37                if (is_file($class_file)) {
38                    include_once($class_file);
39                    $gui = new $next_class();
40                    $this->ctrl->forwardCommand($gui);
41                } else {
42                    ilUtil::sendFailure('Plugin GUI-Class not found! (' . $next_class . ')');
43                }
44                break;
45        }
46    }
47}
48