ILIAS  release_4-4 Revision
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 ()
 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
 

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

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

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

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

◆ appendRequestTokenParameterString()

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

Append request token as url parameter.

Parameters
stringurl
booleanxml style

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

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

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

◆ callBaseClass()

ilCtrl::callBaseClass ( )

Calls base class of current request.

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

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

References $_GET, forwardCommand(), and getCallStructure().

92  {
93  global $ilDB;
94 
95  $baseClass = strtolower($_GET["baseClass"]);
96 
97  // get class information
98  $mc_set = $ilDB->query("SELECT * FROM module_class WHERE LOWER(class) = ".
99  $ilDB->quote($baseClass, "text"));
100  $mc_rec = $ilDB->fetchAssoc($mc_set);
101  $module = $mc_rec["module"];
102  $class = $mc_rec["class"];
103  $class_dir = $mc_rec["dir"];
104 
105  if ($module != "")
106  {
107  $m_set = $ilDB->query("SELECT * FROM il_component WHERE name = ".
108  $ilDB->quote($module, "text"));
109  $m_rec = $ilDB->fetchAssoc($m_set);
110  $this->module_dir = $m_rec["type"]."/".$m_rec["name"];
111  include_once $this->module_dir."/".$class_dir."/class.".$class.".php";
112  }
113  else // check whether class belongs to a service
114  {
115  $mc_set = $ilDB->query("SELECT * FROM service_class WHERE LOWER(class) = ".
116  $ilDB->quote($baseClass, "text"));
117  $mc_rec = $ilDB->fetchAssoc($mc_set);
118 
119  $service = $mc_rec["service"];
120  $class = $mc_rec["class"];
121  $class_dir = $mc_rec["dir"];
122 
123  if ($service == "")
124  {
125  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
126  throw new ilCtrlException("Could not find entry in modules.xml or services.xml for ".
127  $baseClass." <br/>".str_replace("&", "<br />&", htmlentities($_SERVER["REQUEST_URI"])));
128  }
129 
130  // get service information
131  $m_set = $ilDB->query("SELECT * FROM il_component WHERE name = ".
132  $ilDB->quote($service, "text"));
133  $m_rec = $ilDB->fetchAssoc($m_set);
134  $this->service_dir = $m_rec["type"]."/".$m_rec["name"];
135 
136  include_once $this->service_dir."/".$class_dir."/class.".$class.".php";;
137  }
138 
139  // forward processing to base class
140  $this->getCallStructure(strtolower($baseClass));
141  $base_class_gui =& new $class();
142  $this->forwardCommand($base_class_gui);
143  }
$_GET["client_id"]
getCallStructure($a_class)
Get call structure of class context.
ilCtrl exceptions
& forwardCommand(&$a_gui_object)
Forward flow of control to next gui class this invokes the executeCommand() method of the gui object ...
+ Here is the call graph for this function:

◆ checkTargetClass()

ilCtrl::checkTargetClass (   $a_class)

Check whether target is valid.

Parameters

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

References getCidForClass(), and getNodeIdForTargetClass().

424  {
425  if (!is_array($a_class))
426  {
427  $a_class = array($a_class);
428  }
429 
430  $nr = $this->current_node;
431  foreach ($a_class as $class)
432  {
433  $class = strtolower($class);
434 
435  if (!$this->getCidForClass($class, true))
436  {
437  return false;
438  }
439 
440  $nr = $this->getNodeIdForTargetClass($nr, $class, true);
441  $nr = $nr["node_id"];
442  if ($nr === false)
443  {
444  return false;
445  }
446  }
447  return true;
448  }
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).
getCidForClass($a_class, $a_check=false)
Get Cid for Class.
+ 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 742 of file class.ilCtrl.php.

References clearParametersByClass().

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

◆ clearParametersByClass()

ilCtrl::clearParametersByClass (   $a_class)

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

Parameters
string$a_classgui class name

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

Referenced by clearParameters().

754  {
755  $this->parameter[strtolower($a_class)] = array();
756  }
+ 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 (.

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

References getCmd(), and getNodeIdForTargetClass().

Referenced by callBaseClass(), and ilTestSubmissionReviewGUI\executeCommand().

163  {
164  $class = strtolower(get_class($a_gui_object));
165 //echo "<br>class:".$class.":";
166  $nr = $this->getNodeIdForTargetClass($this->current_node, $class);
167  $nr = $nr["node_id"];
168  if ($nr != "")
169  {
170  $current_node = $this->current_node;
171 
172  $this->current_node = $nr;
173 
174  // always populate the call history
175  // it will only be displayed in DEVMODE but is needed for UI plugins, too
176  $this->call_hist[] = array("class" => get_class($a_gui_object),
177  "mode" => "execComm", "cmd" => $this->getCmd());
178 
179 //echo "<br>class:".get_class($a_gui_object).":";
180  $html = $a_gui_object->executeCommand();
181 
182  // reset current node
183  $this->current_node = $current_node;
184 
185  return $html;
186 
187  }
188 
189  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
190  throw new ilCtrlException("ERROR: Can't forward to class $class.");
191  }
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).
getCmd($a_default_cmd="", $a_safe_commands="")
Determines current get/post command.
ilCtrl exceptions
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

Referenced by init(), and readCallStructure().

