ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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)
 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...
 
 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)
 
 getParentReturnByClass ($a_class)
 Get return script url. 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
 

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...
 
 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 93 of file class.ilCtrl.php.

94 {
96
97 // this information should go to xml files one day
98 $this->stored_trees = array("ilrepositorygui", "ildashboardgui",
99 "illmpresentationgui", "illmeditorgui",
100 "iladministrationgui");
101 }
initializeMemberVariables()
Initialize member variables.

References initializeMemberVariables().

+ 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 468 of file class.ilCtrl.php.

469 {
470 $a_class = strtolower($a_class);
471
472 $this->tab[] = array("lang_var" => $a_lang_var,
473 "link" => $a_link, "cmd" => $a_cmd, "class" => $a_class);
474 }

◆ appendRequestTokenParameterString()

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

Append request token as url parameter.

Parameters
stringurl
booleanxml style

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

1069 {
1071 $a_url,
1072 self::IL_RTOKEN_NAME . '=' . $this->getRequestToken(),
1073 $xml_style
1074 );
1075 }
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

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

+ 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 126 of file class.ilCtrl.php.

127 {
128 global $DIC;
129
130 $ilDB = $DIC->database();
131
132 $baseClass = strtolower($_GET["baseClass"]);
133
134 $module_class = ilCachedCtrl::getInstance();
135 $mc_rec = $module_class->lookupModuleClass($baseClass);
136
137 $module = $mc_rec["module"];
138 $class = $mc_rec["class"];
139 $class_dir = $mc_rec["dir"];
140
141 if ($module != "") {
142 $m_set = $ilDB->query("SELECT * FROM il_component WHERE name = " .
143 $ilDB->quote($module, "text"));
144 $m_rec = $ilDB->fetchAssoc($m_set);
145 } else { // check whether class belongs to a service
146 $mc_rec = $module_class->lookupServiceClass($baseClass);
147
148 $service = $mc_rec["service"];
149 $class = $mc_rec["class"];
150 $class_dir = $mc_rec["dir"];
151
152 if ($service == "") {
153 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
154 throw new ilCtrlException("Could not find entry in modules.xml or services.xml for " .
155 $baseClass . " <br/>" . str_replace("&", "<br />&", htmlentities($_SERVER["REQUEST_URI"])));
156 }
157
158 $m_rec = ilComponent::getComponentInfo('Services', $service);
159 }
160
161 // forward processing to base class
162 $this->getCallStructure(strtolower($baseClass));
163 $base_class_gui = new $class();
164 $this->forwardCommand($base_class_gui);
165 }
$_GET["client_id"]
static getComponentInfo($a_type, $a_name)
ilCtrl exceptions
getCallStructure($a_class)
Get call structure of class context.
forwardCommand($a_gui_object)
Forward flow of control to next gui class this invokes the executeCommand() method of the gui object ...
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
$service
Definition: result.php:17
global $ilDB
$DIC
Definition: xapitoken.php:46

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

+ Here is the call graph for this function:

◆ callOfClassNotKnown()

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

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

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 }

Referenced by fetchCallsOfClassFromCache().

+ 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 1805 of file class.ilCtrl.php.

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 }
getCmdNode()
Get command target node.
getClassForCid($a_cid)
Get class for class id after fetching and storing corresponding information, if necessary.

References getClassForCid(), and getCmdNode().

+ Here is the call graph for this function:

◆ checkLPSettingsForward()

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

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

