ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCtrl Class Reference

This class provides processing control methods. More...

+ Collaboration diagram for ilCtrl:

Public Member Functions

 __construct ()
 control class constructor More...
 
 callBaseClass ()
 Calls base class of current request. More...
 
 getModuleDir ()
 get directory of current module More...
 
 forwardCommand ($a_gui_object)
 Forward flow of control to next gui class this invokes the executeCommand() method of the gui object that is passed via reference. More...
 
 getHTML ($a_gui_object, array $a_parameters=null, array $class_path=[])
 Gets an HTML output from another GUI class and returns the flow of control to the calling class. More...
 
 setContext ($a_obj_id, $a_obj_type, $a_sub_obj_id=0, $a_sub_obj_type="")
 Set context of current user interface. More...
 
 getContextObjId ()
 Get context object id. More...
 
 getContextObjType ()
 Get context object type. More...
 
 getContextSubObjId ()
 Get context subobject id. More...
 
 getContextSubObjType ()
 Get context subobject type. More...
 
 checkTargetClass ($a_class)
 Check whether target is valid. More...
 
 getCmdNode ()
 Get command target node. More...
 
 addTab ($a_lang_var, $a_link, $a_cmd, $a_class)
 Add a tab to tabs array (. More...
 
 getTabs ()
 Get tabs array (. More...
 
 getCallHistory ()
 Get controller call history. More...
 
 getCallStructure ($a_class)
 Get call structure of class context. More...
 
 readCallStructure ($a_class, $a_nr=0, $a_parent=0)
 Reads call structure from db. More...
 
 saveParameter ($a_obj, $a_parameter)
 Set parameters that should be passed in every form and link of a gui class. More...
 
 saveParameterByClass ($a_class, $a_parameter)
 Save parameter for a class. More...
 
 setParameter ($a_obj, $a_parameter, $a_value)
 Set parameters that should be passed a form and link of a gui class. More...
 
 setParameterByClass ($a_class, $a_parameter, $a_value)
 Same as setParameterByClass, except that a class name is passed. More...
 
 clearParameterByClass ($a_class, $a_parameter)
 Same as setParameterByClass, except that a class name is passed. More...
 
 clearParameters ($a_obj)
 Clears all parameters that have been set via setParameter for a GUI class. More...
 
 clearParametersByClass ($a_class)
 Clears all parameters that have been set via setParameter for a GUI class. More...
 
 getNextClass ($a_gui_class=null)
 Get next class in the control path from the current class to the target command class. More...
 
 lookupClassPath ($a_class_name)
 Get class path that can be used in include statements for a given class name. More...
 
 getClassForClasspath ($a_class_path)
 this method assumes that the class path has the format "dir/class.<class_name>.php" More...
 
 setTargetScript (string $a_target_script)
 set target script name More...
 
 getTargetScript ()
 Get target script name. More...
 
 initBaseClass ($a_base_class)
 Initialises new base class. More...
 
 getCmd ($a_default_cmd="", $a_safe_commands="")
 Determines current get/post command. More...
 
 setCmd ($a_cmd)
 Set the current command. More...
 
 setCmdClass ($a_cmd_class)
 Set the current command class. More...
 
 getCmdClass ()
 Determines class that should execute the current command. More...
 
 getFormAction ( $a_gui_obj, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
 Get form action url for gui class object. More...
 
 getFormActionByClass ( $a_class, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
 Get form action url for gui class name. More...
 
 appendRequestTokenParameterString ($a_url, $xml_style=false)
 Append request token as url parameter. More...
 
 getRequestToken ()
 Get request token. More...
 
 redirect ($a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false)
 Redirect to another command. More...
 
 redirectToURL ($a_script)
 
 redirectByClass ($a_class, $a_cmd="", $a_anchor="", $a_asynch=false)
 Redirect to other gui class using class name. More...
 
 isAsynch ()
 Is current command an asynchronous command? More...
 
 getLinkTarget ( $a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
 Get link target for command using gui object. More...
 
 getLinkTargetByClass ( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
 Get link target for command using gui class name. More...
 
 setReturn ($a_gui_obj, $a_cmd)
 Set return command. More...
 
 setReturnByClass ($a_class, $a_cmd)
 Set return command. More...
 
 returnToParent ($a_gui_obj, $a_anchor="")
 Redirects to next parent class that used setReturn. More...
 
 getParentReturn ($a_gui_obj)
 Get return script url. More...
 
 getParentReturnByClass ($a_class)
 Get return script url. More...
 
 getReturnClass ($a_class)
 Get return class. More...
 
 getRedirectSource ()
 Get current redirect source. More...
 
 getUrlParameters ($a_class, $a_str, $a_cmd="", $xml_style=false)
 Get URL parameters for a class and append them to a string. More...
 
 getParameterArray ($a_gui_obj, $a_cmd="")
 Get all set/save parameters for a gui object. More...
 
 getParameterArrayByClass ($a_class, $a_cmd="")
 Get all set/save parameters using gui class name. More...
 
 insertCtrlCalls ($a_parent, $a_child, $a_comp_prefix)
 Insert ctrl calls record. More...
 
 checkCurrentPathForClass ($gui_class)
 Check if current path contains a certain gui class. More...
 
 getCurrentClassPath ()
 Get current class path as array of class file names. More...
 

Data Fields

const IL_RTOKEN_NAME = 'rtoken'
 

Protected Member Functions

 initializeMemberVariables ()
 Initialize member variables. More...
 
 checkLPSettingsForward ($a_gui_obj, $a_cmd_node)
 
 getReadableNode ($node)
 Get readable node. More...
 

Protected Attributes

 $save_parameter
 
 $parameter
 
 $return
 
 $call_hist = array()
 Stores the order in which different GUI classes were called. More...
 
 $calls = array()
 Stores which class calls which other class. More...
 
 $rtoken = false
 
 $target_script = "ilias.php"
 
 $module_dir
 
 $use_current_to_determine_next = false
 
 $inner_base_class = ""
 

Private Member Functions

 getNodeIdForTargetClass ($a_par_node, $a_class, $a_check=false)
 Searches a node for a given class ($a_class) "near" another node ($a_par_node). More...
 
 getPathNew ($a_source_node, $a_target_node)
 Get path in call structure. More...
 
 verifyToken ()
 Verify Token. More...
 
 searchReturnClass ($a_class)
 Determine current return class. More...
 
 classCidUnknown ($a_class)
 
 getCidForClass ($a_class, $a_check=false)
 Get class id for class after fetching and storing corresponding information, if necessary. More...
 
 cidClassUnknown ($a_cid)
 
 getClassForCid ($a_cid)
 Get class for class id after fetching and storing corresponding information, if necessary. More...
 
 fetchCallsOfClassFromCache ($a_class, ilCachedCtrl $a_cached_ctrl)
 
 readCidInfo ($a_cid)
 Save class respective to $a_cid and store corresponding class calls for future reference. More...
 
 readNodeInfo ($a_node)
 Save classes respective to the class id's of a node and store corresponding class calls for future reference. More...
 
 readClassInfo ($a_class)
 Save class id respective to $a_class and store corresponding class calls for future reference. More...
 
 callOfClassNotKnown ($a_class, $a_child)
 
 updateClassCidMap ($a_class, $a_cid)
 
 getParentCidOfNode ($a_node)
 Get 2nd to last class id of node. More...
 
 getCidOfNode ($a_node)
 Get last class id of node. More...
 
 removeLastCid ($a_node)
 Remove the class id that comes at the beginning the sequence. More...
 
 getCurrentCidOfNode ($a_node)
 Get cid of node. More...
 

Detailed Description

This class provides processing control methods.

A global instance is available via variable $ilCtrl

xml_style parameters: This mode was activated per default in the past, is now set to false but still being used and needed, if link information is passed to the xslt processing e.g. in content pages.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 15 of file class.ilCtrl.php.

Constructor & Destructor Documentation

◆ __construct()

ilCtrl::__construct ( )

control class constructor

Definition at line 107 of file class.ilCtrl.php.

References initializeMemberVariables().

108  {
109  $this->initializeMemberVariables();
110 
111  // this information should go to xml files one day
112  $this->stored_trees = array("ilrepositorygui", "ildashboardgui",
113  "illmpresentationgui", "illmeditorgui",
114  "iladministrationgui");
115  }
initializeMemberVariables()
Initialize member variables.
+ Here is the call graph for this function:

Member Function Documentation

◆ addTab()

ilCtrl::addTab (   $a_lang_var,
  $a_link,
  $a_cmd,
  $a_class 
)

Add a tab to tabs array (.

Deprecated:
use $ilTabs)
Parameters
string$a_lang_varlanguage variable
string$a_linklink
string$a_cmdcommand (must be same as in link)
string$a_classcommand class (must be same as in link)

Definition at line 498 of file class.ilCtrl.php.

499  {
500  $a_class = strtolower($a_class);
501 
502  $this->tab[] = array("lang_var" => $a_lang_var,
503  "link" => $a_link, "cmd" => $a_cmd, "class" => $a_class);
504  }

◆ appendRequestTokenParameterString()

ilCtrl::appendRequestTokenParameterString (   $a_url,
  $xml_style = false 
)

Append request token as url parameter.

Parameters
stringurl
booleanxml style

Definition at line 1117 of file class.ilCtrl.php.

References ilUtil\appendUrlParameterString(), and getRequestToken().

1118  {
1120  $a_url,
1121  self::IL_RTOKEN_NAME . '=' . $this->getRequestToken(),
1122  $xml_style
1123  );
1124  }
getRequestToken()
Get request token.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
+ Here is the call graph for this function:

◆ callBaseClass()

ilCtrl::callBaseClass ( )

Calls base class of current request.

The base class is passed via $_GET["baseClass"] and is the first class in the call sequence of the request. Do not call this method within other scripts than ilias.php.

Exceptions
ilCtrlException

Definition at line 140 of file class.ilCtrl.php.

References $_GET, $_SERVER, $DIC, $ilDB, $service, forwardCommand(), getCallStructure(), ilComponent\getComponentInfo(), and ilCachedCtrl\getInstance().

141  {
142  global $DIC;
143 
144  $ilDB = $DIC->database();
145 
146  $baseClass = strtolower($_GET["baseClass"]);
147 
148  $module_class = ilCachedCtrl::getInstance();
149  $mc_rec = $module_class->lookupModuleClass($baseClass);
150 
151  $module = $mc_rec["module"];
152  $class = $mc_rec["class"];
153  $class_dir = $mc_rec["dir"];
154 
155  if ($module != "") {
156  $m_set = $ilDB->query("SELECT * FROM il_component WHERE name = " .
157  $ilDB->quote($module, "text"));
158  $m_rec = $ilDB->fetchAssoc($m_set);
159  } else { // check whether class belongs to a service
160  $mc_rec = $module_class->lookupServiceClass($baseClass);
161 
162  $service = $mc_rec["service"];
163  $class = $mc_rec["class"];
164  $class_dir = $mc_rec["dir"];
165 
166  if ($service == "") {
167  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
168  throw new ilCtrlException("Could not find entry in modules.xml or services.xml for " .
169  $baseClass . " <br/>" . str_replace("&", "<br />&", htmlentities($_SERVER["REQUEST_URI"])));
170  }
171 
172  $m_rec = ilComponent::getComponentInfo('Services', $service);
173  }
174 
175  // forward processing to base class
176  $this->getCallStructure(strtolower($baseClass));
177  $base_class_gui = new $class();
178  $this->forwardCommand($base_class_gui);
179  }
$_GET["client_id"]
getCallStructure($a_class)
Get call structure of class context.
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
$service
Definition: result.php:17
global $DIC
Definition: goto.php:24
ilCtrl exceptions
global $ilDB
forwardCommand($a_gui_object)
Forward flow of control to next gui class this invokes the executeCommand() method of the gui object ...
static getComponentInfo($a_type, $a_name)
+ Here is the call graph for this function:

◆ callOfClassNotKnown()

ilCtrl::callOfClassNotKnown (   $a_class,
  $a_child 
)
private

Definition at line 1778 of file class.ilCtrl.php.

Referenced by fetchCallsOfClassFromCache().

1779  {
1780  return !isset($this->calls[$a_class])
1781  || !is_array($this->calls[$a_class])
1782  || !in_array($a_child, $this->calls[$a_class]);
1783  }
+ Here is the caller graph for this function:

◆ checkCurrentPathForClass()

ilCtrl::checkCurrentPathForClass (   $gui_class)

Check if current path contains a certain gui class.

Parameters
$gui_class
Returns
bool
Exceptions
ilCtrlException

Definition at line 1868 of file class.ilCtrl.php.

References getClassForCid(), and getCmdNode().

1869  {
1870  foreach (explode(":", $this->getCmdNode()) as $cid) {
1871  if ($cid != "" && strtolower($this->getClassForCid($cid)) == strtolower($gui_class)) {
1872  return true;
1873  }
1874  }
1875  return false;
1876  }
getCmdNode()
Get command target node.
getClassForCid($a_cid)
Get class for class id after fetching and storing corresponding information, if necessary.
+ Here is the call graph for this function:

◆ checkLPSettingsForward()

ilCtrl::checkLPSettingsForward (   $a_gui_obj,
  $a_cmd_node 
)
protected

Definition at line 696 of file class.ilCtrl.php.

References $_GET, $DIC, $GLOBALS, $type, ilObject\_lookupObjectId(), ilObjSAHSLearningModule\_lookupSubType(), ilObject\_lookupType(), getNodeIdForTargetClass(), ilObjectLP\isSupportedObjectType(), redirectByClass(), and setParameterByClass().

Referenced by getNextClass().

697  {
698  global $DIC;
699 
700  $objDefinition = $DIC["objDefinition"];
701 
702  // forward to learning progress settings if possible and accessible
703  if ($_GET["gotolp"] &&
704  $a_gui_obj) {
705  $ref_id = $_GET["ref_id"];
706  if (!$ref_id) {
707  $ref_id = $_REQUEST["ref_id"];
708  }
709 
710  $gui_class = get_class($a_gui_obj);
711 
712  if ($gui_class == "ilSAHSEditGUI") {
713  // #1625 - because of scorm "sub-types" this is all very special
714  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
715  $obj_id = ilObject::_lookupObjectId($ref_id);
716  switch (ilObjSAHSLearningModule::_lookupSubType($obj_id)) {
717  case "scorm2004":
718  $class = "ilObjSCORM2004LearningModuleGUI";
719  break;
720 
721  case "scorm":
722  $class = "ilObjSCORMLearningModuleGUI";
723  break;
724 
725  case "aicc":
726  $class = "ilObjAICCLearningModuleGUI";
727  break;
728 
729  case "hacp":
730  $class = "ilObjHACPLearningModuleGUI";
731  break;
732  }
733  if ($GLOBALS["ilAccess"]->checkAccess("edit_learning_progress", "", $ref_id)) {
734  $this->redirectByClass(array($gui_class, $class, "illearningprogressgui", "illplistofsettingsgui"), "");
735  }
736  }
737  // special case: cannot use any presentation GUIs
738  elseif ($gui_class == "ilLMPresentationGUI") {
739  $this->setParameterByClass("ilObjLearningModuleGUI", "gotolp", 1);
740  $this->redirectByClass(array("ilLMEditorGUI", "ilObjLearningModuleGUI"), "");
741  }
742 
743  include_once "Services/Object/classes/class.ilObjectLP.php";
744  $type = ilObject::_lookupType($ref_id, true);
745  $class = "ilObj" . $objDefinition->getClassName($type) . "GUI";
746 
747  if ($gui_class == $class &&
749  $GLOBALS["ilAccess"]->checkAccess("edit_learning_progress", "", $ref_id)) {
750  // add path to repository object gui if missing from cmdNode
751  if (!$a_cmd_node) {
752  $repo_node = $this->getNodeIdForTargetClass(null, "ilrepositorygui");
753  $obj_node = $this->getNodeIdForTargetClass($repo_node["node_id"], $gui_class);
754  $a_cmd_node = $obj_node["node_id"];
755  }
756  // find path to lp settings
757  $lp_node = $this->getNodeIdForTargetClass($a_cmd_node, "illearningprogressgui");
758  $lp_settings_node = $this->getNodeIdForTargetClass($lp_node["node_id"], "illplistofsettingsgui");
759  $_GET["cmdNode"] = $lp_settings_node["node_id"];
760  $_GET["cmdClass"] = "ilLPListOfSettingsGUI";
761  $_GET["cmd"] = "";
762  return "illearningprogressgui";
763  }
764  }
765  }
$type
$_GET["client_id"]
getNodeIdForTargetClass($a_par_node, $a_class, $a_check=false)
Searches a node for a given class ($a_class) "near" another node ($a_par_node).
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static _lookupObjectId($a_ref_id)
lookup object id
redirectByClass($a_class, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to other gui class using class name.
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static _lookupType($a_id, $a_reference=false)
lookup object type
static isSupportedObjectType($type)
setParameterByClass($a_class, $a_parameter, $a_value)
Same as setParameterByClass, except that a class name is passed.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkTargetClass()

ilCtrl::checkTargetClass (   $a_class)

Check whether target is valid.

Parameters

Definition at line 457 of file class.ilCtrl.php.

References getCidForClass(), and getNodeIdForTargetClass().

458  {
459  if (!is_array($a_class)) {
460  $a_class = array($a_class);
461  }
462 
463  $nr = $this->current_node;
464  foreach ($a_class as $class) {
465  $class = strtolower($class);
466 
467  if (!$this->getCidForClass($class, true)) {
468  return false;
469  }
470 
471  $nr = $this->getNodeIdForTargetClass($nr, $class, true);
472  $nr = $nr["node_id"];
473  if ($nr === false) {
474  return false;
475  }
476  }
477  return true;
478  }
getNodeIdForTargetClass($a_par_node, $a_class, $a_check=false)
Searches a node for a given class ($a_class) "near" another node ($a_par_node).
getCidForClass($a_class, $a_check=false)
Get class id for class after fetching and storing corresponding information, if necessary.
+ Here is the call graph for this function:

◆ cidClassUnknown()

ilCtrl::cidClassUnknown (   $a_cid)
private

Definition at line 1685 of file class.ilCtrl.php.

Referenced by getClassForCid().

1686  {
1687  return $this->cid_class[$a_cid] == "";
1688  }
+ Here is the caller graph for this function:

◆ classCidUnknown()

ilCtrl::classCidUnknown (   $a_class)
private

Definition at line 1657 of file class.ilCtrl.php.

Referenced by getCidForClass().

1658  {
1659  return $this->class_cid[$a_class] == "";
1660  }
+ Here is the caller graph for this function:

◆ clearParameterByClass()

ilCtrl::clearParameterByClass (   $a_class,
  $a_parameter 
)

Same as setParameterByClass, except that a class name is passed.

Parameters
string$a_classgui class name
string$a_parameterparameter name
string$a_parameterparameter value

Definition at line 669 of file class.ilCtrl.php.

670  {
671  unset($this->parameter[strtolower($a_class)][$a_parameter]);
672  }

◆ clearParameters()

ilCtrl::clearParameters (   $a_obj)

Clears all parameters that have been set via setParameter for a GUI class.

Parameters
object$a_objgui object

Definition at line 680 of file class.ilCtrl.php.

References clearParametersByClass().

681  {
682  $this->clearParametersByClass(strtolower(get_class($a_obj)));
683  }
clearParametersByClass($a_class)
Clears all parameters that have been set via setParameter for a GUI class.
+ Here is the call graph for this function:

◆ clearParametersByClass()

ilCtrl::clearParametersByClass (   $a_class)

Clears all parameters that have been set via setParameter for a GUI class.

Parameters
string$a_classgui class name

Definition at line 691 of file class.ilCtrl.php.

Referenced by clearParameters().

692  {
693  $this->parameter[strtolower($a_class)] = array();
694  }
+ Here is the caller graph for this function:

◆ fetchCallsOfClassFromCache()

ilCtrl::fetchCallsOfClassFromCache (   $a_class,
ilCachedCtrl  $a_cached_ctrl 
)
private

Definition at line 1706 of file class.ilCtrl.php.

References callOfClassNotKnown(), and ilCachedCtrl\lookupCall().

Referenced by readCidInfo(), and readClassInfo().

1707  {
1708  foreach ($a_cached_ctrl->lookupCall($a_class) as $call) {
1709  if ($call["child"] != "" && $this->callOfClassNotKnown($a_class, $call['child'])) {
1710  $this->calls[$a_class][] = $call["child"];
1711  }
1712  }
1713  }
callOfClassNotKnown($a_class, $a_child)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ forwardCommand()

ilCtrl::forwardCommand (   $a_gui_object)

Forward flow of control to next gui class this invokes the executeCommand() method of the gui object that is passed via reference.

Parameters
object$a_gui_objectgui object that should receive
Returns
mixed return data of invoked executeCommand() method
Exceptions
ilCtrlException

Definition at line 202 of file class.ilCtrl.php.

References getCmd(), and getNodeIdForTargetClass().

Referenced by callBaseClass(), ilLTIRouterGUI\executeCommand(), ilObjectPermissionStatusGUI\executeCommand(), and ilChatroomInfoGUI\executeDefault().

203  {
204  $class = strtolower(get_class($a_gui_object));
205  $nr = $this->getNodeIdForTargetClass($this->current_node, $class);
206  $nr = $nr["node_id"];
207  if ($nr != "") {
208  $current_node = $this->current_node;
209 
210  $this->current_node = $nr;
211 
212  // always populate the call history
213  // it will only be displayed in DEVMODE but is needed for UI plugins, too
214  $this->call_hist[] = array("class" => get_class($a_gui_object),
215  "mode" => "execComm", "cmd" => $this->getCmd());
216 
217  $html = $a_gui_object->executeCommand();
218 
219  // reset current node
220  $this->current_node = $current_node;
221 
222  return $html;
223  }
224 
225  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
226  throw new ilCtrlException("ERROR: Can't forward to class $class.");
227  }
getNodeIdForTargetClass($a_par_node, $a_class, $a_check=false)
Searches a node for a given class ($a_class) "near" another node ($a_par_node).
getCmd($a_default_cmd="", $a_safe_commands="")
Determines current get/post command.
ilCtrl exceptions
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCallHistory()

ilCtrl::getCallHistory ( )

Get controller call history.

This is used for the developer mode and presented in the footer

Returns
array array of call history entries

Definition at line 523 of file class.ilCtrl.php.

References $call_hist.

524  {
525  return $this->call_hist;
526  }
$call_hist
Stores the order in which different GUI classes were called.

◆ getCallStructure()

ilCtrl::getCallStructure (   $a_class)

Get call structure of class context.

This method must be called for the top level gui class in the leading php script. It must be called before the the current command is forwarded to the top level gui class. Example:

include_once "classes/class.ilRepositoryGUI.php"; $ilCtrl->getCallStructure("ilrepositorygui"); $repository_gui = new ilRepositoryGUI(); $ilCtrl->forwardCommand($repository_gui);

Parameters
string$a_classgui class name

public

Definition at line 543 of file class.ilCtrl.php.

References readClassInfo().

Referenced by callBaseClass(), and getNodeIdForTargetClass().

544  {
545  $this->readClassInfo($a_class);
546  }
readClassInfo($a_class)
Save class id respective to $a_class and store corresponding class calls for future reference...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCidForClass()

ilCtrl::getCidForClass (   $a_class,
  $a_check = false 
)
private

Get class id for class after fetching and storing corresponding information, if necessary.

Definition at line 1665 of file class.ilCtrl.php.

References classCidUnknown(), and readClassInfo().

Referenced by checkTargetClass(), and getNodeIdForTargetClass().

1666  {
1667  if ($this->classCidUnknown($a_class)) {
1668  $this->readClassInfo($a_class);
1669  }
1670  if ($this->classCidUnknown($a_class)) {
1671  if ($a_check) {
1672  return false;
1673  }
1674  if (DEVMODE == 1) {
1675  $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
1676  may solve the issue by putting an empty * @ilCtrl_Calls [YourClassName]: into your class header." .
1677  " In both cases you need to reload the control structure in the setup.";
1678  }
1679  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
1680  throw new ilCtrlException("Cannot find cid for class " . $a_class . "." . $add);
1681  }
1682  return $this->class_cid[$a_class];
1683  }
readClassInfo($a_class)
Save class id respective to $a_class and store corresponding class calls for future reference...
ilCtrl exceptions
classCidUnknown($a_class)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCidOfNode()

ilCtrl::getCidOfNode (   $a_node)
private

Get last class id of node.

Definition at line 1803 of file class.ilCtrl.php.

Referenced by getNodeIdForTargetClass().

1804  {
1805  $class_ids = explode(":", $a_node);
1806  return $class_ids[count($class_ids) - 1];
1807  }
+ Here is the caller graph for this function:

◆ getClassForCid()

ilCtrl::getClassForCid (   $a_cid)
private

Get class for class id after fetching and storing corresponding information, if necessary.

Definition at line 1694 of file class.ilCtrl.php.

References cidClassUnknown(), and readCidInfo().

Referenced by checkCurrentPathForClass(), getCurrentClassPath(), getNodeIdForTargetClass(), getParameterArrayByClass(), getReadableNode(), and searchReturnClass().

1695  {
1696  if ($this->cidClassUnknown($a_cid)) {
1697  $this->readCidInfo($a_cid);
1698  }
1699  if ($this->cidClassUnknown($a_cid)) {
1700  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
1701  throw new ilCtrlException("Cannot find class for cid " . $a_cid . ".");
1702  }
1703  return $this->cid_class[$a_cid];
1704  }
cidClassUnknown($a_cid)
readCidInfo($a_cid)
Save class respective to $a_cid and store corresponding class calls for future reference.
ilCtrl exceptions
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getClassForClasspath()

ilCtrl::getClassForClasspath (   $a_class_path)

this method assumes that the class path has the format "dir/class.<class_name>.php"

Parameters
string$a_class_pathclass path public
Returns
string class name

Definition at line 828 of file class.ilCtrl.php.

829  {
830  $path = pathinfo($a_class_path);
831  $file = $path["basename"];
832  $class = substr($file, 6, strlen($file) - 10);
833 
834  return $class;
835  }

◆ getCmd()

ilCtrl::getCmd (   $a_default_cmd = "",
  $a_safe_commands = "" 
)

Determines current get/post command.

Parameters
stringdefault command
arraysafe commands: for these commands no token is checked for post requests

Definition at line 940 of file class.ilCtrl.php.

References $_GET, $_POST, and verifyToken().

Referenced by ilTestSignatureGUI\executeCommand(), ilObjectPermissionStatusGUI\executeCommand(), ilObjWorkflowEngineGUI\executeCommand(), forwardCommand(), and getHTML().

941  {
942  $cmd = "";
943  if (isset($_GET["cmd"])) {
944  $cmd = $_GET["cmd"];
945  }
946  if ($cmd == "post") {
947  if (isset($_POST["cmd"]) && is_array($_POST["cmd"])) {
948  reset($_POST["cmd"]);
949  }
950  $cmd = @key($_POST["cmd"]);
951 
952  // verify command
953  if ($this->verified_cmd != "") {
954  return $this->verified_cmd;
955  } else {
956  if (!$this->verifyToken() &&
957  (!is_array($a_safe_commands) || !in_array($cmd, $a_safe_commands))) {
958  return $a_default_cmd;
959  }
960  }
961 
962  $this->verified_cmd = $cmd;
963  if ($cmd == "" && isset($_POST["table_top_cmd"])) { // selected command in multi-list (table2)
964  $cmd = @key($_POST["table_top_cmd"]);
965  $this->verified_cmd = $cmd;
966  $_POST[$_POST["cmd_sv"][$cmd]] = $_POST[$_POST["cmd_sv"][$cmd] . "_2"];
967  }
968  if ($cmd == "" && isset($_POST["select_cmd2"])) { // selected command in multi-list (table2)
969  if (isset($_POST["select_cmd_all2"])) {
970  $_POST["select_cmd_all"] = $_POST["select_cmd_all2"];
971  } else {
972  $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
973  }
974  $cmd = $_POST["selected_cmd2"];
975  $this->verified_cmd = $cmd;
976  }
977  if ($cmd == "" && isset($_POST["select_cmd"])) { // selected command in multi-list (table2)
978  if (isset($_POST["select_cmd_all"])) {
979  $_POST["select_cmd_all2"] = $_POST["select_cmd_all"];
980  } else {
981  $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
982  }
983  $cmd = $_POST["selected_cmd"];
984  $this->verified_cmd = $cmd;
985  }
986  if ($cmd == "") {
987  $cmd = $_GET["fallbackCmd"];
988  $this->verified_cmd = $cmd;
989  }
990  }
991  if ($cmd == "") {
992  $cmd = $a_default_cmd;
993  }
994  return $cmd;
995  }
$_GET["client_id"]
verifyToken()
Verify Token.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCmdClass()

ilCtrl::getCmdClass ( )

Determines class that should execute the current command.

Returns
string class name

Definition at line 1036 of file class.ilCtrl.php.

References $_GET.

1037  {
1038  return strtolower($_GET["cmdClass"]);
1039  }
$_GET["client_id"]

◆ getCmdNode()

ilCtrl::getCmdNode ( )

Get command target node.

Returns
string id of current command target node

Definition at line 485 of file class.ilCtrl.php.

References $_GET.

Referenced by checkCurrentPathForClass(), getCurrentClassPath(), and getNextClass().

486  {
487  return $_GET["cmdNode"];
488  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ getContextObjId()

ilCtrl::getContextObjId ( )

Get context object id.

Returns
int object id

Definition at line 311 of file class.ilCtrl.php.

312  {
313  return $this->context_obj_id;
314  }

◆ getContextObjType()

ilCtrl::getContextObjType ( )

Get context object type.

Returns
string object type

Definition at line 321 of file class.ilCtrl.php.

322  {
323  return $this->context_obj_type;
324  }

◆ getContextSubObjId()

ilCtrl::getContextSubObjId ( )

Get context subobject id.

Returns
int subobject id

Definition at line 331 of file class.ilCtrl.php.

332  {
333  return $this->context_sub_obj_id;
334  }

◆ getContextSubObjType()

ilCtrl::getContextSubObjType ( )

Get context subobject type.

Returns
string subobject type

Definition at line 341 of file class.ilCtrl.php.

342  {
343  return $this->context_sub_obj_type;
344  }

◆ getCurrentCidOfNode()

ilCtrl::getCurrentCidOfNode (   $a_node)
private

Get cid of node.

Definition at line 1821 of file class.ilCtrl.php.

Referenced by getNextClass(), getNodeIdForTargetClass(), and getParameterArrayByClass().

1822  {
1823  $n_arr = explode(":", $a_node);
1824  return $n_arr[count($n_arr) - 1];
1825  }
+ Here is the caller graph for this function:

◆ getCurrentClassPath()

ilCtrl::getCurrentClassPath ( )

Get current class path as array of class file names.

Returns
array
Exceptions
ilCtrlException

Definition at line 1884 of file class.ilCtrl.php.

References $_GET, getClassForCid(), and getCmdNode().

1884  : array
1885  {
1886  $path = [];
1887  foreach (explode(":", $this->getCmdNode()) as $cid) {
1888  if ($cid != "") {
1889  $path[] = $this->getClassForCid($cid);
1890  }
1891  }
1892  if ($this->getCmdNode() == "" && $_GET["baseClass"] != "") {
1893  $path[] = $_GET["baseClass"];
1894  }
1895  return $path;
1896  }
getCmdNode()
Get command target node.
$_GET["client_id"]
getClassForCid($a_cid)
Get class for class id after fetching and storing corresponding information, if necessary.
+ Here is the call graph for this function:

◆ getFormAction()

ilCtrl::getFormAction (   $a_gui_obj,
  $a_fallback_cmd = "",
  $a_anchor = "",
  $a_asynch = false,
  $xml_style = false 
)

Get form action url for gui class object.

Parameters
objectgui object
stringfallback command
stringanchor
boolasynchronous call
boolxml style t/f
Returns
string script url

Definition at line 1051 of file class.ilCtrl.php.

References getFormActionByClass().

Referenced by ilTestSkillLevelThresholdsTableGUI\__construct(), ilObjectPermissionStatusGUI\accessStatusInfo(), ilObjectPermissionStatusGUI\addToolbar(), ilChatroomHistoryGUI\byDay(), ilChatroomHistoryGUI\bySession(), ilChatroomAdminViewGUI\clientsettings(), ilChatroomAdminSmileyGUI\deleteMultipleObject(), ilChatroomSettingsGUI\general(), ilChatroomAdminSmileyGUI\initSmiliesEditForm(), ilChatroomAdminSmileyGUI\initSmiliesForm(), ilHistoryTableGUI\initTable(), ilChatroomAdminSmileyGUI\showDeleteSmileyFormObject(), and ilChatroomViewGUI\showNameSelection().

1057  {
1058  $script = $this->getFormActionByClass(
1059  strtolower(get_class($a_gui_obj)),
1060  $a_fallback_cmd,
1061  $a_anchor,
1062  $a_asynch,
1063  $xml_style
1064  );
1065  return $script;
1066  }
getFormActionByClass( $a_class, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
Get form action url for gui class name.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFormActionByClass()

ilCtrl::getFormActionByClass (   $a_class,
  $a_fallback_cmd = "",
  $a_anchor = "",
  $a_asynch = false,
  $xml_style = false 
)

Get form action url for gui class name.

Parameters
stringgui class name
stringfallback command
stringanchor
boolasynchronous call
boolxml style t/f
Returns
string script url

Definition at line 1078 of file class.ilCtrl.php.

References ilUtil\appendUrlParameterString(), getLinkTargetByClass(), and getRequestToken().

Referenced by getFormAction().

1084  {
1085  if (!is_array($a_class)) {
1086  $a_class = strtolower($a_class);
1087  }
1088 
1089  $tok = $this->getRequestToken();
1090 
1091  if ($a_asynch) {
1092  $xml_style = false;
1093  }
1094 
1095  $script = $this->getLinkTargetByClass($a_class, "post", "", $a_asynch, $xml_style);
1096  if ($a_fallback_cmd != "") {
1097  $script = ilUtil::appendUrlParameterString($script, "fallbackCmd=" . $a_fallback_cmd, $xml_style);
1098  }
1100  $script,
1101  self::IL_RTOKEN_NAME . '=' . $this->getRequestToken(),
1102  $xml_style
1103  );
1104  if ($a_anchor != "") {
1105  $script = $script . "#" . $a_anchor;
1106  }
1107 
1108  return $script;
1109  }
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
Get link target for command using gui class name.
getRequestToken()
Get request token.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilCtrl::getHTML (   $a_gui_object,
array  $a_parameters = null,
array  $class_path = [] 
)

Gets an HTML output from another GUI class and returns the flow of control to the calling class.

Parameters
object$a_gui_objectGUI class that implements getHTML() method to return its HTML
array | null$a_parametersparameter array
Returns
string
Exceptions
ilCtrlException

Definition at line 238 of file class.ilCtrl.php.

References $_GET, $inner_base_class, getCmd(), getNodeIdForTargetClass(), and getParameterArrayByClass().

239  {
240  $class = strtolower(get_class($a_gui_object));
241 
242  if (count($class_path) > 0) {
243  $class_path = array_merge($class_path, [$class]);
244  $p = $this->getParameterArrayByClass($class_path);
245  $nr = $p["cmdNode"];
246  $baseclass = $p["baseClass"];
247  $this->inner_base_class = $p["cmdNode"];
248  } else {
249  $nr = $this->getNodeIdForTargetClass($this->current_node, $class);
250  $nr = $nr["node_id"];
251  }
252  if ($nr != "") {
253  $current_inner_base_class = $this->inner_base_class;
254  $this->use_current_to_determine_next = true;
255 
256  if ($baseclass != $_GET["baseClass"]) {
257  $this->inner_base_class = $baseclass;
258  }
259  $current_node = $this->current_node;
260 
261  // set current node to new gui class
262  $this->current_node = $nr;
263 
264  // always populate the call history
265  // it will only be displayed in DEVMODE but is needed for UI plugins, too
266  $this->call_hist[] = array("class" => get_class($a_gui_object),
267  "mode" => "getHtml", "cmd" => $this->getCmd());
268 
269  // get block
270  if ($a_parameters != null) {
271  $html = $a_gui_object->getHTML($a_parameters);
272  } else {
273  $html = $a_gui_object->getHTML();
274  }
275 
276  // reset current node
277  $this->current_node = $current_node;
278  $this->inner_base_class = $current_inner_base_class;
279  $this->use_current_to_determine_next = false;
280 
281  // return block
282  return $html;
283  }
284 
285  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
286  throw new ilCtrlException("ERROR: Can't getHTML from class $class.");
287  }
$_GET["client_id"]
getNodeIdForTargetClass($a_par_node, $a_class, $a_check=false)
Searches a node for a given class ($a_class) "near" another node ($a_par_node).
getParameterArrayByClass($a_class, $a_cmd="")
Get all set/save parameters using gui class name.
getCmd($a_default_cmd="", $a_safe_commands="")
Determines current get/post command.
ilCtrl exceptions
+ Here is the call graph for this function:

◆ getLinkTarget()

ilCtrl::getLinkTarget (   $a_gui_obj,
  $a_cmd = "",
  $a_anchor = "",
  $a_asynch = false,
  $xml_style = false 
)

Get link target for command using gui object.

Parameters
objectgui object (usually $this)
stringcommand
string# anchor
booleanasynchronous mode
booleanxml style t/f
Returns
string target link

Definition at line 1378 of file class.ilCtrl.php.

References getLinkTargetByClass().

Referenced by ilObjWorkflowEngineGUI\initLocator(), ilObjWorkflowEngineGUI\prepareAdminOutput(), and ilChatroomViewGUI\showRoom().

1384  {
1385  $script = $this->getLinkTargetByClass(
1386  strtolower(get_class($a_gui_obj)),
1387  $a_cmd,
1388  $a_anchor,
1389  $a_asynch,
1390  $xml_style
1391  );
1392  return $script;
1393  }
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
Get link target for command using gui class name.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLinkTargetByClass()

ilCtrl::getLinkTargetByClass (   $a_class,
  $a_cmd = "",
  $a_anchor = "",
  $a_asynch = false,
  $xml_style = false 
)

Get link target for command using gui class name.

Parameters
string/arraycommand target class
stringcommand
string# anchor
booleanasynchronous mode
booleanxml style t/f
Returns
string target link

Definition at line 1407 of file class.ilCtrl.php.

References getTargetScript(), and getUrlParameters().

Referenced by ilObjectPermissionStatusGUI\addToolbar(), ilHistoryTableGUI\fillRow(), ilObjStudyProgrammeReferenceListGUI\getCommandLink(), getFormActionByClass(), getLinkTarget(), ilObjWorkflowEngineGUI\prepareAdminOutput(), redirect(), redirectByClass(), and ilChatroomViewGUI\showRoom().

1413  {
1414  if ($a_asynch) {
1415  $xml_style = false;
1416  }
1417 
1418  $script = $this->getTargetScript();
1419  $script = $this->getUrlParameters($a_class, $script, $a_cmd, $xml_style);
1420 
1421  if ($a_asynch) {
1422  $amp = "&";
1423  $script .= $amp . "cmdMode=asynch";
1424  }
1425 
1426  if ($a_anchor != "") {
1427  $script = $script . "#" . $a_anchor;
1428  }
1429 
1430  return $script;
1431  }
getUrlParameters($a_class, $a_str, $a_cmd="", $xml_style=false)
Get URL parameters for a class and append them to a string.
getTargetScript()
Get target script name.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModuleDir()

ilCtrl::getModuleDir ( )

get directory of current module

Deprecated:
Returns
mixed
Exceptions
Exception

Definition at line 187 of file class.ilCtrl.php.

188  {
189  throw new Exception("ilCtrl::getModuleDir is deprecated.");
190  //return $this->module_dir;
191  }

◆ getNextClass()

ilCtrl::getNextClass (   $a_gui_class = null)

Get next class in the control path from the current class to the target command class.

This is the class that should be instantiated and be invoked via $ilCtrl->forwardCommand($class) next.

Returns
string class name of next class

Definition at line 775 of file class.ilCtrl.php.

References checkLPSettingsForward(), getCmdNode(), getCurrentCidOfNode(), getPathNew(), and readCidInfo().

Referenced by ilLTIRouterGUI\executeCommand(), ilTestSignatureGUI\executeCommand(), ilObjectPermissionStatusGUI\executeCommand(), and ilObjWorkflowEngineGUI\executeCommand().

776  {
777  if ($this->use_current_to_determine_next) {
778  $cmdNode = $this->current_node;
779  } else {
780  $cmdNode = $this->getCmdNode();
781  }
782 
783  if ($cmdNode == "") {
784  return ($class = $this->checkLPSettingsForward($a_gui_class, $cmdNode))
785  ? $class
786  : false;
787  } else {
788  if ($this->current_node == $cmdNode) {
789  return ($class = $this->checkLPSettingsForward($a_gui_class, $cmdNode))
790  ? $class
791  : "";
792  } else {
793  $path = $this->getPathNew($this->current_node, $cmdNode);
794  $this->readCidInfo($this->getCurrentCidOfNode($path[1]));
795  return $this->cid_class[$this->getCurrentCidOfNode($path[1])];
796  }
797  }
798  }
getCurrentCidOfNode($a_node)
Get cid of node.
getCmdNode()
Get command target node.
checkLPSettingsForward($a_gui_obj, $a_cmd_node)
readCidInfo($a_cid)
Save class respective to $a_cid and store corresponding class calls for future reference.
getPathNew($a_source_node, $a_target_node)
Get path in call structure.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNodeIdForTargetClass()

ilCtrl::getNodeIdForTargetClass (   $a_par_node,
  $a_class,
  $a_check = false 
)
private

Searches a node for a given class ($a_class) "near" another node ($a_par_node).

It first looks if the given class is a child class of the current node. If such a child node has been found, its id is returned.

If not, this method determines, whether the given class is a sibling of the current node within the call structure. If this is the case, then the corresponding id is returned.

At last the method searches for the given class along the path from the current node to the root class of the call structure.

Parameters
string$a_par_nodeid of starting node for the search
string$a_classclass that should be searched
bool$a_check
Returns
array|bool id of target node that has been found
Exceptions
ilCtrlException

Definition at line 366 of file class.ilCtrl.php.

References getCallStructure(), getCidForClass(), getCidOfNode(), getClassForCid(), getCurrentCidOfNode(), ilCachedCtrl\getInstance(), getParentCidOfNode(), readClassInfo(), readNodeInfo(), and removeLastCid().

Referenced by checkLPSettingsForward(), checkTargetClass(), forwardCommand(), getHTML(), getParameterArrayByClass(), searchReturnClass(), and setCmdClass().

367  {
368  $class = strtolower($a_class);
369  $this->readClassInfo($class);
370 
371  if ($a_par_node === 0 || $a_par_node == "") {
372  return array("node_id" => $this->getCidForClass($class),
373  "base_class" => $class);
374  }
375 
376  $this->readNodeInfo($a_par_node);
377 
378  $node_cid = $this->getCurrentCidOfNode($a_par_node);
379 
380  // target class is class of current node id
381  if ($class == $this->getClassForCid($node_cid)) {
382  return array("node_id" => $a_par_node,
383  "base_class" => "");
384  }
385 
386  // target class is child of current node id
387  if (isset($this->calls[$this->getClassForCid($node_cid)]) &&
388  is_array($this->calls[$this->getClassForCid($node_cid)]) &&
389  in_array($a_class, $this->calls[$this->getClassForCid($node_cid)])) {
390  return array("node_id" => $a_par_node . ":" . $this->getCidForClass($class),
391  "base_class" => "");
392  }
393 
394  // target class is sibling
395  $par_cid = $this->getParentCidOfNode($a_par_node);
396  if ($par_cid != "") {
397  if (is_array($this->calls[$this->getClassForCid($par_cid)]) &&
398  in_array($a_class, $this->calls[$this->getClassForCid($par_cid)])) {
399  return array("node_id" =>
400  $this->removeLastCid($a_par_node) . ":" . $this->getCidForClass($class),
401  "base_class" => "");
402  }
403  }
404 
405  // target class is parent
406  $temp_node = $this->removeLastCid($a_par_node);
407  while ($temp_node != "") {
408  $temp_cid = $this->getCurrentCidOfNode($temp_node);
409  if ($this->getClassForCid($temp_cid) == $a_class) {
410  return array("node_id" => $temp_node,
411  "base_class" => "");
412  }
413  $temp_node = $this->removeLastCid($temp_node);
414  }
415 
416  // target class is another base class
417  $n_class = "";
418  if ($a_class != "") {
419  $module_class = ilCachedCtrl::getInstance();
420  $mc_rec = $module_class->lookupModuleClass($class);
421  $n_class = $mc_rec['lower_class'];
422 
423  if ($n_class == "") {
424  $mc_rec = $module_class->lookupServiceClass($class);
425  $n_class = $mc_rec['lower_class'];
426  }
427 
428  if ($n_class != "") {
429  $this->getCallStructure($n_class);
430  return array("node_id" => $this->getCidForClass($n_class),
431  "base_class" => $class);
432  }
433  }
434 
435  if ($a_check) {
436  return false;
437  }
438 
439  // Please do NOT change these lines.
440  // Developers must be aware, if they use classes unknown to the controller
441  // otherwise certain problem will be extremely hard to track down...
442 
443  error_log("ERROR: Can't find target class $a_class for node $a_par_node " .
444  "(" . $this->cid_class[$this->getCidOfNode($a_par_node)] . ")");
445 
446  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
447  throw new ilCtrlException("ERROR: Can't find target class $a_class for node $a_par_node " .
448  "(" . $this->cid_class[$this->getCidOfNode($a_par_node)] . ").");
449  }
getCurrentCidOfNode($a_node)
Get cid of node.
removeLastCid($a_node)
Remove the class id that comes at the beginning the sequence.
getParentCidOfNode($a_node)
Get 2nd to last class id of node.
getCidOfNode($a_node)
Get last class id of node.
getClassForCid($a_cid)
Get class for class id after fetching and storing corresponding information, if necessary.
getCallStructure($a_class)
Get call structure of class context.
getCidForClass($a_class, $a_check=false)
Get class id for class after fetching and storing corresponding information, if necessary.
readClassInfo($a_class)
Save class id respective to $a_class and store corresponding class calls for future reference...
readNodeInfo($a_node)
Save classes respective to the class id&#39;s of a node and store corresponding class calls for future re...
ilCtrl exceptions
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParameterArray()

ilCtrl::getParameterArray (   $a_gui_obj,
  $a_cmd = "" 
)

Get all set/save parameters for a gui object.

Definition at line 1576 of file class.ilCtrl.php.

References getParameterArrayByClass().

1577  {
1578  $par_arr = $this->getParameterArrayByClass(strtolower(get_class($a_gui_obj)), $a_cmd);
1579 
1580  return $par_arr;
1581  }
getParameterArrayByClass($a_class, $a_cmd="")
Get all set/save parameters using gui class name.
+ Here is the call graph for this function:

◆ getParameterArrayByClass()

ilCtrl::getParameterArrayByClass (   $a_class,
  $a_cmd = "" 
)

Get all set/save parameters using gui class name.

Parameters
stringclass name
stringcmd $
Returns
array parameter array

Definition at line 1590 of file class.ilCtrl.php.

References $_GET, $_POST, $inner_base_class, getClassForCid(), getCurrentCidOfNode(), getNodeIdForTargetClass(), getPathNew(), and ilUtil\stripSlashesRecursive().

Referenced by getHTML(), getParameterArray(), and getUrlParameters().

1591  {
1592  if ($a_class == "") {
1593  return array();
1594  }
1595 
1596  $current_base_class = $_GET["baseClass"];
1597  if ($this->use_current_to_determine_next && $this->inner_base_class != "") {
1598  $current_base_class = $this->inner_base_class;
1599  }
1600 
1601  if (!is_array($a_class)) {
1602  $a_class = array($a_class);
1603  }
1604 
1605  $nr = $this->current_node;
1606  $new_baseclass = "";
1607  foreach ($a_class as $class) {
1608  $class = strtolower($class);
1609  $nr = $this->getNodeIdForTargetClass($nr, $class);
1610  if ($nr["base_class"] != "") {
1611  $new_baseclass = $nr["base_class"];
1612  }
1613  $nr = $nr["node_id"];
1614  $target_class = $class;
1615  }
1616 
1617  $path = $this->getPathNew(1, $nr);
1618  $params = array();
1619 
1620  // append parameters of parent classes
1621  foreach ($path as $node_id) {
1622  $class = ($node_id == "")
1623  ? strtolower($current_base_class)
1624  : $this->getClassForCid($this->getCurrentCidOfNode($node_id));
1625  if (isset($this->save_parameter[$class]) && is_array($this->save_parameter[$class])) {
1626  foreach ($this->save_parameter[$class] as $par) {
1627  if (isset($_GET[$par])) {
1628  $params[$par] = $_GET[$par];
1629  } elseif (isset($_POST[$par])) {
1630  $params[$par] = ilUtil::stripSlashesRecursive($_POST[$par]);
1631  }
1632  }
1633  }
1634 
1635  if (isset($this->parameter[$class]) && is_array($this->parameter[$class])) {
1636  foreach ($this->parameter[$class] as $par => $value) {
1637  $params[$par] = $value;
1638  }
1639  }
1640  }
1641 
1642  if ($a_cmd != "") {
1643  $params["cmd"] = $a_cmd;
1644  }
1645 
1646  $params["cmdClass"] = $target_class;
1647  $params["cmdNode"] = $nr;
1648  if ($new_baseclass == "") {
1649  $params["baseClass"] = $current_base_class;
1650  } else {
1651  $params["baseClass"] = $new_baseclass;
1652  }
1653 
1654  return $params;
1655  }
getCurrentCidOfNode($a_node)
Get cid of node.
$_GET["client_id"]
getNodeIdForTargetClass($a_par_node, $a_class, $a_check=false)
Searches a node for a given class ($a_class) "near" another node ($a_par_node).
getClassForCid($a_cid)
Get class for class id after fetching and storing corresponding information, if necessary.
getPathNew($a_source_node, $a_target_node)
Get path in call structure.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentCidOfNode()

ilCtrl::getParentCidOfNode (   $a_node)
private

Get 2nd to last class id of node.

Definition at line 1794 of file class.ilCtrl.php.

Referenced by getNodeIdForTargetClass().

1795  {
1796  $class_ids = explode(":", $a_node);
1797  return $class_ids[count($class_ids) - 2];
1798  }
+ Here is the caller graph for this function:

◆ getParentReturn()

ilCtrl::getParentReturn (   $a_gui_obj)

Get return script url.

Used in conjunction with ilTabs->setBackTarget and ilBlockGUI->addHeaderCommand.

Definition at line 1484 of file class.ilCtrl.php.

References getParentReturnByClass().

Referenced by returnToParent().

1485  {
1486  return $this->getParentReturnByClass(strtolower(get_class($a_gui_obj)));
1487  }
getParentReturnByClass($a_class)
Get return script url.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentReturnByClass()

ilCtrl::getParentReturnByClass (   $a_class)

Get return script url.

Only used in getParentReturn.

Definition at line 1495 of file class.ilCtrl.php.

References searchReturnClass().

Referenced by getParentReturn().

1496  {
1497  $a_class = strtolower($a_class);
1498  $ret_class = $this->searchReturnClass($a_class);
1499  if ($ret_class) {
1500  return $this->return[$ret_class];
1501  }
1502  }
searchReturnClass($a_class)
Determine current return class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPathNew()

ilCtrl::getPathNew (   $a_source_node,
  $a_target_node 
)
private

Get path in call structure.

Parameters
string$a_source_nodesource node id
string$a_source_nodetarget node id

Definition at line 843 of file class.ilCtrl.php.

References $failure, $GLOBALS, and redirectToURL().

Referenced by getNextClass(), and getParameterArrayByClass().

844  {
845  if ($a_source_node == "1") {
846  $a_source_node = "";
847  }
848  if (substr($a_target_node, 0, strlen($a_source_node)) != $a_source_node) {
849  $failure = "ERROR: Path not found. Source:" . $a_source_node .
850  ", Target:" . $a_target_node;
851  if (DEVMODE == 1) {
852  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
853  throw new ilCtrlException($failure);
854  }
855  $GLOBALS['ilLog']->write(__METHOD__ . ' ' . $failure);
856  $this->redirectToURL('./ilias.php?baseClass=ilRepositoryGUI');
857  }
858  $temp_node = $a_source_node;
859 
860  $path = array();
861  if ($a_source_node != "") {
862  $path = array($a_source_node);
863  }
864 
865  $diffstart = ($a_source_node == "")
866  ? 0
867  : strlen($a_source_node) + 1;
868  $diff = substr($a_target_node, $diffstart);
869  $diff_arr = explode(":", $diff);
870  foreach ($diff_arr as $cid) {
871  if ($temp_node != "") {
872  $temp_node .= ":";
873  }
874  $temp_node .= $cid;
875  $path[] = $temp_node;
876  }
877  return $path;
878  }
$failure
redirectToURL($a_script)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
ilCtrl exceptions
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReadableNode()

ilCtrl::getReadableNode (   $node)
protected

Get readable node.

Parameters

Definition at line 895 of file class.ilCtrl.php.

References getClassForCid().

896  {
897  return implode(
898  ":",
899  array_map(function ($cid) {
900  return $this->getClassForCid($cid);
901  }, explode(":", $node))
902  );
903  }
getClassForCid($a_cid)
Get class for class id after fetching and storing corresponding information, if necessary.
+ Here is the call graph for this function:

◆ getRedirectSource()

ilCtrl::getRedirectSource ( )

Get current redirect source.

Returns
string redirect source class

Definition at line 1547 of file class.ilCtrl.php.

References $_GET.

1548  {
1549  return $_GET["redirectSource"];
1550  }
$_GET["client_id"]

◆ getRequestToken()

ilCtrl::getRequestToken ( )

Get request token.

Returns
string request token for user and session

Definition at line 1131 of file class.ilCtrl.php.

References $DIC, $ilDB, $ilUser, $res, $rtoken, ANONYMOUS_USER_ID, IL_CAL_DATETIME, IL_CAL_DAY, IL_CAL_HOUR, and IL_CAL_UNIX.

Referenced by appendRequestTokenParameterString(), and getFormActionByClass().

1132  {
1133  global $DIC;
1134 
1135  $ilUser = $DIC["ilUser"];
1136  $ilDB = $DIC->database();
1137 
1138 
1139  if ($this->rtoken != "") {
1140  return $this->rtoken;
1141  } else {
1142  if (is_object($ilDB) && is_object($ilUser) && $ilUser->getId() > 0 &&
1143  $ilUser->getId() != ANONYMOUS_USER_ID) {
1144  $res = $ilDB->query("SELECT token FROM il_request_token WHERE user_id = " .
1145  $ilDB->quote($ilUser->getId(), "integer") .
1146  " AND session_id = " . $ilDB->quote(session_id(), "text"));
1147  $rec = $ilDB->fetchAssoc($res);
1148  if ($rec["token"] != "") {
1149  $this->rtoken = $rec["token"];
1150  return $rec["token"];
1151  }
1152  //echo "new rtoken, new entry for :".$ilUser->getId().":".session_id().":"; exit;
1153  $random = new \ilRandom();
1154  $this->rtoken = md5(uniqid($random->int(), true));
1155 
1156  // delete entries older than one and a half days
1157  if ($random->int(1, 200) == 2) {
1158  $dt = new ilDateTime(time(), IL_CAL_UNIX);
1159  $dt->increment(IL_CAL_DAY, -1);
1160  $dt->increment(IL_CAL_HOUR, -12);
1161  $dq = "DELETE FROM il_request_token WHERE " .
1162  " stamp < " . $ilDB->quote($dt->get(IL_CAL_DATETIME), "timestamp");
1163  $ilDB->manipulate($dq);
1164  }
1165 
1166  // IMPORTANT: Please do NOT try to move this implementation to a
1167  // session basis. This will fail due to framesets that are used
1168  // occasionally in ILIAS, e.g. in the chat, where multiple
1169  // forms are loaded in different frames.
1170  $ilDB->manipulate("INSERT INTO il_request_token (user_id, token, stamp, session_id) VALUES " .
1171  "(" .
1172  $ilDB->quote($ilUser->getId(), "integer") . "," .
1173  $ilDB->quote($this->rtoken, "text") . "," .
1174  $ilDB->now() . "," .
1175  $ilDB->quote(session_id(), "text") . ")");
1176  return $this->rtoken;
1177  }
1178  }
1179  return "";
1180  }
const IL_CAL_DATETIME
const ANONYMOUS_USER_ID
Definition: constants.php:25
const IL_CAL_HOUR
const IL_CAL_UNIX
const IL_CAL_DAY
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
global $ilDB
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ getReturnClass()

ilCtrl::getReturnClass (   $a_class)

Get return class.

Only used in COPage/ilPCParagraphGUI and COPage/ilPCPlaceHolderGUI

Parameters
string | object$class
Returns
string|bool

Definition at line 1512 of file class.ilCtrl.php.

References searchReturnClass().

1513  {
1514  if (is_object($a_class)) {
1515  $class = strtolower(get_class($a_class));
1516  } else {
1517  $class = strtolower($a_class);
1518  }
1519  return $this->searchReturnClass($class);
1520  }
searchReturnClass($a_class)
Determine current return class.
+ Here is the call graph for this function:

◆ getTabs()

ilCtrl::getTabs ( )

Get tabs array (.

Deprecated:
, use $ilTabs)
Returns
array array of tab entries (array("lang_var", "link", "cmd", "class))

Definition at line 511 of file class.ilCtrl.php.

512  {
513  return $this->tab;
514  }

◆ getTargetScript()

ilCtrl::getTargetScript ( )

Get target script name.

Returns
string target script name

Definition at line 910 of file class.ilCtrl.php.

References $target_script.

Referenced by getLinkTargetByClass(), setReturn(), and setReturnByClass().

910  : string
911  {
912  return $this->target_script;
913  }
+ Here is the caller graph for this function:

◆ getUrlParameters()

ilCtrl::getUrlParameters (   $a_class,
  $a_str,
  $a_cmd = "",
  $xml_style = false 
)

Get URL parameters for a class and append them to a string.

Parameters
$a_class
$a_str
string$a_cmdcommand
bool$xml_style
Returns
string

Definition at line 1560 of file class.ilCtrl.php.

References ilUtil\appendUrlParameterString(), and getParameterArrayByClass().

Referenced by getLinkTargetByClass(), setReturn(), and setReturnByClass().

1561  {
1562  $params = $this->getParameterArrayByClass($a_class, $a_cmd);
1563 
1564  foreach ($params as $par => $value) {
1565  if (strlen((string) $value)) {
1566  $a_str = ilUtil::appendUrlParameterString($a_str, $par . "=" . $value, $xml_style);
1567  }
1568  }
1569 
1570  return $a_str;
1571  }
getParameterArrayByClass($a_class, $a_cmd="")
Get all set/save parameters using gui class name.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initBaseClass()

ilCtrl::initBaseClass (   $a_base_class)

Initialises new base class.

Note: this resets the whole current ilCtrl context completely. You can call callBaseClass() after that.

Parameters
stringbase class name

Definition at line 924 of file class.ilCtrl.php.

References $_GET, and initializeMemberVariables().

925  {
926  $_GET["baseClass"] = $a_base_class;
927  $_GET["cmd"] = "";
928  $_GET["cmdClass"] = "";
929  $_GET["cmdNode"] = "";
930  $this->initializeMemberVariables();
931  }
$_GET["client_id"]
initializeMemberVariables()
Initialize member variables.
+ Here is the call graph for this function:

◆ initializeMemberVariables()

ilCtrl::initializeMemberVariables ( )
protected

Initialize member variables.

This is used in __construct and initBaseClass.

Definition at line 122 of file class.ilCtrl.php.

Referenced by __construct(), and initBaseClass().

123  {
124  $this->save_parameter = array();
125  $this->parameter = array(); // save parameter array
126  $this->return = array(); // return commmands
127  $this->tab = array();
128  $this->current_node = 0;
129  $this->call_node = array();
130  $this->root_class = "";
131  }
+ Here is the caller graph for this function:

◆ insertCtrlCalls()

ilCtrl::insertCtrlCalls (   $a_parent,
  $a_child,
  $a_comp_prefix 
)

Insert ctrl calls record.

Parameters

Definition at line 1833 of file class.ilCtrl.php.

References $DIC, and $ilDB.

1834  {
1835  global $DIC;
1836 
1837  $ilDB = $DIC->database();
1838  ;
1839 
1840  $a_parent = strtolower($a_parent);
1841  $a_child = strtolower($a_child);
1842  $a_comp_prefix = strtolower($a_comp_prefix);
1843 
1844  $set = $ilDB->query(
1845  "SELECT * FROM ctrl_calls WHERE " .
1846  " parent = " . $ilDB->quote($a_parent, "text") . " AND " .
1847  " child = " . $ilDB->quote($a_child, "text") . " AND " .
1848  " comp_prefix = " . $ilDB->quote($a_comp_prefix, "text")
1849  );
1850  if ($rec = $ilDB->fetchAssoc($set)) {
1851  return;
1852  }
1853  $ilDB->manipulate("INSERT IGNORE INTO ctrl_calls " .
1854  "(parent, child, comp_prefix) VALUES (" .
1855  $ilDB->quote($a_parent, "text") . "," .
1856  $ilDB->quote($a_child, "text") . "," .
1857  $ilDB->quote($a_comp_prefix, "text") .
1858  ")");
1859  }
global $DIC
Definition: goto.php:24
global $ilDB

◆ isAsynch()

ilCtrl::isAsynch ( )

Is current command an asynchronous command?

Returns
boolean asynchronous t/f

Definition at line 1357 of file class.ilCtrl.php.

References $_GET.

1358  {
1359  if (isset($_GET["cmdMode"]) && $_GET["cmdMode"] == "asynch") {
1360  return true;
1361  } else {
1362  return false;
1363  }
1364  }
$_GET["client_id"]

◆ lookupClassPath()

ilCtrl::lookupClassPath (   $a_class_name)

Get class path that can be used in include statements for a given class name.

Parameters
string$a_class_nameclass name

Definition at line 806 of file class.ilCtrl.php.

References ilCachedCtrl\getInstance().

Referenced by ilLTIRouterGUI\executeCommand().

807  {
808  $a_class_name = strtolower($a_class_name);
809 
810  $cached_ctrl = ilCachedCtrl::getInstance();
811  $class_rec = $cached_ctrl->lookupClassFile($a_class_name);
812 
813  if ($class_rec["plugin_path"] != "") {
814  return $class_rec["plugin_path"] . "/" . $class_rec["filename"];
815  } else {
816  return $class_rec["filename"];
817  }
818  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readCallStructure()

ilCtrl::readCallStructure (   $a_class,
  $a_nr = 0,
  $a_parent = 0 
)

Reads call structure from db.

Definition at line 551 of file class.ilCtrl.php.

References $DIC, and $ilDB.

552  {
553  global $DIC;
554 
555  $ilDB = $DIC->database();
556 
557  $a_class = strtolower($a_class);
558 
559  $a_nr++;
560 
561  // determine call node structure
562  $this->call_node[$a_nr] = array("class" => $a_class, "parent" => $a_parent);
563 
564  $call_set = $ilDB->query("SELECT * FROM ctrl_calls WHERE parent = " .
565  $ilDB->quote(strtolower($a_class), "text") .
566  " ORDER BY child", array("text"));
567  $a_parent = $a_nr;
568  while ($call_rec = $ilDB->fetchAssoc($call_set)) {
569  $a_nr = $this->readCallStructure($call_rec["child"], $a_nr, $a_parent);
570  $forw[] = $call_rec["child"];
571  }
572 
573  // determine root class
574  $this->root_class = $a_class;
575  return $a_nr;
576  }
global $DIC
Definition: goto.php:24
global $ilDB
readCallStructure($a_class, $a_nr=0, $a_parent=0)
Reads call structure from db.

◆ readCidInfo()

ilCtrl::readCidInfo (   $a_cid)
private

Save class respective to $a_cid and store corresponding class calls for future reference.

Parameters
object$a_cidcid

Definition at line 1721 of file class.ilCtrl.php.

References fetchCallsOfClassFromCache(), ilCachedCtrl\getInstance(), and updateClassCidMap().

Referenced by getClassForCid(), getNextClass(), and readNodeInfo().

1722  {
1723  if (isset($this->info_read_cid[$a_cid])) {
1724  return;
1725  }
1726 
1727  $cached_ctrl = ilCachedCtrl::getInstance();
1728  $cid_info = $cached_ctrl->lookupCid($a_cid);
1729 
1730  if ($cid_info) {
1731  $this->updateClassCidMap($cid_info['class'], $a_cid);
1732  $this->fetchCallsOfClassFromCache($cid_info['class'], $cached_ctrl);
1733  $this->info_read_class[$cid_info["class"]] = true;
1734  }
1735 
1736  $this->info_read_cid[$a_cid] = true;
1737  }
updateClassCidMap($a_class, $a_cid)
fetchCallsOfClassFromCache($a_class, ilCachedCtrl $a_cached_ctrl)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readClassInfo()

ilCtrl::readClassInfo (   $a_class)
private

Save class id respective to $a_class and store corresponding class calls for future reference.

Parameters
object$a_classclass name

Definition at line 1759 of file class.ilCtrl.php.

References fetchCallsOfClassFromCache(), ilCachedCtrl\getInstance(), and updateClassCidMap().

Referenced by getCallStructure(), getCidForClass(), and getNodeIdForTargetClass().

1760  {
1761  $a_class = strtolower($a_class);
1762  if (isset($this->info_read_class[$a_class])) {
1763  return;
1764  }
1765 
1766  $cached_ctrl = ilCachedCtrl::getInstance();
1767  $class_info = $cached_ctrl->lookupClassFile($a_class);
1768 
1769  if ($class_info) {
1770  $this->updateClassCidMap($a_class, $class_info['cid']);
1771  }
1772  $this->fetchCallsOfClassFromCache($a_class, $cached_ctrl);
1773 
1774  $this->info_read_class[$a_class] = true;
1775  $this->info_read_cid[$this->class_cid[$a_class]] = true;
1776  }
updateClassCidMap($a_class, $a_cid)
fetchCallsOfClassFromCache($a_class, ilCachedCtrl $a_cached_ctrl)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readNodeInfo()

ilCtrl::readNodeInfo (   $a_node)
private

Save classes respective to the class id's of a node and store corresponding class calls for future reference.

Parameters
string$a_node

Definition at line 1745 of file class.ilCtrl.php.

References readCidInfo().

Referenced by getNodeIdForTargetClass().

1746  {
1747  $class_ids = explode(":", $a_node);
1748  foreach ($class_ids as $cid) {
1749  $this->readCidInfo($cid);
1750  }
1751  }
readCidInfo($a_cid)
Save class respective to $a_cid and store corresponding class calls for future reference.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirect()

ilCtrl::redirect (   $a_gui_obj,
  $a_cmd = "",
  $a_anchor = "",
  $a_asynch = false 
)

Redirect to another command.

Parameters
objectgui object
stringcommand
stringanchor

Definition at line 1261 of file class.ilCtrl.php.

References getLinkTargetByClass(), and redirectToURL().

Referenced by ilChatroomAdminSmileyGUI\confirmedDeleteMultipleObject(), ilChatroomBanGUI\delete(), ilChatroomAdminSmileyGUI\deleteMultipleObject(), ilChatroomAdminSmileyGUI\deleteSmileyObject(), ilChatroomAdminViewGUI\executeDefault(), ilChatroomViewGUI\executeDefault(), ilChatroomViewGUI\invitePD(), ilChatroomCreateGUI\save(), ilChatroomAdminViewGUI\saveClientSettings(), and ilChatroomSettingsGUI\saveGeneral().

1262  {
1263  $script = $this->getLinkTargetByClass(
1264  strtolower(get_class($a_gui_obj)),
1265  $a_cmd,
1266  "",
1267  $a_asynch,
1268  false
1269  );
1270  if ($a_anchor != "") {
1271  $script = $script . "#" . $a_anchor;
1272  }
1273  $this->redirectToURL($script);
1274  }
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
Get link target for command using gui class name.
redirectToURL($a_script)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectByClass()

ilCtrl::redirectByClass (   $a_class,
  $a_cmd = "",
  $a_anchor = "",
  $a_asynch = false 
)

Redirect to other gui class using class name.

Parameters
stringcommand target class
stringcommand

Definition at line 1343 of file class.ilCtrl.php.

References getLinkTargetByClass(), and redirectToURL().

Referenced by checkLPSettingsForward(), ilChatroomSettingsGUI\general(), ilChatroomViewGUI\logout(), ilChatroomViewGUI\lostConnection(), ilChatroomGUIHandler\redirectIfNoPermission(), ilChatroomViewGUI\showRoom(), and ilChatroomKickGUI\sub().

1344  {
1345  $script = $this->getLinkTargetByClass($a_class, $a_cmd, "", $a_asynch, false);
1346  if ($a_anchor != "") {
1347  $script = $script . "#" . $a_anchor;
1348  }
1349  $this->redirectToURL($script);
1350  }
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
Get link target for command using gui class name.
redirectToURL($a_script)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectToURL()

ilCtrl::redirectToURL (   $a_script)
Parameters
$a_script

Definition at line 1280 of file class.ilCtrl.php.

References $_SERVER, $DIC, $http, XapiProxy\$resp, exit, ilPluginAdmin\getPluginObject(), IL_COMP_SERVICE, ilUIHookPluginGUI\KEEP, and ILIAS\Filesystem\Stream\Streams\ofString().

Referenced by getPathNew(), redirect(), redirectByClass(), and returnToParent().

1281  {
1282  global $DIC;
1283 
1284  $ilPluginAdmin = null;
1285  if (isset($DIC["ilPluginAdmin"])) {
1286  $ilPluginAdmin = $DIC["ilPluginAdmin"];
1287  }
1288 
1289  if (!is_int(strpos($a_script, "://"))) {
1290  if (substr($a_script, 0, 1) != "/" && defined("ILIAS_HTTP_PATH")) {
1291  if (is_int(strpos($_SERVER["PHP_SELF"], "/setup/"))) {
1292  $a_script = "setup/" . $a_script;
1293  }
1294  $a_script = ILIAS_HTTP_PATH . "/" . $a_script;
1295  }
1296  }
1297 
1298  // include the user interface hook
1299  if (is_object($ilPluginAdmin)) {
1300  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
1301  foreach ($pl_names as $pl) {
1302  $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
1303  $gui_class = $ui_plugin->getUIClassInstance();
1304  $resp = $gui_class->getHTML("Services/Utilities", "redirect", array( "html" => $a_script ));
1305  if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
1306  $a_script = $gui_class->modifyHTML($a_script, $resp);
1307  }
1308  }
1309  }
1310 
1311  // Manually trigger to write and close the session. This has the advantage that if an exception is thrown
1312  // during the writing of the session (ILIAS writes the session into the database by default) we get an exception
1313  // if the session_write_close() is triggered by exit() then the exception will be dismissed but the session
1314  // is never written, which is a nightmare to develop with.
1315  session_write_close();
1316 
1317  global $DIC;
1318  $http = $DIC->http();
1319  switch ($http->request()->getHeaderLine('Accept')) {
1320  case 'application/json':
1321  $stream = \ILIAS\Filesystem\Stream\Streams::ofString(json_encode([
1322  'success' => true,
1323  'message' => 'Called redirect after async fileupload request',
1324  "redirect_url" => $a_script,
1325  ]));
1326  $http->saveResponse($http->response()->withBody($stream));
1327  break;
1328  default:
1329  $http->saveResponse($http->response()->withAddedHeader("Location", $a_script));
1330  break;
1331  }
1332  $http->sendResponse();
1333  exit;
1334  }
exit
Definition: login.php:29
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
global $DIC
Definition: goto.php:24
static ofString($string)
Creates a new stream with an initial value.
Definition: Streams.php:25
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
$http
Definition: raiseError.php:7
const IL_COMP_SERVICE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeLastCid()

ilCtrl::removeLastCid (   $a_node)
private

Remove the class id that comes at the beginning the sequence.

Definition at line 1812 of file class.ilCtrl.php.

Referenced by getNodeIdForTargetClass().

1813  {
1814  $lpos = strrpos($a_node, ":");
1815  return substr($a_node, 0, $lpos);
1816  }
+ Here is the caller graph for this function:

◆ returnToParent()

ilCtrl::returnToParent (   $a_gui_obj,
  $a_anchor = "" 
)

Redirects to next parent class that used setReturn.

Definition at line 1459 of file class.ilCtrl.php.

References $_GET, ilUtil\appendUrlParameterString(), getParentReturn(), and redirectToURL().

1460  {
1461  $script = $this->getParentReturn($a_gui_obj);
1462 
1464  $script,
1465  "redirectSource=" . strtolower(get_class($a_gui_obj))
1466  );
1468  $script,
1469  "cmdMode=" . $_GET["cmdMode"]
1470  );
1471  if ($a_anchor != "") {
1472  $script = $script . "#" . $a_anchor;
1473  }
1474 
1475  $this->redirectToURL($script);
1476  }
redirectToURL($a_script)
$_GET["client_id"]
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
getParentReturn($a_gui_obj)
Get return script url.
+ Here is the call graph for this function:

◆ saveParameter()

ilCtrl::saveParameter (   $a_obj,
  $a_parameter 
)

Set parameters that should be passed in every form and link of a gui class.

All links that relate to the specified gui object class and are build e.g. by using getLinkTarger() or getFormAction() will include this parameter. This is the mechanism to add url parameters to the standard url target everytime.

A typical example is the "ref_id" that should be included in almost every link or form action url. So the constructor of ilRepositoryGUI includes the command:

$this->ctrl->saveParameter($this, array("ref_id"));

Parameters
object$a_objgui object that will process the parameter
mixed$a_parameterparameter name (string) or array of parameter names

public

Definition at line 597 of file class.ilCtrl.php.

References saveParameterByClass().

Referenced by ilChatroomAdminSmileyGUI\initSmiliesEditForm(), and ilChatroomViewGUI\showNameSelection().

598  {
599  if (is_object($a_obj)) {
600  $this->saveParameterByClass(get_class($a_obj), $a_parameter);
601  }
602  }
saveParameterByClass($a_class, $a_parameter)
Save parameter for a class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveParameterByClass()

ilCtrl::saveParameterByClass (   $a_class,
  $a_parameter 
)

Save parameter for a class.

Parameters
stringclass name
stringparameter name

Definition at line 610 of file class.ilCtrl.php.

References $parameter.

Referenced by saveParameter().

611  {
612  if (is_array($a_parameter)) {
613  foreach ($a_parameter as $parameter) {
614  $this->save_parameter[strtolower($a_class)][] = $parameter;
615  }
616  } else {
617  $this->save_parameter[strtolower($a_class)][] = $a_parameter;
618  }
619  }
+ Here is the caller graph for this function:

◆ searchReturnClass()

ilCtrl::searchReturnClass (   $a_class)
private

Determine current return class.

Definition at line 1526 of file class.ilCtrl.php.

References $i, getClassForCid(), and getNodeIdForTargetClass().

Referenced by getParentReturnByClass(), and getReturnClass().

1527  {
1528  $a_class = strtolower($a_class);
1529 
1530  $node = $this->getNodeIdForTargetClass($this->current_node, $a_class);
1531  $node = $node["node_id"];
1532  $n_arr = explode(":", $node);
1533  for ($i = count($n_arr) - 2; $i >= 0; $i--) {
1534  if ($this->return[$this->getClassForCid($n_arr[$i])] != "") {
1535  return $this->getClassForCid($n_arr[$i]);
1536  }
1537  }
1538 
1539  return false;
1540  }
getNodeIdForTargetClass($a_par_node, $a_class, $a_check=false)
Searches a node for a given class ($a_class) "near" another node ($a_par_node).
getClassForCid($a_cid)
Get class for class id after fetching and storing corresponding information, if necessary.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCmd()

ilCtrl::setCmd (   $a_cmd)

Set the current command.

IMPORTANT NOTE:

please use this function only in exceptional cases it is not intended for setting commands in forms or links! use the corresponding parameters of getFormAction() and getLinkTarget() instead.

Definition at line 1007 of file class.ilCtrl.php.

References $_GET.

Referenced by ilChatroomInfoGUI\executeDefault().

1008  {
1009  $_GET["cmd"] = $a_cmd;
1010  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ setCmdClass()

ilCtrl::setCmdClass (   $a_cmd_class)

Set the current command class.

IMPORTANT NOTE:

please use this function only in exceptional cases it is not intended for setting the command class in forms or links! use the corresponding parameters of getFormAction() and getLinkTarget() instead.

Definition at line 1022 of file class.ilCtrl.php.

References $_GET, and getNodeIdForTargetClass().

1023  {
1024  $a_cmd_class = strtolower($a_cmd_class);
1025  $nr = $this->getNodeIdForTargetClass($this->current_node, $a_cmd_class);
1026  $nr = $nr["node_id"];
1027  $_GET["cmdClass"] = $a_cmd_class;
1028  $_GET["cmdNode"] = $nr;
1029  }
$_GET["client_id"]
getNodeIdForTargetClass($a_par_node, $a_class, $a_check=false)
Searches a node for a given class ($a_class) "near" another node ($a_par_node).
+ Here is the call graph for this function:

◆ setContext()

ilCtrl::setContext (   $a_obj_id,
  $a_obj_type,
  $a_sub_obj_id = 0,
  $a_sub_obj_type = "" 
)

Set context of current user interface.

A context is a ILIAS repository object (obj ID + obj type) with an additional optional subobject (ID + Type)

Parameters
integerobject ID
stringobject type
integersubobject ID
stringsubobject type

Definition at line 298 of file class.ilCtrl.php.

299  {
300  $this->context_obj_id = $a_obj_id;
301  $this->context_obj_type = $a_obj_type;
302  $this->context_sub_obj_id = $a_sub_obj_id;
303  $this->context_sub_obj_type = $a_sub_obj_type;
304  }

◆ setParameter()

ilCtrl::setParameter (   $a_obj,
  $a_parameter,
  $a_value 
)

Set parameters that should be passed a form and link of a gui class.

All links that relate to the specified gui object class and are build e.g. by using getLinkTarger() or getFormAction() will include this parameter. This is the mechanism to add url parameters to the standard url target. The difference to the saveParameter() method is, that setParameter() does not simply forward the url parameter of the last request. You can set a spefific value.

If this parameter is also a "saved parameter" (set by saveParameter() method) the saved value will be overwritten.

The method is usually used in conjunction with a getFormAction() or getLinkTarget() call. E.g.:

    $this->ctrl->setParameter($this, "obj_id", $data_row["obj_id"]);
    $obj_link = $this->ctrl->getLinkTarget($this, "view");
Parameters
object$a_objgui object
string$a_parameterparameter name
string$a_parameterparameter value

Definition at line 644 of file class.ilCtrl.php.

Referenced by ilObjWorkflowEngineGUI\initLocator(), ilChatroomViewGUI\invitePD(), and ilChatroomCreateGUI\save().

645  {
646  $this->parameter[strtolower(get_class($a_obj))][$a_parameter] = $a_value;
647  }
+ Here is the caller graph for this function:

◆ setParameterByClass()

ilCtrl::setParameterByClass (   $a_class,
  $a_parameter,
  $a_value 
)

Same as setParameterByClass, except that a class name is passed.

Parameters
string$a_classgui class name
string$a_parameterparameter name
string$a_parameterparameter value

Definition at line 657 of file class.ilCtrl.php.

Referenced by checkLPSettingsForward(), ilHistoryTableGUI\fillRow(), ilChatroomSettingsGUI\general(), ilObjStudyProgrammeReferenceListGUI\getCommandLink(), ilChatroomViewGUI\logout(), ilChatroomGUIHandler\redirectIfNoPermission(), and ilChatroomKickGUI\sub().

658  {
659  $this->parameter[strtolower($a_class)][$a_parameter] = $a_value;
660  }
+ Here is the caller graph for this function:

◆ setReturn()

ilCtrl::setReturn (   $a_gui_obj,
  $a_cmd 
)

Set return command.

Definition at line 1436 of file class.ilCtrl.php.

References getTargetScript(), and getUrlParameters().

Referenced by ilObjectPermissionStatusGUI\executeCommand().

1437  {
1438  $script = $this->getTargetScript();
1439  $script = $this->getUrlParameters(strtolower(get_class($a_gui_obj)), $script, $a_cmd);
1440  $this->return[strtolower(get_class($a_gui_obj))] = $script;
1441  }
getUrlParameters($a_class, $a_str, $a_cmd="", $xml_style=false)
Get URL parameters for a class and append them to a string.
getTargetScript()
Get target script name.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setReturnByClass()

ilCtrl::setReturnByClass (   $a_class,
  $a_cmd 
)

Set return command.

Definition at line 1446 of file class.ilCtrl.php.

References getTargetScript(), and getUrlParameters().

1447  {
1448  // may not be an array!
1449  $a_class = strtolower($a_class);
1450 
1451  $script = $this->getTargetScript();
1452  $script = $this->getUrlParameters($a_class, $script, $a_cmd);
1453  $this->return[strtolower($a_class)] = $script;
1454  }
getUrlParameters($a_class, $a_str, $a_cmd="", $xml_style=false)
Get URL parameters for a class and append them to a string.
getTargetScript()
Get target script name.
+ Here is the call graph for this function:

◆ setTargetScript()

ilCtrl::setTargetScript ( string  $a_target_script)

set target script name

Parameters
string$a_target_scripttarget script name

Definition at line 885 of file class.ilCtrl.php.

886  {
887  $this->target_script = $a_target_script;
888  }

◆ updateClassCidMap()

ilCtrl::updateClassCidMap (   $a_class,
  $a_cid 
)
private

Definition at line 1785 of file class.ilCtrl.php.

Referenced by readCidInfo(), and readClassInfo().

1786  {
1787  $this->cid_class[$a_cid] = $a_class;
1788  $this->class_cid[$a_class] = $a_cid;
1789  }
+ Here is the caller graph for this function:

◆ verifyToken()

ilCtrl::verifyToken ( )
private

Verify Token.

Returns
boolean valid t/f

Definition at line 1187 of file class.ilCtrl.php.

References $_GET, $_SESSION, $DIC, $ilDB, $ilUser, ANONYMOUS_USER_ID, IL_CAL_DATETIME, IL_CAL_DAY, IL_CAL_HOUR, and IL_CAL_UNIX.

Referenced by getCmd().

1188  {
1189  global $DIC;
1190 
1191  $ilUser = $DIC["ilUser"];
1192 
1193  $ilDB = $DIC->database();
1194  ;
1195 
1196  if (is_object($ilUser) && is_object($ilDB) && $ilUser->getId() > 0 &&
1197  $ilUser->getId() != ANONYMOUS_USER_ID) {
1198  if ($_GET["rtoken"] == "") {
1199  return false;
1200  }
1201 
1202  $set = $ilDB->query("SELECT * FROM il_request_token WHERE " .
1203  " user_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " .
1204  " token = " . $ilDB->quote($_GET[self::IL_RTOKEN_NAME]), "text");
1205  if ($ilDB->numRows($set) > 0) {
1206  // remove tokens from older sessions
1207  // if we do this immediately, working with multiple windows does not work:
1208  // - window one: open form (with token a)
1209  // - window two: open form (with token b)
1210  // - submit window one: a is verified, but b must not be deleted immediately, otherwise
1211  // - window two: submit results in invalid token
1212  // see also bug #13551
1213  $dt = new ilDateTime(time(), IL_CAL_UNIX);
1214  $dt->increment(IL_CAL_DAY, -1);
1215  $dt->increment(IL_CAL_HOUR, -12);
1216  $ilDB->manipulate("DELETE FROM il_request_token WHERE " .
1217  " user_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " .
1218  " session_id != " . $ilDB->quote(session_id(), "text") . " AND " .
1219  " stamp < " . $ilDB->quote($dt->get(IL_CAL_DATETIME), "timestamp"));
1220  return true;
1221  } else {
1222  return false;
1223  }
1224 
1225  if ($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]] != "") {
1226  // remove used token
1227  unset($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]]);
1228 
1229  // remove old tokens
1230  if (count($_SESSION["rtokens"]) > 100) {
1231  $to_remove = array();
1232  $sec = 7200; // two hours
1233 
1234  foreach ($_SESSION["rtokens"] as $tok => $time) {
1235  if (time() - $time > $sec) {
1236  $to_remove[] = $tok;
1237  }
1238  }
1239  foreach ($to_remove as $tok) {
1240  unset($_SESSION["rtokens"][$tok]);
1241  }
1242  }
1243 
1244  return true;
1245  }
1246  return false;
1247  } else {
1248  return true; // do not verify, if user or db object is missing
1249  }
1250 
1251  return false;
1252  }
const IL_CAL_DATETIME
const ANONYMOUS_USER_ID
Definition: constants.php:25
$_SESSION["AccountId"]
$_GET["client_id"]
const IL_CAL_HOUR
const IL_CAL_UNIX
const IL_CAL_DAY
global $DIC
Definition: goto.php:24
global $ilDB
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

Field Documentation

◆ $call_hist

ilCtrl::$call_hist = array()
protected

Stores the order in which different GUI classes were called.

TODO: Might better be called call_stack.

This is used in: forwardCommand, getHTML, getCallHistory

Definition at line 61 of file class.ilCtrl.php.

Referenced by getCallHistory().

◆ $calls

ilCtrl::$calls = array()
protected

Stores which class calls which other class.

This is used in: getNodeIdForTargetClass, fetchCallsOfClassFromCache, callOfClassNotKnown

Definition at line 68 of file class.ilCtrl.php.

◆ $inner_base_class

ilCtrl::$inner_base_class = ""
protected

Definition at line 102 of file class.ilCtrl.php.

Referenced by getHTML(), and getParameterArrayByClass().

◆ $module_dir

ilCtrl::$module_dir
protected

Definition at line 88 of file class.ilCtrl.php.

◆ $parameter

ilCtrl::$parameter
protected

Definition at line 39 of file class.ilCtrl.php.

Referenced by saveParameterByClass().

◆ $return

ilCtrl::$return
protected

Definition at line 52 of file class.ilCtrl.php.

◆ $rtoken

ilCtrl::$rtoken = false
protected

Definition at line 77 of file class.ilCtrl.php.

Referenced by getRequestToken().

◆ $save_parameter

ilCtrl::$save_parameter
protected

Definition at line 28 of file class.ilCtrl.php.

◆ $target_script

ilCtrl::$target_script = "ilias.php"
protected

Definition at line 83 of file class.ilCtrl.php.

Referenced by getTargetScript().

◆ $use_current_to_determine_next

ilCtrl::$use_current_to_determine_next = false
protected

Definition at line 95 of file class.ilCtrl.php.

◆ IL_RTOKEN_NAME

const ilCtrl::IL_RTOKEN_NAME = 'rtoken'

Definition at line 17 of file class.ilCtrl.php.


The documentation for this class was generated from the following file: