/** * execute command */ function &executeCommand() { global $ilCtrl, $ilHelp; $cmd = $this->ctrl->getCmd("displayPage"); //echo "-$cmd-"; exit; $cmdClass = strtolower($this->ctrl->getCmdClass()); $hier_id = $_GET["hier_id"]; $pc_id = $_GET["pc_id"]; if (isset($_POST["new_hier_id"])) { $hier_id = $_POST["new_hier_id"]; } //echo "GEThier_id:".$_GET["hier_id"]."<br>"; //$this->ctrl->debug("hier_id:".$hier_id); $new_type = isset($_GET["new_type"]) ? $_GET["new_type"] : $_POST["new_type"]; //echo "-$cmd-"; //var_dump($_GET); var_dump($_POST); exit; /*array 'target' => array 0 => string '' (length=0) 'commandpg' => string 'insertJS' (length=8) 'cmd' => array 'exec_pg:' => string 'Ok' (length=2) 'ajaxform_content' => string '<div class=\"ilc_text_block_Standard\">sdfsdfsd sd</div>' (length=56) 'ajaxform_char' => string '' (length=0)*/ /*array 'usedwsiwygeditor' => string '0' (length=1) 'par_characteristic' => string 'Standard' (length=8) 'par_content' => string 'adasdaasda a ' (length=14) 'par_language' => string 'en' (length=2) 'cmd' => array 'create_par' => string 'Save' (length=4)*/ if (substr($cmd, 0, 5) == "exec_") { //echo ":".key($_POST["cmd"]).":"; // check whether pc id is given $pca = explode(":", key($_POST["cmd"])); $pc_id = $pca[1]; //echo "<br />exec_pc_id:-$pc_id-"; $cmd = explode("_", $pca[0]); unset($cmd[0]); $hier_id = implode($cmd, "_"); $cmd = $_POST["command" . $hier_id]; } //echo "<br>cmd:$cmd:";exit; // strip "c" "r" of table ids from hierarchical id $first_hier_character = substr($hier_id, 0, 1); if ($first_hier_character == "c" || $first_hier_character == "r" || $first_hier_character == "i") { $hier_id = substr($hier_id, 1); } $this->page->buildDom(); $this->page->addHierIDs(); // determine command and content object if ($cmdClass != "ilfilesystemgui") { $com = explode("_", $cmd); $cmd = $com[0]; } $next_class = $this->ctrl->getNextClass($this); // determine content type if ($com[0] == "insert" || $com[0] == "create") { $cmd = $com[0]; $ctype = $com[1]; $add_type = $com[2]; if ($ctype == "mob") { $ctype = "media"; } } else { // setting cmd and cmdclass for editing of linked media if ($cmd == "editLinkedMedia") { $this->ctrl->setCmd("edit"); $cmd = "edit"; $_GET["pgEdMediaMode"] = "editLinkedMedia"; $_GET["mob_id"] = $_POST["mob_id"]; } if ($_GET["pgEdMediaMode"] == "editLinkedMedia") { $this->ctrl->setParameter($this, "pgEdMediaMode", "editLinkedMedia"); $this->ctrl->setParameter($this, "mob_id", $_GET["mob_id"]); if ($cmdClass != "ilinternallinkgui" && $cmdClass != "ilmdeditorgui" && $cmdClass != "ilimagemapeditorgui" && $cmdClass != "ilfilesystemgui") { $this->ctrl->setCmdClass("ilobjmediaobjectgui"); $cmdClass = "ilobjmediaobjectgui"; } } if (false) { var_dump($_POST); var_dump($_GET); echo ";{$cmd};" . $next_class . ";"; echo "-{$pc_id}-"; echo "-{$cmd}-" . $this->ctrl->getCmd() . "-"; exit; } //var_dump($_POST); // note: ilinternallinkgui for page: no cont_obj is received // ilinternallinkgui for mob: cont_obj is received if ($cmd != "insertFromClipboard" && $cmd != "pasteFromClipboard" && $cmd != "setMediaMode" && $cmd != "copyLinkedMediaToClipboard" && $cmd != "activatePage" && $cmd != "deactivatePage" && $cmd != "copyLinkedMediaToMediaPool" && $cmd != "showSnippetInfo" && $cmd != "deleteSelected" && $cmd != "paste" && $cmd != "copySelected" && $cmd != "cutSelected" && ($cmd != "displayPage" || $_POST["editImagemapForward_x"] != "" || $_POST["imagemap_x"] != "") && ($cmd != "displayPage" || $_POST["editImagemapForward_x"] != "") && $cmd != "activateSelected" && $cmd != "assignCharacteristicForm" && $cmd != "assignCharacteristic" && $cmd != "cancelCreate" && $cmd != "popup" && $cmdClass != "ileditclipboardgui" && $cmd != "addChangeComment" && ($cmdClass != "ilinternallinkgui" || $next_class == "ilpcmediaobjectgui")) { if ($_GET["pgEdMediaMode"] != "editLinkedMedia") { //$this->ctrl->debug("gettingContentObject (no linked media)"); //echo $hier_id."-".$pc_id; $cont_obj =& $this->page->getContentObject($hier_id, $pc_id); if (!is_object($cont_obj)) { $ilCtrl->returnToParent($this); } $ctype = $cont_obj->getType(); } } } //$this->ctrl->debug("+ctype:".$ctype."+"); // $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html"); // $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html"); if ($ctype != "media" || !is_object($cont_obj)) { if ($this->getHeader() != "") { $this->tpl->setTitle($this->getHeader()); } $this->displayLocator(); } $this->cont_obj =& $cont_obj; // special command / command class handling $this->ctrl->setParameter($this, "hier_id", $hier_id); $this->ctrl->setParameter($this, "pc_id", $pc_id); $this->ctrl->setCmd($cmd); //$next_class = $this->ctrl->getNextClass($this); //$this->ctrl->debug("+next_class:".$next_class."+"); //echo("+next_class:".$next_class."+".$ctype."+"); exit; if ($next_class == "") { include_once "./Services/COPage/classes/class.ilCOPagePCDef.php"; $pc_def = ilCOPagePCDef::getPCDefinitionByType($ctype); if (is_array($pc_def)) { $this->ctrl->setCmdClass($pc_def["pc_gui_class"]); } $next_class = $this->ctrl->getNextClass($this); } // do not do this while imagemap editing is ongoing if ($cmd == "displayPage" && $_POST["editImagemapForward_x"] == "" && $_POST["imagemap_x"] == "") { $next_class = ""; } //echo "hier_id:$hier_id:type:$type:cmd:$cmd:ctype:$ctype:next_class:$next_class:<br>"; exit; switch ($next_class) { case "ilinternallinkgui": $link_gui = new ilInternalLinkGUI($this->page_gui->getPageConfig()->getIntLinkHelpDefaultType(), $this->page_gui->getPageConfig()->getIntLinkHelpDefaultId()); $link_gui->setMode("normal"); $link_gui->setFilterWhiteList($this->page_gui->getPageConfig()->getIntLinkFilterWhiteList()); foreach ($this->page_gui->getPageConfig()->getIntLinkFilters() as $filter) { $link_gui->filterLinkType($filter); } // $link_gui->setSetLinkTargetScript( // $this->ctrl->getLinkTarget($this, "setInternalLink")); $link_gui->setReturn($this->int_link_return); if ($ilCtrl->isAsynch()) { $link_gui->setMode("asynch"); } $ret =& $this->ctrl->forwardCommand($link_gui); break; // PC Media Object // PC Media Object case "ilpcmediaobjectgui": include_once "./Services/COPage/classes/class.ilPCMediaObjectGUI.php"; $this->tabs_gui->clearTargets(); $this->tabs_gui->setBackTarget($this->page_gui->page_back_title, $ilCtrl->getLinkTarget($this->page_gui, "edit")); $pcmob_gui =& new ilPCMediaObjectGUI($this->page, $cont_obj, $hier_id, $pc_id); $pcmob_gui->setStyleId($this->page_gui->getStyleId()); $pcmob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks()); $ret =& $this->ctrl->forwardCommand($pcmob_gui); $ilHelp->setScreenIdComponent("copg_media"); break; // only for "linked" media // only for "linked" media case "ilobjmediaobjectgui": $this->tabs_gui->clearTargets(); $this->tabs_gui->setBackTarget($this->lng->txt("back"), $ilCtrl->getParentReturn($this)); $mob_gui =& new ilObjMediaObjectGUI("", $_GET["mob_id"], false, false); $mob_gui->getTabs($this->tabs_gui); $mob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks()); $this->tpl->setTitle($this->lng->txt("mob") . ": " . ilObject::_lookupTitle($_GET["mob_id"])); $ret =& $this->ctrl->forwardCommand($mob_gui); break; // Question // Question case "ilpcquestiongui": include_once "./Services/COPage/classes/class.ilPCQuestionGUI.php"; $pc_question_gui =& new ilPCQuestionGUI($this->page, $cont_obj, $hier_id, $pc_id); $pc_question_gui->setSelfAssessmentMode($this->page_gui->getPageConfig()->getEnableSelfAssessment()); $pc_question_gui->setPageConfig($this->page_gui->getPageConfig()); if ($this->page_gui->getPageConfig()->getEnableSelfAssessment()) { $this->tabs_gui->clearTargets(); $ilHelp->setScreenIdComponent("copg_pcqst"); $this->tabs_gui->setBackTarget($this->lng->txt("back"), $ilCtrl->getParentReturn($this)); $ret = $this->ctrl->forwardCommand($pc_question_gui); } else { $cmd = $this->ctrl->getCmd(); $pc_question_gui->{$cmd}(); $this->ctrl->redirectByClass(array("ilobjquestionpoolgui", get_class($cont_obj)), "editQuestion"); } break; // Plugged Component // Plugged Component case "ilpcpluggedgui": $this->tabs_gui->clearTargets(); include_once "./Services/COPage/classes/class.ilPCPluggedGUI.php"; $plugged_gui = new ilPCPluggedGUI($this->page, $cont_obj, $hier_id, $add_type, $pc_id); $ret = $this->ctrl->forwardCommand($plugged_gui); break; default: // generic calls to gui classes include_once "./Services/COPage/classes/class.ilCOPagePCDef.php"; if (ilCOPagePCDef::isPCGUIClassName($next_class, true)) { $pc_def = ilCOPagePCDef::getPCDefinitionByGUIClassName($next_class); $this->tabs_gui->clearTargets(); $this->tabs_gui->setBackTarget($this->page_gui->page_back_title, $ilCtrl->getLinkTarget($this->page_gui, "edit")); $ilHelp->setScreenIdComponent("copg_" . $pc_def["pc_type"]); ilCOPagePCDef::requirePCGUIClassByName($pc_def["name"]); $gui_class_name = $pc_def["pc_gui_class"]; $pc_gui = new $gui_class_name($this->page, $cont_obj, $hier_id, $pc_id); if ($pc_def["style_classes"]) { $pc_gui->setStyleId($this->page_gui->getStyleId()); } $pc_gui->setPageConfig($this->page_gui->getPageConfig()); $ret = $this->ctrl->forwardCommand($pc_gui); } else { // cmd belongs to ilPageEditorGUI if ($cmd == "pasteFromClipboard") { $ret = $this->pasteFromClipboard($hier_id); } else { if ($cmd == "paste") { $ret = $this->paste($hier_id); } else { $ret = $this->{$cmd}(); } } } break; } return $ret; }