ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCtrl Class Reference

This class provides processing control methods. More...

+ Collaboration diagram for ilCtrl:

Public Member Functions

 __construct ()
 control class constructor More...
 
 debug ($str)
 Collect debugging strings (. More...
 
 getDebug ()
 Get debug message string (. More...
 
 init ()
 initialisation 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)
 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...
 
 addLocation ($a_title, $a_link, $a_target="", $a_ref_id=0)
 Add a location to the locator array (. More...
 
 getLocations ()
 Get locations array (. 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)
 stores often used common call structures (called from db_update script!!!) 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 ($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=true)
 Get form action url for gui class object. More...
 
 getFormActionByClass ( $a_class, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
 Get form action url for gui class name. More...
 
 appendRequestTokenParameterString ($a_url, $xml_style=true)
 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=true)
 Get link target for command using gui object. More...
 
 getLinkTargetByClass ( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
 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...
 
 getRedirectSource ()
 Get current redirect source. 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...
 
 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...
 

Data Fields

const IL_RTOKEN_NAME = 'rtoken'
 
 $target_script
 
 $forward
 
 $parent
 
 $save_parameter
 
 $return
 
 $call_hist = array()
 
 $debug = array()
 
 $calls = array()
 
 $rtoken = false
 

Protected Member Functions

 checkLPSettingsForward ($a_gui_obj, $a_cmd_node)
 

Protected Attributes

 $db
 
 $plugin_admin
 

Private Member Functions

 getNodeIdForTargetClass ($a_par_node, $a_class, $a_check=false)
 Searchs a node for a given class ($a_class) "near" the another node ($a_par_node). More...
 
 forwards ($a_from_class, $a_to_class)
 Stores which classes forwards commands to which other classes. 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...
 
 getCidForClass ($a_class, $a_check=false)
 Get Cid for Class. More...
 
 getClassForCid ($a_cid)
 Get class for cid. More...
 
 readCidInfo ($a_cid)
 Read information of class per cid. More...
 
 readNodeInfo ($a_node)
 Read info of node. More...
 
 readClassInfo ($a_class)
 Read info of class. More...
 
 getParentCidOfNode ($a_node)
 Get last but one cid of node id. More...
 
 removeLastCid ($a_node)
 Remove last cid of node. More...
 
 getCurrentCidOfNode ($a_node)
 Get last cid of node id. More...
 

Detailed Description

This class provides processing control methods.

A global instance is available via variable $ilCtrl

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

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

Constructor & Destructor Documentation

◆ __construct()

ilCtrl::__construct ( )

control class constructor

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

40 {
41 // initialisation
42 $this->init();
43
44 // this information should go to xml files one day
45 $this->stored_trees = array("ilrepositorygui", "ilpersonaldesktopgui",
46 "illmpresentationgui", "illmeditorgui",
47 "iladministrationgui");
48 }
init()
initialisation

References init().

+ Here is the call graph for this function:

Member Function Documentation

◆ addLocation()

ilCtrl::addLocation (   $a_title,
  $a_link,
  $a_target = "",
  $a_ref_id = 0 
)

Add a location to the locator array (.

Deprecated:
, use $ilLocator)
Parameters
string$a_titlelink text
string$a_linklink
string$a_targettarget frame

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

467 {
468 $this->location[] = array("title" => $a_title,
469 "link" => $a_link, "target" => $a_target, "ref_id" => $a_ref_id);
470 }

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

491 {
492 $a_class = strtolower($a_class);
493
494 $this->tab[] = array("lang_var" => $a_lang_var,
495 "link" => $a_link, "cmd" => $a_cmd, "class" => $a_class);
496 }

◆ appendRequestTokenParameterString()

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

Append request token as url parameter.

Parameters
stringurl
booleanxml style

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

1174 {
1176 $a_url,
1177 self::IL_RTOKEN_NAME . '=' . $this->getRequestToken(),
1178 $xml_style
1179 );
1180 }
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.

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

98 {
99 global $DIC;
100
101 $ilDB = $DIC->database();
102
103 $baseClass = strtolower($_GET["baseClass"]);
104
105 $module_class = ilCachedCtrl::getInstance();
106 $mc_rec = $module_class->lookupModuleClass($baseClass);
107 // get class information
108 // $mc_set = $ilDB->query("SELECT * FROM module_class WHERE LOWER(class) = ".
109 // $ilDB->quote($baseClass, "text"));
110 // $mc_rec = $ilDB->fetchAssoc($mc_set);
111
112 $module = $mc_rec["module"];
113 $class = $mc_rec["class"];
114 $class_dir = $mc_rec["dir"];
115
116 if ($module != "") {
117 $m_set = $ilDB->query("SELECT * FROM il_component WHERE name = " .
118 $ilDB->quote($module, "text"));
119 $m_rec = $ilDB->fetchAssoc($m_set);
120 $this->module_dir = $m_rec["type"] . "/" . $m_rec["name"];
121 include_once $this->module_dir . "/" . $class_dir . "/class." . $class . ".php";
122 } else { // check whether class belongs to a service
123 // $mc_set = $ilDB->query("SELECT * FROM service_class WHERE LOWER(class) = ".
124 // $ilDB->quote($baseClass, "text"));
125 // $mc_rec = $ilDB->fetchAssoc($mc_set);
126
127 $mc_rec = $module_class->lookupServiceClass($baseClass);
128
129 $service = $mc_rec["service"];
130 $class = $mc_rec["class"];
131 $class_dir = $mc_rec["dir"];
132
133 if ($service == "") {
134 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
135 throw new ilCtrlException("Could not find entry in modules.xml or services.xml for " .
136 $baseClass . " <br/>" . str_replace("&", "<br />&", htmlentities($_SERVER["REQUEST_URI"])));
137 }
138
139 // get service information
140 // $m_set = $ilDB->query("SELECT * FROM il_component WHERE name = ".
141 // $ilDB->quote($service, "text"));
142 // $m_rec = $ilDB->fetchAssoc($m_set);
143
144 $m_rec = ilComponent::getComponentInfo('Services', $service);
145
146 $this->service_dir = $m_rec["type"] . "/" . $m_rec["name"];
147
148 include_once $this->service_dir . "/" . $class_dir . "/class." . $class . ".php";
149 ;
150 }
151
152 // forward processing to base class
153 $this->getCallStructure(strtolower($baseClass));
154 $base_class_gui = new $class();
155 $this->forwardCommand($base_class_gui);
156 }
$_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 ...
$service
Definition: login.php:15
if($modEnd===false) $module
Definition: module.php:59
global $DIC
Definition: saml.php:7
global $ilDB
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

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

+ Here is the call 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 1914 of file class.ilCtrl.php.

1915 {
1916 foreach (explode(":", $this->getCmdNode()) as $cid) {
1917 if ($cid != "" && strtolower($this->getClassForCid($cid)) == strtolower($gui_class)) {
1918 return true;
1919 }
1920 }
1921 return false;
1922 }
getCmdNode()
Get command target node.
getClassForCid($a_cid)
Get class for cid.

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

755 {
756 global $DIC;
757
758 $objDefinition = $DIC["objDefinition"];
759
760 // forward to learning progress settings if possible and accessible
761 if ($_GET["gotolp"] &&
762 $a_gui_obj) {
763 $ref_id = $_GET["ref_id"];
764 if (!$ref_id) {
765 $ref_id = $_REQUEST["ref_id"];
766 }
767
768 $gui_class = get_class($a_gui_obj);
769
770 if ($gui_class == "ilSAHSEditGUI") {
771 // #1625 - because of scorm "sub-types" this is all very special
772 include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
773 $obj_id = ilObject::_lookupObjectId($ref_id);
775 case "scorm2004":
776 $class = "ilObjSCORM2004LearningModuleGUI";
777 break;
778
779 case "scorm":
780 $class = "ilObjSCORMLearningModuleGUI";
781 break;
782
783 case "aicc":
784 $class = "ilObjAICCLearningModuleGUI";
785 break;
786
787 case "hacp":
788 $class = "ilObjHACPLearningModuleGUI";
789 break;
790 }
791 if ($GLOBALS["ilAccess"]->checkAccess("edit_learning_progress", "", $ref_id)) {
792 $this->redirectByClass(array($gui_class, $class, "illearningprogressgui", "illplistofsettingsgui"), "");
793 }
794 }
795 // special case: cannot use any presentation GUIs
796 elseif ($gui_class == "ilLMPresentationGUI") {
797 $this->setParameterByClass("ilObjLearningModuleGUI", "gotolp", 1);
798 $this->redirectByClass(array("ilLMEditorGUI", "ilObjLearningModuleGUI"), "");
799 }
800
801 include_once "Services/Object/classes/class.ilObjectLP.php";
802 $type = ilObject::_lookupType($ref_id, true);
803 $class = "ilObj" . $objDefinition->getClassName($type) . "GUI";
804
805 if ($gui_class == $class &&
807 $GLOBALS["ilAccess"]->checkAccess("edit_learning_progress", "", $ref_id)) {
808 // add path to repository object gui if missing from cmdNode
809 if (!$a_cmd_node) {
810 $repo_node = $this->getNodeIdForTargetClass(null, "ilrepositorygui");
811 $obj_node = $this->getNodeIdForTargetClass($repo_node["node_id"], $gui_class);
812 $a_cmd_node = $obj_node["node_id"];
813 }
814 // find path to lp settings
815 $lp_node = $this->getNodeIdForTargetClass($a_cmd_node, "illearningprogressgui");
816 $lp_settings_node = $this->getNodeIdForTargetClass($lp_node["node_id"], "illplistofsettingsgui");
817 $_GET["cmdNode"] = $lp_settings_node["node_id"];
818 $_GET["cmdClass"] = "ilLPListOfSettingsGUI";
819 $_GET["cmd"] = "";
820 return "illearningprogressgui";
821 }
822 }
823 }
getNodeIdForTargetClass($a_par_node, $a_class, $a_check=false)
Searchs a node for a given class ($a_class) "near" the 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
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$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 426 of file class.ilCtrl.php.

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

References getCidForClass(), and getNodeIdForTargetClass().

+ Here is the call 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 727 of file class.ilCtrl.php.

728 {
729 unset($this->parameter[strtolower($a_class)][$a_parameter]);
730 }

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

739 {
740 $this->clearParametersByClass(strtolower(get_class($a_obj)));
741 }
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 749 of file class.ilCtrl.php.

750 {
751 $this->parameter[strtolower($a_class)] = array();
752 }

Referenced by clearParameters().

+ Here is the caller graph for this function:

◆ debug()

ilCtrl::debug (   $str)

Collect debugging strings (.

Deprecated:
)
Parameters
stringdebug message

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

56 {
57 $this->debug[] = $str;
58 }
debug($str)
Collect debugging strings (.

References debug().

Referenced by debug().

+ 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
objectgui object that should receive the flow of control
Returns
mixed return data of invoked executeCommand() method

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

176 {
177 $class = strtolower(get_class($a_gui_object));
178 //echo "<br>class:".$class.":";
179 $nr = $this->getNodeIdForTargetClass($this->current_node, $class);
180 $nr = $nr["node_id"];
181 if ($nr != "") {
182 $current_node = $this->current_node;
183
184 $this->current_node = $nr;
185
186 // always populate the call history
187 // it will only be displayed in DEVMODE but is needed for UI plugins, too
188 $this->call_hist[] = array("class" => get_class($a_gui_object),
189 "mode" => "execComm", "cmd" => $this->getCmd());
190
191 //echo "<br>class:".get_class($a_gui_object).":";
192 $html = $a_gui_object->executeCommand();
193
194 // reset current node
195 $this->current_node = $current_node;
196
197 return $html;
198 }
199
200 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
201 throw new ilCtrlException("ERROR: Can't forward to class $class.");
202 }
getCmd($a_default_cmd="", $a_safe_commands="")
Determines current get/post command.
$html
Definition: example_001.php:87

References $html, getCmd(), and getNodeIdForTargetClass().

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

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

◆ forwards()

ilCtrl::forwards (   $a_from_class,
  $a_to_class 
)
private

Stores which classes forwards commands to which other classes.

Parameters
string$a_from_classsource class name
string$a_to_classtarget class name

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

608 {
609 $a_from_class = strtolower($a_from_class);
610
611 if (is_array($a_to_class)) {
612 foreach ($a_to_class as $to_class) {
613 if ($a_from_class != "" && $to_class != "") {
614 if (!is_array($this->forward[$a_from_class]) || !in_array(strtolower($to_class), $this->forward[$a_from_class])) {
615 $this->forward[$a_from_class][] = strtolower($to_class);
616 }
617 if (!is_array($this->parent[strtolower($to_class)]) || !in_array($a_from_class, $this->parent[strtolower($to_class)])) {
618 $this->parent[strtolower($to_class)][] = $a_from_class;
619 }
620 }
621 }
622 } else {
623 $to_class = $a_to_class;
624 if ($a_from_class != "" && $to_class != "") {
625 if (!is_array($this->forward[$a_from_class]) || !in_array(strtolower($to_class), $this->forward[$a_from_class])) {
626 $this->forward[$a_from_class][] = strtolower($to_class);
627 }
628 if (!is_array($this->parent[strtolower($to_class)]) || !in_array($a_from_class, $this->parent[strtolower($to_class)])) {
629 $this->parent[strtolower($to_class)][] = $a_from_class;
630 }
631 }
632 }
633 }

Referenced by init(), and readCallStructure().

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

515 {
516 return $this->call_hist;
517 }

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->setTargetScript("ilias.php"); $ilCtrl->getCallStructure("ilrepositorygui"); $repository_gui = new ilRepositoryGUI(); $ilCtrl->forwardCommand($repository_gui);

Parameters
string$a_classgui class name

@access public

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

536 {
537 $this->readClassInfo($a_class);
538 }
readClassInfo($a_class)
Read info of class.

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 Cid for Class.

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

1724 {
1725 if ($this->class_cid[$a_class] == "") {
1726 $this->readClassInfo($a_class);
1727 }
1728 if ($this->class_cid[$a_class] == "") {
1729 if ($a_check) {
1730 return false;
1731 }
1732 if (DEVMODE == 1) {
1733 $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
1734 may solve the issue by putting an empty * @ilCtrl_Calls [YourClassName]: into your class header." .
1735 " In both cases you need to reload the control structure in the setup.";
1736 }
1737 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
1738 throw new ilCtrlException("Cannot find cid for class " . $a_class . "." . $add);
1739 }
1740 return $this->class_cid[$a_class];
1741 }

References 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 cid.

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

1747 {
1748 if ($this->cid_class[$a_cid] == "") {
1749 $this->readCidInfo($a_cid);
1750 }
1751 if ($this->cid_class[$a_cid] == "") {
1752 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
1753 throw new ilCtrlException("Cannot find class for cid " . $a_cid . ".");
1754 }
1755 return $this->cid_class[$a_cid];
1756 }
readCidInfo($a_cid)
Read information of class per cid.

References readCidInfo().

Referenced by checkCurrentPathForClass(), 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 891 of file class.ilCtrl.php.

892 {
893 $path = pathinfo($a_class_path);
894 $file = $path["basename"];
895 $class = substr($file, 6, strlen($file) - 10);
896
897 return $class;
898 }
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, and $path.

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

997 {
998 $cmd = "";
999 if (isset($_GET["cmd"])) {
1000 $cmd = $_GET["cmd"];
1001 }
1002 if ($cmd == "post") {
1003 if (isset($_POST["cmd"]) && is_array($_POST["cmd"])) {
1004 reset($_POST["cmd"]);
1005 }
1006 $cmd = @key($_POST["cmd"]);
1007
1008 // verify command
1009 if ($this->verified_cmd != "") {
1010 return $this->verified_cmd;
1011 } else {
1012 if (!$this->verifyToken() &&
1013 (!is_array($a_safe_commands) || !in_array($cmd, $a_safe_commands))) {
1014 return $a_default_cmd;
1015 }
1016 }
1017
1018 $this->verified_cmd = $cmd;
1019 if ($cmd == "" && isset($_POST["table_top_cmd"])) { // selected command in multi-list (table2)
1020 $cmd = @key($_POST["table_top_cmd"]);
1021 $this->verified_cmd = $cmd;
1022 $_POST[$_POST["cmd_sv"][$cmd]] = $_POST[$_POST["cmd_sv"][$cmd] . "_2"];
1023 }
1024 if ($cmd == "" && isset($_POST["select_cmd2"])) { // selected command in multi-list (table2)
1025 if (isset($_POST["select_cmd_all2"])) {
1026 $_POST["select_cmd_all"] = $_POST["select_cmd_all2"];
1027 } else {
1028 $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
1029 }
1030 $cmd = $_POST["selected_cmd2"];
1031 $this->verified_cmd = $cmd;
1032 }
1033 if ($cmd == "" && isset($_POST["select_cmd"])) { // selected command in multi-list (table2)
1034 if (isset($_POST["select_cmd_all"])) {
1035 $_POST["select_cmd_all2"] = $_POST["select_cmd_all"];
1036 } else {
1037 $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
1038 }
1039 $cmd = $_POST["selected_cmd"];
1040 $this->verified_cmd = $cmd;
1041 }
1042 if ($cmd == "") {
1043 $cmd = $_GET["fallbackCmd"];
1044 $this->verified_cmd = $cmd;
1045 }
1046 }
1047 if ($cmd == "") {
1048 $cmd = $a_default_cmd;
1049 }
1050 return $cmd;
1051 }
$_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 1092 of file class.ilCtrl.php.

1093 {
1094 return strtolower($_GET["cmdClass"]);
1095 }

References $_GET.

◆ getCmdNode()

ilCtrl::getCmdNode ( )

Get command target node.

Returns
string id of current command target node

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

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

References $_GET.

Referenced by checkCurrentPathForClass(), and getNextClass().

+ Here is the caller graph for this function:

◆ getContextObjId()

ilCtrl::getContextObjId ( )

Get context object id.

Returns
int object id

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

265 {
266 return $this->context_obj_id;
267 }

◆ getContextObjType()

ilCtrl::getContextObjType ( )

Get context object type.

Returns
string object type

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

275 {
276 return $this->context_obj_type;
277 }

◆ getContextSubObjId()

ilCtrl::getContextSubObjId ( )

Get context subobject id.

Returns
int subobject id

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

285 {
286 return $this->context_sub_obj_id;
287 }

◆ getContextSubObjType()

ilCtrl::getContextSubObjType ( )

Get context subobject type.

Returns
string subobject type

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

295 {
296 return $this->context_sub_obj_type;
297 }

◆ getCurrentCidOfNode()

ilCtrl::getCurrentCidOfNode (   $a_node)
private

Get last cid of node id.

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

1868 {
1869 $n_arr = explode(":", $a_node);
1870 return $n_arr[count($n_arr) - 1];
1871 }

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

+ Here is the caller graph for this function:

◆ getDebug()

ilCtrl::getDebug ( )

Get debug message string (.

Deprecated:
)
Returns
array array of debug strings

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

66 {
67 return $this->debug;
68 }

References $debug.

◆ getFormAction()

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

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

1113 {
1114 $script = $this->getFormActionByClass(
1115 strtolower(get_class($a_gui_obj)),
1116 $a_fallback_cmd,
1117 $a_anchor,
1118 $a_asynch,
1119 $xml_style
1120 );
1121 return $script;
1122 }
getFormActionByClass( $a_class, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get form action url for gui class name.

References getFormActionByClass().

Referenced by ilWorkflowEngineDefinitionsTableGUI\__construct(), ilTestSkillLevelThresholdsTableGUI\__construct(), ilObjectPermissionStatusGUI\accessStatusInfo(), ilObjectPermissionStatusGUI\addToolbar(), ilChatroomAdminViewGUI\clientsettings(), ilHistoryTableGUI\initTable(), and ilChatroomAdminViewGUI\serversettings().

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

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

1140 {
1141 if (!is_array($a_class)) {
1142 $a_class = strtolower($a_class);
1143 }
1144
1145 $tok = $this->getRequestToken();
1146
1147 if ($a_asynch) {
1148 $xml_style = false;
1149 }
1150
1151 $script = $this->getLinkTargetByClass($a_class, "post", "", $a_asynch);
1152 if ($a_fallback_cmd != "") {
1153 $script = ilUtil::appendUrlParameterString($script, "fallbackCmd=" . $a_fallback_cmd, $xml_style);
1154 }
1156 $script,
1157 self::IL_RTOKEN_NAME . '=' . $this->getRequestToken(),
1158 $xml_style
1159 );
1160 if ($a_anchor != "") {
1161 $script = $script . "#" . $a_anchor;
1162 }
1163
1164 return $script;
1165 }
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
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)

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

Parameters
objectgui object that returns the HTML block
Returns
string HTML

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

212 {
213 $class = strtolower(get_class($a_gui_object));
214
215 $nr = $this->getNodeIdForTargetClass($this->current_node, $class);
216 $nr = $nr["node_id"];
217 if ($nr != "") {
218 $current_node = $this->current_node;
219
220 // set current node to new gui class
221 $this->current_node = $nr;
222
223 // always populate the call history
224 // it will only be displayed in DEVMODE but is needed for UI plugins, too
225 $this->call_hist[] = array("class" => get_class($a_gui_object),
226 "mode" => "getHtml", "cmd" => $this->getCmd());
227
228 // get block
229 $html = $a_gui_object->getHTML();
230
231 // reset current node
232 $this->current_node = $current_node;
233
234 // return block
235 return $html;
236 }
237
238 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
239 throw new ilCtrlException("ERROR: Can't getHTML from class $class.");
240 }

References $html, 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 = true 
)

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

1450 {
1451 $script = $this->getLinkTargetByClass(
1452 strtolower(get_class($a_gui_obj)),
1453 $a_cmd,
1454 $a_anchor,
1455 $a_asynch,
1456 $xml_style
1457 );
1458 return $script;
1459 }

References getLinkTargetByClass().

Referenced by ilObjWorkflowEngineGUI\initLocator(), and ilTestToplistGUI\manageTabs().

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

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

1479 {
1480 if ($a_asynch) {
1481 $xml_style = false;
1482 }
1483
1484 // note: $a_class may be an array
1485 //$a_class = strtolower($a_class);
1486
1487 //echo "<br>getLinkTargetByClass";
1488 $script = $this->getTargetScript();
1489 $script = $this->getUrlParameters($a_class, $script, $a_cmd, $xml_style);
1490
1491 if ($a_asynch) {
1492 //$amp = $xml_style
1493 // ? "&amp;"
1494 // : "&";
1495 $amp = "&";
1496 $script.= $amp . "cmdMode=asynch";
1497 }
1498
1499 if ($a_anchor != "") {
1500 $script = $script . "#" . $a_anchor;
1501 }
1502
1503 return $script;
1504 }
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(), getFormActionByClass(), getLinkTarget(), ilTestToplistGUI\manageTabs(), redirect(), and redirectByClass().

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

◆ getLocations()

ilCtrl::getLocations ( )

Get locations array (.

Deprecated:
, use $ilLocator)
Returns
array array of locations (array("title", "link", "target"))

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

478 {
479 return $this->location;
480 }
$location
Definition: buildRTE.php:44

References $location.

◆ getModuleDir()

ilCtrl::getModuleDir ( )

get directory of current module

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

162 {
163 return $this->module_dir;
164 }

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

834 {
835 $cmdNode = $this->getCmdNode();
836 //echo "<br>getNextClass (current node: ".$this->current_node."; cmd node: ".$cmdNode.") ";
837 if ($cmdNode == "") {
838 return ($class = $this->checkLPSettingsForward($a_gui_class, $cmdNode))
839 ? $class
840 : false;
841 } else {
842 if ($this->current_node == $cmdNode) {
843 //echo "1:".$this->call_node[$cmdNode]["class"]."<br>";
844 //return $this->call_node[$cmdNode]["class"];
845 return ($class = $this->checkLPSettingsForward($a_gui_class, $cmdNode))
846 ? $class
847 : "";
848 } else {
849 $path = $this->getPathNew($this->current_node, $cmdNode);
850 //var_dump($path);
851 //echo " - Next Node: ".$path[1];
852 $this->readCidInfo($this->getCurrentCidOfNode($path[1]));
853 //echo ":".$this->cid_class[$this->getCurrentCidOfNode($path[1])].":".$this->getCurrentCidOfNode($path[1]).":";
854 return $this->cid_class[$this->getCurrentCidOfNode($path[1])];
855 }
856 }
857 }
checkLPSettingsForward($a_gui_obj, $a_cmd_node)
getPathNew($a_source_node, $a_target_node)
Get path in call structure.
getCurrentCidOfNode($a_node)
Get last cid of node id.

References $path, 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

Searchs a node for a given class ($a_class) "near" the 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 wether 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 methode searchs for the given class along the path from the current node to the root class of the call structure.

Parameters
stringid of starting node for the search
stringclass that should be searched
Returns
int id of target node that has been found

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

318 {
319 $class = strtolower($a_class);
320 $this->readClassInfo($class);
321
322 if ($a_par_node === 0 || $a_par_node == "") {
323 return array("node_id" => $this->getCidForClass($class),
324 "base_class" => "");
325 }
326
327 $this->readNodeInfo($a_par_node);
328
329 $node_cid = $this->getCurrentCidOfNode($a_par_node);
330
331 // target class is class of current node id
332 if ($class == $this->getClassForCid($node_cid)) {
333 return array("node_id" => $a_par_node,
334 "base_class" => "");
335 }
336
337 // target class is child of current node id
338 if (isset($this->calls[$this->getClassForCid($node_cid)]) &&
339 is_array($this->calls[$this->getClassForCid($node_cid)]) &&
340 in_array($a_class, $this->calls[$this->getClassForCid($node_cid)])) {
341 return array("node_id" => $a_par_node . ":" . $this->getCidForClass($class),
342 "base_class" => "");
343 }
344
345 // target class is sibling
346 $par_cid = $this->getParentCidOfNode($a_par_node);
347 if ($par_cid != "") {
348 if (is_array($this->calls[$this->getClassForCid($par_cid)]) &&
349 in_array($a_class, $this->calls[$this->getClassForCid($par_cid)])) {
350 return array("node_id" =>
351 $this->removeLastCid($a_par_node) . ":" . $this->getCidForClass($class),
352 "base_class" => "");
353 }
354 }
355
356 // target class is parent
357 $temp_node = $this->removeLastCid($a_par_node);
358 while ($temp_node != "") {
359 $temp_cid = $this->getCurrentCidOfNode($temp_node);
360 if ($this->getClassForCid($temp_cid) == $a_class) {
361 return array("node_id" => $temp_node,
362 "base_class" => "");
363 }
364 $temp_node = $this->removeLastCid($temp_node);
365 }
366
367 // target class is another base class
368 $n_class = "";
369 if ($a_class != "") {
370 $module_class = ilCachedCtrl::getInstance();
371 $mc_rec = $module_class->lookupModuleClass($class);
372 $n_class = $mc_rec['lower_class'];
373 // global $ilDB;
374//
375 // get class information
376 // $mc_set = $ilDB->query("SELECT * FROM module_class WHERE LOWER(class) = ".
377 // $ilDB->quote($class, "text"));
378 // $mc_rec = $ilDB->fetchAssoc($mc_set);
379 // $n_class = strtolower($mc_rec["class"]);
380
381 if ($n_class == "") {
382 $mc_rec = $module_class->lookupServiceClass($class);
383 $n_class = $mc_rec['lower_class'];
384
385 // $mc_set = $ilDB->query("SELECT * FROM service_class WHERE LOWER(class) = ".
386// $ilDB->quote($class, "text"));
387// $mc_rec = $ilDB->fetchAssoc($mc_set);
388// $n_class = strtolower($mc_rec["class"]);
389 }
390
391 if ($n_class != "") {
392 $this->getCallStructure($n_class);
393 return array("node_id" => $this->getCidForClass($n_class),
394 "base_class" => $class);
395 }
396 }
397
398 if ($a_check) {
399 return false;
400 }
401
402 // Please do NOT change these lines.
403 // Developers must be aware, if they use classes unknown to the controller
404 // otherwise certain problem will be extremely hard to track down...
405
406 // echo "ERROR: Can't find target class $a_class for node $a_par_node ".
407 // "(".$this->cid_class[$this->getParentCidOfNode($a_par_node)].").<br>";
408 error_log("ERROR: Can't find target class $a_class for node $a_par_node " .
409 "(" . $this->cid_class[$this->getParentCidOfNode($a_par_node)] . ")");
410
411 if (DEVMODE == 1) {
412 // ilUtil::printBacktrace();
413 }
414
415 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
416 throw new ilCtrlException("ERROR: Can't find target class $a_class for node $a_par_node " .
417 "(" . $this->cid_class[$this->getParentCidOfNode($a_par_node)] . ").");
418 }
getParentCidOfNode($a_node)
Get last but one cid of node id.
removeLastCid($a_node)
Remove last cid of node.
readNodeInfo($a_node)
Read info of node.

References Monolog\Handler\error_log(), 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 1645 of file class.ilCtrl.php.

1646 {
1647 $par_arr = $this->getParameterArrayByClass(strtolower(get_class($a_gui_obj)), $a_cmd);
1648
1649 return $par_arr;
1650 }
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 1659 of file class.ilCtrl.php.

1660 {
1661 if ($a_class == "") {
1662 return array();
1663 }
1664
1665 if (!is_array($a_class)) {
1666 $a_class = array($a_class);
1667 }
1668
1669 $nr = $this->current_node;
1670 foreach ($a_class as $class) {
1671 $class = strtolower($class);
1672 $nr = $this->getNodeIdForTargetClass($nr, $class);
1673 if ($nr["base_class"] != "") {
1674 $new_baseclass = $nr["base_class"];
1675 }
1676 $nr = $nr["node_id"];
1677 $target_class = $class;
1678 }
1679
1680 $path = $this->getPathNew(1, $nr);
1681 $params = array();
1682
1683 // append parameters of parent classes
1684 foreach ($path as $node_id) {
1685 $class = ($node_id == "")
1686 ? strtolower($_GET["baseClass"])
1687 : $this->getClassForCid($this->getCurrentCidOfNode($node_id));
1688 if (isset($this->save_parameter[$class]) && is_array($this->save_parameter[$class])) {
1689 foreach ($this->save_parameter[$class] as $par) {
1690 if (isset($_GET[$par])) {
1691 $params[$par] = $_GET[$par];
1692 } elseif (isset($_POST[$par])) {
1694 }
1695 }
1696 }
1697
1698 if (isset($this->parameter[$class]) && is_array($this->parameter[$class])) {
1699 foreach ($this->parameter[$class] as $par => $value) {
1700 $params[$par] = $value;
1701 }
1702 }
1703 }
1704
1705 if ($a_cmd != "") {
1706 $params["cmd"] = $a_cmd;
1707 }
1708
1709 $params["cmdClass"] = $target_class;
1710 $params["cmdNode"] = $nr;
1711 if ($new_baseclass == "") {
1712 $params["baseClass"] = $_GET["baseClass"];
1713 } else {
1714 $params["baseClass"] = $new_baseclass;
1715 }
1716
1717 return $params;
1718 }
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
$params
Definition: disable.php:11

References $_GET, $_POST, $params, $path, 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 last but one cid of node id.

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

1850 {
1851 $n_arr = explode(":", $a_node);
1852 return $n_arr[count($n_arr) - 2];
1853 }

Referenced by getNodeIdForTargetClass().

+ Here is the caller graph for this function:

◆ getParentReturn()

ilCtrl::getParentReturn (   $a_gui_obj)

Get return script url.

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

1568 {
1569 return $this->getParentReturnByClass(strtolower(get_class($a_gui_obj)));
1570 }
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)

Get return script url.

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

1577 {
1578 $a_class = strtolower($a_class);
1579 $ret_class = $this->searchReturnClass($a_class);
1580 //echo ":$ret_class:";
1581 if ($ret_class) {
1582 //echo ":".$this->return[$ret_class].":";
1583 return $this->return[$ret_class];
1584 }
1585 }
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 906 of file class.ilCtrl.php.

907 {
908 //if ($this->getCmdClass() == "ilmailfoldergui") echo "-".$a_source_node."-".$a_target_node."-";
909 //echo "-".$a_source_node."-".$a_target_node."-";
910 //echo "<br>:::$a_source_node:::";
911 if ($a_source_node == "1") {
912 $a_source_node = "";
913 }
914 if (substr($a_target_node, 0, strlen($a_source_node)) != $a_source_node) {
915 $failure = "ERROR: Path not found. Source:" . $a_source_node .
916 ", Target:" . $a_target_node;
917 if (DEVMODE == 1) {
918 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
919 throw new ilCtrlException($failure);
920 }
921 $GLOBALS['ilLog']->write(__METHOD__ . ' ' . $failure);
922 $this->redirectToURL('./ilias.php?baseClass=ilRepositoryGUI');
923 }
924 //echo "<br>:::$a_source_node:::";
925 $temp_node = $a_source_node;
926
927 $path = array();
928 if ($a_source_node != "") {
929 $path = array($a_source_node);
930 }
931
932 $diffstart = ($a_source_node == "")
933 ? 0
934 : strlen($a_source_node) + 1;
935 $diff = substr($a_target_node, $diffstart);
936 //echo "=$diff=$diffstart=";
937 $diff_arr = explode(":", $diff);
938 foreach ($diff_arr as $cid) {
939 if ($temp_node != "") {
940 $temp_node.= ":";
941 }
942 $temp_node.= $cid;
943 $path[] = $temp_node;
944 }
945 //if ($this->getCmdClass() == "ilmailfoldergui") var_dump($path);
946 //var_dump($path);
947 return $path;
948 }
$failure
redirectToURL($a_script)

References $failure, $GLOBALS, $path, 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 1559 of file class.ilCtrl.php.

1560 {
1561 return $_GET["redirectSource"];
1562 }

References $_GET.

◆ getRequestToken()

ilCtrl::getRequestToken ( )

Get request token.

Returns
string request token for user and session

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

1188 {
1189 global $DIC;
1190
1191 $ilUser = $DIC["ilUser"];
1192 $ilDB = $DIC->database();
1193
1194
1195 if ($this->rtoken != "") {
1196 return $this->rtoken;
1197 } else {
1198 if (is_object($ilDB) && is_object($ilUser) && $ilUser->getId() > 0 &&
1199 $ilUser->getId() != ANONYMOUS_USER_ID) {
1200 $res = $ilDB->query("SELECT token FROM il_request_token WHERE user_id = " .
1201 $ilDB->quote($ilUser->getId(), "integer") .
1202 " AND session_id = " . $ilDB->quote(session_id(), "text"));
1203 $rec = $ilDB->fetchAssoc($res);
1204 //echo session_id();
1205 if ($rec["token"] != "") {
1206 $this->rtoken = $rec["token"];
1207 return $rec["token"];
1208 }
1209 //echo "new rtoken, new entry for :".$ilUser->getId().":".session_id().":"; exit;
1210 $random = new \ilRandom();
1211 $this->rtoken = md5(uniqid($random->int(), true));
1212
1213 // delete entries older than one and a half days
1214 if ($random->int(1, 200) == 2) {
1215 $dt = new ilDateTime(time(), IL_CAL_UNIX);
1216 $dt->increment(IL_CAL_DAY, -1);
1217 $dt->increment(IL_CAL_HOUR, -12);
1218 $dq = "DELETE FROM il_request_token WHERE " .
1219 " stamp < " . $ilDB->quote($dt->get(IL_CAL_DATETIME), "timestamp");
1220 $ilDB->manipulate($dq);
1221 }
1222
1223 // IMPORTANT: Please do NOT try to move this implementation to a
1224 // session basis. This will fail due to framesets that are used
1225 // occasionally in ILIAS, e.g. in the chat, where multiple
1226 // forms are loaded in different frames.
1227 $ilDB->manipulate("INSERT INTO il_request_token (user_id, token, stamp, session_id) VALUES " .
1228 "(" .
1229 $ilDB->quote($ilUser->getId(), "integer") . "," .
1230 $ilDB->quote($this->rtoken, "text") . "," .
1231 $ilDB->now() . "," .
1232 $ilDB->quote(session_id(), "text") . ")");
1233 return $this->rtoken;
1234 }
1235 //$this->rtoken = md5(uniqid(rand(), true));
1236 }
1237 return "";
1238 }
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.