667 {
668 global $DIC;
669
670 $objDefinition = $DIC["objDefinition"];
671
672 // forward to learning progress settings if possible and accessible
673 if ($_GET["gotolp"] &&
674 $a_gui_obj) {
675 $ref_id = $_GET["ref_id"];
676 if (!$ref_id) {
677 $ref_id = $_REQUEST["ref_id"];
678 }
679
680 $gui_class = get_class($a_gui_obj);
681
682 if ($gui_class == "ilSAHSEditGUI") {
683 // #1625 - because of scorm "sub-types" this is all very special
684 include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
685 $obj_id = ilObject::_lookupObjectId($ref_id);
687 case "scorm2004":
688 $class = "ilObjSCORM2004LearningModuleGUI";
689 break;
690
691 case "scorm":
692 $class = "ilObjSCORMLearningModuleGUI";
693 break;
694
695 case "aicc":
696 $class = "ilObjAICCLearningModuleGUI";
697 break;
698
699 case "hacp":
700 $class = "ilObjHACPLearningModuleGUI";
701 break;
702 }
703 if ($GLOBALS["ilAccess"]->checkAccess("edit_learning_progress", "", $ref_id)) {
704 $this->redirectByClass(array($gui_class, $class, "illearningprogressgui", "illplistofsettingsgui"), "");
705 }
706 }
707 // special case: cannot use any presentation GUIs
708 elseif ($gui_class == "ilLMPresentationGUI") {
709 $this->setParameterByClass("ilObjLearningModuleGUI", "gotolp", 1);
710 $this->redirectByClass(array("ilLMEditorGUI", "ilObjLearningModuleGUI"), "");
711 }
712
713 include_once "Services/Object/classes/class.ilObjectLP.php";
714 $type = ilObject::_lookupType($ref_id, true);
715 $class = "ilObj" . $objDefinition->getClassName($type) . "GUI";
716
717 if ($gui_class == $class &&
719 $GLOBALS["ilAccess"]->checkAccess("edit_learning_progress", "", $ref_id)) {
720 // add path to repository object gui if missing from cmdNode
721 if (!$a_cmd_node) {
722 $repo_node = $this->getNodeIdForTargetClass(null, "ilrepositorygui");
723 $obj_node = $this->getNodeIdForTargetClass($repo_node["node_id"], $gui_class);
724 $a_cmd_node = $obj_node["node_id"];
725 }
726 // find path to lp settings
727 $lp_node = $this->getNodeIdForTargetClass($a_cmd_node, "illearningprogressgui");
728 $lp_settings_node = $this->getNodeIdForTargetClass($lp_node["node_id"], "illplistofsettingsgui");
729 $_GET["cmdNode"] = $lp_settings_node["node_id"];
730 $_GET["cmdClass"] = "ilLPListOfSettingsGUI";
731 $_GET["cmd"] = "";
732 return "illearningprogressgui";
733 }
734 }
735 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
getNodeIdForTargetClass($a_par_node, $a_class, $a_check=false)
Searches a node for a given class ($a_class) "near" another node ($a_par_node).
setParameterByClass($a_class, $a_parameter, $a_value)
Same as setParameterByClass, except that a class name is passed.
redirectByClass($a_class, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to other gui class using class name.
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static isSupportedObjectType($a_type)
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupType($a_id, $a_reference=false)
lookup object type
$type

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

Referenced by getNextClass().

+ 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

return

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

428 {
429 if (!is_array($a_class)) {
430 $a_class = array($a_class);
431 }
432
433 $nr = $this->current_node;
434 foreach ($a_class as $class) {
435 $class = strtolower($class);
436
437 if (!$this->getCidForClass($class, true)) {
438 return false;
439 }
440
441 $nr = $this->getNodeIdForTargetClass($nr, $class, true);
442 $nr = $nr["node_id"];
443 if ($nr === false) {
444 return false;
445 }
446 }
447 return true;
448 }
getCidForClass($a_class, $a_check=false)
Get class id for class after fetching and storing corresponding information, if necessary.

References getCidForClass(), and getNodeIdForTargetClass().

+ Here is the call graph for this function:

◆ cidClassUnknown()

ilCtrl::cidClassUnknown (   $a_cid)
private

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

1632 {
1633 return $this->cid_class[$a_cid] == "";
1634 }

Referenced by getClassForCid().

+ Here is the caller graph for this function:

◆ classCidUnknown()

ilCtrl::classCidUnknown (   $a_class)
private

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

1604 {
1605 return $this->class_cid[$a_class] == "";
1606 }

Referenced by getCidForClass().

+ 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 639 of file class.ilCtrl.php.

640 {
641 unset($this->parameter[strtolower($a_class)][$a_parameter]);
642 }

◆ 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 650 of file class.ilCtrl.php.

651 {
652 $this->clearParametersByClass(strtolower(get_class($a_obj)));
653 }
clearParametersByClass($a_class)
Clears all parameters that have been set via setParameter for a GUI class.

References clearParametersByClass().

+ 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 661 of file class.ilCtrl.php.

662 {
663 $this->parameter[strtolower($a_class)] = array();
664 }

Referenced by clearParameters().

+ Here is the caller graph for this function:

◆ fetchCallsOfClassFromCache()

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

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

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 }
callOfClassNotKnown($a_class, $a_child)

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

Referenced by readCidInfo(), and readClassInfo().

+ 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 188 of file class.ilCtrl.php.

189 {
190 $class = strtolower(get_class($a_gui_object));
191 $nr = $this->getNodeIdForTargetClass($this->current_node, $class);
192 $nr = $nr["node_id"];
193 if ($nr != "") {
194 $current_node = $this->current_node;
195
196 $this->current_node = $nr;
197
198 // always populate the call history
199 // it will only be displayed in DEVMODE but is needed for UI plugins, too
200 $this->call_hist[] = array("class" => get_class($a_gui_object),
201 "mode" => "execComm", "cmd" => $this->getCmd());
202
203 $html = $a_gui_object->executeCommand();
204
205 // reset current node
206 $this->current_node = $current_node;
207
208 return $html;
209 }
210
211 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
212 throw new ilCtrlException("ERROR: Can't forward to class $class.");
213 }
getCmd($a_default_cmd="", $a_safe_commands="")
Determines current get/post command.

References getCmd(), and getNodeIdForTargetClass().

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

+ 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 493 of file class.ilCtrl.php.

494 {
495 return $this->call_hist;
496 }
$call_hist
Stores the order in which different GUI classes were called.

References $call_hist.

◆ 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

@access public

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

514 {
515 $this->readClassInfo($a_class);
516 }
readClassInfo($a_class)
Save class id respective to $a_class and store corresponding class calls for future reference.

References readClassInfo().

Referenced by callBaseClass(), and getNodeIdForTargetClass().

+ 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 1611 of file class.ilCtrl.php.

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 }
classCidUnknown($a_class)

References classCidUnknown(), and readClassInfo().

Referenced by checkTargetClass(), and getNodeIdForTargetClass().

+ Here is the call graph for this function:
+ 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 1640 of file class.ilCtrl.php.

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 }
cidClassUnknown($a_cid)
readCidInfo($a_cid)
Save class respective to $a_cid and store corresponding class calls for future reference.

References cidClassUnknown(), and readCidInfo().

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

+ 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 @access public
Returns
string class name

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

794 {
795 $path = pathinfo($a_class_path);
796 $file = $path["basename"];
797 $class = substr($file, 6, strlen($file) - 10);
798
799 return $class;
800 }

◆ 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 891 of file class.ilCtrl.php.

