ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCtrl.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3 require_once('class.ilCachedCtrl.php');
4 
12 class ilCtrl
13 {
17  protected $db;
18 
19 
23  protected $plugin_admin;
24 
25  const IL_RTOKEN_NAME = 'rtoken';
26 
36  protected $save_parameter;
37 
47  protected $parameter;
48 
58  protected $return;
59 
67  protected $call_hist = array(); // calling history
68 
74  protected $calls = array();
75 
83  protected $rtoken = false;
84 
89  protected $target_script = "ilias.php";
90 
94  public function __construct()
95  {
97 
98  // this information should go to xml files one day
99  $this->stored_trees = array("ilrepositorygui", "ilpersonaldesktopgui",
100  "illmpresentationgui", "illmeditorgui",
101  "iladministrationgui");
102  }
103 
111  protected function initializeMemberVariables()
112  {
113  $this->save_parameter = array();
114  $this->parameter = array(); // save parameter array
115  $this->return = array(); // return commmands
116  $this->tab = array();
117  $this->current_node = 0;
118  $this->module_dir = "";
119  $this->service_dir = "";
120  $this->call_node = array();
121  $this->root_class = "";
122  }
123 
130  public function callBaseClass()
131  {
132  global $DIC;
133 
134  $ilDB = $DIC->database();
135 
136  $baseClass = strtolower($_GET["baseClass"]);
137 
138  $module_class = ilCachedCtrl::getInstance();
139  $mc_rec = $module_class->lookupModuleClass($baseClass);
140 
141  $module = $mc_rec["module"];
142  $class = $mc_rec["class"];
143  $class_dir = $mc_rec["dir"];
144 
145  if ($module != "") {
146  $m_set = $ilDB->query("SELECT * FROM il_component WHERE name = " .
147  $ilDB->quote($module, "text"));
148  $m_rec = $ilDB->fetchAssoc($m_set);
149  $this->module_dir = $m_rec["type"] . "/" . $m_rec["name"];
150  include_once $this->module_dir . "/" . $class_dir . "/class." . $class . ".php";
151  } else { // check whether class belongs to a service
152  $mc_rec = $module_class->lookupServiceClass($baseClass);
153 
154  $service = $mc_rec["service"];
155  $class = $mc_rec["class"];
156  $class_dir = $mc_rec["dir"];
157 
158  if ($service == "") {
159  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
160  throw new ilCtrlException("Could not find entry in modules.xml or services.xml for " .
161  $baseClass . " <br/>" . str_replace("&", "<br />&", htmlentities($_SERVER["REQUEST_URI"])));
162  }
163 
164  $m_rec = ilComponent::getComponentInfo('Services', $service);
165 
166  $this->service_dir = $m_rec["type"] . "/" . $m_rec["name"];
167 
168  include_once $this->service_dir . "/" . $class_dir . "/class." . $class . ".php";
169  ;
170  }
171 
172  // forward processing to base class
173  $this->getCallStructure(strtolower($baseClass));
174  $base_class_gui = new $class();
175  $this->forwardCommand($base_class_gui);
176  }
177 
181  public function getModuleDir()
182  {
183  return $this->module_dir;
184  }
185 
195  public function forwardCommand($a_gui_object)
196  {
197  $class = strtolower(get_class($a_gui_object));
198  $nr = $this->getNodeIdForTargetClass($this->current_node, $class);
199  $nr = $nr["node_id"];
200  if ($nr != "") {
201  $current_node = $this->current_node;
202 
203  $this->current_node = $nr;
204 
205  // always populate the call history
206  // it will only be displayed in DEVMODE but is needed for UI plugins, too
207  $this->call_hist[] = array("class" => get_class($a_gui_object),
208  "mode" => "execComm", "cmd" => $this->getCmd());
209 
210  $html = $a_gui_object->executeCommand();
211 
212  // reset current node
213  $this->current_node = $current_node;
214 
215  return $html;
216  }
217 
218  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
219  throw new ilCtrlException("ERROR: Can't forward to class $class.");
220  }
221 
231  public function getHTML($a_gui_object, array $a_parameters = null)
232  {
233  $class = strtolower(get_class($a_gui_object));
234 
235  $nr = $this->getNodeIdForTargetClass($this->current_node, $class);
236  $nr = $nr["node_id"];
237  if ($nr != "") {
238  $current_node = $this->current_node;
239 
240  // set current node to new gui class
241  $this->current_node = $nr;
242 
243  // always populate the call history
244  // it will only be displayed in DEVMODE but is needed for UI plugins, too
245  $this->call_hist[] = array("class" => get_class($a_gui_object),
246  "mode" => "getHtml", "cmd" => $this->getCmd());
247 
248  // get block
249  if ($a_parameters != null) {
250  $html = $a_gui_object->getHTML($a_parameters);
251  } else {
252  $html = $a_gui_object->getHTML();
253  }
254 
255  // reset current node
256  $this->current_node = $current_node;
257 
258  // return block
259  return $html;
260  }
261 
262  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
263  throw new ilCtrlException("ERROR: Can't getHTML from class $class.");
264  }
265 
275  public function setContext($a_obj_id, $a_obj_type, $a_sub_obj_id = 0, $a_sub_obj_type = "")
276  {
277  $this->context_obj_id = $a_obj_id;
278  $this->context_obj_type = $a_obj_type;
279  $this->context_sub_obj_id = $a_sub_obj_id;
280  $this->context_sub_obj_type = $a_sub_obj_type;
281  }
282 
288  public function getContextObjId()
289  {
290  return $this->context_obj_id;
291  }
292 
298  public function getContextObjType()
299  {
300  return $this->context_obj_type;
301  }
302 
308  public function getContextSubObjId()
309  {
310  return $this->context_sub_obj_id;
311  }
312 
318  public function getContextSubObjType()
319  {
320  return $this->context_sub_obj_type;
321  }
322 
341  private function getNodeIdForTargetClass($a_par_node, $a_class, $a_check = false)
342  {
343  $class = strtolower($a_class);
344  $this->readClassInfo($class);
345 
346  if ($a_par_node === 0 || $a_par_node == "") {
347  return array("node_id" => $this->getCidForClass($class),
348  "base_class" => "");
349  }
350 
351  $this->readNodeInfo($a_par_node);
352 
353  $node_cid = $this->getCurrentCidOfNode($a_par_node);
354 
355  // target class is class of current node id
356  if ($class == $this->getClassForCid($node_cid)) {
357  return array("node_id" => $a_par_node,
358  "base_class" => "");
359  }
360 
361  // target class is child of current node id
362  if (isset($this->calls[$this->getClassForCid($node_cid)]) &&
363  is_array($this->calls[$this->getClassForCid($node_cid)]) &&
364  in_array($a_class, $this->calls[$this->getClassForCid($node_cid)])) {
365  return array("node_id" => $a_par_node . ":" . $this->getCidForClass($class),
366  "base_class" => "");
367  }
368 
369  // target class is sibling
370  $par_cid = $this->getParentCidOfNode($a_par_node);
371  if ($par_cid != "") {
372  if (is_array($this->calls[$this->getClassForCid($par_cid)]) &&
373  in_array($a_class, $this->calls[$this->getClassForCid($par_cid)])) {
374  return array("node_id" =>
375  $this->removeLastCid($a_par_node) . ":" . $this->getCidForClass($class),
376  "base_class" => "");
377  }
378  }
379 
380  // target class is parent
381  $temp_node = $this->removeLastCid($a_par_node);
382  while ($temp_node != "") {
383  $temp_cid = $this->getCurrentCidOfNode($temp_node);
384  if ($this->getClassForCid($temp_cid) == $a_class) {
385  return array("node_id" => $temp_node,
386  "base_class" => "");
387  }
388  $temp_node = $this->removeLastCid($temp_node);
389  }
390 
391  // target class is another base class
392  $n_class = "";
393  if ($a_class != "") {
394  $module_class = ilCachedCtrl::getInstance();
395  $mc_rec = $module_class->lookupModuleClass($class);
396  $n_class = $mc_rec['lower_class'];
397 
398  if ($n_class == "") {
399  $mc_rec = $module_class->lookupServiceClass($class);
400  $n_class = $mc_rec['lower_class'];
401  }
402 
403  if ($n_class != "") {
404  $this->getCallStructure($n_class);
405  return array("node_id" => $this->getCidForClass($n_class),
406  "base_class" => $class);
407  }
408  }
409 
410  if ($a_check) {
411  return false;
412  }
413 
414  // Please do NOT change these lines.
415  // Developers must be aware, if they use classes unknown to the controller
416  // otherwise certain problem will be extremely hard to track down...
417 
418  error_log("ERROR: Can't find target class $a_class for node $a_par_node " .
419  "(" . $this->cid_class[$this->getParentCidOfNode($a_par_node)] . ")");
420 
421  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
422  throw new ilCtrlException("ERROR: Can't find target class $a_class for node $a_par_node " .
423  "(" . $this->cid_class[$this->getParentCidOfNode($a_par_node)] . ").");
424  }
425 
432  public function checkTargetClass($a_class)
433  {
434  if (!is_array($a_class)) {
435  $a_class = array($a_class);
436  }
437 
438  $nr = $this->current_node;
439  foreach ($a_class as $class) {
440  $class = strtolower($class);
441 
442  if (!$this->getCidForClass($class, true)) {
443  return false;
444  }
445 
446  $nr = $this->getNodeIdForTargetClass($nr, $class, true);
447  $nr = $nr["node_id"];
448  if ($nr === false) {
449  return false;
450  }
451  }
452  return true;
453  }
454 
460  public function getCmdNode()
461  {
462  return $_GET["cmdNode"];
463  }
464 
473  public function addTab($a_lang_var, $a_link, $a_cmd, $a_class)
474  {
475  $a_class = strtolower($a_class);
476 
477  $this->tab[] = array("lang_var" => $a_lang_var,
478  "link" => $a_link, "cmd" => $a_cmd, "class" => $a_class);
479  }
480 
486  public function getTabs()
487  {
488  return $this->tab;
489  }
490 
498  public function getCallHistory()
499  {
500  return $this->call_hist;
501  }
502 
518  public function getCallStructure($a_class)
519  {
520  $this->readClassInfo($a_class);
521  }
522 
526  public function readCallStructure($a_class, $a_nr = 0, $a_parent = 0)
527  {
528  global $DIC;
529 
530  $ilDB = $DIC->database();
531 
532  $a_class = strtolower($a_class);
533 
534  $a_nr++;
535 
536  // determine call node structure
537  $this->call_node[$a_nr] = array("class" => $a_class, "parent" => $a_parent);
538 
539  $call_set = $ilDB->query("SELECT * FROM ctrl_calls WHERE parent = " .
540  $ilDB->quote(strtolower($a_class), "text") .
541  " ORDER BY child", array("text"));
542  $a_parent = $a_nr;
543  while ($call_rec = $ilDB->fetchAssoc($call_set)) {
544  $a_nr = $this->readCallStructure($call_rec["child"], $a_nr, $a_parent);
545  $forw[] = $call_rec["child"];
546  }
547 
548  // determine root class
549  $this->root_class = $a_class;
550  return $a_nr;
551  }
552 
572  public function saveParameter($a_obj, $a_parameter)
573  {
574  if (is_object($a_obj)) {
575  $this->saveParameterByClass(get_class($a_obj), $a_parameter);
576  }
577  }
578 
585  public function saveParameterByClass($a_class, $a_parameter)
586  {
587  if (is_array($a_parameter)) {
588  foreach ($a_parameter as $parameter) {
589  $this->save_parameter[strtolower($a_class)][] = $parameter;
590  }
591  } else {
592  $this->save_parameter[strtolower($a_class)][] = $a_parameter;
593  }
594  }
595 
596 
619  public function setParameter($a_obj, $a_parameter, $a_value)
620  {
621  $this->parameter[strtolower(get_class($a_obj))][$a_parameter] = $a_value;
622  }
623 
624 
632  public function setParameterByClass($a_class, $a_parameter, $a_value)
633  {
634  $this->parameter[strtolower($a_class)][$a_parameter] = $a_value;
635  }
636 
644  public function clearParameterByClass($a_class, $a_parameter)
645  {
646  unset($this->parameter[strtolower($a_class)][$a_parameter]);
647  }
648 
655  public function clearParameters($a_obj)
656  {
657  $this->clearParametersByClass(strtolower(get_class($a_obj)));
658  }
659 
666  public function clearParametersByClass($a_class)
667  {
668  $this->parameter[strtolower($a_class)] = array();
669  }
670 
671  protected function checkLPSettingsForward($a_gui_obj, $a_cmd_node)
672  {
673  global $DIC;
674 
675  $objDefinition = $DIC["objDefinition"];
676 
677  // forward to learning progress settings if possible and accessible
678  if ($_GET["gotolp"] &&
679  $a_gui_obj) {
680  $ref_id = $_GET["ref_id"];
681  if (!$ref_id) {
682  $ref_id = $_REQUEST["ref_id"];
683  }
684 
685  $gui_class = get_class($a_gui_obj);
686 
687  if ($gui_class == "ilSAHSEditGUI") {
688  // #1625 - because of scorm "sub-types" this is all very special
689  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
690  $obj_id = ilObject::_lookupObjectId($ref_id);
691  switch (ilObjSAHSLearningModule::_lookupSubType($obj_id)) {
692  case "scorm2004":
693  $class = "ilObjSCORM2004LearningModuleGUI";
694  break;
695 
696  case "scorm":
697  $class = "ilObjSCORMLearningModuleGUI";
698  break;
699 
700  case "aicc":
701  $class = "ilObjAICCLearningModuleGUI";
702  break;
703 
704  case "hacp":
705  $class = "ilObjHACPLearningModuleGUI";
706  break;
707  }
708  if ($GLOBALS["ilAccess"]->checkAccess("edit_learning_progress", "", $ref_id)) {
709  $this->redirectByClass(array($gui_class, $class, "illearningprogressgui", "illplistofsettingsgui"), "");
710  }
711  }
712  // special case: cannot use any presentation GUIs
713  elseif ($gui_class == "ilLMPresentationGUI") {
714  $this->setParameterByClass("ilObjLearningModuleGUI", "gotolp", 1);
715  $this->redirectByClass(array("ilLMEditorGUI", "ilObjLearningModuleGUI"), "");
716  }
717 
718  include_once "Services/Object/classes/class.ilObjectLP.php";
719  $type = ilObject::_lookupType($ref_id, true);
720  $class = "ilObj" . $objDefinition->getClassName($type) . "GUI";
721 
722  if ($gui_class == $class &&
724  $GLOBALS["ilAccess"]->checkAccess("edit_learning_progress", "", $ref_id)) {
725  // add path to repository object gui if missing from cmdNode
726  if (!$a_cmd_node) {
727  $repo_node = $this->getNodeIdForTargetClass(null, "ilrepositorygui");
728  $obj_node = $this->getNodeIdForTargetClass($repo_node["node_id"], $gui_class);
729  $a_cmd_node = $obj_node["node_id"];
730  }
731  // find path to lp settings
732  $lp_node = $this->getNodeIdForTargetClass($a_cmd_node, "illearningprogressgui");
733  $lp_settings_node = $this->getNodeIdForTargetClass($lp_node["node_id"], "illplistofsettingsgui");
734  $_GET["cmdNode"] = $lp_settings_node["node_id"];
735  $_GET["cmdClass"] = "ilLPListOfSettingsGUI";
736  $_GET["cmd"] = "";
737  return "illearningprogressgui";
738  }
739  }
740  }
741 
750  public function getNextClass($a_gui_class = null)
751  {
752  $cmdNode = $this->getCmdNode();
753  if ($cmdNode == "") {
754  return ($class = $this->checkLPSettingsForward($a_gui_class, $cmdNode))
755  ? $class
756  : false;
757  } else {
758  if ($this->current_node == $cmdNode) {
759  return ($class = $this->checkLPSettingsForward($a_gui_class, $cmdNode))
760  ? $class
761  : "";
762  } else {
763  $path = $this->getPathNew($this->current_node, $cmdNode);
764  $this->readCidInfo($this->getCurrentCidOfNode($path[1]));
765  return $this->cid_class[$this->getCurrentCidOfNode($path[1])];
766  }
767  }
768  }
769 
776  public function lookupClassPath($a_class_name)
777  {
778  $a_class_name = strtolower($a_class_name);
779 
780  $cached_ctrl = ilCachedCtrl::getInstance();
781  $class_rec = $cached_ctrl->lookupClassFile($a_class_name);
782 
783  if ($class_rec["plugin_path"] != "") {
784  return $class_rec["plugin_path"] . "/" . $class_rec["filename"];
785  } else {
786  return $class_rec["filename"];
787  }
788  }
789 
798  public function getClassForClasspath($a_class_path)
799  {
800  $path = pathinfo($a_class_path);
801  $file = $path["basename"];
802  $class = substr($file, 6, strlen($file) - 10);
803 
804  return $class;
805  }
806 
813  private function getPathNew($a_source_node, $a_target_node)
814  {
815  if ($a_source_node == "1") {
816  $a_source_node = "";
817  }
818  if (substr($a_target_node, 0, strlen($a_source_node)) != $a_source_node) {
819  $failure = "ERROR: Path not found. Source:" . $a_source_node .
820  ", Target:" . $a_target_node;
821  if (DEVMODE == 1) {
822  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
823  throw new ilCtrlException($failure);
824  }
825  $GLOBALS['ilLog']->write(__METHOD__ . ' ' . $failure);
826  $this->redirectToURL('./ilias.php?baseClass=ilRepositoryGUI');
827  }
828  $temp_node = $a_source_node;
829 
830  $path = array();
831  if ($a_source_node != "") {
832  $path = array($a_source_node);
833  }
834 
835  $diffstart = ($a_source_node == "")
836  ? 0
837  : strlen($a_source_node) + 1;
838  $diff = substr($a_target_node, $diffstart);
839  $diff_arr = explode(":", $diff);
840  foreach ($diff_arr as $cid) {
841  if ($temp_node != "") {
842  $temp_node .= ":";
843  }
844  $temp_node .= $cid;
845  $path[] = $temp_node;
846  }
847  return $path;
848  }
849 
855  public function setTargetScript(string $a_target_script)
856  {
857  $this->target_script = $a_target_script;
858  }
859 
860 
866  public function getTargetScript() : string
867  {
868  return $this->target_script;
869  }
870 
871 
880  public function initBaseClass($a_base_class)
881  {
882  $_GET["baseClass"] = $a_base_class;
883  $_GET["cmd"] = "";
884  $_GET["cmdClass"] = "";
885  $_GET["cmdNode"] = "";
886  $this->initializeMemberVariables();
887  }
888 
896  public function getCmd($a_default_cmd = "", $a_safe_commands = "")
897  {
898  $cmd = "";
899  if (isset($_GET["cmd"])) {
900  $cmd = $_GET["cmd"];
901  }
902  if ($cmd == "post") {
903  if (isset($_POST["cmd"]) && is_array($_POST["cmd"])) {
904  reset($_POST["cmd"]);
905  }
906  $cmd = @key($_POST["cmd"]);
907 
908  // verify command
909  if ($this->verified_cmd != "") {
910  return $this->verified_cmd;
911  } else {
912  if (!$this->verifyToken() &&
913  (!is_array($a_safe_commands) || !in_array($cmd, $a_safe_commands))) {
914  return $a_default_cmd;
915  }
916  }
917 
918  $this->verified_cmd = $cmd;
919  if ($cmd == "" && isset($_POST["table_top_cmd"])) { // selected command in multi-list (table2)
920  $cmd = @key($_POST["table_top_cmd"]);
921  $this->verified_cmd = $cmd;
922  $_POST[$_POST["cmd_sv"][$cmd]] = $_POST[$_POST["cmd_sv"][$cmd] . "_2"];
923  }
924  if ($cmd == "" && isset($_POST["select_cmd2"])) { // selected command in multi-list (table2)
925  if (isset($_POST["select_cmd_all2"])) {
926  $_POST["select_cmd_all"] = $_POST["select_cmd_all2"];
927  } else {
928  $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
929  }
930  $cmd = $_POST["selected_cmd2"];
931  $this->verified_cmd = $cmd;
932  }
933  if ($cmd == "" && isset($_POST["select_cmd"])) { // selected command in multi-list (table2)
934  if (isset($_POST["select_cmd_all"])) {
935  $_POST["select_cmd_all2"] = $_POST["select_cmd_all"];
936  } else {
937  $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
938  }
939  $cmd = $_POST["selected_cmd"];
940  $this->verified_cmd = $cmd;
941  }
942  if ($cmd == "") {
943  $cmd = $_GET["fallbackCmd"];
944  $this->verified_cmd = $cmd;
945  }
946  }
947  if ($cmd == "") {
948  $cmd = $a_default_cmd;
949  }
950  return $cmd;
951  }
952 
963  public function setCmd($a_cmd)
964  {
965  $_GET["cmd"] = $a_cmd;
966  }
967 
978  public function setCmdClass($a_cmd_class)
979  {
980  $a_cmd_class = strtolower($a_cmd_class);
981  $nr = $this->getNodeIdForTargetClass($this->current_node, $a_cmd_class);
982  $nr = $nr["node_id"];
983  $_GET["cmdClass"] = $a_cmd_class;
984  $_GET["cmdNode"] = $nr;
985  }
986 
992  public function getCmdClass()
993  {
994  return strtolower($_GET["cmdClass"]);
995  }
996 
1007  public function getFormAction(
1008  $a_gui_obj,
1009  $a_fallback_cmd = "",
1010  $a_anchor = "",
1011  $a_asynch = false,
1012  $xml_style = true
1013  ) {
1014  $script = $this->getFormActionByClass(
1015  strtolower(get_class($a_gui_obj)),
1016  $a_fallback_cmd,
1017  $a_anchor,
1018  $a_asynch,
1019  $xml_style
1020  );
1021  return $script;
1022  }
1023 
1034  public function getFormActionByClass(
1035  $a_class,
1036  $a_fallback_cmd = "",
1037  $a_anchor = "",
1038  $a_asynch = false,
1039  $xml_style = true
1040  ) {
1041  if (!is_array($a_class)) {
1042  $a_class = strtolower($a_class);
1043  }
1044 
1045  $tok = $this->getRequestToken();
1046 
1047  if ($a_asynch) {
1048  $xml_style = false;
1049  }
1050 
1051  $script = $this->getLinkTargetByClass($a_class, "post", "", $a_asynch, $xml_style);
1052  if ($a_fallback_cmd != "") {
1053  $script = ilUtil::appendUrlParameterString($script, "fallbackCmd=" . $a_fallback_cmd, $xml_style);
1054  }
1056  $script,
1057  self::IL_RTOKEN_NAME . '=' . $this->getRequestToken(),
1058  $xml_style
1059  );
1060  if ($a_anchor != "") {
1061  $script = $script . "#" . $a_anchor;
1062  }
1063 
1064  return $script;
1065  }
1066 
1073  public function appendRequestTokenParameterString($a_url, $xml_style = true)
1074  {
1076  $a_url,
1077  self::IL_RTOKEN_NAME . '=' . $this->getRequestToken(),
1078  $xml_style
1079  );
1080  }
1081 
1087  public function getRequestToken()
1088  {
1089  global $DIC;
1090 
1091  $ilUser = $DIC["ilUser"];
1092  $ilDB = $DIC->database();
1093 
1094 
1095  if ($this->rtoken != "") {
1096  return $this->rtoken;
1097  } else {
1098  if (is_object($ilDB) && is_object($ilUser) && $ilUser->getId() > 0 &&
1099  $ilUser->getId() != ANONYMOUS_USER_ID) {
1100  $res = $ilDB->query("SELECT token FROM il_request_token WHERE user_id = " .
1101  $ilDB->quote($ilUser->getId(), "integer") .
1102  " AND session_id = " . $ilDB->quote(session_id(), "text"));
1103  $rec = $ilDB->fetchAssoc($res);
1104  if ($rec["token"] != "") {
1105  $this->rtoken = $rec["token"];
1106  return $rec["token"];
1107  }
1108  //echo "new rtoken, new entry for :".$ilUser->getId().":".session_id().":"; exit;
1109  $random = new \ilRandom();
1110  $this->rtoken = md5(uniqid($random->int(), true));
1111 
1112  // delete entries older than one and a half days
1113  if ($random->int(1, 200) == 2) {
1114  $dt = new ilDateTime(time(), IL_CAL_UNIX);
1115  $dt->increment(IL_CAL_DAY, -1);
1116  $dt->increment(IL_CAL_HOUR, -12);
1117  $dq = "DELETE FROM il_request_token WHERE " .
1118  " stamp < " . $ilDB->quote($dt->get(IL_CAL_DATETIME), "timestamp");
1119  $ilDB->manipulate($dq);
1120  }
1121 
1122  // IMPORTANT: Please do NOT try to move this implementation to a
1123  // session basis. This will fail due to framesets that are used
1124  // occasionally in ILIAS, e.g. in the chat, where multiple
1125  // forms are loaded in different frames.
1126  $ilDB->manipulate("INSERT INTO il_request_token (user_id, token, stamp, session_id) VALUES " .
1127  "(" .
1128  $ilDB->quote($ilUser->getId(), "integer") . "," .
1129  $ilDB->quote($this->rtoken, "text") . "," .
1130  $ilDB->now() . "," .
1131  $ilDB->quote(session_id(), "text") . ")");
1132  return $this->rtoken;
1133  }
1134  }
1135  return "";
1136  }
1137 
1143  private function verifyToken()
1144  {
1145  global $DIC;
1146 
1147  $ilUser = $DIC["ilUser"];
1148 
1149  $ilDB = $DIC->database();
1150  ;
1151 
1152  if (is_object($ilUser) && is_object($ilDB) && $ilUser->getId() > 0 &&
1153  $ilUser->getId() != ANONYMOUS_USER_ID) {
1154  if ($_GET["rtoken"] == "") {
1155  return false;
1156  }
1157 
1158  $set = $ilDB->query("SELECT * FROM il_request_token WHERE " .
1159  " user_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " .
1160  " token = " . $ilDB->quote($_GET[self::IL_RTOKEN_NAME]), "text");
1161  if ($ilDB->numRows($set) > 0) {
1162  // remove tokens from older sessions
1163  // if we do this immediately, working with multiple windows does not work:
1164  // - window one: open form (with token a)
1165  // - window two: open form (with token b)
1166  // - submit window one: a is verified, but b must not be deleted immediately, otherwise
1167  // - window two: submit results in invalid token
1168  // see also bug #13551
1169  $dt = new ilDateTime(time(), IL_CAL_UNIX);
1170  $dt->increment(IL_CAL_DAY, -1);
1171  $dt->increment(IL_CAL_HOUR, -12);
1172  $ilDB->manipulate("DELETE FROM il_request_token WHERE " .
1173  " user_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " .
1174  " session_id != " . $ilDB->quote(session_id(), "text") . " AND " .
1175  " stamp < " . $ilDB->quote($dt->get(IL_CAL_DATETIME), "timestamp"));
1176  return true;
1177  } else {
1178  return false;
1179  }
1180 
1181  if ($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]] != "") {
1182  // remove used token
1183  unset($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]]);
1184 
1185  // remove old tokens
1186  if (count($_SESSION["rtokens"]) > 100) {
1187  $to_remove = array();
1188  $sec = 7200; // two hours
1189 
1190  foreach ($_SESSION["rtokens"] as $tok => $time) {
1191  if (time() - $time > $sec) {
1192  $to_remove[] = $tok;
1193  }
1194  }
1195  foreach ($to_remove as $tok) {
1196  unset($_SESSION["rtokens"][$tok]);
1197  }
1198  }
1199 
1200  return true;
1201  }
1202  return false;
1203  } else {
1204  return true; // do not verify, if user or db object is missing
1205  }
1206 
1207  return false;
1208  }
1209 
1217  public function redirect($a_gui_obj, $a_cmd = "", $a_anchor = "", $a_asynch = false)
1218  {
1219  $script = $this->getLinkTargetByClass(
1220  strtolower(get_class($a_gui_obj)),
1221  $a_cmd,
1222  "",
1223  $a_asynch,
1224  false
1225  );
1226  if ($a_anchor != "") {
1227  $script = $script . "#" . $a_anchor;
1228  }
1229  $this->redirectToURL($script);
1230  }
1231 
1232 
1236  public function redirectToURL($a_script)
1237  {
1238  global $DIC;
1239 
1240  $ilPluginAdmin = null;
1241  if (isset($DIC["ilPluginAdmin"])) {
1242  $ilPluginAdmin = $DIC["ilPluginAdmin"];
1243  }
1244 
1245  if (!is_int(strpos($a_script, "://"))) {
1246  if (substr($a_script, 0, 1) != "/" && defined("ILIAS_HTTP_PATH")) {
1247  if (is_int(strpos($_SERVER["PHP_SELF"], "/setup/"))) {
1248  $a_script = "setup/" . $a_script;
1249  }
1250  $a_script = ILIAS_HTTP_PATH . "/" . $a_script;
1251  }
1252  }
1253 
1254  // include the user interface hook
1255  if (is_object($ilPluginAdmin)) {
1256  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
1257  foreach ($pl_names as $pl) {
1258  $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
1259  $gui_class = $ui_plugin->getUIClassInstance();
1260  $resp = $gui_class->getHTML("Services/Utilities", "redirect", array( "html" => $a_script ));
1261  if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
1262  $a_script = $gui_class->modifyHTML($a_script, $resp);
1263  }
1264  }
1265  }
1266 
1267  // Manually trigger to write and close the session. This has the advantage that if an exception is thrown
1268  // during the writing of the session (ILIAS writes the session into the database by default) we get an exception
1269  // if the session_write_close() is triggered by exit() then the exception will be dismissed but the session
1270  // is never written, which is a nightmare to develop with.
1271  session_write_close();
1272 
1273  global $DIC;
1274  $http = $DIC->http();
1275  switch ($http->request()->getHeaderLine('Accept')) {
1276  case 'application/json':
1278  'success' => true,
1279  'message' => 'Called redirect after async fileupload request',
1280  "redirect_url" => $a_script,
1281  ]));
1282  $http->saveResponse($http->response()->withBody($stream));
1283  break;
1284  default:
1285  $http->saveResponse($http->response()->withAddedHeader("Location", $a_script));
1286  break;
1287  }
1288  $http->sendResponse();
1289  exit;
1290  }
1291 
1292 
1299  public function redirectByClass($a_class, $a_cmd = "", $a_anchor = "", $a_asynch = false)
1300  {
1301  $script = $this->getLinkTargetByClass($a_class, $a_cmd, "", $a_asynch, false);
1302  if ($a_anchor != "") {
1303  $script = $script . "#" . $a_anchor;
1304  }
1305  $this->redirectToURL($script);
1306  }
1307 
1313  public function isAsynch()
1314  {
1315  if (isset($_GET["cmdMode"]) && $_GET["cmdMode"] == "asynch") {
1316  return true;
1317  } else {
1318  return false;
1319  }
1320  }
1321 
1322 
1334  public function getLinkTarget(
1335  $a_gui_obj,
1336  $a_cmd = "",
1337  $a_anchor = "",
1338  $a_asynch = false,
1339  $xml_style = true
1340  ) {
1341  $script = $this->getLinkTargetByClass(
1342  strtolower(get_class($a_gui_obj)),
1343  $a_cmd,
1344  $a_anchor,
1345  $a_asynch,
1346  $xml_style
1347  );
1348  return $script;
1349  }
1350 
1351 
1363  public function getLinkTargetByClass(
1364  $a_class,
1365  $a_cmd = "",
1366  $a_anchor = "",
1367  $a_asynch = false,
1368  $xml_style = true
1369  ) {
1370  if ($a_asynch) {
1371  $xml_style = false;
1372  }
1373 
1374  $script = $this->getTargetScript();
1375  $script = $this->getUrlParameters($a_class, $script, $a_cmd, $xml_style);
1376 
1377  if ($a_asynch) {
1378  $amp = "&";
1379  $script .= $amp . "cmdMode=asynch";
1380  }
1381 
1382  if ($a_anchor != "") {
1383  $script = $script . "#" . $a_anchor;
1384  }
1385 
1386  return $script;
1387  }
1388 
1392  public function setReturn($a_gui_obj, $a_cmd)
1393  {
1394  $script = $this->getTargetScript();
1395  $script = $this->getUrlParameters(strtolower(get_class($a_gui_obj)), $script, $a_cmd);
1396  $this->return[strtolower(get_class($a_gui_obj))] = $script;
1397  }
1398 
1402  public function setReturnByClass($a_class, $a_cmd)
1403  {
1404  // may not be an array!
1405  $a_class = strtolower($a_class);
1406 
1407  $script = $this->getTargetScript();
1408  $script = $this->getUrlParameters($a_class, $script, $a_cmd);
1409  $this->return[strtolower($a_class)] = $script;
1410  }
1411 
1415  public function returnToParent($a_gui_obj, $a_anchor = "")
1416  {
1417  $script = $this->getParentReturn($a_gui_obj);
1418 
1420  $script,
1421  "redirectSource=" . strtolower(get_class($a_gui_obj))
1422  );
1424  $script,
1425  "cmdMode=" . $_GET["cmdMode"]
1426  );
1427  if ($a_anchor != "") {
1428  $script = $script . "#" . $a_anchor;
1429  }
1430 
1431  $this->redirectToURL($script);
1432  }
1433 
1434 
1440  public function getParentReturn($a_gui_obj)
1441  {
1442  return $this->getParentReturnByClass(strtolower(get_class($a_gui_obj)));
1443  }
1444 
1445 
1451  protected function getParentReturnByClass($a_class)
1452  {
1453  $a_class = strtolower($a_class);
1454  $ret_class = $this->searchReturnClass($a_class);
1455  if ($ret_class) {
1456  return $this->return[$ret_class];
1457  }
1458  }
1459 
1468  public function getReturnClass($a_class)
1469  {
1470  if (is_object($a_class)) {
1471  $class = strtolower(get_class($a_class));
1472  } else {
1473  $class = strtolower($a_class);
1474  }
1475  return $this->searchReturnClass($class);
1476  }
1477 
1478 
1482  private function searchReturnClass($a_class)
1483  {
1484  $a_class = strtolower($a_class);
1485 
1486  $node = $this->getNodeIdForTargetClass($this->current_node, $a_class);
1487  $node = $node["node_id"];
1488  $n_arr = explode(":", $node);
1489  for ($i = count($n_arr) - 2; $i >= 0; $i--) {
1490  if ($this->return[$this->getClassForCid($n_arr[$i])] != "") {
1491  return $this->getClassForCid($n_arr[$i]);
1492  }
1493  }
1494 
1495  return false;
1496  }
1497 
1503  public function getRedirectSource()
1504  {
1505  return $_GET["redirectSource"];
1506  }
1507 
1511  public function getUrlParameters($a_class, $a_str, $a_cmd = "", $xml_style = false)
1512  {
1513  $params = $this->getParameterArrayByClass($a_class, $a_cmd);
1514 
1515  foreach ($params as $par => $value) {
1516  if (strlen((string) $value)) {
1517  $a_str = ilUtil::appendUrlParameterString($a_str, $par . "=" . $value, $xml_style);
1518  }
1519  }
1520 
1521  return $a_str;
1522  }
1523 
1527  public function getParameterArray($a_gui_obj, $a_cmd = "")
1528  {
1529  $par_arr = $this->getParameterArrayByClass(strtolower(get_class($a_gui_obj)), $a_cmd);
1530 
1531  return $par_arr;
1532  }
1533 
1541  public function getParameterArrayByClass($a_class, $a_cmd = "")
1542  {
1543  if ($a_class == "") {
1544  return array();
1545  }
1546 
1547  if (!is_array($a_class)) {
1548  $a_class = array($a_class);
1549  }
1550 
1551  $nr = $this->current_node;
1552  $new_baseclass = "";
1553  foreach ($a_class as $class) {
1554  $class = strtolower($class);
1555  $nr = $this->getNodeIdForTargetClass($nr, $class);
1556  if ($nr["base_class"] != "") {
1557  $new_baseclass = $nr["base_class"];
1558  }
1559  $nr = $nr["node_id"];
1560  $target_class = $class;
1561  }
1562 
1563  $path = $this->getPathNew(1, $nr);
1564  $params = array();
1565 
1566  // append parameters of parent classes
1567  foreach ($path as $node_id) {
1568  $class = ($node_id == "")
1569  ? strtolower($_GET["baseClass"])
1570  : $this->getClassForCid($this->getCurrentCidOfNode($node_id));
1571  if (isset($this->save_parameter[$class]) && is_array($this->save_parameter[$class])) {
1572  foreach ($this->save_parameter[$class] as $par) {
1573  if (isset($_GET[$par])) {
1574  $params[$par] = $_GET[$par];
1575  } elseif (isset($_POST[$par])) {
1577  }
1578  }
1579  }
1580 
1581  if (isset($this->parameter[$class]) && is_array($this->parameter[$class])) {
1582  foreach ($this->parameter[$class] as $par => $value) {
1583  $params[$par] = $value;
1584  }
1585  }
1586  }
1587 
1588  if ($a_cmd != "") {
1589  $params["cmd"] = $a_cmd;
1590  }
1591 
1592  $params["cmdClass"] = $target_class;
1593  $params["cmdNode"] = $nr;
1594  if ($new_baseclass == "") {
1595  $params["baseClass"] = $_GET["baseClass"];
1596  } else {
1597  $params["baseClass"] = $new_baseclass;
1598  }
1599 
1600  return $params;
1601  }
1602 
1603  private function classCidUnknown($a_class)
1604  {
1605  return $this->class_cid[$a_class] == "";
1606  }
1607 
1611  private function getCidForClass($a_class, $a_check = false)
1612  {
1613  if ($this->classCidUnknown($a_class)) {
1614  $this->readClassInfo($a_class);
1615  }
1616  if ($this->classCidUnknown($a_class)) {
1617  if ($a_check) {
1618  return false;
1619  }
1620  if (DEVMODE == 1) {
1621  $add = "<br><br>Please make sure your GUI class name ends with 'GUI' and that the filename is 'class.[YourClassName].php'. In exceptional cases you
1622  may solve the issue by putting an empty * @ilCtrl_Calls [YourClassName]: into your class header." .
1623  " In both cases you need to reload the control structure in the setup.";
1624  }
1625  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
1626  throw new ilCtrlException("Cannot find cid for class " . $a_class . "." . $add);
1627  }
1628  return $this->class_cid[$a_class];
1629  }
1630 
1631  private function cidClassUnknown($a_cid)
1632  {
1633  return $this->cid_class[$a_cid] == "";
1634  }
1635 
1636 
1640  private function getClassForCid($a_cid)
1641  {
1642  if ($this->cidClassUnknown($a_cid)) {
1643  $this->readCidInfo($a_cid);
1644  }
1645  if ($this->cidClassUnknown($a_cid)) {
1646  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
1647  throw new ilCtrlException("Cannot find class for cid " . $a_cid . ".");
1648  }
1649  return $this->cid_class[$a_cid];
1650  }
1651 
1652  private function fetchCallsOfClassFromCache($a_class, ilCachedCtrl $a_cached_ctrl)
1653  {
1654  foreach ($a_cached_ctrl->lookupCall($a_class) as $call) {
1655  if ($call["child"] != "" && $this->callOfClassNotKnown($a_class, $call['child'])) {
1656  $this->calls[$a_class][] = $call["child"];
1657  }
1658  }
1659  }
1660 
1667  private function readCidInfo($a_cid)
1668  {
1669  if (isset($this->info_read_cid[$a_cid])) {
1670  return;
1671  }
1672 
1673  $cached_ctrl = ilCachedCtrl::getInstance();
1674  $cid_info = $cached_ctrl->lookupCid($a_cid);
1675 
1676  if ($cid_info) {
1677  $this->updateClassCidMap($cid_info['class'], $a_cid);
1678  $this->fetchCallsOfClassFromCache($cid_info['class'], $cached_ctrl);
1679  $this->info_read_class[$cid_info["class"]] = true;
1680  }
1681 
1682  $this->info_read_cid[$a_cid] = true;
1683  }
1684 
1691  private function readNodeInfo($a_node)
1692  {
1693  $class_ids = explode(":", $a_node);
1694  foreach ($class_ids as $cid) {
1695  $this->readCidInfo($cid);
1696  }
1697  }
1698 
1705  private function readClassInfo($a_class)
1706  {
1707  $a_class = strtolower($a_class);
1708  if (isset($this->info_read_class[$a_class])) {
1709  return;
1710  }
1711 
1712  $cached_ctrl = ilCachedCtrl::getInstance();
1713  $class_info = $cached_ctrl->lookupClassFile($a_class);
1714 
1715  if ($class_info) {
1716  $this->updateClassCidMap($a_class, $class_info['cid']);
1717  }
1718  $this->fetchCallsOfClassFromCache($a_class, $cached_ctrl);
1719 
1720  $this->info_read_class[$a_class] = true;
1721  $this->info_read_cid[$this->class_cid[$a_class]] = true;
1722  }
1723 
1724  private function callOfClassNotKnown($a_class, $a_child)
1725  {
1726  return !isset($this->calls[$a_class])
1727  || !is_array($this->calls[$a_class])
1728  || !in_array($a_child, $this->calls[$a_class]);
1729  }
1730 
1731  private function updateClassCidMap($a_class, $a_cid)
1732  {
1733  $this->cid_class[$a_cid] = $a_class;
1734  $this->class_cid[$a_class] = $a_cid;
1735  }
1736 
1740  private function getParentCidOfNode($a_node)
1741  {
1742  $class_ids = explode(":", $a_node);
1743  return $class_ids[count($class_ids) - 2];
1744  }
1745 
1749  private function removeLastCid($a_node)
1750  {
1751  $lpos = strrpos($a_node, ":");
1752  return substr($a_node, 0, $lpos);
1753  }
1754 
1758  private function getCurrentCidOfNode($a_node)
1759  {
1760  $n_arr = explode(":", $a_node);
1761  return $n_arr[count($n_arr) - 1];
1762  }
1763 
1770  public function insertCtrlCalls($a_parent, $a_child, $a_comp_prefix)
1771  {
1772  global $DIC;
1773 
1774  $ilDB = $DIC->database();
1775  ;
1776 
1777  $a_parent = strtolower($a_parent);
1778  $a_child = strtolower($a_child);
1779  $a_comp_prefix = strtolower($a_comp_prefix);
1780 
1781  $set = $ilDB->query(
1782  "SELECT * FROM ctrl_calls WHERE " .
1783  " parent = " . $ilDB->quote($a_parent, "text") . " AND " .
1784  " child = " . $ilDB->quote($a_child, "text") . " AND " .
1785  " comp_prefix = " . $ilDB->quote($a_comp_prefix, "text")
1786  );
1787  if ($rec = $ilDB->fetchAssoc($set)) {
1788  return;
1789  }
1790  $ilDB->manipulate("INSERT INTO ctrl_calls " .
1791  "(parent, child, comp_prefix) VALUES (" .
1792  $ilDB->quote($a_parent, "text") . "," .
1793  $ilDB->quote($a_child, "text") . "," .
1794  $ilDB->quote($a_comp_prefix, "text") .
1795  ")");
1796  }
1797 
1805  public function checkCurrentPathForClass($gui_class)
1806  {
1807  foreach (explode(":", $this->getCmdNode()) as $cid) {
1808  if ($cid != "" && strtolower($this->getClassForCid($cid)) == strtolower($gui_class)) {
1809  return true;
1810  }
1811  }
1812  return false;
1813  }
1814 }
getCurrentCidOfNode($a_node)
Get cid of node.
removeLastCid($a_node)
Remove the class id that comes at the beginning the sequence.
getReturnClass($a_class)
Get return class.
setParameter($a_obj, $a_parameter, $a_value)
Set parameters that should be passed a form and link of a gui class.
$path
Definition: aliased.php:25
$failure
getContextObjId()
Get context object id.
This class provides processing control methods.
redirectToURL($a_script)
setReturn($a_gui_obj, $a_cmd)
Set return command.
getTabs()
Get tabs array (.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
getLinkTarget( $a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui object.
getCmdNode()
Get command target node.
getFormActionByClass( $a_class, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get form action url for gui class name.
const IL_CAL_DATETIME
lookupClassPath($a_class_name)
Get class path that can be used in include statements for a given class name.
$_SESSION["AccountId"]
getCmdClass()
Determines class that should execute the current command.
$type
global $DIC
Definition: saml.php:7
getParentCidOfNode($a_node)
Get 2nd to last class id of node.
$_GET["client_id"]
const IL_CAL_HOUR
getClassForClasspath($a_class_path)
this method assumes that the class path has the format "dir/class.<class_name>.php" ...
getHTML($a_gui_object, array $a_parameters=null)
Gets an HTML output from another GUI class and returns the flow of control to the calling class...
setCmdClass($a_cmd_class)
Set the current command class.
getRequestToken()
Get request token.
checkLPSettingsForward($a_gui_obj, $a_cmd_node)
static isSupportedObjectType($a_type)
initBaseClass($a_base_class)
Initialises new base class.
getNodeIdForTargetClass($a_par_node, $a_class, $a_check=false)
Searches a node for a given class ($a_class) "near" another node ($a_par_node).
cidClassUnknown($a_cid)
checkTargetClass($a_class)
Check whether target is valid.
getParameterArrayByClass($a_class, $a_cmd="")
Get all set/save parameters using gui class name.
const IL_CAL_UNIX
getClassForCid($a_cid)
Get class for class id after fetching and storing corresponding information, if necessary.
searchReturnClass($a_class)
Determine current return class.
$calls
Stores which class calls which other class.
checkCurrentPathForClass($gui_class)
Check if current path contains a certain gui class.
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
$stream
PHP stream implementation.
getRedirectSource()
Get current redirect source.
getCallStructure($a_class)
Get call structure of class context.
getContextSubObjType()
Get context subobject type.
saveParameterByClass($a_class, $a_parameter)
Save parameter for a class.
if($modEnd===false) $module
Definition: module.php:59
setCmd($a_cmd)
Set the current command.
appendRequestTokenParameterString($a_url, $xml_style=true)
Append request token as url parameter.
static _lookupObjectId($a_ref_id)
lookup object id
const IL_RTOKEN_NAME
$time
Definition: cron.php:21
getContextSubObjId()
Get context subobject id.
initializeMemberVariables()
Initialize member variables.
const IL_CAL_DAY
isAsynch()
Is current command an asynchronous command?
setReturnByClass($a_class, $a_cmd)
Set return command.
getCidForClass($a_class, $a_check=false)
Get class id for class after fetching and storing corresponding information, if necessary.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
readCidInfo($a_cid)
Save class respective to $a_cid and store corresponding class calls for future reference.
updateClassCidMap($a_class, $a_cid)
getNextClass($a_gui_class=null)
Get next class in the control path from the current class to the target command class.
fetchCallsOfClassFromCache($a_class, ilCachedCtrl $a_cached_ctrl)
foreach($_POST as $key=> $value) $res
setContext($a_obj_id, $a_obj_type, $a_sub_obj_id=0, $a_sub_obj_type="")
Set context of current user interface.
getParameterArray($a_gui_obj, $a_cmd="")
Get all set/save parameters for a gui object.
redirectByClass($a_class, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to other gui class using class name.
clearParameters($a_obj)
Clears all parameters that have been set via setParameter for a GUI class.
clearParametersByClass($a_class)
Clears all parameters that have been set via setParameter for a GUI class.
insertCtrlCalls($a_parent, $a_child, $a_comp_prefix)
Insert ctrl calls record.
getPathNew($a_source_node, $a_target_node)
Get path in call structure.
getCmd($a_default_cmd="", $a_safe_commands="")
Determines current get/post command.
getUrlParameters($a_class, $a_str, $a_cmd="", $xml_style=false)
Get URL parameters for a class and append them to a string.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
readClassInfo($a_class)
Save class id respective to $a_class and store corresponding class calls for future reference...
static ofString($string)
Creates a new stream with an initial value.
Definition: Streams.php:30
Date and time handling
$ilUser
Definition: imgupload.php:18
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
getTargetScript()
Get target script name.
$http
Definition: raiseError.php:7
verifyToken()
Verify Token.
saveParameter($a_obj, $a_parameter)
Set parameters that should be passed in every form and link of a gui class.
static _lookupType($a_id, $a_reference=false)
lookup object type
readNodeInfo($a_node)
Save classes respective to the class id&#39;s of a node and store corresponding class calls for future re...
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui class name.
ilCtrl exceptions
getParentReturn($a_gui_obj)
Get return script url.
exit
Definition: backend.php:16
getModuleDir()
get directory of current module
clearParameterByClass($a_class, $a_parameter)
Same as setParameterByClass, except that a class name is passed.
classCidUnknown($a_class)
setTargetScript(string $a_target_script)
set target script name
setParameterByClass($a_class, $a_parameter, $a_value)
Same as setParameterByClass, except that a class name is passed.
getCallHistory()
Get controller call history.
callBaseClass()
Calls base class of current request.
returnToParent($a_gui_obj, $a_anchor="")
Redirects to next parent class that used setReturn.
global $ilDB
$i
Definition: disco.tpl.php:19
getParentReturnByClass($a_class)
Get return script url.
$call_hist
Stores the order in which different GUI classes were called.
readCallStructure($a_class, $a_nr=0, $a_parent=0)
Reads call structure from db.
Class ilCachedCtrl.
$_POST["username"]
$html
Definition: example_001.php:87
forwardCommand($a_gui_object)
Forward flow of control to next gui class this invokes the executeCommand() method of the gui object ...
const IL_COMP_SERVICE
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
callOfClassNotKnown($a_class, $a_child)
redirect($a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to another command.
getContextObjType()
Get context object type.
__construct()
control class constructor
static getComponentInfo($a_type, $a_name)
addTab($a_lang_var, $a_link, $a_cmd, $a_class)
Add a tab to tabs array (.
getFormAction( $a_gui_obj, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get form action url for gui class object.