Parameters

return

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

1594 {
1595 if (is_object($a_class)) {
1596 $class = strtolower(get_class($a_class));
1597 } else {
1598 $class = strtolower($a_class);
1599 }
1600 return $this->searchReturnClass($class);
1601 }

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

504 {
505 return $this->tab;
506 }

References $tab.

◆ getTargetScript()

ilCtrl::getTargetScript ( )

Get target script name.

Returns
string target script name

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

967 {
969 }

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.

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

1627 {
1628 // note: $a_class may be an array!
1629 //$a_class = strtolower($a_class);
1630
1631 $params = $this->getParameterArrayByClass($a_class, $a_cmd);
1632
1633 foreach ($params as $par => $value) {
1634 if (strlen((string) $value)) {
1635 $a_str = ilUtil::appendUrlParameterString($a_str, $par . "=" . $value, $xml_style);
1636 }
1637 }
1638
1639 return $a_str;
1640 }

References $params, 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:

◆ init()

ilCtrl::init ( )

initialisation

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

74 {
75 $this->transit = array();
76 $this->forward = array(); // forward array
77 $this->forwards = array(); // forward array
78 $this->parent = array(); // parent array (reverse forward)
79 $this->save_parameter = array(); // save parameter array
80 $this->parameter = array(); // save parameter array
81 $this->return = array(); // return commmands
82 $this->location = array();
83 $this->tab = array();
84 $this->current_node = 0;
85 $this->module_dir = "";
86 $this->service_dir = "";
87 $this->call_node = array();
88 $this->root_class = "";
89 }
forwards($a_from_class, $a_to_class)
Stores which classes forwards commands to which other classes.

References forwards().

Referenced by __construct(), and initBaseClass().

+ 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 setTargetScript() and callBaseClass() after that.

Parameters
stringbase class name

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

981 {
982 $_GET["baseClass"] = $a_base_class;
983 $_GET["cmd"] = "";
984 $_GET["cmdClass"] = "";
985 $_GET["cmdNode"] = "";
986 $this->init();
987 }

References $_GET, and init().

+ Here is the call graph for this function:

◆ insertCtrlCalls()

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

Insert ctrl calls record.

Parameters

return

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

1880 {
1881 global $DIC;
1882
1883 $ilDB = $DIC->database();
1884 ;
1885
1886 $a_parent = strtolower($a_parent);
1887 $a_child = strtolower($a_child);
1888 $a_comp_prefix = strtolower($a_comp_prefix);
1889
1890 $set = $ilDB->query(
1891 "SELECT * FROM ctrl_calls WHERE " .
1892 " parent = " . $ilDB->quote($a_parent, "text") . " AND " .
1893 " child = " . $ilDB->quote($a_child, "text") . " AND " .
1894 " comp_prefix = " . $ilDB->quote($a_comp_prefix, "text")
1895 );
1896 if ($rec = $ilDB->fetchAssoc($set)) {
1897 return;
1898 }
1899 $ilDB->manipulate("INSERT INTO ctrl_calls " .
1900 "(parent, child, comp_prefix) VALUES (" .
1901 $ilDB->quote($a_parent, "text") . "," .
1902 $ilDB->quote($a_child, "text") . "," .
1903 $ilDB->quote($a_comp_prefix, "text") .
1904 ")");
1905 }

References $DIC, and $ilDB.

◆ isAsynch()

ilCtrl::isAsynch ( )

Is current command an asynchronous command?

Returns
boolean asynchronous t/f

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

1424 {
1425 if (isset($_GET["cmdMode"]) && $_GET["cmdMode"] == "asynch") {
1426 return true;
1427 } else {
1428 return false;
1429 }
1430 }

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

866 {
867 $a_class_name = strtolower($a_class_name);
868
869 $cached_ctrl = ilCachedCtrl::getInstance();
870 $class_rec = $cached_ctrl->lookupClassFile($a_class_name);
871
872 //$class_set = $ilDB->query("SELECT * FROM ctrl_classfile WHERE class = ".
873 // $ilDB->quote($a_class_name, "text"));
874 //$class_rec = $ilDB->fetchAssoc($class_set);
875
876 if ($class_rec["plugin_path"] != "") {
877 return $class_rec["plugin_path"] . "/" . $class_rec["filename"];
878 } else {
879 return $class_rec["filename"];
880 }
881 }

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 
)

stores often used common call structures (called from db_update script!!!)

Reads call structure from db

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

569 {
570 global $DIC;
571
572 $ilDB = $DIC->database();
573
574 $a_class = strtolower($a_class);
575
576 $a_nr++;
577
578 // determine call node structure
579 $this->call_node[$a_nr] = array("class" => $a_class, "parent" => $a_parent);
580
581 //echo "<br>nr:$a_nr:class:$a_class:parent:$a_parent:";
582 $call_set = $ilDB->query("SELECT * FROM ctrl_calls WHERE parent = " .
583 $ilDB->quote(strtolower($a_class), "text") .
584 " ORDER BY child", array("text"));
585 $a_parent = $a_nr;
586 while ($call_rec = $ilDB->fetchAssoc($call_set)) {
587 $a_nr = $this->readCallStructure($call_rec["child"], $a_nr, $a_parent);
588 $forw[] = $call_rec["child"];
589 }
590
591 // determin forward and parent array
592 $this->forwards($a_class, $forw);
593 //echo "<br>forwards:".$a_class."<br>"; var_dump($forw);
594
595 // determine root class
596 $this->root_class = $a_class;
597 return $a_nr;
598 }
readCallStructure($a_class, $a_nr=0, $a_parent=0)
stores often used common call structures (called from db_update script!!!)

References $DIC, $ilDB, forwards(), 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

Read information of class per cid.

Returns
Parameters
object$a_cidcid

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

1764 {
1765 if (isset($this->info_read_cid[$a_cid])) {
1766 return;
1767 }
1768
1769 $cached_ctrl = ilCachedCtrl::getInstance();
1770 $rec = $cached_ctrl->lookupCid($a_cid);
1771
1772 if ($rec) {
1773 $this->cid_class[$a_cid] = $rec["class"];
1774 $this->class_cid[$rec["class"]] = $a_cid;
1775
1776 $calls = $cached_ctrl->lookupCall($rec["class"]);
1777
1778 foreach ($calls as $rec2) {
1779 if (!isset($this->calls[$rec["class"]]) || !is_array($this->calls[$rec["class"]]) || !in_array($rec2["child"], $this->calls[$rec["class"]])) {
1780 if ($rec2["child"] != "") {
1781 $this->calls[$rec["class"]][] = $rec2["child"];
1782 }
1783 }
1784 }
1785 $this->info_read_class[$rec["class"]] = true;
1786 }
1787
1788 $this->info_read_cid[$a_cid] = true;
1789 }