892 {
893 $cmd = "";
894 if (isset($_GET["cmd"])) {
895 $cmd = $_GET["cmd"];
896 }
897 if ($cmd == "post") {
898 if (isset($_POST["cmd"]) && is_array($_POST["cmd"])) {
899 reset($_POST["cmd"]);
900 }
901 $cmd = @key($_POST["cmd"]);
902
903 // verify command
904 if ($this->verified_cmd != "") {
905 return $this->verified_cmd;
906 } else {
907 if (!$this->verifyToken() &&
908 (!is_array($a_safe_commands) || !in_array($cmd, $a_safe_commands))) {
909 return $a_default_cmd;
910 }
911 }
912
913 $this->verified_cmd = $cmd;
914 if ($cmd == "" && isset($_POST["table_top_cmd"])) { // selected command in multi-list (table2)
915 $cmd = @key($_POST["table_top_cmd"]);
916 $this->verified_cmd = $cmd;
917 $_POST[$_POST["cmd_sv"][$cmd]] = $_POST[$_POST["cmd_sv"][$cmd] . "_2"];
918 }
919 if ($cmd == "" && isset($_POST["select_cmd2"])) { // selected command in multi-list (table2)
920 if (isset($_POST["select_cmd_all2"])) {
921 $_POST["select_cmd_all"] = $_POST["select_cmd_all2"];
922 } else {
923 $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
924 }
925 $cmd = $_POST["selected_cmd2"];
926 $this->verified_cmd = $cmd;
927 }
928 if ($cmd == "" && isset($_POST["select_cmd"])) { // selected command in multi-list (table2)
929 if (isset($_POST["select_cmd_all"])) {
930 $_POST["select_cmd_all2"] = $_POST["select_cmd_all"];
931 } else {
932 $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
933 }
934 $cmd = $_POST["selected_cmd"];
935 $this->verified_cmd = $cmd;
936 }
937 if ($cmd == "") {
938 $cmd = $_GET["fallbackCmd"];
939 $this->verified_cmd = $cmd;
940 }
941 }
942 if ($cmd == "") {
943 $cmd = $a_default_cmd;
944 }
945 return $cmd;
946 }
$_POST["username"]
verifyToken()
Verify Token.

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

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

+ 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 987 of file class.ilCtrl.php.

988 {
989 return strtolower($_GET["cmdClass"]);
990 }

References $_GET.

◆ getCmdNode()

ilCtrl::getCmdNode ( )

Get command target node.

Returns
string id of current command target node

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

456 {
457 return $_GET["cmdNode"];
458 }

References $_GET.

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

+ Here is the caller graph for this function:

◆ getContextObjId()

ilCtrl::getContextObjId ( )

Get context object id.

Returns
int object id

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

282 {
283 return $this->context_obj_id;
284 }

◆ getContextObjType()

ilCtrl::getContextObjType ( )

Get context object type.

Returns
string object type

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

292 {
293 return $this->context_obj_type;
294 }

◆ getContextSubObjId()

ilCtrl::getContextSubObjId ( )

Get context subobject id.

Returns
int subobject id

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

302 {
303 return $this->context_sub_obj_id;
304 }

◆ getContextSubObjType()

ilCtrl::getContextSubObjType ( )

Get context subobject type.

Returns
string subobject type

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

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

◆ getCurrentCidOfNode()

ilCtrl::getCurrentCidOfNode (   $a_node)
private

Get cid of node.

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

1759 {
1760 $n_arr = explode(":", $a_node);
1761 return $n_arr[count($n_arr) - 1];
1762 }

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

+ 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 1821 of file class.ilCtrl.php.

1821 : array
1822 {
1823 $path = [];
1824 foreach (explode(":", $this->getCmdNode()) as $cid) {
1825 if ($cid != "") {
1826 $path[] = $this->getClassForCid($cid);
1827 }
1828 }
1829 if ($this->getCmdNode() == "" && $_GET["baseClass"] != "") {
1830 $path[] = $_GET["baseClass"];
1831 }
1832 return $path;
1833 }

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

+ 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 1002 of file class.ilCtrl.php.

1008 {
1009 $script = $this->getFormActionByClass(
1010 strtolower(get_class($a_gui_obj)),
1011 $a_fallback_cmd,
1012 $a_anchor,
1013 $a_asynch,
1014 $xml_style
1015 );
1016 return $script;
1017 }
getFormActionByClass( $a_class, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
Get form action url for gui class name.

References getFormActionByClass().

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

+ 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 1029 of file class.ilCtrl.php.

1035 {
1036 if (!is_array($a_class)) {
1037 $a_class = strtolower($a_class);
1038 }
1039
1040 $tok = $this->getRequestToken();
1041
1042 if ($a_asynch) {
1043 $xml_style = false;
1044 }
1045
1046 $script = $this->getLinkTargetByClass($a_class, "post", "", $a_asynch, $xml_style);
1047 if ($a_fallback_cmd != "") {
1048 $script = ilUtil::appendUrlParameterString($script, "fallbackCmd=" . $a_fallback_cmd, $xml_style);
1049 }
1051 $script,
1052 self::IL_RTOKEN_NAME . '=' . $this->getRequestToken(),
1053 $xml_style
1054 );
1055 if ($a_anchor != "") {
1056 $script = $script . "#" . $a_anchor;
1057 }
1058
1059 return $script;
1060 }
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
Get link target for command using gui class name.

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

Referenced by getFormAction().

+ 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 
)

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 224 of file class.ilCtrl.php.

225 {
226 $class = strtolower(get_class($a_gui_object));
227
228 $nr = $this->getNodeIdForTargetClass($this->current_node, $class);
229 $nr = $nr["node_id"];
230 if ($nr != "") {
231 $current_node = $this->current_node;
232
233 // set current node to new gui class
234 $this->current_node = $nr;
235
236 // always populate the call history
237 // it will only be displayed in DEVMODE but is needed for UI plugins, too
238 $this->call_hist[] = array("class" => get_class($a_gui_object),
239 "mode" => "getHtml", "cmd" => $this->getCmd());
240
241 // get block
242 if ($a_parameters != null) {
243 $html = $a_gui_object->getHTML($a_parameters);
244 } else {
245 $html = $a_gui_object->getHTML();
246 }
247
248 // reset current node
249 $this->current_node = $current_node;
250
251 // return block
252 return $html;
253 }
254
255 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
256 throw new ilCtrlException("ERROR: Can't getHTML from class $class.");
257 }

References getCmd(), and getNodeIdForTargetClass().

+ 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 1329 of file class.ilCtrl.php.

1335 {
1336 $script = $this->getLinkTargetByClass(
1337 strtolower(get_class($a_gui_obj)),
1338 $a_cmd,
1339 $a_anchor,
1340 $a_asynch,
1341 $xml_style
1342 );
1343 return $script;
1344 }

References getLinkTargetByClass().

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

+ 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 1358 of file class.ilCtrl.php.

1364 {
1365 if ($a_asynch) {
1366 $xml_style = false;
1367 }
1368
1369 $script = $this->getTargetScript();
1370 $script = $this->getUrlParameters($a_class, $script, $a_cmd, $xml_style);
1371
1372 if ($a_asynch) {
1373 $amp = "&";
1374 $script .= $amp . "cmdMode=asynch";
1375 }
1376
1377 if ($a_anchor != "") {
1378 $script = $script . "#" . $a_anchor;
1379 }
1380
1381 return $script;
1382 }
getTargetScript()
Get target script name.
getUrlParameters($a_class, $a_str, $a_cmd="", $xml_style=false)
Get URL parameters for a class and append them to a string.

References getTargetScript(), and getUrlParameters().

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

+ 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 173 of file class.ilCtrl.php.

174 {
175 throw new Exception("ilCtrl::getModuleDir is deprecated.");
176 //return $this->module_dir;
177 }

◆ 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 745 of file class.ilCtrl.php.

746 {
747 $cmdNode = $this->getCmdNode();
748 if ($cmdNode == "") {
749 return ($class = $this->checkLPSettingsForward($a_gui_class, $cmdNode))
750 ? $class
751 : false;
752 } else {
753 if ($this->current_node == $cmdNode) {
754 return ($class = $this->checkLPSettingsForward($a_gui_class, $cmdNode))
755 ? $class
756 : "";
757 } else {
758 $path = $this->getPathNew($this->current_node, $cmdNode);
759 $this->readCidInfo($this->getCurrentCidOfNode($path[1]));
760 return $this->cid_class[$this->getCurrentCidOfNode($path[1])];
761 }
762 }
763 }
checkLPSettingsForward($a_gui_obj, $a_cmd_node)
getPathNew($a_source_node, $a_target_node)
Get path in call structure.
getCurrentCidOfNode($a_node)
Get cid of node.

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

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

+ 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 336 of file class.ilCtrl.php.

337 {
338 $class = strtolower($a_class);
339 $this->readClassInfo($class);
340
341 if ($a_par_node === 0 || $a_par_node == "") {
342 return array("node_id" => $this->getCidForClass($class),
343 "base_class" => $class);
344 }
345
346 $this->readNodeInfo($a_par_node);
347
348 $node_cid = $this->getCurrentCidOfNode($a_par_node);
349
350 // target class is class of current node id
351 if ($class == $this->getClassForCid($node_cid)) {
352 return array("node_id" => $a_par_node,
353 "base_class" => "");
354 }
355
356 // target class is child of current node id
357 if (isset($this->calls[$this->getClassForCid($node_cid)]) &&
358 is_array($this->calls[$this->getClassForCid($node_cid)]) &&
359 in_array($a_class, $this->calls[$this->getClassForCid($node_cid)])) {
360 return array("node_id" => $a_par_node . ":" . $this->getCidForClass($class),
361 "base_class" => "");
362 }
363
364 // target class is sibling
365 $par_cid = $this->getParentCidOfNode($a_par_node);
366 if ($par_cid != "") {
367 if (is_array($this->calls[$this->getClassForCid($par_cid)]) &&
368 in_array($a_class, $this->calls[$this->getClassForCid($par_cid)])) {
369 return array("node_id" =>
370 $this->removeLastCid($a_par_node) . ":" . $this->getCidForClass($class),
371 "base_class" => "");
372 }
373 }
374
375 // target class is parent
376 $temp_node = $this->removeLastCid($a_par_node);
377 while ($temp_node != "") {
378 $temp_cid = $this->getCurrentCidOfNode($temp_node);
379 if ($this->getClassForCid($temp_cid) == $a_class) {
380 return array("node_id" => $temp_node,
381 "base_class" => "");
382 }
383 $temp_node = $this->removeLastCid($temp_node);
384 }
385
386 // target class is another base class
387 $n_class = "";
388 if ($a_class != "") {
389 $module_class = ilCachedCtrl::getInstance();
390 $mc_rec = $module_class->lookupModuleClass($class);
391 $n_class = $mc_rec['lower_class'];
392
393 if ($n_class == "") {
394 $mc_rec = $module_class->lookupServiceClass($class);
395 $n_class = $mc_rec['lower_class'];
396 }
397
398 if ($n_class != "") {
399 $this->getCallStructure($n_class);
400 return array("node_id" => $this->getCidForClass($n_class),
401 "base_class" => $class);
402 }
403 }
404
405 if ($a_check) {
406 return false;
407 }
408
409 // Please do NOT change these lines.
410 // Developers must be aware, if they use classes unknown to the controller
411 // otherwise certain problem will be extremely hard to track down...
412
413 error_log("ERROR: Can't find target class $a_class for node $a_par_node " .
414 "(" . $this->cid_class[$this->getParentCidOfNode($a_par_node)] . ")");
415
416 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
417 throw new ilCtrlException("ERROR: Can't find target class $a_class for node $a_par_node " .
418 "(" . $this->cid_class[$this->getParentCidOfNode($a_par_node)] . ").");
419 }
getParentCidOfNode($a_node)
Get 2nd to last class id of node.
removeLastCid($a_node)
Remove the class id that comes at the beginning the sequence.
readNodeInfo($a_node)
Save classes respective to the class id's of a node and store corresponding class calls for future re...

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

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

+ 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 1527 of file class.ilCtrl.php.

1528 {
1529 $par_arr = $this->getParameterArrayByClass(strtolower(get_class($a_gui_obj)), $a_cmd);
1530
1531 return $par_arr;
1532 }
getParameterArrayByClass($a_class, $a_cmd="")
Get all set/save parameters using gui class name.

References getParameterArrayByClass().

+ 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 1541 of file class.ilCtrl.php.

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])) {
1576 $params[$par] = ilUtil::stripSlashesRecursive($_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 }
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.

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

Referenced by getParameterArray(), and getUrlParameters().

+ 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 1740 of file class.ilCtrl.php.

1741 {
1742 $class_ids = explode(":", $a_node);
1743 return $class_ids[count($class_ids) - 2];
1744 }

Referenced by getNodeIdForTargetClass().

+ 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 1435 of file class.ilCtrl.php.

1436 {
1437 return $this->getParentReturnByClass(strtolower(get_class($a_gui_obj)));
1438 }
getParentReturnByClass($a_class)
Get return script url.

References getParentReturnByClass().

Referenced by returnToParent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentReturnByClass()

ilCtrl::getParentReturnByClass (   $a_class)
protected

Get return script url.

Only used in getParentReturn.

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

1447 {
1448 $a_class = strtolower($a_class);
1449 $ret_class = $this->searchReturnClass($a_class);
1450 if ($ret_class) {
1451 return $this->return[$ret_class];
1452 }
1453 }
searchReturnClass($a_class)
Determine current return class.

References searchReturnClass().

Referenced by getParentReturn().

+ 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 808 of file class.ilCtrl.php.

809 {
810 if ($a_source_node == "1") {
811 $a_source_node = "";
812 }
813 if (substr($a_target_node, 0, strlen($a_source_node)) != $a_source_node) {
814 $failure = "ERROR: Path not found. Source:" . $a_source_node .
815 ", Target:" . $a_target_node;
816 if (DEVMODE == 1) {
817 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
818 throw new ilCtrlException($failure);
819 }
820 $GLOBALS['ilLog']->write(__METHOD__ . ' ' . $failure);
821 $this->redirectToURL('./ilias.php?baseClass=ilRepositoryGUI');
822 }
823 $temp_node = $a_source_node;
824
825 $path = array();
826 if ($a_source_node != "") {
827 $path = array($a_source_node);
828 }
829
830 $diffstart = ($a_source_node == "")
831 ? 0
832 : strlen($a_source_node) + 1;
833 $diff = substr($a_target_node, $diffstart);
834 $diff_arr = explode(":", $diff);
835 foreach ($diff_arr as $cid) {
836 if ($temp_node != "") {
837 $temp_node .= ":";
838 }
839 $temp_node .= $cid;
840 $path[] = $temp_node;
841 }
842 return $path;
843 }
$failure
redirectToURL($a_script)

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

Referenced by getNextClass(), and getParameterArrayByClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRedirectSource()

ilCtrl::getRedirectSource ( )

Get current redirect source.

Returns
string redirect source class

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

1499 {
1500 return $_GET["redirectSource"];
1501 }

References $_GET.

◆ getRequestToken()

ilCtrl::getRequestToken ( )

Get request token.

Returns
string request token for user and session

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

1083 {
1084 global $DIC;
1085
1086 $ilUser = $DIC["ilUser"];
1087 $ilDB = $DIC->database();
1088
1089
1090 if ($this->rtoken != "") {
1091 return $this->rtoken;
1092 } else {
1093 if (is_object($ilDB) && is_object($ilUser) && $ilUser->getId() > 0 &&
1094 $ilUser->getId() != ANONYMOUS_USER_ID) {
1095 $res = $ilDB->query("SELECT token FROM il_request_token WHERE user_id = " .
1096 $ilDB->quote($ilUser->getId(), "integer") .
1097 " AND session_id = " . $ilDB->quote(session_id(), "text"));
1098 $rec = $ilDB->fetchAssoc($res);
1099 if ($rec["token"] != "") {
1100 $this->rtoken = $rec["token"];
1101 return $rec["token"];
1102 }
1103 //echo "new rtoken, new entry for :".$ilUser->getId().":".session_id().":"; exit;
1104 $random = new \ilRandom();
1105 $this->rtoken = md5(uniqid($random->int(), true));
1106
1107 // delete entries older than one and a half days
1108 if ($random->int(1, 200) == 2) {
1109 $dt = new ilDateTime(time(), IL_CAL_UNIX);
1110 $dt->increment(IL_CAL_DAY, -1);
1111 $dt->increment(IL_CAL_HOUR, -12);
1112 $dq = "DELETE FROM il_request_token WHERE " .
1113 " stamp < " . $ilDB->quote($dt->get(IL_CAL_DATETIME), "timestamp");
1114 $ilDB->manipulate($dq);
1115 }
1116
1117 // IMPORTANT: Please do NOT try to move this implementation to a
1118 // session basis. This will fail due to framesets that are used
1119 // occasionally in ILIAS, e.g. in the chat, where multiple
1120 // forms are loaded in different frames.
1121 $ilDB->manipulate("INSERT INTO il_request_token (user_id, token, stamp, session_id) VALUES " .
1122 "(" .
1123 $ilDB->quote($ilUser->getId(), "integer") . "," .
1124 $ilDB->quote($this->rtoken, "text") . "," .
1125 $ilDB->now() . "," .
1126 $ilDB->quote(session_id(), "text") . ")");
1127 return $this->rtoken;
1128 }
1129 }
1130 return "";
1131 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
const IL_CAL_HOUR
const IL_CAL_DAY
@classDescription Date and time handling
foreach($_POST as $key=> $value) $res
$ilUser
Definition: imgupload.php:18

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

Referenced by appendRequestTokenParameterString(), and getFormActionByClass().

+ 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 1463 of file class.ilCtrl.php.

1464 {
1465 if (is_object($a_class)) {
1466 $class = strtolower(get_class($a_class));
1467 } else {
1468 $class = strtolower($a_class);
1469 }
1470 return $this->searchReturnClass($class);
1471 }

References searchReturnClass().

+ 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 481 of file class.ilCtrl.php.

482 {
483 return $this->tab;
484 }

References $tab.

◆ getTargetScript()

ilCtrl::getTargetScript ( )

Get target script name.

Returns
string target script name

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

861 : string
862 {
864 }

References $target_script.

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

+ 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 1511 of file class.ilCtrl.php.

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 }

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

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

+ 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 875 of file class.ilCtrl.php.

876 {
877 $_GET["baseClass"] = $a_base_class;
878 $_GET["cmd"] = "";
879 $_GET["cmdClass"] = "";
880 $_GET["cmdNode"] = "";
882 }

References $_GET, and initializeMemberVariables().

+ 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 108 of file class.ilCtrl.php.

109 {
110 $this->save_parameter = array();
111 $this->parameter = array(); // save parameter array
112 $this->return = array(); // return commmands
113 $this->tab = array();
114 $this->current_node = 0;
115 $this->call_node = array();
116 $this->root_class = "";
117 }

Referenced by __construct(), and initBaseClass().

+ Here is the caller graph for this function:

◆ insertCtrlCalls()

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

Insert ctrl calls record.

Parameters

return

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

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 }

