3require_once(
'class.ilCachedCtrl.php');
 
   45        $this->stored_trees = array(
"ilrepositorygui", 
"ilpersonaldesktopgui",
 
   46            "illmpresentationgui", 
"illmeditorgui",
 
   47            "iladministrationgui");
 
   57        $this->
debug[] = $str;
 
   75        $this->transit = array();
 
   76        $this->forward = array();                       
 
   78        $this->parent = array();                        
 
   79        $this->save_parameter = array();        
 
   80        $this->parameter = array();                     
 
   81        $this->
return = array();                        
 
   82        $this->location = array();
 
   84        $this->current_node = 0;
 
   85        $this->module_dir = 
"";
 
   86        $this->service_dir = 
"";
 
   87        $this->call_node = array();
 
   88        $this->root_class = 
"";
 
  103        $baseClass = strtolower(
$_GET[
"baseClass"]);
 
  106        $mc_rec = $module_class->lookupModuleClass($baseClass);
 
  113        $class = $mc_rec[
"class"];
 
  114        $class_dir = $mc_rec[
"dir"];
 
  117            $m_set = 
$ilDB->query(
"SELECT * FROM il_component WHERE name = " .
 
  119            $m_rec = 
$ilDB->fetchAssoc($m_set);
 
  120            $this->module_dir = $m_rec[
"type"] . 
"/" . $m_rec[
"name"];
 
  121            include_once $this->module_dir . 
"/" . $class_dir . 
"/class." . $class . 
".php";
 
  127            $mc_rec = $module_class->lookupServiceClass($baseClass);
 
  130            $class = $mc_rec[
"class"];
 
  131            $class_dir = $mc_rec[
"dir"];
 
  134                include_once(
"./Services/UICore/exceptions/class.ilCtrlException.php");
 
  135                throw new ilCtrlException(
"Could not find entry in modules.xml or services.xml for " .
 
  136                    $baseClass . 
" <br/>" . str_replace(
"&", 
"<br />&", htmlentities(
$_SERVER[
"REQUEST_URI"])));
 
  146            $this->service_dir = $m_rec[
"type"] . 
"/" . $m_rec[
"name"];
 
  148            include_once $this->service_dir . 
"/" . $class_dir . 
"/class." . $class . 
".php";
 
  154        $base_class_gui = 
new $class();
 
  163        return $this->module_dir;
 
  177        $class = strtolower(get_class($a_gui_object));
 
  180        $nr = $nr[
"node_id"];
 
  182            $current_node = $this->current_node;
 
  184            $this->current_node = $nr;
 
  188            $this->call_hist[] = array(
"class" => get_class($a_gui_object),
 
  189                    "mode" => 
"execComm", 
"cmd" => $this->
getCmd());
 
  192            $html = $a_gui_object->executeCommand();
 
  195            $this->current_node = $current_node;
 
  200        include_once(
"./Services/UICore/exceptions/class.ilCtrlException.php");
 
  213        $class = strtolower(get_class($a_gui_object));
 
  216        $nr = $nr[
"node_id"];
 
  218            $current_node = $this->current_node;
 
  221            $this->current_node = $nr;
 
  225            $this->call_hist[] = array(
"class" => get_class($a_gui_object),
 
  226                    "mode" => 
"getHtml", 
"cmd" => $this->
getCmd());
 
  229            $html = $a_gui_object->getHTML();
 
  232            $this->current_node = $current_node;
 
  238        include_once(
"./Services/UICore/exceptions/class.ilCtrlException.php");
 
  251    public function setContext($a_obj_id, $a_obj_type, $a_sub_obj_id = 0, $a_sub_obj_type = 
"")
 
  253        $this->context_obj_id = $a_obj_id;
 
  254        $this->context_obj_type = $a_obj_type;
 
  255        $this->context_sub_obj_id = $a_sub_obj_id;
 
  256        $this->context_sub_obj_type = $a_sub_obj_type;
 
  266        return $this->context_obj_id;
 
  276        return $this->context_obj_type;
 
  286        return $this->context_sub_obj_id;
 
  296        return $this->context_sub_obj_type;
 
  319        $class = strtolower($a_class);
 
  322        if ($a_par_node === 0 || $a_par_node == 
"") {
 
  333            return array(
"node_id" => $a_par_node,
 
  340            in_array($a_class, $this->calls[$this->
getClassForCid($node_cid)])) {
 
  341            return array(
"node_id" => $a_par_node . 
":" . $this->
getCidForClass($class),
 
  347        if ($par_cid != 
"") {
 
  349                in_array($a_class, $this->calls[$this->
getClassForCid($par_cid)])) {
 
  350                return array(
"node_id" =>
 
  358        while ($temp_node != 
"") {
 
  361                return array(
"node_id" => $temp_node,
 
  369        if ($a_class != 
"") {
 
  371            $mc_rec = $module_class->lookupModuleClass($class);
 
  372            $n_class = $mc_rec[
'lower_class'];
 
  381            if ($n_class == 
"") {
 
  382                $mc_rec =  $module_class->lookupServiceClass($class);
 
  383                $n_class = $mc_rec[
'lower_class'];
 
  391            if ($n_class != 
"") {
 
  394                    "base_class" => $class);
 
  408        error_log(
"ERROR: Can't find target class $a_class for node $a_par_node " .
 
  415        include_once(
"./Services/UICore/exceptions/class.ilCtrlException.php");
 
  416        throw new ilCtrlException(
"ERROR: Can't find target class $a_class for node $a_par_node " .
 
  428        if (!is_array($a_class)) {
 
  429            $a_class = array($a_class);
 
  432        $nr = $this->current_node;
 
  433        foreach ($a_class as $class) {
 
  434            $class = strtolower($class);
 
  441            $nr = $nr[
"node_id"];
 
  456        return $_GET[
"cmdNode"];
 
  466    public function addLocation($a_title, $a_link, $a_target = 
"", $a_ref_id = 0)
 
  468        $this->location[] = array(
"title" => $a_title,
 
  469            "link" => $a_link, 
"target" => $a_target, 
"ref_id" => $a_ref_id);
 
  490    public function addTab($a_lang_var, $a_link, $a_cmd, $a_class)
 
  492        $a_class = strtolower($a_class);
 
  494        $this->tab[] = array(
"lang_var" => $a_lang_var,
 
  495            "link" => $a_link, 
"cmd" => $a_cmd, 
"class" => $a_class);
 
  574        $a_class = strtolower($a_class);
 
  579        $this->call_node[$a_nr] = array(
"class" => $a_class, 
"parent" => $a_parent);
 
  582        $call_set = 
$ilDB->query(
"SELECT * FROM ctrl_calls WHERE parent = " .
 
  583            $ilDB->quote(strtolower($a_class), 
"text") .
 
  584            " ORDER BY child", array(
"text"));
 
  586        while ($call_rec = 
$ilDB->fetchAssoc($call_set)) {
 
  588            $forw[] = $call_rec[
"child"];
 
  596        $this->root_class = $a_class;
 
  607    private function forwards($a_from_class, $a_to_class)
 
  609        $a_from_class = strtolower($a_from_class);
 
  611        if (is_array($a_to_class)) {
 
  612            foreach ($a_to_class as $to_class) {
 
  613                if ($a_from_class != 
"" && $to_class != 
"") {
 
  614                    if (!is_array($this->forward[$a_from_class]) || !in_array(strtolower($to_class), $this->forward[$a_from_class])) {
 
  615                        $this->forward[$a_from_class][] = strtolower($to_class);
 
  617                    if (!is_array($this->parent[strtolower($to_class)]) || !in_array($a_from_class, $this->parent[strtolower($to_class)])) {
 
  618                        $this->parent[strtolower($to_class)][] = $a_from_class;
 
  623            $to_class = $a_to_class;
 
  624            if ($a_from_class != 
"" && $to_class != 
"") {
 
  625                if (!is_array($this->forward[$a_from_class]) || !in_array(strtolower($to_class), $this->forward[$a_from_class])) {
 
  626                    $this->forward[$a_from_class][] = strtolower($to_class);
 
  628                if (!is_array($this->parent[strtolower($to_class)]) || !in_array($a_from_class, $this->parent[strtolower($to_class)])) {
 
  629                    $this->parent[strtolower($to_class)][] = $a_from_class;
 
  657        if (is_object($a_obj)) {
 
  670        if (is_array($a_parameter)) {
 
  671            foreach ($a_parameter as $parameter) {
 
  672                $this->save_parameter[strtolower($a_class)][] = $parameter;
 
  675            $this->save_parameter[strtolower($a_class)][] = $a_parameter;
 
  704        $this->parameter[strtolower(get_class($a_obj))][$a_parameter] = $a_value;
 
  717        $this->parameter[strtolower($a_class)][$a_parameter] = $a_value;
 
  729        unset($this->parameter[strtolower($a_class)][$a_parameter]);
 
  751        $this->parameter[strtolower($a_class)] = array();
 
  758        $objDefinition = 
$DIC[
"objDefinition"];
 
  761        if (
$_GET[
"gotolp"] &&
 
  763            $ref_id = 
$_GET[
"ref_id"];
 
  765                $ref_id = $_REQUEST[
"ref_id"];
 
  768            $gui_class = get_class($a_gui_obj);
 
  770            if ($gui_class == 
"ilSAHSEditGUI") {
 
  772                include_once 
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
 
  776                        $class = 
"ilObjSCORM2004LearningModuleGUI";
 
  780                        $class = 
"ilObjSCORMLearningModuleGUI";
 
  784                        $class = 
"ilObjAICCLearningModuleGUI";
 
  788                        $class = 
"ilObjHACPLearningModuleGUI";
 
  791                if (
$GLOBALS[
"ilAccess"]->checkAccess(
"edit_learning_progress", 
"", $ref_id)) {
 
  792                    $this->
redirectByClass(array($gui_class, $class, 
"illearningprogressgui", 
"illplistofsettingsgui"), 
"");
 
  796            elseif ($gui_class == 
"ilLMPresentationGUI") {
 
  798                $this->
redirectByClass(array(
"ilLMEditorGUI", 
"ilObjLearningModuleGUI"), 
"");
 
  801            include_once 
"Services/Object/classes/class.ilObjectLP.php";
 
  803            $class = 
"ilObj" . $objDefinition->getClassName(
$type) . 
"GUI";
 
  805            if ($gui_class == $class &&
 
  807                $GLOBALS[
"ilAccess"]->checkAccess(
"edit_learning_progress", 
"", $ref_id)) {
 
  812                    $a_cmd_node = $obj_node[
"node_id"];
 
  817                $_GET[
"cmdNode"] = $lp_settings_node[
"node_id"];
 
  818                $_GET[
"cmdClass"] = 
"ilLPListOfSettingsGUI";
 
  820                return "illearningprogressgui";
 
  837        if ($cmdNode == 
"") {
 
  842            if ($this->current_node == $cmdNode) {
 
  867        $a_class_name = strtolower($a_class_name);
 
  870        $class_rec = $cached_ctrl->lookupClassFile($a_class_name);
 
  876        if ($class_rec[
"plugin_path"] != 
"") {
 
  877            return $class_rec[
"plugin_path"] . 
"/" . $class_rec[
"filename"];
 
  879            return $class_rec[
"filename"];
 
  893        $path = pathinfo($a_class_path);
 
  895        $class = substr(
$file, 6, strlen(
$file) - 10);
 
  911        if ($a_source_node == 
"1") {
 
  914        if (substr($a_target_node, 0, strlen($a_source_node)) != $a_source_node) {
 
  915            $failure =  
"ERROR: Path not found. Source:" . $a_source_node .
 
  916                ", Target:" . $a_target_node;
 
  918                include_once(
"./Services/UICore/exceptions/class.ilCtrlException.php");
 
  922            $this->
redirectToURL(
'./ilias.php?baseClass=ilRepositoryGUI');
 
  925        $temp_node = $a_source_node;
 
  928        if ($a_source_node != 
"") {
 
  929            $path = array($a_source_node);
 
  932        $diffstart = ($a_source_node == 
"")
 
  934            : strlen($a_source_node) + 1;
 
  935        $diff = substr($a_target_node, $diffstart);
 
  937        $diff_arr = explode(
":", $diff);
 
  938        foreach ($diff_arr as $cid) {
 
  939            if ($temp_node != 
"") {
 
  943            $path[] = $temp_node;
 
  957        $this->target_script = $a_target_script;
 
  982        $_GET[
"baseClass"] = $a_base_class;
 
  984        $_GET[
"cmdClass"] = 
"";
 
  985        $_GET[
"cmdNode"] = 
"";
 
  996    public function getCmd($a_default_cmd = 
"", $a_safe_commands = 
"")
 
  999        if (isset(
$_GET[
"cmd"])) {
 
 1000            $cmd = 
$_GET[
"cmd"];
 
 1002        if ($cmd == 
"post") {
 
 1006            $cmd = @key(
$_POST[
"cmd"]);
 
 1009            if ($this->verified_cmd != 
"") {
 
 1010                return $this->verified_cmd;
 
 1013                    (!is_array($a_safe_commands) || !in_array($cmd, $a_safe_commands))) {
 
 1014                    return $a_default_cmd;
 
 1018            $this->verified_cmd = $cmd;
 
 1019            if ($cmd == 
"" && isset(
$_POST[
"table_top_cmd"])) {         
 
 1020                $cmd = @key(
$_POST[
"table_top_cmd"]);
 
 1021                $this->verified_cmd = $cmd;
 
 1024            if ($cmd == 
"" && isset(
$_POST[
"select_cmd2"])) {           
 
 1025                if (isset(
$_POST[
"select_cmd_all2"])) {
 
 1028                    $_POST[
"select_cmd_all"] = 
$_POST[
"select_cmd_all2"] = 
null;
 
 1030                $cmd = 
$_POST[
"selected_cmd2"];
 
 1031                $this->verified_cmd = $cmd;
 
 1033            if ($cmd == 
"" && isset(
$_POST[
"select_cmd"])) {            
 
 1034                if (isset(
$_POST[
"select_cmd_all"])) {
 
 1037                    $_POST[
"select_cmd_all"] = 
$_POST[
"select_cmd_all2"] = 
null;
 
 1039                $cmd = 
$_POST[
"selected_cmd"];
 
 1040                $this->verified_cmd = $cmd;
 
 1043                $cmd = 
$_GET[
"fallbackCmd"];
 
 1044                $this->verified_cmd = $cmd;
 
 1048            $cmd = $a_default_cmd;
 
 1065        $_GET[
"cmd"] = $a_cmd;
 
 1080        $a_cmd_class = strtolower($a_cmd_class);
 
 1082        $nr = $nr[
"node_id"];
 
 1083        $_GET[
"cmdClass"] = $a_cmd_class;
 
 1084        $_GET[
"cmdNode"] = $nr;
 
 1094        return strtolower(
$_GET[
"cmdClass"]);
 
 1109        $a_fallback_cmd = 
"",
 
 1115            strtolower(get_class($a_gui_obj)),
 
 1136        $a_fallback_cmd = 
"",
 
 1141        if (!is_array($a_class)) {
 
 1142            $a_class = strtolower($a_class);
 
 1152        if ($a_fallback_cmd != 
"") {
 
 1160        if ($a_anchor != 
"") {
 
 1161            $script = $script . 
"#" . $a_anchor;
 
 1195        if ($this->rtoken != 
"") {
 
 1199                $ilUser->getId() != ANONYMOUS_USER_ID) {
 
 1200                $res = 
$ilDB->query(
"SELECT token FROM il_request_token WHERE user_id = " .
 
 1202                    " AND session_id = " . 
$ilDB->quote(session_id(), 
"text"));
 
 1205                if ($rec[
"token"] != 
"") {
 
 1206                    $this->rtoken = $rec[
"token"];
 
 1207                    return $rec[
"token"];
 
 1210                $random = new \ilRandom();
 
 1211                $this->rtoken = md5(uniqid($random->int(), 
true));
 
 1214                if ($random->int(1, 200) == 2) {
 
 1218                    $dq = 
"DELETE FROM il_request_token WHERE " .
 
 1220                    $ilDB->manipulate($dq);
 
 1227                $ilDB->manipulate(
"INSERT INTO il_request_token (user_id, token, stamp, session_id) VALUES " .
 
 1230                    $ilDB->quote($this->rtoken, 
"text") . 
"," .
 
 1231                    $ilDB->now() . 
"," .
 
 1232                    $ilDB->quote(session_id(), 
"text") . 
")");
 
 1255            $ilUser->getId() != ANONYMOUS_USER_ID) {
 
 1256            if (
$_GET[
"rtoken"] == 
"") {
 
 1257                #echo "ilCtrl::No Request Token Given!";                
 
 1261            $set = 
$ilDB->query(
"SELECT * FROM il_request_token WHERE " .
 
 1262                " user_id = " . 
$ilDB->quote(
$ilUser->getId(), 
"integer") . 
" AND " .
 
 1263                " token = " . 
$ilDB->quote(
$_GET[self::IL_RTOKEN_NAME]), 
"text");
 
 1264            if (
$ilDB->numRows($set) > 0) {
 
 1282                $ilDB->manipulate(
"DELETE FROM il_request_token WHERE " .
 
 1283                    " user_id = " . 
$ilDB->quote(
$ilUser->getId(), 
"integer") . 
" AND " .
 
 1284                    " session_id != " . 
$ilDB->quote(session_id(), 
"text") . 
" AND " .
 
 1296                if (count(
$_SESSION[
"rtokens"]) > 100) {
 
 1297                    $to_remove = array();
 
 1301                        if (time() - 
$time > $sec) {
 
 1302                            $to_remove[] = $tok;
 
 1305                    foreach ($to_remove as $tok) {
 
 1327    public function redirect($a_gui_obj, $a_cmd = 
"", $a_anchor = 
"", $a_asynch = 
false)
 
 1330            strtolower(get_class($a_gui_obj)),
 
 1336        if ($a_anchor != 
"") {
 
 1337            $script = $script . 
"#" . $a_anchor;
 
 1350        $ilPluginAdmin = 
null;
 
 1351        if (isset(
$DIC[
"ilPluginAdmin"])) {
 
 1352            $ilPluginAdmin = 
$DIC[
"ilPluginAdmin"];
 
 1355        if (!is_int(strpos($a_script, 
"://"))) {
 
 1356            if (substr($a_script, 0, 1) != 
"/" && 
defined(
"ILIAS_HTTP_PATH")) {
 
 1357                if (is_int(strpos(
$_SERVER[
"PHP_SELF"], 
"/setup/"))) {
 
 1358                    $a_script = 
"setup/" . $a_script;
 
 1360                $a_script = ILIAS_HTTP_PATH . 
"/" . $a_script;
 
 1365        if (is_object($ilPluginAdmin)) {
 
 1366            $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE, 
"UIComponent", 
"uihk");
 
 1367            foreach ($pl_names as $pl) {
 
 1369                $gui_class = $ui_plugin->getUIClassInstance();
 
 1370                $resp = $gui_class->getHTML(
"Services/Utilities", 
"redirect", array( 
"html" => $a_script ));
 
 1372                    $a_script = $gui_class->modifyHTML($a_script, $resp);
 
 1381        session_write_close();
 
 1385        switch (
$http->request()->getHeaderLine(
'Accept')) {
 
 1386            case 'application/json':
 
 1389                    'message'      => 
'Called redirect after async fileupload request',
 
 1390                    "redirect_url" => $a_script,
 
 1395                $http->saveResponse(
$http->response()->withAddedHeader(
"Location", $a_script));
 
 1398        $http->sendResponse();
 
 1412        if ($a_anchor != 
"") {
 
 1413            $script = $script . 
"#" . $a_anchor;
 
 1425        if (isset(
$_GET[
"cmdMode"]) && 
$_GET[
"cmdMode"] == 
"asynch") {
 
 1452            strtolower(get_class($a_gui_obj)),
 
 1496            $script.= $amp . 
"cmdMode=asynch";
 
 1499        if ($a_anchor != 
"") {
 
 1500            $script = $script . 
"#" . $a_anchor;
 
 1512        $script = $this->
getUrlParameters(strtolower(get_class($a_gui_obj)), $script, $a_cmd);
 
 1514        $this->
return[strtolower(get_class($a_gui_obj))] = $script;
 
 1523        $a_class = strtolower($a_class);
 
 1528        $this->
return[strtolower($a_class)] = $script;
 
 1540            "redirectSource=" . strtolower(get_class($a_gui_obj))
 
 1544            "cmdMode=" . 
$_GET[
"cmdMode"]
 
 1546        if ($a_anchor != 
"") {
 
 1547            $script = $script . 
"#" . $a_anchor;
 
 1561        return $_GET[
"redirectSource"];
 
 1578        $a_class = strtolower($a_class);
 
 1583            return $this->
return[$ret_class];
 
 1595        if (is_object($a_class)) {
 
 1596            $class = strtolower(get_class($a_class));
 
 1598            $class = strtolower($a_class);
 
 1609        $a_class = strtolower($a_class);
 
 1612        $node = $node[
"node_id"];
 
 1613        $n_arr = explode(
":", $node);
 
 1614        for (
$i = count($n_arr)-2; 
$i>=0; 
$i--) {
 
 1633        foreach (
$params as $par => $value) {
 
 1634            if (strlen((
string) $value)) {
 
 1661        if ($a_class == 
"") {
 
 1665        if (!is_array($a_class)) {
 
 1666            $a_class = array($a_class);
 
 1669        $nr = $this->current_node;
 
 1670        foreach ($a_class as $class) {
 
 1671            $class = strtolower($class);
 
 1673            if ($nr[
"base_class"] != 
"") {
 
 1674                $new_baseclass = $nr[
"base_class"];
 
 1676            $nr = $nr[
"node_id"];
 
 1677            $target_class = $class;
 
 1684        foreach (
$path as $node_id) {
 
 1685            $class = ($node_id == 
"")
 
 1686                ? strtolower(
$_GET[
"baseClass"])
 
 1688            if (isset($this->save_parameter[$class]) && is_array($this->save_parameter[$class])) {
 
 1689                foreach ($this->save_parameter[$class] as $par) {
 
 1690                    if (isset(
$_GET[$par])) {
 
 1692                    } elseif (isset(
$_POST[$par])) {
 
 1698            if (isset($this->parameter[$class]) && is_array($this->parameter[$class])) {
 
 1699                foreach ($this->parameter[$class] as $par => $value) {
 
 1709        $params[
"cmdClass"] = $target_class;
 
 1711        if ($new_baseclass == 
"") {
 
 1714            $params[
"baseClass"] = $new_baseclass;
 
 1725        if ($this->class_cid[$a_class] == 
"") {
 
 1728        if ($this->class_cid[$a_class] == 
"") {
 
 1733                $add = 
"<br><br>Please make sure your GUI class name ends with 'GUI' and that the filename is 'class.[YourClassName].php'. In exceptional cases you 
 1734                                        may solve the issue by putting an empty * @ilCtrl_Calls [YourClassName]: into your class header." .
 
 1735                    " In both cases you need to reload the control structure in the setup.";
 
 1737            include_once(
"./Services/UICore/exceptions/class.ilCtrlException.php");
 
 1738            throw new ilCtrlException(
"Cannot find cid for class " . $a_class . 
"." . $add);
 
 1740        return $this->class_cid[$a_class];
 
 1748        if ($this->cid_class[$a_cid] == 
"") {
 
 1751        if ($this->cid_class[$a_cid] == 
"") {
 
 1752            include_once(
"./Services/UICore/exceptions/class.ilCtrlException.php");
 
 1753            throw new ilCtrlException(
"Cannot find class for cid " . $a_cid . 
".");
 
 1755        return $this->cid_class[$a_cid];
 
 1765        if (isset($this->info_read_cid[$a_cid])) {
 
 1770        $rec = $cached_ctrl->lookupCid($a_cid);
 
 1773            $this->cid_class[$a_cid] = $rec[
"class"];
 
 1774            $this->class_cid[$rec[
"class"]] = $a_cid;
 
 1776            $calls = $cached_ctrl->lookupCall($rec[
"class"]);
 
 1778            foreach (
$calls as $rec2) {
 
 1779                if (!isset($this->calls[$rec[
"class"]]) || !is_array($this->calls[$rec[
"class"]]) || !in_array($rec2[
"child"], $this->calls[$rec[
"class"]])) {
 
 1780                    if ($rec2[
"child"] != 
"") {
 
 1781                        $this->calls[$rec[
"class"]][] = $rec2[
"child"];
 
 1785            $this->info_read_class[$rec[
"class"]] = 
true;
 
 1788        $this->info_read_cid[$a_cid] = 
true;
 
 1798        $n_arr = explode(
":", $a_node);
 
 1799        foreach ($n_arr as $cid) {
 
 1811        $a_class = strtolower($a_class);
 
 1812        if (isset($this->info_read_class[$a_class])) {
 
 1817        $rec = $cached_ctrl->lookupClassFile($a_class);
 
 1825            $this->cid_class[$rec[
"cid"]] = $a_class;
 
 1826            $this->class_cid[$a_class] = $rec[
"cid"];
 
 1832        $recs = $cached_ctrl->lookupCall($a_class);
 
 1834        foreach ($recs as $rec) {
 
 1835            if (!isset($this->calls[$a_class]) || !is_array($this->calls[$a_class]) || !in_array($rec[
"child"], $this->calls[$a_class])) {
 
 1836                if ($rec[
"child"] != 
"") {
 
 1837                    $this->calls[$a_class][] = $rec[
"child"];
 
 1842        $this->info_read_class[$a_class] = 
true;
 
 1843        $this->info_read_cid[$this->class_cid[$a_class]] = 
true;
 
 1851        $n_arr = explode(
":", $a_node);
 
 1852        return $n_arr[count($n_arr) - 2];
 
 1860        $lpos = strrpos($a_node, 
":");
 
 1861        return substr($a_node, 0, $lpos);
 
 1869        $n_arr = explode(
":", $a_node);
 
 1870        return $n_arr[count($n_arr) - 1];
 
 1886        $a_parent = strtolower($a_parent);
 
 1887        $a_child = strtolower($a_child);
 
 1888        $a_comp_prefix = strtolower($a_comp_prefix);
 
 1890        $set = 
$ilDB->query(
 
 1891            "SELECT * FROM ctrl_calls WHERE " .
 
 1892            " parent = " . 
$ilDB->quote($a_parent, 
"text") . 
" AND " .
 
 1893            " child = " . 
$ilDB->quote($a_child, 
"text") . 
" AND " .
 
 1894            " comp_prefix = " . 
$ilDB->quote($a_comp_prefix, 
"text")
 
 1896        if ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1899        $ilDB->manipulate(
"INSERT INTO ctrl_calls " .
 
 1900            "(parent, child, comp_prefix) VALUES (" .
 
 1901            $ilDB->quote($a_parent, 
"text") . 
"," .
 
 1902            $ilDB->quote($a_child, 
"text") . 
"," .
 
 1903            $ilDB->quote($a_comp_prefix, 
"text") .
 
 1916        foreach (explode(
":", $this->
getCmdNode()) as $cid) {
 
 1917            if ($cid != 
"" && strtolower($this->
getClassForCid($cid)) == strtolower($gui_class)) {
 
An exception for terminatinating execution or to throw for unit testing.
static ofString($string)
Creates a new stream with an initial value.
static getComponentInfo($a_type, $a_name)
This class provides processing control methods.
appendRequestTokenParameterString($a_url, $xml_style=true)
Append request token as url parameter.
getCidForClass($a_class, $a_check=false)
Get Cid for Class.
checkLPSettingsForward($a_gui_obj, $a_cmd_node)
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui class name.
getCallHistory()
Get controller call history.
setCmdClass($a_cmd_class)
Set the current command class.
clearParameterByClass($a_class, $a_parameter)
Same as setParameterByClass, except that a class name is passed.
getCmd($a_default_cmd="", $a_safe_commands="")
Determines current get/post command.
getParentReturnByClass($a_class)
Get return script url.
getContextSubObjId()
Get context subobject id.
getContextObjId()
Get context object id.
getCmdNode()
Get command target node.
readCallStructure($a_class, $a_nr=0, $a_parent=0)
stores often used common call structures (called from db_update script!!!)
getParentCidOfNode($a_node)
Get last but one cid of node id.
getFormActionByClass( $a_class, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get form action url for gui class name.
readCidInfo($a_cid)
Read information of class per cid.
getParentReturn($a_gui_obj)
Get return script url.
getTargetScript()
Get target script name.
getModuleDir()
get directory of current module
verifyToken()
Verify Token.
addTab($a_lang_var, $a_link, $a_cmd, $a_class)
Add a tab to tabs array (.
removeLastCid($a_node)
Remove last cid of node.
setReturn($a_gui_obj, $a_cmd)
Set return command.
__construct()
control class constructor
getPathNew($a_source_node, $a_target_node)
Get path in call structure.
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).
getDebug()
Get debug message string (.
checkCurrentPathForClass($gui_class)
Check if current path contains a certain gui class.
getCmdClass()
Determines class that should execute the current command.
getNextClass($a_gui_class=null)
Get next class in the control path from the current class to the target command class.
getCallStructure($a_class)
Get call structure of class context.
debug($str)
Collect debugging strings (.
getRequestToken()
Get request token.
getRedirectSource()
Get current redirect source.
searchReturnClass($a_class)
Determine current return class.
getClassForClasspath($a_class_path)
this method assumes that the class path has the format "dir/class.<class_name>.php"
readNodeInfo($a_node)
Read info of node.
returnToParent($a_gui_obj, $a_anchor="")
Redirects to next parent class that used setReturn.
setContext($a_obj_id, $a_obj_type, $a_sub_obj_id=0, $a_sub_obj_type="")
Set context of current user interface.
getTabs()
Get tabs array (.
setTargetScript($a_target_script)
set target script name
setReturnByClass($a_class, $a_cmd)
Set return command.
getFormAction( $a_gui_obj, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get form action url for gui class object.
getHTML($a_gui_object)
Gets an HTML output from another GUI class and returns the flow of control to the calling class.
readClassInfo($a_class)
Read info of class.
getReturnClass($a_class)
Get return class.
getContextObjType()
Get context object type.
getCurrentCidOfNode($a_node)
Get last cid of node id.
callBaseClass()
Calls base class of current request.
getUrlParameters($a_class, $a_str, $a_cmd="", $xml_style=false)
Get URL parameters for a class and append them to a string.
getParameterArrayByClass($a_class, $a_cmd="")
Get all set/save parameters using gui class name.
saveParameter($a_obj, $a_parameter)
Set parameters that should be passed in every form and link of a gui class.
getContextSubObjType()
Get context subobject type.
isAsynch()
Is current command an asynchronous command?
setParameterByClass($a_class, $a_parameter, $a_value)
Same as setParameterByClass, except that a class name is passed.
clearParametersByClass($a_class)
Clears all parameters that have been set via setParameter for a GUI class.
insertCtrlCalls($a_parent, $a_child, $a_comp_prefix)
Insert ctrl calls record.
redirectByClass($a_class, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to other gui class using class name.
lookupClassPath($a_class_name)
Get class path that can be used in include statements for a given class name.
saveParameterByClass($a_class, $a_parameter)
Save parameter for a class.
redirect($a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to another command.
getClassForCid($a_cid)
Get class for cid.
forwardCommand($a_gui_object)
Forward flow of control to next gui class this invokes the executeCommand() method of the gui object ...
setCmd($a_cmd)
Set the current command.
clearParameters($a_obj)
Clears all parameters that have been set via setParameter for a GUI class.
checkTargetClass($a_class)
Check whether target is valid.
forwards($a_from_class, $a_to_class)
Stores which classes forwards commands to which other classes.
getLinkTarget( $a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui object.
setParameter($a_obj, $a_parameter, $a_value)
Set parameters that should be passed a form and link of a gui class.
initBaseClass($a_base_class)
Initialises new base class.
addLocation($a_title, $a_link, $a_target="", $a_ref_id=0)
Add a location to the locator array (.
getLocations()
Get locations array (.
getParameterArray($a_gui_obj, $a_cmd="")
Get all set/save parameters for a gui object.
@classDescription Date and time handling
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static isSupportedObjectType($a_type)
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupType($a_id, $a_reference=false)
lookup object type
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if($modEnd===false) $module
$stream
PHP stream implementation.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
foreach($_POST as $key=> $value) $res
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']