ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCtrl Class Reference

This class provides processing control methods. More...

+ Collaboration diagram for ilCtrl:

Public Member Functions

 ilCtrl ()
 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...
 
 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...
 
 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...
 

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)
 

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.

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

483 {
484 $this->location[] = array("title" => $a_title,
485 "link" => $a_link, "target" => $a_target, "ref_id" => $a_ref_id);
486 }

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

507 {
508 $a_class = strtolower($a_class);
509
510 $this->tab[] = array("lang_var" => $a_lang_var,
511 "link" => $a_link, "cmd" => $a_cmd, "class" => $a_class);
512 }

◆ appendRequestTokenParameterString()

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

Append request token as url parameter.

Parameters
stringurl
booleanxml style

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

1221 {
1222 return ilUtil::appendUrlParameterString($a_url, self::IL_RTOKEN_NAME.'='.$this->getRequestToken(),
1223 $xml_style);
1224 }
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 91 of file class.ilCtrl.php.

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

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

+ Here is the call graph for this function:

◆ checkLPSettingsForward()

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

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

774 {
775 global $objDefinition;
776
777 // forward to learning progress settings if possible and accessible
778 if($_GET["gotolp"] &&
779 $a_gui_obj)
780 {
781 $ref_id = $_GET["ref_id"];
782 if(!$ref_id)
783 {
784 $ref_id = $_REQUEST["ref_id"];
785 }
786
787 $gui_class = get_class($a_gui_obj);
788
789 if($gui_class == "ilSAHSEditGUI")
790 {
791 // #1625 - because of scorm "sub-types" this is all very special
792 include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
795 {
796 case "scorm2004":
797 $class = "ilObjSCORM2004LearningModuleGUI";
798 break;
799
800 case "scorm":
801 $class = "ilObjSCORMLearningModuleGUI";
802 break;
803
804 case "aicc":
805 $class = "ilObjAICCLearningModuleGUI";
806 break;
807
808 case "hacp":
809 $class = "ilObjHACPLearningModuleGUI";
810 break;
811 }
812 if($GLOBALS["ilAccess"]->checkAccess("edit_learning_progress", "", $ref_id))
813 {
814 $this->redirectByClass(array($gui_class, $class, "illearningprogressgui", "illplistofsettingsgui"), "");
815 }
816 }
817 // special case: cannot use any presentation GUIs
818 else if($gui_class == "ilLMPresentationGUI")
819 {
820 $this->setParameterByClass("ilObjLearningModuleGUI", "gotolp", 1);
821 $this->redirectByClass(array("ilLMEditorGUI", "ilObjLearningModuleGUI"), "");
822 }
823
824 include_once "Services/Object/classes/class.ilObjectLP.php";
825 $type = ilObject::_lookupType($ref_id, true);
826 $class = "ilObj".$objDefinition->getClassName($type)."GUI";
827
828 if($gui_class == $class &&
830 $GLOBALS["ilAccess"]->checkAccess("edit_learning_progress", "", $ref_id))
831 {
832 // add path to repository object gui if missing from cmdNode
833 if(!$a_cmd_node)
834 {
835 $repo_node = $this->getNodeIdForTargetClass(null, "ilrepositorygui");
836 $obj_node = $this->getNodeIdForTargetClass($repo_node["node_id"], $gui_class);
837 $a_cmd_node = $obj_node["node_id"];
838 }
839 // find path to lp settings
840 $lp_node = $this->getNodeIdForTargetClass($a_cmd_node, "illearningprogressgui");
841 $lp_settings_node = $this->getNodeIdForTargetClass($lp_node["node_id"], "illplistofsettingsgui");
842 $_GET["cmdNode"] = $lp_settings_node["node_id"];
843 $_GET["cmdClass"] = "ilLPListOfSettingsGUI";
844 $_GET["cmd"] = "";
845 return "illearningprogressgui";
846 }
847 }
848 }
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.
_lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
static isSupportedObjectType($a_type)
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupType($a_id, $a_reference=false)
lookup object type
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
$ref_id
Definition: sahs_server.php:39
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_GET, $_REQUEST, $GLOBALS, $ref_id, 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 438 of file class.ilCtrl.php.

439 {
440 if (!is_array($a_class))
441 {
442 $a_class = array($a_class);
443 }
444
445 $nr = $this->current_node;
446 foreach ($a_class as $class)
447 {
448 $class = strtolower($class);
449
450 if (!$this->getCidForClass($class, true))
451 {
452 return false;
453 }
454
455 $nr = $this->getNodeIdForTargetClass($nr, $class, true);
456 $nr = $nr["node_id"];
457 if ($nr === false)
458 {
459 return false;
460 }
461 }
462 return true;
463 }
getCidForClass($a_class, $a_check=false)
Get Cid for Class.

References getCidForClass(), and getNodeIdForTargetClass().

+ Here is the call graph for this function:

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

758 {
759 $this->clearParametersByClass(strtolower(get_class($a_obj)));
760 }
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 768 of file class.ilCtrl.php.

769 {
770 $this->parameter[strtolower($a_class)] = array();
771 }

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

50 {
51 $this->debug[] = $str;
52 }
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 170 of file class.ilCtrl.php.

171 {
172 $class = strtolower(get_class($a_gui_object));
173//echo "<br>class:".$class.":";
174 $nr = $this->getNodeIdForTargetClass($this->current_node, $class);
175 $nr = $nr["node_id"];
176 if ($nr != "")
177 {
178 $current_node = $this->current_node;
179
180 $this->current_node = $nr;
181
182 // always populate the call history
183 // it will only be displayed in DEVMODE but is needed for UI plugins, too
184 $this->call_hist[] = array("class" => get_class($a_gui_object),
185 "mode" => "execComm", "cmd" => $this->getCmd());
186
187//echo "<br>class:".get_class($a_gui_object).":";
188 $html = $a_gui_object->executeCommand();
189
190 // reset current node
191 $this->current_node = $current_node;
192
193 return $html;
194
195 }
196
197 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
198 throw new ilCtrlException("ERROR: Can't forward to class $class.");
199 }
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(), and ilObjectPermissionStatusGUI\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 622 of file class.ilCtrl.php.

623 {
624 $a_from_class = strtolower($a_from_class);
625
626 if (is_array($a_to_class))
627 {
628 foreach($a_to_class as $to_class)
629 {
630 if ($a_from_class != "" && $to_class != "")
631 {
632 if (!is_array($this->forward[$a_from_class]) || !in_array(strtolower($to_class), $this->forward[$a_from_class]))
633 {
634 $this->forward[$a_from_class][] = strtolower($to_class);
635 }
636 if (!is_array($this->parent[strtolower($to_class)]) || !in_array($a_from_class, $this->parent[strtolower($to_class)]))
637 {
638 $this->parent[strtolower($to_class)][] = $a_from_class;
639 }
640 }
641 }
642 }
643 else
644 {
645 $to_class = $a_to_class;
646 if ($a_from_class != "" && $to_class != "")
647 {
648 if (!is_array($this->forward[$a_from_class]) || !in_array(strtolower($to_class), $this->forward[$a_from_class]))
649 {
650 $this->forward[$a_from_class][] = strtolower($to_class);
651 }
652 if (!is_array($this->parent[strtolower($to_class)]) || !in_array($a_from_class, $this->parent[strtolower($to_class)]))
653 {
654 $this->parent[strtolower($to_class)][] = $a_from_class;
655 }
656 }
657 }
658 }

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

531 {
532 return $this->call_hist;
533 }

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

552 {
553 $this->readClassInfo($a_class);
554 }
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 1732 of file class.ilCtrl.php.

1733 {
1734 if ($this->class_cid[$a_class] == "")
1735 {
1736 $this->readClassInfo($a_class);
1737 }
1738 if ($this->class_cid[$a_class] == "")
1739 {
1740 if ($a_check)
1741 {
1742 return false;
1743 }
1744 if (DEVMODE == 1)
1745 {
1746 $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
1747 may solve the issue by putting an empty * @ilCtrl_Calls [YourClassName]: into your class header.".
1748 " In both cases you need to reload the control structure in the setup.";
1749 }
1750 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
1751 throw new ilCtrlException("Cannot find cid for class ".$a_class.".".$add);
1752 }
1753 return $this->class_cid[$a_class];
1754 }

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

1760 {
1761 if ($this->cid_class[$a_cid] == "")
1762 {
1763 $this->readCidInfo($a_cid);
1764 }
1765 if ($this->cid_class[$a_cid] == "")
1766 {
1767 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
1768 throw new ilCtrlException("Cannot find class for cid ".$a_cid.".");
1769 }
1770 return $this->cid_class[$a_cid];
1771 }
readCidInfo($a_cid)
Read information of class per cid.

References readCidInfo().

Referenced by 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 926 of file class.ilCtrl.php.

927 {
928 $path = pathinfo($a_class_path);
929 $file = $path["basename"];
930 $class = substr($file, 6, strlen($file) - 10);
931
932 return $class;
933 }
print $file
$path
Definition: index.php:22

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

1038 {
1039 $cmd = "";
1040 if (isset($_GET["cmd"]))
1041 {
1042 $cmd = $_GET["cmd"];
1043 }
1044 if($cmd == "post")
1045 {
1046 if (isset($_POST["cmd"]) && is_array($_POST["cmd"]))
1047 {
1048 reset($_POST["cmd"]);
1049 }
1050 $cmd = @key($_POST["cmd"]);
1051
1052 // verify command
1053 if ($this->verified_cmd != "")
1054 {
1055 return $this->verified_cmd;
1056 }
1057 else
1058 {
1059 if (!$this->verifyToken() &&
1060 (!is_array($a_safe_commands) || !in_array($cmd, $a_safe_commands)))
1061 {
1062 return $a_default_cmd;
1063 }
1064 }
1065
1066 $this->verified_cmd = $cmd;
1067 if($cmd == "" && isset($_POST["table_top_cmd"])) // selected command in multi-list (table2)
1068 {
1069 $cmd = @key($_POST["table_top_cmd"]);
1070 $this->verified_cmd = $cmd;
1071 $_POST[$_POST["cmd_sv"][$cmd]] = $_POST[$_POST["cmd_sv"][$cmd]."_2"];
1072 }
1073 if($cmd == "" && isset($_POST["select_cmd2"])) // selected command in multi-list (table2)
1074 {
1075 if(isset($_POST["select_cmd_all2"]))
1076 {
1077 $_POST["select_cmd_all"] = $_POST["select_cmd_all2"];
1078 }
1079 else
1080 {
1081 $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
1082 }
1083 $cmd = $_POST["selected_cmd2"];
1084 $this->verified_cmd = $cmd;
1085 }
1086 if($cmd == "" && isset($_POST["select_cmd"])) // selected command in multi-list (table2)
1087 {
1088 if(isset($_POST["select_cmd_all"]))
1089 {
1090 $_POST["select_cmd_all2"] = $_POST["select_cmd_all"];
1091 }
1092 else
1093 {
1094 $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
1095 }
1096 $cmd = $_POST["selected_cmd"];
1097 $this->verified_cmd = $cmd;
1098 }
1099 if($cmd == "")
1100 {
1101 $cmd = $_GET["fallbackCmd"];
1102 $this->verified_cmd = $cmd;
1103 }
1104 }
1105 if($cmd == "")
1106 {
1107 $cmd = $a_default_cmd;
1108 }
1109 return $cmd;
1110 }
verifyToken()
Verify Token.
$_POST['username']
Definition: cron.php:12
$cmd
Definition: sahs_server.php:35

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

Referenced by ilObjectPermissionStatusGUI\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 1151 of file class.ilCtrl.php.

1152 {
1153 return strtolower($_GET["cmdClass"]);
1154 }

References $_GET.

◆ getCmdNode()

ilCtrl::getCmdNode ( )

Get command target node.

Returns
string id of current command target node

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

471 {
472 return $_GET["cmdNode"];
473 }

References $_GET.

Referenced by getNextClass().

+ Here is the caller graph for this function:

◆ getContextObjId()

ilCtrl::getContextObjId ( )

Get context object id.

Returns
int object id

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

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

◆ getContextObjType()

ilCtrl::getContextObjType ( )

Get context object type.

Returns
string object type

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

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

◆ getContextSubObjId()

ilCtrl::getContextSubObjId ( )

Get context subobject id.

Returns
int subobject id

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

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

◆ getContextSubObjType()

ilCtrl::getContextSubObjType ( )

Get context subobject type.

Returns
string subobject type

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

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

◆ getCurrentCidOfNode()

ilCtrl::getCurrentCidOfNode (   $a_node)
private

Get last cid of node id.

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

1906 {
1907 $n_arr = explode(":", $a_node);
1908 return $n_arr[count($n_arr) - 1];
1909 }

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

60 {
61 return $this->debug;
62 }

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

1168 {
1169 $script = $this->getFormActionByClass(strtolower(get_class($a_gui_obj)),
1170 $a_fallback_cmd, $a_anchor, $a_asynch, $xml_style);
1171 return $script;
1172 }
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 ilTestSkillLevelThresholdsTableGUI\__construct(), ilObjectPermissionStatusGUI\accessStatusInfo(), ilObjectPermissionStatusGUI\addToolbar(), and ilHistoryTableGUI\initTable().

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

1186 {
1187 if(!is_array($a_class))
1188 {
1189 $a_class = strtolower($a_class);
1190 }
1191
1192 $tok = $this->getRequestToken();
1193
1194 if ($a_asynch)
1195 {
1196 $xml_style = false;
1197 }
1198
1199 $script = $this->getLinkTargetByClass($a_class, "post", "", $a_asynch);
1200 if ($a_fallback_cmd != "")
1201 {
1202 $script = ilUtil::appendUrlParameterString($script, "fallbackCmd=".$a_fallback_cmd, $xml_style);
1203 }
1204 $script = ilUtil::appendUrlParameterString($script, self::IL_RTOKEN_NAME.'='.$this->getRequestToken(),
1205 $xml_style);
1206 if ($a_anchor != "")
1207 {
1208 $script = $script."#".$a_anchor;
1209 }
1210
1211 return $script;
1212 }
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 208 of file class.ilCtrl.php.

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

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

1444 {
1445 $script = $this->getLinkTargetByClass(strtolower(get_class($a_gui_obj)), $a_cmd, $a_anchor, $a_asynch,
1446 $xml_style);
1447 return $script;
1448 }

References getLinkTargetByClass().

Referenced by 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 1462 of file class.ilCtrl.php.

1464 {
1465 if ($a_asynch)
1466 {
1467 $xml_style = false;
1468 }
1469
1470 // note: $a_class may be an array
1471 //$a_class = strtolower($a_class);
1472
1473//echo "<br>getLinkTargetByClass";
1474 $script = $this->getTargetScript();
1475 $script = $this->getUrlParameters($a_class, $script, $a_cmd, $xml_style);
1476
1477 if ($a_asynch)
1478 {
1479 //$amp = $xml_style
1480 // ? "&amp;"
1481 // : "&";
1482 $amp = "&";
1483 $script.= $amp."cmdMode=asynch";
1484 }
1485
1486 if ($a_anchor != "")
1487 {
1488 $script = $script."#".$a_anchor;
1489 }
1490
1491 return $script;
1492 }
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 493 of file class.ilCtrl.php.

494 {
495 return $this->location;
496 }
$location
Definition: buildRTE.php:44

References $location.

◆ getModuleDir()

ilCtrl::getModuleDir ( )

get directory of current module

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

157 {
158 return $this->module_dir;
159 }

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

859 {
860 $cmdNode = $this->getCmdNode();
861//echo "<br>getNextClass (current node: ".$this->current_node."; cmd node: ".$cmdNode.") ";
862 if ($cmdNode == "")
863 {
864 return ($class = $this->checkLPSettingsForward($a_gui_class, $cmdNode))
865 ? $class
866 : false;
867 }
868 else
869 {
870 if ($this->current_node == $cmdNode)
871 {
872//echo "1:".$this->call_node[$cmdNode]["class"]."<br>";
873 //return $this->call_node[$cmdNode]["class"];
874 return ($class = $this->checkLPSettingsForward($a_gui_class, $cmdNode))
875 ? $class
876 : "";
877 }
878 else
879 {
880 $path = $this->getPathNew($this->current_node, $cmdNode);
881//var_dump($path);
882//echo " - Next Node: ".$path[1];
883 $this->readCidInfo($this->getCurrentCidOfNode($path[1]));
884//echo ":".$this->cid_class[$this->getCurrentCidOfNode($path[1])].":".$this->getCurrentCidOfNode($path[1]).":";
885 return $this->cid_class[$this->getCurrentCidOfNode($path[1])];
886 }
887 }
888 }
checkLPSettingsForward($a_gui_obj, $a_cmd_node)
getCmdNode()
Get command target 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(), and ilObjectPermissionStatusGUI\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 316 of file class.ilCtrl.php.

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

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

1639 {
1640 $par_arr = $this->getParameterArrayByClass(strtolower(get_class($a_gui_obj)), $a_cmd);
1641
1642 return $par_arr;
1643 }
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 1652 of file class.ilCtrl.php.

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

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

1888 {
1889 $n_arr = explode(":", $a_node);
1890 return $n_arr[count($n_arr) - 2];
1891 }

Referenced by getNodeIdForTargetClass().

+ Here is the caller graph for this function:

◆ getParentReturn()

ilCtrl::getParentReturn ( $a_gui_obj)

Get return script url.

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

1553 {
1554 return $this->getParentReturnByClass(strtolower(get_class($a_gui_obj)));
1555 }
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 1561 of file class.ilCtrl.php.

1562 {
1563 $a_class = strtolower($a_class);
1564 $ret_class = $this->searchReturnClass($a_class);
1565//echo ":$ret_class:";
1566 if($ret_class)
1567 {
1568//echo ":".$this->return[$ret_class].":";
1569 return $this->return[$ret_class];
1570 }
1571 }
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 941 of file class.ilCtrl.php.

942 {
943//if ($this->getCmdClass() == "ilmailfoldergui") echo "-".$a_source_node."-".$a_target_node."-";
944//echo "-".$a_source_node."-".$a_target_node."-";
945//echo "<br>:::$a_source_node:::";
946 if ($a_source_node == "1")
947 {
948 $a_source_node = "";
949 }
950 if (substr($a_target_node, 0, strlen($a_source_node)) != $a_source_node)
951 {
952 $failure = "ERROR: Path not found. Source:".$a_source_node.
953 ", Target:".$a_target_node;
954 if (DEVMODE == 1)
955 {
956 include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
957 throw new ilCtrlException($failure);
958 }
959 $GLOBALS['ilLog']->write(__METHOD__.' '.$failure);
960 ilUtil::redirect('./ilias.php?baseClass=ilRepositoryGUI');
961 }
962//echo "<br>:::$a_source_node:::";
963 $temp_node = $a_source_node;
964
965 $path = array();
966 if ($a_source_node != "")
967 {
968 $path = array($a_source_node);
969 }
970
971 $diffstart = ($a_source_node == "")
972 ? 0
973 : strlen($a_source_node) + 1;
974 $diff = substr($a_target_node, $diffstart);
975//echo "=$diff=$diffstart=";
976 $diff_arr = explode(":", $diff);
977 foreach($diff_arr as $cid)
978 {
979 if ($temp_node != "")
980 {
981 $temp_node.= ":";
982 }
983 $temp_node.= $cid;
984 $path[] = $temp_node;
985 }
986//if ($this->getCmdClass() == "ilmailfoldergui") var_dump($path);
987//var_dump($path);
988 return $path;
989 }
$failure
static redirect($a_script)
http redirect to other script