References $DIC, and $ilDB.

◆ isAsynch()

ilCtrl::isAsynch ( )

Is current command an asynchronous command?

Returns
boolean asynchronous t/f

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

1309 {
1310 if (isset($_GET["cmdMode"]) && $_GET["cmdMode"] == "asynch") {
1311 return true;
1312 } else {
1313 return false;
1314 }
1315 }

References $_GET.

◆ 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 771 of file class.ilCtrl.php.

772 {
773 $a_class_name = strtolower($a_class_name);
774
775 $cached_ctrl = ilCachedCtrl::getInstance();
776 $class_rec = $cached_ctrl->lookupClassFile($a_class_name);
777
778 if ($class_rec["plugin_path"] != "") {
779 return $class_rec["plugin_path"] . "/" . $class_rec["filename"];
780 } else {
781 return $class_rec["filename"];
782 }
783 }

References ilCachedCtrl\getInstance().

Referenced by ilLTIRouterGUI\executeCommand().

+ 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 521 of file class.ilCtrl.php.

522 {
523 global $DIC;
524
525 $ilDB = $DIC->database();
526
527 $a_class = strtolower($a_class);
528
529 $a_nr++;
530
531 // determine call node structure
532 $this->call_node[$a_nr] = array("class" => $a_class, "parent" => $a_parent);
533
534 $call_set = $ilDB->query("SELECT * FROM ctrl_calls WHERE parent = " .
535 $ilDB->quote(strtolower($a_class), "text") .
536 " ORDER BY child", array("text"));
537 $a_parent = $a_nr;
538 while ($call_rec = $ilDB->fetchAssoc($call_set)) {
539 $a_nr = $this->readCallStructure($call_rec["child"], $a_nr, $a_parent);
540 $forw[] = $call_rec["child"];
541 }
542
543 // determine root class
544 $this->root_class = $a_class;
545 return $a_nr;
546 }
readCallStructure($a_class, $a_nr=0, $a_parent=0)
Reads call structure from db.

References $DIC, $ilDB, and readCallStructure().

Referenced by readCallStructure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 1667 of file class.ilCtrl.php.

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 }
fetchCallsOfClassFromCache($a_class, ilCachedCtrl $a_cached_ctrl)
updateClassCidMap($a_class, $a_cid)

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

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

+ 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 1705 of file class.ilCtrl.php.

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 }

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

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

+ 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 1691 of file class.ilCtrl.php.

