ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjPluginDispatchGUI.php
Go to the documentation of this file.
1 <?php
2 
20 
28 {
29  protected ilCtrl $ctrl;
31  protected object $gui_obj;
32 
33  public function __construct()
34  {
36  global $DIC;
37 
38  $this->request = $DIC->repository()
39  ->internal()
40  ->gui()
41  ->pluginSlot()
42  ->request();
43 
44  $this->ctrl = $DIC->ctrl();
45  }
46 
47  public function executeCommand(): void
48  {
49  $ilCtrl = $this->ctrl;
50 
51  $next_class = $ilCtrl->getNextClass();
52  $cmd_class = strtolower($ilCtrl->getCmdClass());
53  if ($cmd_class !== "ilobjplugindispatchgui" && $cmd_class !== "" && $cmd_class !== null) {
54  $class_path = $ilCtrl->lookupClassPath($next_class);
55  // note: $next_class is lower case, $class_name
56  // has the correct case so that new $class_name will work
57  // also note: if other places did a new $class_name already
58  // the lower case name will work here "by accident", too
59  $class_name = $ilCtrl->getClassForClasspath($class_path);
60  $this->gui_obj = new $class_name($this->request->getRefId());
61  $ilCtrl->forwardCommand($this->gui_obj);
62  } else {
63  $this->processCommand($ilCtrl->getCmd());
64  }
65  }
66 
67  public function processCommand(string $a_cmd): void
68  {
69  switch ($a_cmd) {
70  case "forward":
71  $this->forward();
72  break;
73  }
74  }
75 
79  public function forward(): void
80  {
81  $ilCtrl = $this->ctrl;
82 
83  $type = ilObject::_lookupType($this->request->getRefId(), true);
84  if ($type !== "") {
86  if ($plugin) {
87  $gui_cn = "ilObj" . $plugin->getPluginName() . "GUI";
88  $ilCtrl->setParameterByClass($gui_cn, "ref_id", $this->request->getRefId());
89  $ilCtrl->redirectByClass($gui_cn, $this->request->getForwardCmd());
90  }
91  }
92  }
93 }
$type
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
global $DIC
Definition: feed.php:28
Dispatcher to all repository object plugins.
getNextClass($a_gui_class=null)
forward()
Forward command to plugin.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPluginObjectByType(string $type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
__construct(Container $dic, ilPlugin $plugin)
static _lookupType(int $id, bool $reference=false)