References $calls, and ilCachedCtrl\getInstance().

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

Read info of class.

Parameters
object$a_classclass name

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

1810 {
1811 $a_class = strtolower($a_class);
1812 if (isset($this->info_read_class[$a_class])) {
1813 return;
1814 }
1815
1816 $cached_ctrl = ilCachedCtrl::getInstance();
1817 $rec = $cached_ctrl->lookupClassFile($a_class);
1818
1819
1820 // $set = $ilDB->query("SELECT * FROM ctrl_classfile ".
1821 // " WHERE class = ".$ilDB->quote($a_class, "text")
1822 // );
1823 // if ($rec = $ilDB->fetchAssoc($set))
1824 if ($rec) {
1825 $this->cid_class[$rec["cid"]] = $a_class;
1826 $this->class_cid[$a_class] = $rec["cid"];
1827 }
1828
1829 // $set = $ilDB->query("SELECT * FROM ctrl_calls ".
1830 // " WHERE parent = ".$ilDB->quote($a_class, "text")
1831 // );
1832 $recs = $cached_ctrl->lookupCall($a_class);
1833 // while ($rec = $ilDB->fetchAssoc($set))
1834 foreach ($recs as $rec) {
1835 if (!isset($this->calls[$a_class]) || !is_array($this->calls[$a_class]) || !in_array($rec["child"], $this->calls[$a_class])) {
1836 if ($rec["child"] != "") {
1837 $this->calls[$a_class][] = $rec["child"];
1838 }
1839 }
1840 }
1841
1842 $this->info_read_class[$a_class] = true;
1843 $this->info_read_cid[$this->class_cid[$a_class]] = true;
1844 }

References ilCachedCtrl\getInstance().

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

Read info of node.

Parameters
object$a_classclass name

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

1797 {
1798 $n_arr = explode(":", $a_node);
1799 foreach ($n_arr as $cid) {
1800 $this->readCidInfo($cid);
1801 }
1802 }

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

1328 {
1329 $script = $this->getLinkTargetByClass(
1330 strtolower(get_class($a_gui_obj)),
1331 $a_cmd,
1332 "",
1333 $a_asynch,
1334 false
1335 );
1336 if ($a_anchor != "") {
1337 $script = $script . "#" . $a_anchor;
1338 }
1339 $this->redirectToURL($script);
1340 }

References getLinkTargetByClass(), and redirectToURL().

Referenced by ilChatroomBanGUI\delete(), ilChatroomAdminViewGUI\executeDefault(), ilChatroomCreateGUI\save(), ilChatroomAdminViewGUI\saveClientSettings(), 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 1409 of file class.ilCtrl.php.

1410 {
1411 $script = $this->getLinkTargetByClass($a_class, $a_cmd, "", $a_asynch, false);
1412 if ($a_anchor != "") {
1413 $script = $script . "#" . $a_anchor;
1414 }
1415 $this->redirectToURL($script);
1416 }

References getLinkTargetByClass(), and redirectToURL().

Referenced by checkLPSettingsForward(), ilChatroomGUIHandler\redirectIfNoPermission(), 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 1346 of file class.ilCtrl.php.

1347 {
1348 global $DIC;
1349
1350 $ilPluginAdmin = null;
1351 if (isset($DIC["ilPluginAdmin"])) {
1352 $ilPluginAdmin = $DIC["ilPluginAdmin"];
1353 }
1354
1355 if (!is_int(strpos($a_script, "://"))) {
1356 if (substr($a_script, 0, 1) != "/" && defined("ILIAS_HTTP_PATH")) {
1357 if (is_int(strpos($_SERVER["PHP_SELF"], "/setup/"))) {
1358 $a_script = "setup/" . $a_script;
1359 }
1360 $a_script = ILIAS_HTTP_PATH . "/" . $a_script;
1361 }
1362 }
1363
1364 // include the user interface hook
1365 if (is_object($ilPluginAdmin)) {
1366 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
1367 foreach ($pl_names as $pl) {
1368 $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
1369 $gui_class = $ui_plugin->getUIClassInstance();
1370 $resp = $gui_class->getHTML("Services/Utilities", "redirect", array( "html" => $a_script ));
1371 if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
1372 $a_script = $gui_class->modifyHTML($a_script, $resp);
1373 }
1374 }
1375 }
1376
1377 // Manually trigger to write and close the session. This has the advantage that if an exception is thrown
1378 // during the writing of the session (ILIAS writes the session into the database by default) we get an exception
1379 // if the session_write_close() is triggered by exit() then the exception will be dismissed but the session
1380 // is never written, which is a nightmare to develop with.
1381 session_write_close();
1382
1383 global $DIC;
1384 $http = $DIC->http();
1385 switch ($http->request()->getHeaderLine('Accept')) {
1386 case 'application/json':
1388 'success' => true,
1389 'message' => 'Called redirect after async fileupload request',
1390 "redirect_url" => $a_script,
1391 ]));
1392 $http->saveResponse($http->response()->withBody($stream));
1393 break;
1394 default:
1395 $http->saveResponse($http->response()->withAddedHeader("Location", $a_script));
1396 break;
1397 }
1398 $http->sendResponse();
1399 exit;
1400 }
static ofString($string)
Creates a new stream with an initial value.
Definition: Streams.php:29
const IL_COMP_SERVICE
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
$stream
PHP stream implementation.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
$http
Definition: raiseError.php:7

References $_SERVER, $DIC, $http, GuzzleHttp\Psr7\$stream, defined, exit, ilPluginAdmin\getPluginObject(), IL_COMP_SERVICE, 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 last cid of node.

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

1859 {
1860 $lpos = strrpos($a_node, ":");
1861 return substr($a_node, 0, $lpos);
1862 }

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

1535 {
1536 $script = $this->getParentReturn($a_gui_obj);
1537
1539 $script,
1540 "redirectSource=" . strtolower(get_class($a_gui_obj))
1541 );
1543 $script,
1544 "cmdMode=" . $_GET["cmdMode"]
1545 );
1546 if ($a_anchor != "") {
1547 $script = $script . "#" . $a_anchor;
1548 }
1549
1550 $this->redirectToURL($script);
1551 }
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 (which is set by the setTargetScript() method) 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 655 of file class.ilCtrl.php.

656 {
657 if (is_object($a_obj)) {
658 $this->saveParameterByClass(get_class($a_obj), $a_parameter);
659 }
660 }
saveParameterByClass($a_class, $a_parameter)
Save parameter for a class.

References saveParameterByClass().

+ Here is the call graph for this function:

◆ saveParameterByClass()

ilCtrl::saveParameterByClass (   $a_class,
  $a_parameter 
)

Save parameter for a class.

Parameters
stringclass name
stringparameter name

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