608  {
609  $a_from_class = strtolower($a_from_class);
610 
611  if (is_array($a_to_class))
612  {
613  foreach($a_to_class as $to_class)
614  {
615  if ($a_from_class != "" && $to_class != "")
616  {
617  if (!is_array($this->forward[$a_from_class]) || !in_array(strtolower($to_class), $this->forward[$a_from_class]))
618  {
619  $this->forward[$a_from_class][] = strtolower($to_class);
620  }
621  if (!is_array($this->parent[strtolower($to_class)]) || !in_array($a_from_class, $this->parent[strtolower($to_class)]))
622  {
623  $this->parent[strtolower($to_class)][] = $a_from_class;
624  }
625  }
626  }
627  }
628  else
629  {
630  $to_class = $a_to_class;
631  if ($a_from_class != "" && $to_class != "")
632  {
633  if (!is_array($this->forward[$a_from_class]) || !in_array(strtolower($to_class), $this->forward[$a_from_class]))
634  {
635  $this->forward[$a_from_class][] = strtolower($to_class);
636  }
637  if (!is_array($this->parent[strtolower($to_class)]) || !in_array($a_from_class, $this->parent[strtolower($to_class)]))
638  {
639  $this->parent[strtolower($to_class)][] = $a_from_class;
640  }
641  }
642  }
643  }
+ 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 515 of file class.ilCtrl.php.

References $call_hist.

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

◆ 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

public

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

References readClassInfo().

Referenced by callBaseClass(), and getNodeIdForTargetClass().

537  {
538  $this->readClassInfo($a_class);
539  }
readClassInfo($a_class)
Read info of class.
+ 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 1633 of file class.ilCtrl.php.

References readClassInfo().

Referenced by checkTargetClass(), and getNodeIdForTargetClass().

1634  {
1635  if ($this->class_cid[$a_class] == "")
1636  {
1637  $this->readClassInfo($a_class);
1638  }
1639  if ($this->class_cid[$a_class] == "")
1640  {
1641  if ($a_check)
1642  {
1643  return false;
1644  }
1645  if (DEVMODE == 1)
1646  {
1647  $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
1648  may solve the issue by putting an empty * @ilCtrl_Calls [YourClassName]: into your class header.".
1649  " In both cases you need to reload the control structure in the setup.";
1650  }
1651  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
1652  throw new ilCtrlException("Cannot find cid for class ".$a_class.".".$add);
1653  }
1654  return $this->class_cid[$a_class];
1655  }
readClassInfo($a_class)
Read info of class.
ilCtrl exceptions
+ 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 1660 of file class.ilCtrl.php.

References readCidInfo().

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

1661  {
1662  if ($this->cid_class[$a_cid] == "")
1663  {
1664  $this->readCidInfo($a_cid);
1665  }
1666  if ($this->cid_class[$a_cid] == "")
1667  {
1668  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
1669  throw new ilCtrlException("Cannot find class for cid ".$a_cid.".");
1670  }
1671  return $this->cid_class[$a_cid];
1672  }
readCidInfo($a_cid)
Read information of class per cid.
ilCtrl exceptions
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getClassForClasspath()

ilCtrl::getClassForClasspath (   $a_class_path)

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

Parameters
string$a_class_pathclass path public
Returns
string class name

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

References $file, and $path.

828  {
829  $path = pathinfo($a_class_path);
830  $file = $path["basename"];
831  $class = substr($file, 6, strlen($file) - 10);
832 
833  return $class;
834  }
print $file
$path
Definition: index.php:22

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

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

Referenced by ilTestSubmissionReviewGUI\dispatchCommand(), ilTestSignatureGUI\executeCommand(), forwardCommand(), and getHTML().

939  {
940  $cmd = "";
941  if (isset($_GET["cmd"]))
942  {
943  $cmd = $_GET["cmd"];
944  }
945  if($cmd == "post")
946  {
947  if (isset($_POST["cmd"]) && is_array($_POST["cmd"]))
948  {
949  reset($_POST["cmd"]);
950  }
951  $cmd = @key($_POST["cmd"]);
952 
953  // verify command
954  if ($this->verified_cmd != "")
955  {
956  return $this->verified_cmd;
957  }
958  else
959  {
960  if (!$this->verifyToken() &&
961  (!is_array($a_safe_commands) || !in_array($cmd, $a_safe_commands)))
962  {
963  return $a_default_cmd;
964  }
965  }
966 
967  $this->verified_cmd = $cmd;
968  if($cmd == "" && isset($_POST["table_top_cmd"])) // selected command in multi-list (table2)
969  {
970  $cmd = @key($_POST["table_top_cmd"]);
971  $this->verified_cmd = $cmd;
972  $_POST[$_POST["cmd_sv"][$cmd]] = $_POST[$_POST["cmd_sv"][$cmd]."_2"];
973  }
974  if($cmd == "" && isset($_POST["select_cmd2"])) // selected command in multi-list (table2)
975  {
976  if(isset($_POST["select_cmd_all2"]))
977  {
978  $_POST["select_cmd_all"] = $_POST["select_cmd_all2"];
979  }
980  else
981  {
982  $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
983  }
984  $cmd = $_POST["selected_cmd2"];
985  $this->verified_cmd = $cmd;
986  }
987  if($cmd == "" && isset($_POST["select_cmd"])) // selected command in multi-list (table2)
988  {
989  if(isset($_POST["select_cmd_all"]))
990  {
991  $_POST["select_cmd_all2"] = $_POST["select_cmd_all"];
992  }
993  else
994  {
995  $_POST["select_cmd_all"] = $_POST["select_cmd_all2"] = null;
996  }
997  $cmd = $_POST["selected_cmd"];
998  $this->verified_cmd = $cmd;
999  }
1000  if($cmd == "")
1001  {
1002  $cmd = $_GET["fallbackCmd"];
1003  $this->verified_cmd = $cmd;
1004  }
1005  }
1006  if($cmd == "")
1007  {
1008  $cmd = $a_default_cmd;
1009  }
1010  return $cmd;
1011  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
verifyToken()
Verify Token.
+ 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 1052 of file class.ilCtrl.php.

References $_GET.

1053  {
1054  return strtolower($_GET["cmdClass"]);
1055  }
$_GET["client_id"]

◆ getCmdNode()

ilCtrl::getCmdNode ( )

Get command target node.

Returns
string id of current command target node

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

References $_GET.

Referenced by getNextClass().

456  {
457  return $_GET["cmdNode"];
458  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ getContextObjId()

ilCtrl::getContextObjId ( )

Get context object id.

Returns
int object id

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

256  {
257  return $this->context_obj_id;
258  }

◆ getContextObjType()

ilCtrl::getContextObjType ( )

Get context object type.

Returns
string object type

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

266  {
267  return $this->context_obj_type;
268  }

◆ getContextSubObjId()

ilCtrl::getContextSubObjId ( )

Get context subobject id.

Returns
int subobject id

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

276  {
277  return $this->context_sub_obj_id;
278  }

◆ getContextSubObjType()

ilCtrl::getContextSubObjType ( )

Get context subobject type.

Returns
string subobject type

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

286  {
287  return $this->context_sub_obj_type;
288  }

◆ getCurrentCidOfNode()

ilCtrl::getCurrentCidOfNode (   $a_node)
private

Get last cid of node id.

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

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

1791  {
1792  $n_arr = explode(":", $a_node);
1793  return $n_arr[count($n_arr) - 1];
1794  }
+ 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.

References $debug.

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

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

References getFormActionByClass().

Referenced by ilTestSubmissionReviewGUI\show().

1069  {
1070  $script = $this->getFormActionByClass(strtolower(get_class($a_gui_obj)),
1071  $a_fallback_cmd, $a_anchor, $a_asynch, $xml_style);
1072  return $script;
1073  }
getFormActionByClass($a_class, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get form action url for gui class name.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFormActionByClass()

ilCtrl::getFormActionByClass (   $a_class,
  $a_fallback_cmd = "",
  $a_anchor = "",
  $a_asynch = false,
  $xml_style = 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 1085 of file class.ilCtrl.php.

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

Referenced by getFormAction().

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

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

References getCmd(), and getNodeIdForTargetClass().

201  {
202  $class = strtolower(get_class($a_gui_object));
203 
204  $nr = $this->getNodeIdForTargetClass($this->current_node, $class);
205  $nr = $nr["node_id"];
206  if ($nr != "")
207  {
208  $current_node = $this->current_node;
209 
210  // set current node to new gui class
211  $this->current_node = $nr;
212 
213  // always populate the call history
214  // it will only be displayed in DEVMODE but is needed for UI plugins, too
215  $this->call_hist[] = array("class" => get_class($a_gui_object),
216  "mode" => "getHtml", "cmd" => $this->getCmd());
217 
218  // get block
219  $html = $a_gui_object->getHTML();
220 
221  // reset current node
222  $this->current_node = $current_node;
223 
224  // return block
225  return $html;
226  }
227 
228  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
229  throw new ilCtrlException("ERROR: Can't getHTML from class $class.");
230 
231  }
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).
getCmd($a_default_cmd="", $a_safe_commands="")
Determines current get/post command.
ilCtrl exceptions
+ Here is the call graph for this function:

◆ getLinkTarget()

ilCtrl::getLinkTarget ( $a_gui_obj,
  $a_cmd = "",
  $a_anchor = "",
  $a_asynch = false,
  $xml_style = 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 1343 of file class.ilCtrl.php.

References getLinkTargetByClass().

1345  {
1346  $script = $this->getLinkTargetByClass(strtolower(get_class($a_gui_obj)), $a_cmd, $a_anchor, $a_asynch,
1347  $xml_style);
1348  return $script;
1349  }
getLinkTargetByClass($a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui class name.
+ Here is the call 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 1363 of file class.ilCtrl.php.

References getTargetScript(), and getUrlParameters().

Referenced by getFormActionByClass(), getLinkTarget(), redirect(), and redirectByClass().

1365  {
1366  if ($a_asynch)
1367  {
1368  $xml_style = false;
1369  }
1370 
1371  // note: $a_class may be an array
1372  //$a_class = strtolower($a_class);
1373 
1374 //echo "<br>getLinkTargetByClass";
1375  $script = $this->getTargetScript();
1376  $script = $this->getUrlParameters($a_class, $script, $a_cmd, $xml_style);
1377 
1378  if ($a_asynch)
1379  {
1380  //$amp = $xml_style
1381  // ? "&amp;"
1382  // : "&";
1383  $amp = "&";
1384  $script.= $amp."cmdMode=asynch";
1385  }
1386 
1387  if ($a_anchor != "")
1388  {
1389  $script = $script."#".$a_anchor;
1390  }
1391 
1392  return $script;
1393  }
getUrlParameters($a_class, $a_str, $a_cmd="", $xml_style=false)
Get URL parameters for a class and append them to a string.
getTargetScript()
Get target script name.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocations()

ilCtrl::getLocations ( )

Get locations array (.

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

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

References $location.

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

◆ getModuleDir()

ilCtrl::getModuleDir ( )

get directory of current module

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

149  {
150  return $this->module_dir;
151  }

◆ getNextClass()

ilCtrl::getNextClass ( )

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

References $path, getCmdNode(), getCurrentCidOfNode(), getPathNew(), and readCidInfo().

Referenced by ilTestSubmissionReviewGUI\executeCommand(), and ilTestSignatureGUI\executeCommand().

767  {
768  $cmdNode = $this->getCmdNode();
769 //echo "<br>getNextClass (current node: ".$this->current_node."; cmd node: ".$cmdNode.") ";
770  if ($cmdNode == "")
771  {
772  return false;
773  }
774  else
775  {
776  if ($this->current_node == $cmdNode)
777  {
778 //echo "1:".$this->call_node[$cmdNode]["class"]."<br>";
779  //return $this->call_node[$cmdNode]["class"];
780  return "";
781  }
782  else
783  {
784  $path = $this->getPathNew($this->current_node, $cmdNode);
785 //var_dump($path);
786 //echo " - Next Node: ".$path[1];
787  $this->readCidInfo($this->getCurrentCidOfNode($path[1]));
788 //echo ":".$this->cid_class[$this->getCurrentCidOfNode($path[1])].":".$this->getCurrentCidOfNode($path[1]).":";
789  return $this->cid_class[$this->getCurrentCidOfNode($path[1])];
790  }
791  }
792  }
getCurrentCidOfNode($a_node)
Get last cid of node id.
getCmdNode()
Get command target node.
readCidInfo($a_cid)
Read information of class per cid.
getPathNew($a_source_node, $a_target_node)
Get path in call structure.
$path
Definition: index.php:22
+ 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 308 of file class.ilCtrl.php.

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

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

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

◆ getParameterArray()

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

Get all set/save parameters for a gui object.

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

References getParameterArrayByClass().

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

◆ getParameterArrayByClass()

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

Get all set/save parameters using gui class name.

Parameters
stringclass name
stringcmd $
Returns
array parameter array

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

References $_GET, $_POST, $path, getClassForCid(), getCurrentCidOfNode(), getNodeIdForTargetClass(), and getPathNew().

Referenced by getParameterArray(), and getUrlParameters().

1554  {
1555  if ($a_class == "")
1556  {
1557  return array();
1558  }
1559 
1560  if (!is_array($a_class))
1561  {
1562  $a_class = array($a_class);
1563  }
1564 
1565  $nr = $this->current_node;
1566  foreach ($a_class as $class)
1567  {
1568  $class = strtolower($class);
1569  $nr = $this->getNodeIdForTargetClass($nr, $class);
1570  if ($nr["base_class"] != "")
1571  {
1572  $new_baseclass = $nr["base_class"];
1573  }
1574  $nr = $nr["node_id"];
1575  $target_class = $class;
1576  }
1577 
1578  $path = $this->getPathNew(1, $nr);
1579  $params = array();
1580 
1581  // append parameters of parent classes
1582  foreach($path as $node_id)
1583  {
1584  $class = ($node_id == "")
1585  ? strtolower($_GET["baseClass"])
1586  : $this->getClassForCid($this->getCurrentCidOfNode($node_id));
1587  if (isset($this->save_parameter[$class]) && is_array($this->save_parameter[$class]))
1588  {
1589  foreach($this->save_parameter[$class] as $par)
1590  {
1591  if (isset($_GET[$par]))
1592  {
1593  $params[$par] = $_GET[$par];
1594  }
1595  else if (isset($_POST[$par]))
1596  {
1597  $params[$par] = $_POST[$par];
1598  }
1599  }
1600  }
1601 
1602  if (isset($this->parameter[$class]) && is_array($this->parameter[$class]))
1603  {
1604  foreach($this->parameter[$class] as $par => $value)
1605  {
1606  $params[$par] = $value;
1607  }
1608  }
1609  }
1610 
1611  if ($a_cmd != "")
1612  {
1613  $params["cmd"] = $a_cmd;
1614  }
1615 
1616  $params["cmdClass"] = $target_class;
1617  $params["cmdNode"] = $nr;
1618  if($new_baseclass == "")
1619  {
1620  $params["baseClass"] = $_GET["baseClass"];
1621  }
1622  else
1623  {
1624  $params["baseClass"] = $new_baseclass;
1625  }
1626 
1627  return $params;
1628  }
getCurrentCidOfNode($a_node)
Get last cid of node id.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
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).
getClassForCid($a_cid)
Get class for cid.
getPathNew($a_source_node, $a_target_node)
Get path in call structure.
$path
Definition: index.php:22
+ 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 1772 of file class.ilCtrl.php.

Referenced by getNodeIdForTargetClass().

1773  {
1774  $n_arr = explode(":", $a_node);
1775  return $n_arr[count($n_arr) - 2];
1776  }
+ Here is the caller graph for this function:

◆ getParentReturn()

ilCtrl::getParentReturn ( $a_gui_obj)

Get return script url.

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

References getParentReturnByClass().

Referenced by returnToParent().

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

◆ getParentReturnByClass()

ilCtrl::getParentReturnByClass (   $a_class)

Get return script url.

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

References searchReturnClass().

Referenced by getParentReturn().

1463  {
1464  $a_class = strtolower($a_class);
1465  $ret_class = $this->searchReturnClass($a_class);
1466 //echo ":$ret_class:";
1467  if($ret_class)
1468  {
1469 //echo ":".$this->return[$ret_class].":";
1470  return $this->return[$ret_class];
1471  }
1472  }
searchReturnClass($a_class)
Determine current return class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPathNew()

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

Get path in call structure.

Parameters
string$a_source_nodesource node id
string$a_source_nodetarget node id

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

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

Referenced by getNextClass(), and getParameterArrayByClass().

843  {
844 //if ($this->getCmdClass() == "ilmailfoldergui") echo "-".$a_source_node."-".$a_target_node."-";
845 //echo "-".$a_source_node."-".$a_target_node."-";
846 //echo "<br>:::$a_source_node:::";
847  if ($a_source_node == "1")
848  {
849  $a_source_node = "";
850  }
851  if (substr($a_target_node, 0, strlen($a_source_node)) != $a_source_node)
852  {
853  $failure = "ERROR: Path not found. Source:".$a_source_node.
854  ", Target:".$a_target_node;
855  if (DEVMODE == 1)
856  {
857  include_once("./Services/UICore/exceptions/class.ilCtrlException.php");
858  throw new ilCtrlException($failure);
859  }
860  $GLOBALS['ilLog']->write(__METHOD__.' '.$failure);
861  ilUtil::redirect('./ilias.php?baseClass=ilRepositoryGUI');
862  }
863 //echo "<br>:::$a_source_node:::";
864  $temp_node = $a_source_node;
865 
866  $path = array();
867  if ($a_source_node != "")
868  {
869  $path = array($a_source_node);
870  }
871 
872  $diffstart = ($a_source_node == "")
873  ? 0
874  : strlen($a_source_node) + 1;
875  $diff = substr($a_target_node, $diffstart);
876 //echo "=$diff=$diffstart=";
877  $diff_arr = explode(":", $diff);
878  foreach($diff_arr as $cid)
879  {
880  if ($temp_node != "")
881  {
882  $temp_node.= ":";
883  }
884  $temp_node.= $cid;
885  $path[] = $temp_node;
886  }
887 //if ($this->getCmdClass() == "ilmailfoldergui") var_dump($path);
888 //var_dump($path);
889  return $path;
890  }
$failure
$GLOBALS['ct_recipient']
ilCtrl exceptions
$path
Definition: index.php:22
static redirect($a_script)
http redirect to other script
+ 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 1445 of file class.ilCtrl.php.

References $_GET.

1446  {
1447  return $_GET["redirectSource"];
1448  }
$_GET["client_id"]

◆ getRequestToken()

ilCtrl::getRequestToken ( )

Get request token.

Returns
string request token for user and session

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

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

Referenced by appendRequestTokenParameterString(), and getFormActionByClass().

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

◆ getReturnClass()

ilCtrl::getReturnClass (   $a_class)

Get return class.

Parameters

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

References searchReturnClass().

1481  {
1482  if (is_object($a_class))
1483  {
1484  $class = strtolower(get_class($a_class));
1485  }
1486  else
1487  {
1488  $class = strtolower($a_class);
1489  }
1490  return $this->searchReturnClass($class);
1491  }
searchReturnClass($a_class)
Determine current return class.
+ Here is the call graph for this function:

◆ getTabs()

ilCtrl::getTabs ( )

Get tabs array (.

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

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

References $tab.

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

◆ getTargetScript()

ilCtrl::getTargetScript ( )

Get target script name.

Returns
string target script name

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

References $target_script.

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

909  {
910  return $this->target_script;
911  }
+ 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 1518 of file class.ilCtrl.php.

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

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

1519  {
1520  // note: $a_class may be an array!
1521  //$a_class = strtolower($a_class);
1522 
1523  $params = $this->getParameterArrayByClass($a_class, $a_cmd);
1524 
1525  foreach ($params as $par => $value)
1526  {
1527  if (strlen((string) $value))
1528  {
1529  $a_str = ilUtil::appendUrlParameterString($a_str, $par."=".$value, $xml_style);
1530  }
1531  }
1532 
1533  return $a_str;
1534  }
getParameterArrayByClass($a_class, $a_cmd="")
Get all set/save parameters using gui class name.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ilCtrl()

ilCtrl::ilCtrl ( )

control class constructor

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

References $ilBench, and init().

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  }
global $ilBench
Definition: ilias.php:18
init()
initialisation
+ Here is the call graph for this function:

◆ init()

ilCtrl::init ( )

initialisation

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

References forwards().

Referenced by ilCtrl(), and initBaseClass().

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

References $_GET, and init().

923  {
924  $_GET["baseClass"] = $a_base_class;
925  $_GET["cmd"] = "";
926  $_GET["cmdClass"] = "";
927  $_GET["cmdNode"] = "";
928  $this->init();
929  }
$_GET["client_id"]
init()
initialisation
+ Here is the call graph for this function:

◆ insertCtrlCalls()

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

Insert ctrl calls record.

Parameters

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

1803  {
1804  global $ilDB;
1805 
1806  $a_parent = strtolower($a_parent);
1807  $a_child = strtolower($a_child);
1808  $a_comp_prefix = strtolower($a_comp_prefix);
1809 
1810  $set = $ilDB->query("SELECT * FROM ctrl_calls WHERE ".
1811  " parent = ".$ilDB->quote($a_parent, "text")." AND ".
1812  " child = ".$ilDB->quote($a_child, "text")." AND ".
1813  " comp_prefix = ".$ilDB->quote($a_comp_prefix, "text")
1814  );
1815  if ($rec = $ilDB->fetchAssoc($set))
1816  {
1817  return;
1818  }
1819  $ilDB->manipulate("INSERT INTO ctrl_calls ".
1820  "(parent, child, comp_prefix) VALUES (".
1821  $ilDB->quote($a_parent, "text").",".
1822  $ilDB->quote($a_child, "text").",".
1823  $ilDB->quote($a_comp_prefix, "text").
1824  ")");
1825  }

◆ isAsynch()

ilCtrl::isAsynch ( )

Is current command an asynchronous command?

Returns
boolean asynchronous t/f

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

References $_GET.

1320  {
1321  if (isset($_GET["cmdMode"]) && $_GET["cmdMode"] == "asynch")
1322  {
1323  return true;
1324  }
1325  else
1326  {
1327  return false;
1328  }
1329  }
$_GET["client_id"]

◆ lookupClassPath()

ilCtrl::lookupClassPath (   $a_class_name)

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

Parameters
string$a_class_nameclass name

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

801  {
802  global $ilDB;
803  $a_class_name = strtolower($a_class_name);
804 
805  $class_set = $ilDB->query("SELECT * FROM ctrl_classfile WHERE class = ".
806  $ilDB->quote($a_class_name, "text"));
807  $class_rec = $ilDB->fetchAssoc($class_set);
808 
809  if ($class_rec["plugin_path"] != "")
810  {
811  return $class_rec["plugin_path"]."/".$class_rec["filename"];
812  }
813  else
814  {
815  return $class_rec["filename"];
816  }
817  }

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

References forwards().

570  {
571  global $ilDB;
572 
573  $a_class = strtolower($a_class);
574 
575  $a_nr++;
576 
577  // determine call node structure
578  $this->call_node[$a_nr] = array("class" => $a_class, "parent" => $a_parent);
579 
580 //echo "<br>nr:$a_nr:class:$a_class:parent:$a_parent:";
581  $call_set = $ilDB->query("SELECT * FROM ctrl_calls WHERE parent = ".
582  $ilDB->quote(strtolower($a_class), "text").
583  " ORDER BY child", array("text"));
584  $a_parent = $a_nr;
585  while ($call_rec = $ilDB->fetchAssoc($call_set))
586  {
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  }
forwards($a_from_class, $a_to_class)
Stores which classes forwards commands to which other classes.
readCallStructure($a_class, $a_nr=0, $a_parent=0)
stores often used common call structures (called from db_update script!!!)
+ Here is the call graph for this function:

◆ readCidInfo()

ilCtrl::readCidInfo (   $a_cid)
private

Read information of class per cid.

Returns
Parameters
object$a_cidcid

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

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

1680  {
1681  global $ilDB;
1682 
1683  if (isset($this->info_read_cid[$a_cid]))
1684  {
1685  return;
1686  }
1687  $set = $ilDB->query("SELECT * FROM ctrl_classfile ".
1688  " WHERE cid = ".$ilDB->quote($a_cid, "text")
1689  );
1690  if ($rec = $ilDB->fetchAssoc($set))
1691  {
1692  $this->cid_class[$a_cid] = $rec["class"];
1693  $this->class_cid[$rec["class"]] = $a_cid;
1694 
1695  $set = $ilDB->query("SELECT * FROM ctrl_calls ".
1696  " WHERE parent = ".$ilDB->quote($rec["class"], "text")
1697  );
1698  while ($rec2 = $ilDB->fetchAssoc($set))
1699  {
1700  if (!isset($this->calls[$rec["class"]]) || !is_array($this->calls[$rec["class"]]) || !in_array($rec2["child"], $this->calls[$rec["class"]]))
1701  {
1702  if ($rec2["child"] != "")
1703  {
1704  $this->calls[$rec["class"]][] = $rec2["child"];
1705  }
1706  }
1707  }
1708  $this->info_read_class[$rec["class"]] = true;
1709  }
1710 
1711  $this->info_read_cid[$a_cid] = true;
1712  }
+ 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 1733 of file class.ilCtrl.php.

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

1734  {
1735  global $ilDB;
1736 
1737  $a_class = strtolower($a_class);
1738  if (isset($this->info_read_class[$a_class]))
1739  {
1740  return;
1741  }
1742  $set = $ilDB->query("SELECT * FROM ctrl_classfile ".
1743  " WHERE class = ".$ilDB->quote($a_class, "text")
1744  );
1745  if ($rec = $ilDB->fetchAssoc($set))
1746  {
1747  $this->cid_class[$rec["cid"]] = $a_class;
1748  $this->class_cid[$a_class] = $rec["cid"];
1749  }
1750 
1751  $set = $ilDB->query("SELECT * FROM ctrl_calls ".
1752  " WHERE parent = ".$ilDB->quote($a_class, "text")
1753  );
1754  while ($rec = $ilDB->fetchAssoc($set))
1755  {
1756  if (!isset($this->calls[$a_class]) || !is_array($this->calls[$a_class]) || !in_array($rec["child"], $this->calls[$a_class]))
1757  {
1758  if ($rec["child"] != "")
1759  {
1760  $this->calls[$a_class][] = $rec["child"];
1761  }
1762  }
1763  }
1764 
1765  $this->info_read_class[$a_class] = true;
1766  $this->info_read_cid[$this->class_cid[$a_class]] = true;
1767  }
+ 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 1719 of file class.ilCtrl.php.

References readCidInfo().

Referenced by getNodeIdForTargetClass().

1720  {
1721  $n_arr = explode(":", $a_node);
1722  foreach ($n_arr as $cid)
1723  {
1724  $this->readCidInfo($cid);
1725  }
1726  }
readCidInfo($a_cid)
Read information of class per cid.
+ 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 1280 of file class.ilCtrl.php.

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

1281  {
1282  global $ilBench;
1283 
1284  $script = $this->getLinkTargetByClass(strtolower(get_class($a_gui_obj)), $a_cmd,
1285  "", $a_asynch, false);
1286  if (is_object($ilBench))
1287  {
1288  $ilBench->save();
1289  }
1290  if ($a_anchor != "")
1291  {
1292  $script = $script."#".$a_anchor;
1293  }
1294  ilUtil::redirect($script);
1295  }
getLinkTargetByClass($a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui class name.
global $ilBench
Definition: ilias.php:18
static redirect($a_script)
http redirect to other script
+ 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 1304 of file class.ilCtrl.php.

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

1305  {
1306  $script = $this->getLinkTargetByClass($a_class, $a_cmd, "", $a_asynch, false);
1307  if ($a_anchor != "")
1308  {
1309  $script = $script."#".$a_anchor;
1310  }
1311  ilUtil::redirect($script);
1312  }
getLinkTargetByClass($a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui class name.
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ removeLastCid()

ilCtrl::removeLastCid (   $a_node)
private

Remove last cid of node.

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

Referenced by getNodeIdForTargetClass().

1782  {
1783  $lpos = strrpos($a_node, ":");
1784  return substr($a_node, 0, $lpos);
1785  }
+ 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 1423 of file class.ilCtrl.php.

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

1424  {
1425  $script = $this->getParentReturn($a_gui_obj);
1426 
1427  $script = ilUtil::appendUrlParameterString($script,
1428  "redirectSource=".strtolower(get_class($a_gui_obj)));
1429  $script = ilUtil::appendUrlParameterString($script,
1430  "cmdMode=".$_GET["cmdMode"]);
1431  if ($a_anchor != "")
1432  {
1433  $script = $script."#".$a_anchor;
1434  }
1435 
1436  ilUtil::redirect($script);
1437  }
$_GET["client_id"]
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
getParentReturn(&$a_gui_obj)
Get return script url.
static redirect($a_script)
http redirect to other script
+ 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

public

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

References saveParameterByClass().

666  {
667  if (is_object($a_obj))
668  {
669  $this->saveParameterByClass(get_class($a_obj), $a_parameter);
670  }
671  }
saveParameterByClass($a_class, $a_parameter)
Save parameter for a class.
+ 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 679 of file class.ilCtrl.php.

Referenced by saveParameter().

680  {
681  if (is_array($a_parameter))
682  {
683  foreach($a_parameter as $parameter)
684  {
685  $this->save_parameter[strtolower($a_class)][] = $parameter;
686  }
687  }
688  else
689  {
690  $this->save_parameter[strtolower($a_class)][] = $a_parameter;
691  }
692  }
+ Here is the caller graph for this function:

◆ searchReturnClass()

ilCtrl::searchReturnClass (   $a_class)
private

Determine current return class.

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

References getClassForCid(), and getNodeIdForTargetClass().

Referenced by getParentReturnByClass(), and getReturnClass().

1498  {
1499  $a_class = strtolower($a_class);
1500 
1501  $node = $this->getNodeIdForTargetClass($this->current_node, $a_class);
1502  $node = $node["node_id"];
1503  $n_arr = explode(":", $node);
1504  for($i = count($n_arr)-2; $i>=0; $i--)
1505  {
1506  if ($this->return[$this->getClassForCid($n_arr[$i])] != "")
1507  {
1508  return $this->getClassForCid($n_arr[$i]);
1509  }
1510  }
1511 
1512  return false;
1513  }
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).
getClassForCid($a_cid)
Get class for cid.
+ 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 1023 of file class.ilCtrl.php.

References $_GET.

1024  {
1025  $_GET["cmd"] = $a_cmd;
1026  }
$_GET["client_id"]

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

References $_GET, and getNodeIdForTargetClass().

1039  {
1040  $a_cmd_class = strtolower($a_cmd_class);
1041  $nr = $this->getNodeIdForTargetClass($this->current_node, $a_cmd_class);
1042  $nr = $nr["node_id"];
1043  $_GET["cmdClass"] = $a_cmd_class;
1044  $_GET["cmdNode"] = $nr;
1045  }
$_GET["client_id"]
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).
+ 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 242 of file class.ilCtrl.php.

243  {
244  $this->context_obj_id = $a_obj_id;
245  $this->context_obj_type = $a_obj_type;
246  $this->context_sub_obj_id = $a_sub_obj_id;
247  $this->context_sub_obj_type = $a_sub_obj_type;
248  }

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

Referenced by ilTestSubmissionReviewGUI\show().

718  {
719  $this->parameter[strtolower(get_class($a_obj))][$a_parameter] = $a_value;
720  }
+ 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 730 of file class.ilCtrl.php.

731  {
732  $this->parameter[strtolower($a_class)][$a_parameter] = $a_value;
733  }

◆ setReturn()

ilCtrl::setReturn ( $a_gui_obj,
  $a_cmd 
)

Set return command.

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

References getTargetScript(), and getUrlParameters().

1399  {
1400  $script = $this->getTargetScript();
1401  $script = $this->getUrlParameters(strtolower(get_class($a_gui_obj)), $script, $a_cmd);
1402 //echo "<br>setReturn:".get_class($a_gui_obj).":".$script.":<br>";
1403  $this->return[strtolower(get_class($a_gui_obj))] = $script;
1404  }
getUrlParameters($a_class, $a_str, $a_cmd="", $xml_style=false)
Get URL parameters for a class and append them to a string.
getTargetScript()
Get target script name.
+ Here is the call graph for this function:

◆ setReturnByClass()

ilCtrl::setReturnByClass (   $a_class,
  $a_cmd 
)

Set return command.

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

References getTargetScript(), and getUrlParameters().

1410  {
1411  // may not be an array!
1412  $a_class = strtolower($a_class);
1413 
1414  $script = $this->getTargetScript();
1415  $script = $this->getUrlParameters($a_class, $script, $a_cmd);
1416 //echo "<br>setReturn:".get_class($a_gui_obj).":".$script.":<br>";
1417  $this->return[strtolower($a_class)] = $script;
1418  }
getUrlParameters($a_class, $a_str, $a_cmd="", $xml_style=false)
Get URL parameters for a class and append them to a string.
getTargetScript()
Get target script name.
+ Here is the call graph for this function:

◆ setTargetScript()

ilCtrl::setTargetScript (   $a_target_script)

set target script name

Parameters
string$a_target_scripttarget script name

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

898  {
899  $this->target_script = $a_target_script;
900  }

◆ verifyToken()

ilCtrl::verifyToken ( )
private

Verify Token.

Returns
boolean valid t/f

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

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

Referenced by getCmd().

1192  {
1193  global $ilDB, $ilUser;
1194 
1195  if (is_object($ilUser) && is_object($ilDB) && $ilUser->getId() > 0 &&
1196  $ilUser->getId() != ANONYMOUS_USER_ID)
1197  {
1198  if ($_GET["rtoken"] == "")
1199  {
1200  #echo "ilCtrl::No Request Token Given!"; // for debugging, maybe changed later
1201  return false;
1202  }
1203 
1204  $set = $ilDB->query("SELECT * FROM il_request_token WHERE ".
1205  " user_id = ".$ilDB->quote($ilUser->getId(), "integer")." AND ".
1206  " token = ".$ilDB->quote($_GET[self::IL_RTOKEN_NAME]), "text");
1207  if ($ilDB->numRows($set) > 0)
1208  {
1209  // remove used token
1210  /*
1211  $ilDB->query("DELETE FROM il_request_token WHERE ".
1212  " user_id = ".$ilDB->quote($ilUser->getId())." AND ".
1213  " token = ".$ilDB->quote($_GET[self::IL_RTOKEN_NAME]));
1214  */
1215 
1216  // remove tokens from older sessions
1217  // if we do this immediately, working with multiple windows does not work:
1218  // - window one: open form (with token a)
1219  // - window two: open form (with token b)
1220  // - submit window one: a is verified, but b must not be deleted immediately, otherwise
1221  // - window two: submit results in invalid token
1222  // see also bug #13551
1223  $dt = new ilDateTime(time(),IL_CAL_UNIX);
1224  $dt->increment(IL_CAL_DAY, -1);
1225  $dt->increment(IL_CAL_HOUR, -12);
1226  $ilDB->manipulate("DELETE FROM il_request_token WHERE ".
1227  " user_id = ".$ilDB->quote($ilUser->getId(), "integer")." AND ".
1228  " session_id != ".$ilDB->quote(session_id(), "text")." AND ".
1229  " stamp < ".$ilDB->quote($dt->get(IL_CAL_DATETIME), "timestamp"));
1230  return true;
1231  }
1232  else
1233  {
1234  return false;
1235  }
1236 
1237  if ($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]] != "")
1238  {
1239  // remove used token
1240  unset($_SESSION["rtokens"][$_GET[self::IL_RTOKEN_NAME]]);
1241 
1242  // remove old tokens
1243  if (count($_SESSION["rtokens"]) > 100)
1244  {
1245  $to_remove = array();
1246  $sec = 7200; // two hours
1247 
1248  foreach($_SESSION["rtokens"] as $tok => $time)
1249  {
1250  if (time() - $time > $sec)
1251  {
1252  $to_remove[] = $tok;
1253  }
1254  }
1255  foreach($to_remove as $tok)
1256  {
1257  unset($_SESSION["rtokens"][$tok]);
1258  }
1259  }
1260 
1261  return true;
1262  }
1263  return false;
1264  }
1265  else
1266  {
1267  return true; // do not verify, if user or db object is missing
1268  }
1269 
1270  return false;
1271  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
const IL_CAL_DATETIME
$_GET["client_id"]
const IL_CAL_HOUR
const IL_CAL_UNIX
const IL_CAL_DAY
Date and time handling
global $ilUser
Definition: imgupload.php:15
+ 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.

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