1692 {
1693 $class_ids = explode(":", $a_node);
1694 foreach ($class_ids as $cid) {
1695 $this->readCidInfo($cid);
1696 }
1697 }

References readCidInfo().

Referenced by getNodeIdForTargetClass().

+ 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 1212 of file class.ilCtrl.php.

1213 {
1214 $script = $this->getLinkTargetByClass(
1215 strtolower(get_class($a_gui_obj)),
1216 $a_cmd,
1217 "",
1218 $a_asynch,
1219 false
1220 );
1221 if ($a_anchor != "") {
1222 $script = $script . "#" . $a_anchor;
1223 }
1224 $this->redirectToURL($script);
1225 }

References getLinkTargetByClass(), and redirectToURL().

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

+ 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 1294 of file class.ilCtrl.php.

1295 {
1296 $script = $this->getLinkTargetByClass($a_class, $a_cmd, "", $a_asynch, false);
1297 if ($a_anchor != "") {
1298 $script = $script . "#" . $a_anchor;
1299 }
1300 $this->redirectToURL($script);
1301 }

References getLinkTargetByClass(), and redirectToURL().

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

+ 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 1231 of file class.ilCtrl.php.

1232 {
1233 global $DIC;
1234
1235 $ilPluginAdmin = null;
1236 if (isset($DIC["ilPluginAdmin"])) {
1237 $ilPluginAdmin = $DIC["ilPluginAdmin"];
1238 }
1239
1240 if (!is_int(strpos($a_script, "://"))) {
1241 if (substr($a_script, 0, 1) != "/" && defined("ILIAS_HTTP_PATH")) {
1242 if (is_int(strpos($_SERVER["PHP_SELF"], "/setup/"))) {
1243 $a_script = "setup/" . $a_script;
1244 }
1245 $a_script = ILIAS_HTTP_PATH . "/" . $a_script;
1246 }
1247 }
1248
1249 // include the user interface hook
1250 if (is_object($ilPluginAdmin)) {
1251 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
1252 foreach ($pl_names as $pl) {
1253 $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
1254 $gui_class = $ui_plugin->getUIClassInstance();
1255 $resp = $gui_class->getHTML("Services/Utilities", "redirect", array( "html" => $a_script ));
1256 if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
1257 $a_script = $gui_class->modifyHTML($a_script, $resp);
1258 }
1259 }
1260 }
1261
1262 // Manually trigger to write and close the session. This has the advantage that if an exception is thrown
1263 // during the writing of the session (ILIAS writes the session into the database by default) we get an exception
1264 // if the session_write_close() is triggered by exit() then the exception will be dismissed but the session
1265 // is never written, which is a nightmare to develop with.
1266 session_write_close();
1267
1268 global $DIC;
1269 $http = $DIC->http();
1270 switch ($http->request()->getHeaderLine('Accept')) {
1271 case 'application/json':
1272 $stream = \ILIAS\Filesystem\Stream\Streams::ofString(json_encode([
1273 'success' => true,
1274 'message' => 'Called redirect after async fileupload request',
1275 "redirect_url" => $a_script,
1276 ]));
1277 $http->saveResponse($http->response()->withBody($stream));
1278 break;
1279 default:
1280 $http->saveResponse($http->response()->withAddedHeader("Location", $a_script));
1281 break;
1282 }
1283 $http->sendResponse();
1284 exit;
1285 }
static ofString($string)
Creates a new stream with an initial value.
Definition: Streams.php:30
const IL_COMP_SERVICE
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
exit
Definition: login.php:29
$http
Definition: raiseError.php:7

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

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

+ 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 1749 of file class.ilCtrl.php.

1750 {
1751 $lpos = strrpos($a_node, ":");
1752 return substr($a_node, 0, $lpos);
1753 }

Referenced by getNodeIdForTargetClass().

+ 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 1410 of file class.ilCtrl.php.

1411 {
1412 $script = $this->getParentReturn($a_gui_obj);
1413
1415 $script,
1416 "redirectSource=" . strtolower(get_class($a_gui_obj))
1417 );
1419 $script,
1420 "cmdMode=" . $_GET["cmdMode"]
1421 );
1422 if ($a_anchor != "") {
1423 $script = $script . "#" . $a_anchor;
1424 }
1425
1426 $this->redirectToURL($script);
1427 }
getParentReturn($a_gui_obj)
Get return script url.

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

+ 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

@access public

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

568 {
569 if (is_object($a_obj)) {
570 $this->saveParameterByClass(get_class($a_obj), $a_parameter);
571 }
572 }
saveParameterByClass($a_class, $a_parameter)
Save parameter for a class.

References saveParameterByClass().

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

+ 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 580 of file class.ilCtrl.php.

581 {
582 if (is_array($a_parameter)) {
583 foreach ($a_parameter as $parameter) {
584 $this->save_parameter[strtolower($a_class)][] = $parameter;
585 }
586 } else {
587 $this->save_parameter[strtolower($a_class)][] = $a_parameter;
588 }
589 }

References $parameter.

Referenced by saveParameter().

+ Here is the caller graph for this function:

◆ searchReturnClass()

ilCtrl::searchReturnClass (   $a_class)
private

Determine current return class.

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

1478 {
1479 $a_class = strtolower($a_class);
1480
1481 $node = $this->getNodeIdForTargetClass($this->current_node, $a_class);
1482 $node = $node["node_id"];
1483 $n_arr = explode(":", $node);
1484 for ($i = count($n_arr) - 2; $i >= 0; $i--) {
1485 if ($this->return[$this->getClassForCid($n_arr[$i])] != "") {
1486 return $this->getClassForCid($n_arr[$i]);
1487 }
1488 }
1489
1490 return false;
1491 }
$i
Definition: metadata.php:24

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