References $failure, $GLOBALS, $path, and ilUtil\redirect().

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

1545 {
1546 return $_GET["redirectSource"];
1547 }

References $_GET.

◆ getRequestToken()

ilCtrl::getRequestToken ( )

Get request token.

Returns
string request token for user and session

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

1232 {
1233 global $ilDB, $ilUser;
1234
1235 if ($this->rtoken != "")
1236 {
1237 return $this->rtoken;
1238 }
1239 else
1240 {
1241 if (is_object($ilDB) && is_object($ilUser) && $ilUser->getId() > 0 &&
1242 $ilUser->getId() != ANONYMOUS_USER_ID)
1243 {
1244 $res = $ilDB->query("SELECT token FROM il_request_token WHERE user_id = ".
1245 $ilDB->quote($ilUser->getId(), "integer").
1246 " AND session_id = ".$ilDB->quote(session_id(), "text"));
1247 $rec = $ilDB->fetchAssoc($res);
1248//echo session_id();
1249 if ($rec["token"] != "")
1250 {
1251 $this->rtoken = $rec["token"];
1252 return $rec["token"];
1253 }
1254//echo "new rtoken, new entry for :".$ilUser->getId().":".session_id().":"; exit;
1255 $this->rtoken = md5(uniqid(rand(), true));
1256
1257 // delete entries older than one and a half days
1258 if (rand(1, 200) == 2)
1259 {
1260 $dt = new ilDateTime(time(),IL_CAL_UNIX);
1261 $dt->increment(IL_CAL_DAY, -1);
1262 $dt->increment(IL_CAL_HOUR, -12);
1263 $dq = "DELETE FROM il_request_token WHERE ".
1264 " stamp < ".$ilDB->quote($dt->get(IL_CAL_DATETIME), "timestamp");
1265 $ilDB->manipulate($dq);
1266 }
1267
1268 // IMPORTANT: Please do NOT try to move this implementation to a
1269 // session basis. This will fail due to framesets that are used
1270 // occasionally in ILIAS, e.g. in the chat, where multiple
1271 // forms are loaded in different frames.
1272 $ilDB->manipulate("INSERT INTO il_request_token (user_id, token, stamp, session_id) VALUES ".
1273 "(".
1274 $ilDB->quote($ilUser->getId(), "integer").",".
1275 $ilDB->quote($this->rtoken, "text").",".
1276 $ilDB->now().",".
1277 $ilDB->quote(session_id(), "text").")");
1278 return $this->rtoken;
1279 }
1280 //$this->rtoken = md5(uniqid(rand(), true));
1281 }
1282 return "";
1283 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
const IL_CAL_HOUR
const IL_CAL_DAY
@classDescription Date and time handling
global $ilUser
Definition: imgupload.php:15

References $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 1579 of file class.ilCtrl.php.

1580 {
1581 if (is_object($a_class))
1582 {
1583 $class = strtolower(get_class($a_class));
1584 }
1585 else
1586 {
1587 $class = strtolower($a_class);
1588 }
1589 return $this->searchReturnClass($class);
1590 }

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

520 {
521 return $this->tab;
522 }

References $tab.

◆ getTargetScript()

ilCtrl::getTargetScript ( )

Get target script name.

Returns
string target script name

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

1008 {
1009 return $this->target_script;
1010 }

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

1618 {
1619 // note: $a_class may be an array!
1620 //$a_class = strtolower($a_class);
1621
1622 $params = $this->getParameterArrayByClass($a_class, $a_cmd);
1623
1624 foreach ($params as $par => $value)
1625 {
1626 if (strlen((string) $value))
1627 {
1628 $a_str = ilUtil::appendUrlParameterString($a_str, $par."=".$value, $xml_style);
1629 }
1630 }
1631
1632 return $a_str;
1633 }

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:

◆ ilCtrl()

ilCtrl::ilCtrl ( )

control class constructor

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

29 {
30 global $ilBench;
31
32 $this->bench =& $ilBench;
33
34 // initialisation
35 $this->init();
36
37 // this information should go to xml files one day
38 $this->stored_trees = array
39 ("ilrepositorygui", "ilpersonaldesktopgui",
40 "illmpresentationgui", "illmeditorgui",
41 "iladministrationgui");
42 }
init()
initialisation
global $ilBench
Definition: ilias.php:18

References $ilBench, and init().

+ Here is the call graph for this function:

◆ init()

ilCtrl::init ( )

initialisation

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

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

References forwards().

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

1022 {
1023 $_GET["baseClass"] = $a_base_class;
1024 $_GET["cmd"] = "";
1025 $_GET["cmdClass"] = "";
1026 $_GET["cmdNode"] = "";
1027 $this->init();
1028 }

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

1918 {
1919 global $ilDB;
1920
1921 $a_parent = strtolower($a_parent);
1922 $a_child = strtolower($a_child);
1923 $a_comp_prefix = strtolower($a_comp_prefix);
1924
1925 $set = $ilDB->query("SELECT * FROM ctrl_calls WHERE ".
1926 " parent = ".$ilDB->quote($a_parent, "text")." AND ".
1927 " child = ".$ilDB->quote($a_child, "text")." AND ".
1928 " comp_prefix = ".$ilDB->quote($a_comp_prefix, "text")
1929 );
1930 if ($rec = $ilDB->fetchAssoc($set))
1931 {
1932 return;
1933 }
1934 $ilDB->manipulate("INSERT INTO ctrl_calls ".
1935 "(parent, child, comp_prefix) VALUES (".
1936 $ilDB->quote($a_parent, "text").",".
1937 $ilDB->quote($a_child, "text").",".
1938 $ilDB->quote($a_comp_prefix, "text").
1939 ")");
1940 }

References $ilDB.

◆ isAsynch()

ilCtrl::isAsynch ( )

Is current command an asynchronous command?

Returns
boolean asynchronous t/f

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

1419 {
1420 if (isset($_GET["cmdMode"]) && $_GET["cmdMode"] == "asynch")
1421 {
1422 return true;
1423 }
1424 else
1425 {
1426 return false;
1427 }
1428 }

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

897 {
898 global $ilDB;
899 $a_class_name = strtolower($a_class_name);
900
901 $cached_ctrl = ilCachedCtrl::getInstance();
902 $class_rec = $cached_ctrl->lookupClassFile($a_class_name);
903
904 //$class_set = $ilDB->query("SELECT * FROM ctrl_classfile WHERE class = ".
905 // $ilDB->quote($a_class_name, "text"));
906 //$class_rec = $ilDB->fetchAssoc($class_set);
907
908 if ($class_rec["plugin_path"] != "")
909 {
910 return $class_rec["plugin_path"]."/".$class_rec["filename"];
911 }
912 else
913 {
914 return $class_rec["filename"];
915 }
916 }

References $ilDB, and ilCachedCtrl\getInstance().

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

585 {
586 global $ilDB;
587
588 $a_class = strtolower($a_class);
589
590 $a_nr++;
591
592 // determine call node structure
593 $this->call_node[$a_nr] = array("class" => $a_class, "parent" => $a_parent);
594
595//echo "<br>nr:$a_nr:class:$a_class:parent:$a_parent:";
596 $call_set = $ilDB->query("SELECT * FROM ctrl_calls WHERE parent = ".
597 $ilDB->quote(strtolower($a_class), "text").
598 " ORDER BY child", array("text"));
599 $a_parent = $a_nr;
600 while ($call_rec = $ilDB->fetchAssoc($call_set))
601 {
602 $a_nr = $this->readCallStructure($call_rec["child"], $a_nr, $a_parent);
603 $forw[] = $call_rec["child"];
604 }
605
606 // determin forward and parent array
607 $this->forwards($a_class, $forw);
608//echo "<br>forwards:".$a_class."<br>"; var_dump($forw);
609
610 // determine root class
611 $this->root_class = $a_class;
612 return $a_nr;
613 }
readCallStructure($a_class, $a_nr=0, $a_parent=0)
stores often used common call structures (called from db_update script!!!)

References $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 1778 of file class.ilCtrl.php.

1779 {
1780 global $ilDB;
1781
1782 if (isset($this->info_read_cid[$a_cid]))
1783 {
1784 return;
1785 }
1786
1787 $cached_ctrl = ilCachedCtrl::getInstance();
1788 $rec = $cached_ctrl->lookupCid($a_cid);
1789
1790// $set = $ilDB->query("SELECT * FROM ctrl_classfile ".
1791// " WHERE cid = ".$ilDB->quote($a_cid, "text")
1792// );
1793// if ($rec = $ilDB->fetchAssoc($set))
1794 if($rec)
1795 {
1796 $this->cid_class[$a_cid] = $rec["class"];
1797 $this->class_cid[$rec["class"]] = $a_cid;
1798
1799 $calls = $cached_ctrl->lookupCall($rec["class"]);
1800
1801 // $set = $ilDB->query("SELECT * FROM ctrl_calls ".
1802 // " WHERE parent = ".$ilDB->quote($rec["class"], "text")
1803 // );
1804 // while ($rec2 = $ilDB->fetchAssoc($set))
1805 foreach($calls as $rec2)
1806 {
1807 if (!isset($this->calls[$rec["class"]]) || !is_array($this->calls[$rec["class"]]) || !in_array($rec2["child"], $this->calls[$rec["class"]]))
1808 {
1809 if ($rec2["child"] != "")
1810 {
1811 $this->calls[$rec["class"]][] = $rec2["child"];
1812 }
1813 }
1814 }
1815 $this->info_read_class[$rec["class"]] = true;
1816 }
1817
1818 $this->info_read_cid[$a_cid] = true;
1819 }

References $calls, $ilDB, 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 1840 of file class.ilCtrl.php.

1841 {
1842 global $ilDB;
1843
1844 $a_class = strtolower($a_class);
1845 if (isset($this->info_read_class[$a_class]))
1846 {
1847 return;
1848 }
1849
1850 $cached_ctrl = ilCachedCtrl::getInstance();
1851 $rec = $cached_ctrl->lookupClassFile($a_class);
1852
1853
1854// $set = $ilDB->query("SELECT * FROM ctrl_classfile ".
1855// " WHERE class = ".$ilDB->quote($a_class, "text")
1856// );
1857// if ($rec = $ilDB->fetchAssoc($set))
1858 if($rec)
1859 {
1860 $this->cid_class[$rec["cid"]] = $a_class;
1861 $this->class_cid[$a_class] = $rec["cid"];
1862 }
1863
1864// $set = $ilDB->query("SELECT * FROM ctrl_calls ".
1865// " WHERE parent = ".$ilDB->quote($a_class, "text")
1866// );
1867 $recs = $cached_ctrl->lookupCall($a_class);
1868// while ($rec = $ilDB->fetchAssoc($set))
1869 foreach($recs as $rec)
1870 {
1871 if (!isset($this->calls[$a_class]) || !is_array($this->calls[$a_class]) || !in_array($rec["child"], $this->calls[$a_class]))
1872 {
1873 if ($rec["child"] != "")
1874 {
1875 $this->calls[$a_class][] = $rec["child"];
1876 }
1877 }
1878 }
1879
1880 $this->info_read_class[$a_class] = true;
1881 $this->info_read_cid[$this->class_cid[$a_class]] = true;
1882 }

References $ilDB, and 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 1826 of file class.ilCtrl.php.

1827 {
1828 $n_arr = explode(":", $a_node);
1829 foreach ($n_arr as $cid)
1830 {
1831 $this->readCidInfo($cid);
1832 }
1833 }

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

1380 {
1381 global $ilBench;
1382
1383 $script = $this->getLinkTargetByClass(strtolower(get_class($a_gui_obj)), $a_cmd,
1384 "", $a_asynch, false);
1385 if (is_object($ilBench))
1386 {
1387 $ilBench->save();
1388 }
1389 if ($a_anchor != "")
1390 {
1391 $script = $script."#".$a_anchor;
1392 }
1393 ilUtil::redirect($script);
1394 }

References $ilBench, getLinkTargetByClass(), and ilUtil\redirect().

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

1404 {
1405 $script = $this->getLinkTargetByClass($a_class, $a_cmd, "", $a_asynch, false);
1406 if ($a_anchor != "")
1407 {
1408 $script = $script."#".$a_anchor;
1409 }
1410 ilUtil::redirect($script);
1411 }

References getLinkTargetByClass(), and ilUtil\redirect().

Referenced by checkLPSettingsForward().

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

1897 {
1898 $lpos = strrpos($a_node, ":");
1899 return substr($a_node, 0, $lpos);
1900 }

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

1523 {
1524 $script = $this->getParentReturn($a_gui_obj);
1525
1526 $script = ilUtil::appendUrlParameterString($script,
1527 "redirectSource=".strtolower(get_class($a_gui_obj)));
1528 $script = ilUtil::appendUrlParameterString($script,
1529 "cmdMode=".$_GET["cmdMode"]);
1530 if ($a_anchor != "")
1531 {
1532 $script = $script."#".$a_anchor;
1533 }
1534
1535 ilUtil::redirect($script);
1536 }
getParentReturn(&$a_gui_obj)
Get return script url.

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

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

681 {
682 if (is_object($a_obj))
683 {
684 $this->saveParameterByClass(get_class($a_obj), $a_parameter);
685 }
686 }
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 694 of file class.ilCtrl.php.

695 {
696 if (is_array($a_parameter))
697 {
698 foreach($a_parameter as $parameter)
699 {
700 $this->save_parameter[strtolower($a_class)][] = $parameter;
701 }
702 }
703 else
704 {
705 $this->save_parameter[strtolower($a_class)][] = $a_parameter;
706 }
707 }

Referenced by saveParameter().

+ Here is the caller graph for this function:

◆ searchReturnClass()

ilCtrl::searchReturnClass (   $a_class)
private

Determine current return class.

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

1597 {
1598 $a_class = strtolower($a_class);
1599
1600 $node = $this->getNodeIdForTargetClass($this->current_node, $a_class);
1601 $node = $node["node_id"];
1602 $n_arr = explode(":", $node);
1603 for($i = count($n_arr)-2; $i>=0; $i--)
1604 {
1605 if ($this->return[$this->getClassForCid($n_arr[$i])] != "")
1606 {
1607 return $this->getClassForCid($n_arr[$i]);
1608 }
1609 }
1610
1611 return false;
1612 }

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

1123 {
1124 $_GET["cmd"] = $a_cmd;
1125 }

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

1138 {
1139 $a_cmd_class = strtolower($a_cmd_class);
1140 $nr = $this->getNodeIdForTargetClass($this->current_node, $a_cmd_class);
1141 $nr = $nr["node_id"];
1142 $_GET["cmdClass"] = $a_cmd_class;
1143 $_GET["cmdNode"] = $nr;
1144 }

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

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

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

733 {
734 $this->parameter[strtolower(get_class($a_obj))][$a_parameter] = $a_value;
735 }

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

746 {
747 $this->parameter[strtolower($a_class)][$a_parameter] = $a_value;
748 }

Referenced by checkLPSettingsForward(), and ilHistoryTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ setReturn()

ilCtrl::setReturn ( $a_gui_obj,
  $a_cmd 
)

Set return command.

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

1498 {
1499 $script = $this->getTargetScript();
1500 $script = $this->getUrlParameters(strtolower(get_class($a_gui_obj)), $script, $a_cmd);
1501//echo "<br>setReturn:".get_class($a_gui_obj).":".$script.":<br>";
1502 $this->return[strtolower(get_class($a_gui_obj))] = $script;
1503 }

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

1509 {
1510 // may not be an array!
1511 $a_class = strtolower($a_class);
1512
1513 $script = $this->getTargetScript();
1514 $script = $this->getUrlParameters($a_class, $script, $a_cmd);
1515//echo "<br>setReturn:".get_class($a_gui_obj).":".$script.":<br>";
1516 $this->return[strtolower($a_class)] = $script;
1517 }

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

997 {
998 $this->target_script = $a_target_script;
999 }

◆ verifyToken()

ilCtrl::verifyToken ( )
private

Verify Token.

Returns
boolean valid t/f

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

1291 {
1292 global $ilDB, $ilUser;
1293
1294 if (is_object($ilUser) && is_object($ilDB) && $ilUser->getId() > 0 &&
1295 $ilUser->getId() != ANONYMOUS_USER_ID)
1296 {
1297 if ($_GET["rtoken"] == "")
1298 {
1299 #echo "ilCtrl::No Request Token Given!"; // for debugging, maybe changed later
1300 return false;
1301 }
1302
1303 $set = $ilDB->query("SELECT * FROM il_request_token WHERE ".
1304 " user_id = ".$ilDB->quote($ilUser->getId(), "integer")." AND ".
1305 " token = ".$ilDB->quote($_GET[self::IL_RTOKEN_NAME]), "text");
1306 if ($ilDB->numRows($set) > 0)
1307 {
1308 // remove used token
1309 /*
1310 $ilDB->query("DELETE FROM il_request_token WHERE ".
1311 " user_id = ".$ilDB->quote($ilUser->getId())." AND ".
1312 " token = ".$ilDB->quote($_GET[self::IL_RTOKEN_NAME]));
1313 */
1314
1315 // remove tokens from older sessions
1316 // if we do this immediately, working with multiple windows does not work:
1317 // - window one: open form (with token a)
1318 // - window two: open form (with token b)
1319 // - submit window one: a is verified, but b must not be deleted immediately, otherwise
1320 // - window two: submit results in invalid token
1321 // see also bug #13551
1322 $dt = new ilDateTime(time(),IL_CAL_UNIX);
1323 $dt->increment(IL_CAL_DAY, -1);
1324 $dt->increment(IL_CAL_HOUR, -12);
1325 $ilDB->manipulate("DELETE FROM il_request_token WHERE ".
1326 " user_id = ".$ilDB->quote($ilUser->getId(), "integer")." AND ".
1327 " session_id != ".$ilDB->quote(session_id(), "text")." AND ".
1328 " stamp < ".$ilDB->quote($dt->get(IL_CAL_DATETIME), "timestamp"));
1329 return true;
1330 }
1331 else
1332 {
1333 return false;
1334 }
1335
1336 if ($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]] != "")
1337 {
1338 // remove used token
1339 unset($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]]);
1340
1341 // remove old tokens
1342 if (count($_SESSION["rtokens"]) > 100)
1343 {
1344 $to_remove = array();
1345 $sec = 7200; // two hours
1346
1347 foreach($_SESSION["rtokens"] as $tok => $time)
1348 {
1349 if (time() - $time > $sec)
1350 {
1351 $to_remove[] = $tok;
1352 }
1353 }
1354 foreach($to_remove as $tok)
1355 {
1356 unset($_SESSION["rtokens"][$tok]);
1357 }
1358 }
1359
1360 return true;
1361 }
1362 return false;
1363 }
1364 else
1365 {
1366 return true; // do not verify, if user or db object is missing
1367 }
1368
1369 return false;
1370 }
$_SESSION["AccountId"]

References $_GET, $_SESSION, $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()

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

Referenced by getCallHistory().

◆ $calls

ilCtrl::$calls = array()

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

Referenced by readCidInfo().

◆ $debug

ilCtrl::$debug = array()

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

Referenced by getDebug().

◆ $forward

ilCtrl::$forward

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

◆ $parent

ilCtrl::$parent

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

◆ $return

ilCtrl::$return

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

◆ $rtoken

ilCtrl::$rtoken = false

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

Referenced by getRequestToken().

◆ $save_parameter

ilCtrl::$save_parameter

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

◆ $target_script

ilCtrl::$target_script

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

Referenced by getTargetScript().

◆ IL_RTOKEN_NAME


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