669 {
670 if (is_array($a_parameter)) {
671 foreach ($a_parameter as $parameter) {
672 $this->save_parameter[strtolower($a_class)][] = $parameter;
673 }
674 } else {
675 $this->save_parameter[strtolower($a_class)][] = $a_parameter;
676 }
677 }

Referenced by saveParameter().

+ Here is the caller graph for this function:

◆ searchReturnClass()

ilCtrl::searchReturnClass (   $a_class)
private

Determine current return class.

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

1608 {
1609 $a_class = strtolower($a_class);
1610
1611 $node = $this->getNodeIdForTargetClass($this->current_node, $a_class);
1612 $node = $node["node_id"];
1613 $n_arr = explode(":", $node);
1614 for ($i = count($n_arr)-2; $i>=0; $i--) {
1615 if ($this->return[$this->getClassForCid($n_arr[$i])] != "") {
1616 return $this->getClassForCid($n_arr[$i]);
1617 }
1618 }
1619
1620 return false;
1621 }
$i
Definition: disco.tpl.php:19

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

1064 {
1065 $_GET["cmd"] = $a_cmd;
1066 }

References $_GET.

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

1079 {
1080 $a_cmd_class = strtolower($a_cmd_class);
1081 $nr = $this->getNodeIdForTargetClass($this->current_node, $a_cmd_class);
1082 $nr = $nr["node_id"];
1083 $_GET["cmdClass"] = $a_cmd_class;
1084 $_GET["cmdNode"] = $nr;
1085 }

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

252 {
253 $this->context_obj_id = $a_obj_id;
254 $this->context_obj_type = $a_obj_type;
255 $this->context_sub_obj_id = $a_sub_obj_id;
256 $this->context_sub_obj_type = $a_sub_obj_type;
257 }

◆ 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 (which is set by the setTargetScript() method) 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 702 of file class.ilCtrl.php.

703 {
704 $this->parameter[strtolower(get_class($a_obj))][$a_parameter] = $a_value;
705 }

Referenced by ilWorkflowEngineDefinitionsTableGUI\fillRow(), ilObjWorkflowEngineGUI\initLocator(), 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 715 of file class.ilCtrl.php.

716 {
717 $this->parameter[strtolower($a_class)][$a_parameter] = $a_value;
718 }

Referenced by checkLPSettingsForward(), ilHistoryTableGUI\fillRow(), 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 1509 of file class.ilCtrl.php.

1510 {
1511 $script = $this->getTargetScript();
1512 $script = $this->getUrlParameters(strtolower(get_class($a_gui_obj)), $script, $a_cmd);
1513 //echo "<br>setReturn:".get_class($a_gui_obj).":".$script.":<br>";
1514 $this->return[strtolower(get_class($a_gui_obj))] = $script;
1515 }

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

1521 {
1522 // may not be an array!
1523 $a_class = strtolower($a_class);
1524
1525 $script = $this->getTargetScript();
1526 $script = $this->getUrlParameters($a_class, $script, $a_cmd);
1527 //echo "<br>setReturn:".get_class($a_gui_obj).":".$script.":<br>";
1528 $this->return[strtolower($a_class)] = $script;
1529 }

References getTargetScript(), and getUrlParameters().

+ Here is the call graph for this function:

◆ setTargetScript()

ilCtrl::setTargetScript (   $a_target_script)

set target script name

Parameters
string$a_target_scripttarget script name

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

956 {
957 $this->target_script = $a_target_script;
958 }

◆ verifyToken()

ilCtrl::verifyToken ( )
private

Verify Token.

Returns
boolean valid t/f

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

1246 {
1247 global $DIC;
1248
1249 $ilUser = $DIC["ilUser"];
1250
1251 $ilDB = $DIC->database();
1252 ;
1253
1254 if (is_object($ilUser) && is_object($ilDB) && $ilUser->getId() > 0 &&
1255 $ilUser->getId() != ANONYMOUS_USER_ID) {
1256 if ($_GET["rtoken"] == "") {
1257 #echo "ilCtrl::No Request Token Given!"; // for debugging, maybe changed later
1258 return false;
1259 }
1260
1261 $set = $ilDB->query("SELECT * FROM il_request_token WHERE " .
1262 " user_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " .
1263 " token = " . $ilDB->quote($_GET[self::IL_RTOKEN_NAME]), "text");
1264 if ($ilDB->numRows($set) > 0) {
1265 // remove used token
1266 /*
1267 $ilDB->query("DELETE FROM il_request_token WHERE ".
1268 " user_id = ".$ilDB->quote($ilUser->getId())." AND ".
1269 " token = ".$ilDB->quote($_GET[self::IL_RTOKEN_NAME]));
1270 */
1271
1272 // remove tokens from older sessions
1273 // if we do this immediately, working with multiple windows does not work:
1274 // - window one: open form (with token a)
1275 // - window two: open form (with token b)
1276 // - submit window one: a is verified, but b must not be deleted immediately, otherwise
1277 // - window two: submit results in invalid token
1278 // see also bug #13551
1279 $dt = new ilDateTime(time(), IL_CAL_UNIX);
1280 $dt->increment(IL_CAL_DAY, -1);
1281 $dt->increment(IL_CAL_HOUR, -12);
1282 $ilDB->manipulate("DELETE FROM il_request_token WHERE " .
1283 " user_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " .
1284 " session_id != " . $ilDB->quote(session_id(), "text") . " AND " .
1285 " stamp < " . $ilDB->quote($dt->get(IL_CAL_DATETIME), "timestamp"));
1286 return true;
1287 } else {
1288 return false;
1289 }
1290
1291 if ($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]] != "") {
1292 // remove used token
1293 unset($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]]);
1294
1295 // remove old tokens
1296 if (count($_SESSION["rtokens"]) > 100) {
1297 $to_remove = array();
1298 $sec = 7200; // two hours
1299
1300 foreach ($_SESSION["rtokens"] as $tok => $time) {
1301 if (time() - $time > $sec) {
1302 $to_remove[] = $tok;
1303 }
1304 }
1305 foreach ($to_remove as $tok) {
1306 unset($_SESSION["rtokens"][$tok]);
1307 }
1308 }
1309
1310 return true;
1311 }
1312 return false;
1313 } else {
1314 return true; // do not verify, if user or db object is missing
1315 }
1316
1317 return false;
1318 }
$_SESSION["AccountId"]
$time
Definition: cron.php:21

References $_GET, $_SESSION, $DIC, $ilDB, $ilUser, $time, 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()

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

Referenced by getCallHistory().

◆ $calls

ilCtrl::$calls = array()

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

Referenced by readCidInfo().

◆ $db

ilCtrl::$db
protected

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

◆ $debug

ilCtrl::$debug = array()

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

Referenced by getDebug().

◆ $forward

ilCtrl::$forward

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

◆ $parent

ilCtrl::$parent

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

◆ $plugin_admin

ilCtrl::$plugin_admin
protected

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

◆ $return

ilCtrl::$return

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

◆ $rtoken

ilCtrl::$rtoken = false

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

Referenced by getRequestToken().

◆ $save_parameter

ilCtrl::$save_parameter

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

◆ $target_script

ilCtrl::$target_script

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

Referenced by getTargetScript().

◆ IL_RTOKEN_NAME

const ilCtrl::IL_RTOKEN_NAME = 'rtoken'

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


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