Referenced by getParentReturnByClass(), and getReturnClass().

+ 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 958 of file class.ilCtrl.php.

959 {
960 $_GET["cmd"] = $a_cmd;
961 }

References $_GET.

Referenced by ilChatroomInfoGUI\executeDefault().

+ 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 973 of file class.ilCtrl.php.

974 {
975 $a_cmd_class = strtolower($a_cmd_class);
976 $nr = $this->getNodeIdForTargetClass($this->current_node, $a_cmd_class);
977 $nr = $nr["node_id"];
978 $_GET["cmdClass"] = $a_cmd_class;
979 $_GET["cmdNode"] = $nr;
980 }

References $_GET, and getNodeIdForTargetClass().

+ 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 268 of file class.ilCtrl.php.

269 {
270 $this->context_obj_id = $a_obj_id;
271 $this->context_obj_type = $a_obj_type;
272 $this->context_sub_obj_id = $a_sub_obj_id;
273 $this->context_sub_obj_type = $a_sub_obj_type;
274 }

◆ 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 614 of file class.ilCtrl.php.

615 {
616 $this->parameter[strtolower(get_class($a_obj))][$a_parameter] = $a_value;
617 }

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

+ 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 627 of file class.ilCtrl.php.

628 {
629 $this->parameter[strtolower($a_class)][$a_parameter] = $a_value;
630 }

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

+ Here is the caller graph for this function:

◆ setReturn()

ilCtrl::setReturn (   $a_gui_obj,
  $a_cmd 
)

Set return command.

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

1388 {
1389 $script = $this->getTargetScript();
1390 $script = $this->getUrlParameters(strtolower(get_class($a_gui_obj)), $script, $a_cmd);
1391 $this->return[strtolower(get_class($a_gui_obj))] = $script;
1392 }

References getTargetScript(), and getUrlParameters().

Referenced by ilObjectPermissionStatusGUI\executeCommand().

+ 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 1397 of file class.ilCtrl.php.

1398 {
1399 // may not be an array!
1400 $a_class = strtolower($a_class);
1401
1402 $script = $this->getTargetScript();
1403 $script = $this->getUrlParameters($a_class, $script, $a_cmd);
1404 $this->return[strtolower($a_class)] = $script;
1405 }

References getTargetScript(), and getUrlParameters().

+ 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 850 of file class.ilCtrl.php.

851 {
852 $this->target_script = $a_target_script;
853 }

◆ updateClassCidMap()

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

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

1732 {
1733 $this->cid_class[$a_cid] = $a_class;
1734 $this->class_cid[$a_class] = $a_cid;
1735 }

Referenced by readCidInfo(), and readClassInfo().

+ Here is the caller graph for this function:

◆ verifyToken()

ilCtrl::verifyToken ( )
private

Verify Token.

Returns
boolean valid t/f

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

1139 {
1140 global $DIC;
1141
1142 $ilUser = $DIC["ilUser"];
1143
1144 $ilDB = $DIC->database();
1145 ;
1146
1147 if (is_object($ilUser) && is_object($ilDB) && $ilUser->getId() > 0 &&
1148 $ilUser->getId() != ANONYMOUS_USER_ID) {
1149 if ($_GET["rtoken"] == "") {
1150 return false;
1151 }
1152
1153 $set = $ilDB->query("SELECT * FROM il_request_token WHERE " .
1154 " user_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " .
1155 " token = " . $ilDB->quote($_GET[self::IL_RTOKEN_NAME]), "text");
1156 if ($ilDB->numRows($set) > 0) {
1157 // remove tokens from older sessions
1158 // if we do this immediately, working with multiple windows does not work:
1159 // - window one: open form (with token a)
1160 // - window two: open form (with token b)
1161 // - submit window one: a is verified, but b must not be deleted immediately, otherwise
1162 // - window two: submit results in invalid token
1163 // see also bug #13551
1164 $dt = new ilDateTime(time(), IL_CAL_UNIX);
1165 $dt->increment(IL_CAL_DAY, -1);
1166 $dt->increment(IL_CAL_HOUR, -12);
1167 $ilDB->manipulate("DELETE FROM il_request_token WHERE " .
1168 " user_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " .
1169 " session_id != " . $ilDB->quote(session_id(), "text") . " AND " .
1170 " stamp < " . $ilDB->quote($dt->get(IL_CAL_DATETIME), "timestamp"));
1171 return true;
1172 } else {
1173 return false;
1174 }
1175
1176 if ($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]] != "") {
1177 // remove used token
1178 unset($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]]);
1179
1180 // remove old tokens
1181 if (count($_SESSION["rtokens"]) > 100) {
1182 $to_remove = array();
1183 $sec = 7200; // two hours
1184
1185 foreach ($_SESSION["rtokens"] as $tok => $time) {
1186 if (time() - $time > $sec) {
1187 $to_remove[] = $tok;
1188 }
1189 }
1190 foreach ($to_remove as $tok) {
1191 unset($_SESSION["rtokens"][$tok]);
1192 }
1193 }
1194
1195 return true;
1196 }
1197 return false;
1198 } else {
1199 return true; // do not verify, if user or db object is missing
1200 }
1201
1202 return false;
1203 }
$_SESSION["AccountId"]

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

Referenced by getCmd().

+ 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.

◆ $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().

◆ 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: