/**
  * Get the bb menu incl. script
  */
 function getBBMenu($a_ta_name = "par_content")
 {
     global $lng, $ilCtrl;
     include_once "./Services/COPage/classes/class.ilPageEditorSettings.php";
     $btpl = new ilTemplate("tpl.bb_menu.html", true, true, "Services/COPage");
     // not nice, should be set by context per method
     //if ($this->pg_obj->getParentType() == "gdf" ||
     //	$this->pg_obj->getParentType() == "lm" ||
     //	$this->pg_obj->getParentType() == "dbk")
     if ($this->getPageConfig()->getEnableInternalLinks()) {
         $btpl->setCurrentBlock("bb_ilink_button");
         $btpl->setVariable("BB_LINK_ILINK", $this->ctrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp"));
         $btpl->parseCurrentBlock();
         // add int link parts
         include_once "./Services/Link/classes/class.ilInternalLinkGUI.php";
         $btpl->setCurrentBlock("int_link_prep");
         $btpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML($ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"), "", false, true, false), true));
         $btpl->parseCurrentBlock();
     }
     if ($this->getPageConfig()->getEnableKeywords()) {
         $btpl->touchBlock("bb_kw_button");
         $btpl->setVariable("TXT_KW", $this->lng->txt("cont_text_keyword"));
     }
     if ($this->pg_obj->getParentType() == "wpg") {
         $btpl->setCurrentBlock("bb_wikilink_button2");
         $btpl->setVariable("TXT_WIKI_BUTTON2", $lng->txt("obj_wiki"));
         $btpl->setVariable("WIKI_BUTTON2_URL", $ilCtrl->getLinkTargetByClass("ilwikipagegui", ""));
         $btpl->parseCurrentBlock();
         $btpl->setCurrentBlock("bb_wikilink_button");
         $btpl->setVariable("TXT_WLN2", $lng->txt("wiki_wiki_page"));
         $btpl->parseCurrentBlock();
     }
     $mathJaxSetting = new ilSetting("MathJax");
     $style = $this->getStyle();
     //echo URL_TO_LATEX;
     foreach (self::$common_bb_buttons as $c => $st) {
         if (ilPageEditorSettings::lookupSettingByParentType($this->pg_obj->getParentType(), "active_" . $c, true)) {
             if ($c != "tex" || $mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) {
                 $btpl->touchBlock("bb_" . $c . "_button");
                 $btpl->setVariable("TXT_" . strtoupper($c), $this->lng->txt("cont_text_" . $c));
             }
         }
     }
     if ($this->getPageConfig()->getEnableAnchors()) {
         $btpl->touchBlock("bb_anc_button");
         $btpl->setVariable("TXT_ANC", $lng->txt("cont_anchor") . ":");
     }
     // footnote
     //		$btpl->setVariable("TXT_FN", $this->lng->txt("cont_text_fn"));
     //		$btpl->setVariable("TXT_CODE", $this->lng->txt("cont_text_code"));
     $btpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
     //		$btpl->setVariable("TXT_XLN", $this->lng->txt("cont_text_xln"));
     //		$btpl->setVariable("TXT_TEX", $this->lng->txt("cont_text_tex"));
     $btpl->setVariable("TXT_BB_TIP", $this->lng->txt("cont_bb_tip"));
     $btpl->setVariable("TXT_WLN", $lng->txt("wiki_wiki_page"));
     $btpl->setVariable("PAR_TA_NAME", $a_ta_name);
     return $btpl->get();
 }
 /**
  * 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;
 }
Example #3
0
 /**
  * display content of page
  */
 function showPage()
 {
     global $tree, $ilUser, $lng, $ilCtrl, $ilSetting, $ilTabs;
     // jquery and jquery ui are always provided for components
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     iljQueryUtil::initjQuery();
     iljQueryUtil::initjQueryUI();
     //		$this->initSelfAssessmentRendering();
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
     ilObjMediaObjectGUI::includePresentationJS($GLOBALS["tpl"]);
     $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
     // needed for overlays in iim
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     ilOverlayGUI::initJavascript();
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     ilPlayerUtil::initMediaElementJs($GLOBALS["tpl"]);
     // init template
     //if($this->outputToTemplate())
     //{
     if ($this->getOutputMode() == "edit") {
         //echo ":".$this->getTemplateTargetVar().":";
         $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
         //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
         // to do: status dependent class
         $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
         // user comment
         if ($this->isEnabledChangeComments()) {
             $tpl->setCurrentBlock("change_comment");
             $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
             $tpl->parseCurrentBlock();
         }
         $tpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormActionByClass("ilpageeditorgui", "", "", true));
         // determine media, html and javascript mode
         $sel_media_mode = $ilUser->getPref("ilPageEditor_MediaMode") == "disable" ? "disable" : "enable";
         $sel_html_mode = $ilUser->getPref("ilPageEditor_HTMLMode") == "disable" ? "disable" : "enable";
         $sel_js_mode = "disable";
         //if($ilSetting->get("enable_js_edit", 1))
         //{
         $sel_js_mode = ilPageEditorGUI::_doJSEditing() ? "enable" : "disable";
         //}
         // show prepending html
         $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
         $tpl->setVariable("TXT_CONFIRM_DELETE", $lng->txt("cont_confirm_delete"));
         // presentation view
         if ($this->getViewPageLink() != "") {
             $ilTabs->addNonTabbedLink("pres_view", $this->lng->txt("cont_presentation_view"), $this->getViewPageLink(), $this->getViewPageTarget());
         }
         // show actions drop down
         $this->addActionsMenu($tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode);
         // get js files for JS enabled editing
         if ($sel_js_mode == "enable") {
             $this->insertHelp($tpl);
             include_once "./Services/YUI/classes/class.ilYuiUtil.php";
             ilYuiUtil::initDragDrop();
             ilYuiUtil::initConnection();
             ilYuiUtil::initPanel(false);
             $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
             $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
             include_once './Services/Style/classes/class.ilObjStyleSheet.php';
             $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();\n\t\t\t\t\t\tpreloader.src = './templates/default/images/loader.svg';\n\t\t\t\t\t\tilCOPage.setContentCss('" . ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) . ", " . ilUtil::getStyleSheetLocation() . ", ./Services/COPage/css/tiny_extra.css" . "')");
             //$GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
             $GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_1_5/tinymce.js");
             $tpl->touchBlock("init_dragging");
             $cfg = $this->getPageConfig();
             $tpl->setVariable("IL_TINY_MENU", self::getTinyMenu($this->getPageObject()->getParentType(), $cfg->getEnableInternalLinks(), $cfg->getEnableWikiLinks(), $cfg->getEnableKeywords(), $this->getStyleId(), true, true, $cfg->getEnableAnchors()));
             // add int link parts
             include_once "./Services/Link/classes/class.ilInternalLinkGUI.php";
             $tpl->setCurrentBlock("int_link_prep");
             $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML($ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"), "", false, true, false)));
             $tpl->parseCurrentBlock();
             include_once "./Services/YUI/classes/class.ilYuiUtil.php";
             ilYuiUtil::initConnection();
             $GLOBALS["tpl"]->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
         }
         // multiple actions
         $cnt_pcs = $this->getPageObject()->countPageContents();
         if ($cnt_pcs > 1 || $this->getPageObject()->getParentType() != "qpl" && $cnt_pcs > 0) {
             $tpl->setCurrentBlock("multi_actions");
             if ($sel_js_mode == "enable") {
                 $tpl->setVariable("ONCLICK_DE_ACTIVATE_SELECTED", 'onclick="return ilEditMultiAction(\'activateSelected\');"');
                 $tpl->setVariable("ONCLICK_DELETE_SELECTED", 'onclick="return ilEditMultiAction(\'deleteSelected\');"');
                 $tpl->setVariable("ONCLICK_ASSIGN_CHARACTERISTIC", 'onclick="return ilEditMultiAction(\'assignCharacteristicForm\');"');
                 $tpl->setVariable("ONCLICK_COPY_SELECTED", 'onclick="return ilEditMultiAction(\'copySelected\');"');
                 $tpl->setVariable("ONCLICK_CUT_SELECTED", 'onclick="return ilEditMultiAction(\'cutSelected\');"');
                 $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
                 $tpl->setVariable("ONCLICK_SELECT_ALL", 'onclick="return ilEditMultiAction(\'selectAll\');"');
             }
             $tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable"));
             $tpl->setVariable("TXT_ASSIGN_CHARACTERISTIC", $this->lng->txt("cont_assign_characteristic"));
             $tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected"));
             $tpl->setVariable("TXT_COPY_SELECTED", $this->lng->txt("copy"));
             $tpl->setVariable("TXT_CUT_SELECTED", $this->lng->txt("cut"));
             $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
             $tpl->parseCurrentBlock();
         }
     } else {
         // presentation or preview here
         $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage");
         if ($this->getEnabledPageFocus()) {
             $tpl->touchBlock("page_focus");
         }
         include_once "./Services/User/classes/class.ilUserUtil.php";
         // presentation
         if ($this->isPageContainerToBeRendered()) {
             $tpl->touchBlock("page_container_1");
             $tpl->touchBlock("page_container_2");
             $tpl->touchBlock("page_container_3");
         }
         // history
         $c_old_nr = $this->getPageObject()->old_nr;
         if ($c_old_nr > 0 || $this->getCompareMode() || $_GET["history_mode"] == 1) {
             $hist_info = $this->getPageObject()->getHistoryInfo($c_old_nr);
             if (!$this->getCompareMode()) {
                 $ilCtrl->setParameter($this, "history_mode", "1");
                 // previous revision
                 if (is_array($hist_info["previous"])) {
                     $tpl->setCurrentBlock("previous_rev");
                     $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
                     $ilCtrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
                     $tpl->setVariable("HREF_PREV", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                 } else {
                     $tpl->setCurrentBlock("previous_rev_disabled");
                     $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
                     $tpl->parseCurrentBlock();
                 }
                 // next revision
                 if ($c_old_nr > 0) {
                     $tpl->setCurrentBlock("next_rev");
                     $tpl->setVariable("TXT_NEXT_REV", $lng->txt("cont_next_rev"));
                     $ilCtrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]);
                     $tpl->setVariable("HREF_NEXT", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                     // latest revision
                     $tpl->setCurrentBlock("latest_rev");
                     $tpl->setVariable("TXT_LATEST_REV", $lng->txt("cont_latest_rev"));
                     $ilCtrl->setParameter($this, "old_nr", "");
                     $tpl->setVariable("HREF_LATEST", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                 }
                 $ilCtrl->setParameter($this, "history_mode", "");
                 // rollback
                 if ($c_old_nr > 0 && $ilUser->getId() != ANONYMOUS_USER_ID) {
                     $tpl->setCurrentBlock("rollback");
                     $ilCtrl->setParameter($this, "old_nr", $c_old_nr);
                     $tpl->setVariable("HREF_ROLLBACK", $ilCtrl->getLinkTarget($this, "rollbackConfirmation"));
                     $ilCtrl->setParameter($this, "old_nr", "");
                     $tpl->setVariable("TXT_ROLLBACK", $lng->txt("cont_rollback"));
                     $tpl->parseCurrentBlock();
                 }
             }
             $tpl->setCurrentBlock("hist_nav");
             $tpl->setVariable("TXT_REVISION", $lng->txt("cont_revision"));
             $tpl->setVariable("VAL_REVISION_DATE", ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME)));
             $tpl->setVariable("VAL_REV_USER", ilUserUtil::getNamePresentation($hist_info["current"]["user_id"]));
             $tpl->parseCurrentBlock();
         }
     }
     if ($this->getOutputMode() != IL_PAGE_PRESENTATION && $this->getOutputMode() != IL_PAGE_OFFLINE && $this->getOutputMode() != IL_PAGE_PREVIEW && $this->getOutputMode() != IL_PAGE_PRINT) {
         $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
     }
     // output media object edit list (of media links)
     if ($this->getOutputMode() == "edit") {
         $links = ilInternalLink::_getTargetsOfSource($this->obj->getParentType() . ":pg", $this->obj->getId(), $this->obj->getLanguage());
         $mob_links = array();
         foreach ($links as $link) {
             if ($link["type"] == "mob") {
                 if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob") {
                     $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"]) . " [" . $link["id"] . "]";
                 }
             }
         }
         // linked media objects
         if (count($mob_links) > 0) {
             $tpl->setCurrentBlock("med_link");
             $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
             $tpl->setVariable("SEL_MED_LINKS", ilUtil::formSelect(0, "mob_id", $mob_links, false, true));
             $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
             $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
             //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
             $tpl->parseCurrentBlock();
         }
         // content snippets used
         include_once "./Services/COPage/classes/class.ilPCContentInclude.php";
         $snippets = ilPCContentInclude::collectContentIncludes($this->getPageObject(), $this->getPageObject()->getDomDoc());
         if (count($snippets) > 0) {
             foreach ($snippets as $s) {
                 include_once "./Modules/MediaPool/classes/class.ilMediaPoolPage.php";
                 $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
             }
             $tpl->setCurrentBlock("med_link");
             $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
             $tpl->setVariable("SEL_SNIPPETS", ilUtil::formSelect(0, "ci_id", $sn_arr, false, true));
             $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
             $tpl->parseCurrentBlock();
         }
         // scheduled activation?
         if (!$this->getPageObject()->getActive() && $this->getPageObject()->getActivationStart() != "" && $this->getPageConfig()->getEnableScheduledActivation()) {
             $tpl->setCurrentBlock("activation_txt");
             $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $lng->txt("cont_scheduled_activation"));
             $tpl->setVariable("SA_FROM", ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getActivationStart(), IL_CAL_DATETIME)));
             $tpl->setVariable("SA_TO", ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getActivationEnd(), IL_CAL_DATETIME)));
             $tpl->parseCurrentBlock();
         }
     }
     if ($_GET["reloadTree"] == "y") {
         $tpl->setCurrentBlock("reload_tree");
         if ($this->obj->getParentType() == "dbk") {
             $tpl->setVariable("LINK_TREE", $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer", "", false, false));
         } else {
             $tpl->setVariable("LINK_TREE", $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false));
         }
         $tpl->parseCurrentBlock();
     }
     //		}
     // get content
     $builded = $this->obj->buildDom();
     // manage hierarchical ids
     if ($this->getOutputMode() == "edit") {
         // add pc ids, if necessary
         if (!$this->obj->checkPCIds()) {
             $this->obj->insertPCIds();
             $this->obj->update(true, true);
         }
         $this->obj->addFileSizes();
         $this->obj->addHierIDs();
         $hids = $this->obj->getHierIds();
         $row1_ids = $this->obj->getFirstRowIds();
         $col1_ids = $this->obj->getFirstColumnIds();
         $litem_ids = $this->obj->getListItemIds();
         $fitem_ids = $this->obj->getFileItemIds();
         // standard menues
         $hids = $this->obj->getHierIds();
         foreach ($hids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_" . $hid);
             $tpl->parseCurrentBlock();
         }
         // column menues for tables
         foreach ($col1_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_r" . $hid);
             $tpl->parseCurrentBlock();
         }
         // row menues for tables
         foreach ($row1_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_c" . $hid);
             $tpl->parseCurrentBlock();
         }
         // list item menues
         foreach ($litem_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
             $tpl->parseCurrentBlock();
         }
         // file item menues
         foreach ($fitem_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
             $tpl->parseCurrentBlock();
         }
     } else {
         $this->obj->addFileSizes();
     }
     //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>";
     //echo "<br>-".htmlentities($this->getLinkXML())."-";
     // set default link xml, if nothing was set yet
     if (!$this->link_xml_set) {
         $this->setDefaultLinkXml();
     }
     //$content = $this->obj->getXMLFromDom(false, true, true,
     //	$this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
     $link_xml = $this->getLinkXML();
     // disable/enable auto margins
     if ($this->getStyleId() > 0) {
         if (ilObject::_lookupType($this->getStyleId()) == "sty") {
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $style = new ilObjStyleSheet($this->getStyleId());
             $template_xml = $style->getTemplateXML();
             $disable_auto_margins = "n";
             if ($style->lookupStyleSetting("disable_auto_margins")) {
                 $disable_auto_margins = "y";
             }
         }
     }
     if ($this->getAbstractOnly()) {
         $content = "<dummy><PageObject><PageContent><Paragraph>" . $this->obj->getFirstParagraphText() . $link_xml . "</Paragraph></PageContent></PageObject></dummy>";
     } else {
         $content = $this->obj->getXMLFromDom(false, true, true, $link_xml . $this->getQuestionXML() . $template_xml . $this->getComponentPluginsXML());
     }
     // check validation errors
     if ($builded !== true) {
         $this->displayValidationError($builded);
     } else {
         $this->displayValidationError($_SESSION["il_pg_error"]);
     }
     unset($_SESSION["il_pg_error"]);
     if (isset($_SESSION["citation_error"])) {
         ilUtil::sendFailure($this->lng->txt("cont_citation_selection_not_valid"));
         ilSession::clear("citation_error");
     }
     // get title
     $pg_title = $this->getPresentationTitle();
     $col_path = ilUtil::getImagePath("col.svg");
     $row_path = ilUtil::getImagePath("row.svg");
     $item_path = ilUtil::getImagePath("item.svg");
     if ($this->getOutputMode() != "offline") {
         $enlarge_path = ilUtil::getImagePath("enlarge.svg");
         $wb_path = ilUtil::getWebspaceDir("output") . "/";
     } else {
         $enlarge_path = "images/enlarge.svg";
         $wb_path = "";
     }
     $pg_title_class = $this->getOutputMode() == "print" ? "ilc_PrintPageTitle" : "";
     // page splitting only for learning modules and
     // digital books
     $enable_split_new = $this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk" ? "y" : "n";
     // page splitting to next page only for learning modules and
     // digital books if next page exists in tree
     if (($this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk") && ilObjContentObject::hasSuccessorPage($this->obj->getParentId(), $this->obj->getId())) {
         $enable_split_next = "y";
     } else {
         $enable_split_next = "n";
     }
     $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
     if ($this->getPageConfig()->getEnablePCType("Tabs")) {
         //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
         //ilYuiUtil::initTabView();
         include_once "./Services/Accordion/classes/class.ilAccordionGUI.php";
         ilAccordionGUI::addJavaScript();
         ilAccordionGUI::addCss();
     }
     $file_download_link = $this->determineFileDownloadLink();
     $fullscreen_link = $this->determineFullscreenLink();
     $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
     // default values for various parameters (should be used by
     // all instances in the future)
     $media_mode = $this->getOutputMode() == "edit" ? $ilUser->getPref("ilPageEditor_MediaMode") : "enable";
     include_once "./Modules/LearningModule/classes/class.ilEditClipboard.php";
     $paste = ilEditClipboard::getAction() == "copy" && $this->getOutputMode() == "edit";
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     $flv_video_player = $this->getOutputMode() != "offline" ? ilPlayerUtil::getFlashVideoPlayerFilename(true) : ilPlayerUtil::getFlashVideoPlayerFilename(true);
     $cfg = $this->getPageConfig();
     // added UTF-8 encoding otherwise umlaute are converted too
     include_once "./Services/Maps/classes/class.ilMapUtil.php";
     $params = array('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title, ENT_QUOTES, "UTF-8"), 'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n", 'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class, 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path, 'img_col' => $col_path, 'img_row' => $row_path, 'img_item' => $item_path, 'enable_split_new' => $enable_split_new, 'enable_split_next' => $enable_split_next, 'link_params' => $this->link_params, 'file_download_link' => $file_download_link, 'fullscreen_link' => $fullscreen_link, 'img_path' => $img_path, 'parent_id' => $this->obj->getParentId(), 'download_script' => $this->sourcecode_download_script, 'encoded_download_script' => urlencode($this->sourcecode_download_script), 'bib_id' => $this->getBibId(), 'citation' => (int) $this->isEnabledCitation(), 'pagebreak' => $this->lng->txt('dgl_pagebreak'), 'page' => $this->lng->txt('page'), 'citate_page' => $this->lng->txt('citate_page'), 'citate_from' => $this->lng->txt('citate_from'), 'citate_to' => $this->lng->txt('citate_to'), 'citate' => $this->lng->txt('citate'), 'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n", 'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n", 'enable_map' => $cfg->getEnablePCType("Map") && ilMapUtil::isActivated() ? "y" : "n", 'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n", 'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n", 'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n", 'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n", 'enable_content_templates' => count($this->getPageObject()->getContentTemplates()) > 0 ? "y" : "n", 'paste' => $paste ? "y" : "n", 'media_mode' => $media_mode, 'javascript' => $sel_js_mode, 'paragraph_plugins' => $paragraph_plugin_string, 'disable_auto_margins' => $disable_auto_margins, 'page_toc' => $cfg->getEnablePageToc() ? "y" : "n", 'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n", 'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n", 'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n", 'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n", 'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n", 'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n", 'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n", 'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n", 'flv_video_player' => $flv_video_player);
     if ($this->link_frame != "") {
         // todo other link types
         $params["pg_frame"] = $this->link_frame;
     }
     //$content = str_replace("&nbsp;", "", $content);
     // this ensures that cache is emptied with every update
     $params["version"] = ILIAS_VERSION;
     // ensure no cache hit, if included files/media objects have been changed
     $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
     // run xslt
     $md5 = md5(serialize($params) . $link_xml . $template_xml);
     //$a = microtime();
     // check cache (same parameters, non-edit mode and rendered time
     // > last change
     if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") && !$this->getCompareMode() && !$this->getAbstractOnly() && $md5 == $this->obj->getRenderMd5() && $this->obj->getLastChange() < $this->obj->getRenderedTime() && $this->obj->getRenderedTime() != "" && $this->obj->old_nr == 0) {
         // cache hit
         $output = $this->obj->getRenderedContent();
     } else {
         $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
         $args = array('/_xml' => $content, '/_xsl' => $xsl);
         $xh = xslt_create();
         //		echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
         //		echo "mode:".$this->getOutputMode().":<br>";
         $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
         if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview") && !$this->getAbstractOnly() && $this->obj->old_nr == 0) {
             //echo "writerenderedcontent";
             $this->obj->writeRenderedContent($output, $md5);
         }
         //echo xslt_error($xh);
         xslt_free($xh);
     }
     //$b = microtime();
     //echo "$a - $b";
     //echo "<pre>".htmlentities($output)."</pre>";
     // unmask user html
     if (($this->getOutputMode() != "edit" || $ilUser->getPref("ilPageEditor_HTMLMode") != "disable") && !$this->getPageConfig()->getPreventHTMLUnmasking()) {
         $output = str_replace("&lt;", "<", $output);
         $output = str_replace("&gt;", ">", $output);
     }
     $output = str_replace("&amp;", "&", $output);
     $output = ilUtil::insertLatexImages($output);
     // insert page snippets
     $output = $this->insertContentIncludes($output);
     // insert resource blocks
     $output = $this->insertResources($output);
     // insert page toc
     if ($this->getPageConfig()->getEnablePageToc()) {
         $output = $this->insertPageToc($output);
     }
     // insert advanced output trigger
     $output = $this->insertAdvTrigger($output);
     // workaround for preventing template engine
     // from hiding paragraph text that is enclosed
     // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
     $output = $this->replaceCurlyBrackets($output);
     // remove all newlines (important for code / pre output)
     $output = str_replace("\n", "", $output);
     //echo htmlentities($output);
     $output = $this->postOutputProcessing($output);
     //echo htmlentities($output);
     if ($this->getOutputMode() == "edit" && !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation())) {
         $output = '<div class="il_editarea_disabled">' . $output . '</div>';
     }
     // for all page components...
     include_once "./Services/COPage/classes/class.ilCOPagePCDef.php";
     $defs = ilCOPagePCDef::getPCDefinitions();
     foreach ($defs as $def) {
         ilCOPagePCDef::requirePCClassByName($def["name"]);
         $pc_class = $def["pc_class"];
         $pc_obj = new $pc_class($this->getPageObject());
         // post xsl page content modification by pc elements
         $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode());
         // javascript files
         $js_files = $pc_obj->getJavascriptFiles($this->getOutputMode());
         foreach ($js_files as $js) {
             $GLOBALS["tpl"]->addJavascript($js);
         }
         // css files
         $css_files = $pc_obj->getCssFiles($this->getOutputMode());
         foreach ($css_files as $css) {
             $GLOBALS["tpl"]->addCss($css);
         }
         // onload code
         $onload_code = $pc_obj->getOnloadCode($this->getOutputMode());
         foreach ($onload_code as $code) {
             $GLOBALS["tpl"]->addOnloadCode($code);
         }
     }
     //		$output = $this->selfAssessmentRendering($output);
     // output
     if ($ilCtrl->isAsynch() && !$this->getRawPageContent() && $this->getOutputMode() == "edit") {
         // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
         if ($_GET["updated_pc_id_str"] != "") {
             echo $_GET["updated_pc_id_str"];
         }
         $tpl->setVariable($this->getTemplateOutputVar(), $output);
         $tpl->setCurrentBlock("edit_page");
         $tpl->parseCurrentBlock();
         echo $tpl->get("edit_page");
         exit;
     }
     if ($this->outputToTemplate()) {
         $tpl->setVariable($this->getTemplateOutputVar(), $output);
         $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
         return $output;
     } else {
         if ($this->getRawPageContent()) {
             return $output;
         } else {
             $tpl->setVariable($this->getTemplateOutputVar(), $output);
             return $tpl->get();
         }
     }
 }
Example #4
0
 public function getContentOutsideFormTag()
 {
     if ($this->getAllowedLinkTypes() == self::INT || $this->getAllowedLinkTypes() == self::BOTH) {
         // as the ajax-panel uses a form it has to be outside of the parent form!
         return ilInternalLinkGUI::getInitHTML("");
     }
 }
 /**
  * Manage links
  * @return 
  */
 protected function manage()
 {
     $this->checkPermission('write');
     $this->activateTabs('content', 'id_content_manage');
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.webr_manage.html', 'Modules/WebResource');
     $this->showToolbar('ACTION_BUTTONS');
     include_once './Modules/WebResource/classes/class.ilWebResourceEditableLinkTableGUI.php';
     $table = new ilWebResourceEditableLinkTableGUI($this, 'view');
     $table->parse();
     include_once './Modules/LearningModule/classes/class.ilInternalLinkGUI.php';
     $js = ilInternalLinkGUI::getInitHTML("");
     $this->tpl->addJavaScript("Modules/WebResource/js/intLink.js");
     $this->tpl->addJavascript("Services/Form/js/Form.js");
     $this->tpl->setVariable('TABLE_LINKS', $table->getHTML() . $js);
 }
 /**
  * execute command
  */
 function &executeCommand()
 {
     global $ilCtrl, $ilHelp;
     $cmd = $this->ctrl->getCmd("displayPage");
     $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() . "-";
         }
         //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 == "") {
         switch ($ctype) {
             case "src":
                 $this->ctrl->setCmdClass("ilPCSourcecodeGUI");
                 break;
             case "par":
                 $this->ctrl->setCmdClass("ilPCParagraphGUI");
                 break;
                 // advanced table
             // advanced table
             case "tab":
                 $this->ctrl->setCmdClass("ilPCTableGUI");
                 break;
                 // data table
             // data table
             case "dtab":
                 $this->ctrl->setCmdClass("ilPCDataTableGUI");
                 break;
             case "td":
                 $this->ctrl->setCmdClass("ilPCTableDataGUI");
                 break;
             case "media":
                 $this->ctrl->setCmdClass("ilPCMediaObjectGUI");
                 break;
             case "list":
                 $this->ctrl->setCmdClass("ilPCListGUI");
                 break;
             case "li":
                 $this->ctrl->setCmdClass("ilPCListItemGUI");
                 break;
             case "flst":
                 $this->ctrl->setCmdClass("ilPCFileListGUI");
                 break;
             case "flit":
                 $this->ctrl->setCmdClass("ilPCFileItemGUI");
                 break;
             case "pcqst":
                 $this->ctrl->setCmdClass("ilPCQuestionGUI");
                 break;
             case "sec":
                 $this->ctrl->setCmdClass("ilPCSectionGUI");
                 break;
             case "repobj":
                 $this->ctrl->setCmdClass("ilPCResourcesGUI");
                 break;
             case 'lpe':
                 $this->ctrl->setCmdClass('ilPCLoginPageElementGUI');
                 break;
             case "map":
                 $this->ctrl->setCmdClass("ilPCMapGUI");
                 break;
             case "tabs":
                 $this->ctrl->setCmdClass("ilPCTabsGUI");
                 break;
             case "plug":
                 $this->ctrl->setCmdClass("ilPCPluggedGUI");
                 break;
             case "plach":
                 $this->ctrl->setCmdClass("ilPCPlaceHolderGUI");
                 break;
             case "incl":
                 $this->ctrl->setCmdClass("ilPCContentIncludeGUI");
                 break;
             case "iim":
                 $this->ctrl->setCmdClass("ilPCInteractiveImageGUI");
                 break;
             case "prof":
                 $this->ctrl->setCmdClass("ilPCProfileGUI");
                 break;
             case "vrfc":
                 $this->ctrl->setCmdClass("ilPCVerificationGUI");
                 break;
             case "blog":
                 $this->ctrl->setCmdClass("ilPCBlogGUI");
                 break;
             case "qover":
                 $this->ctrl->setCmdClass("ilPCQuestionOverviewGUI");
                 break;
             case "skills":
                 $this->ctrl->setCmdClass("ilPCSkillsGUI");
                 break;
         }
         $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->int_link_def_type, $this->int_link_def_id);
             $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;
             // Sourcecode
         // Sourcecode
         case "ilpcsourcecodegui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_code");
             include_once "./Services/COPage/classes/class.ilPCSourcecodeGUI.php";
             $src_gui =& new ilPCSourcecodeGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret =& $this->ctrl->forwardCommand($src_gui);
             break;
             // Paragraph
         // Paragraph
         case "ilpcparagraphgui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_par");
             include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php";
             $par_gui =& new ilPCParagraphGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $par_gui->setEnableWikiLinks($this->page_gui->getEnabledWikiLinks());
             $par_gui->setStyleId($this->page_gui->getStyleId());
             $par_gui->setEnableInternalLinks($this->getEnableInternalLinks());
             $par_gui->setEnableKeywords($this->getEnableKeywords());
             $par_gui->setEnableAnchors($this->getEnableAnchors());
             $ret =& $this->ctrl->forwardCommand($par_gui);
             break;
             // Table
         // Table
         case "ilpctablegui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_tab");
             include_once "./Services/COPage/classes/class.ilPCTableGUI.php";
             $tab_gui =& new ilPCTableGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $tab_gui->setStyleId($this->page_gui->getStyleId());
             $ret =& $this->ctrl->forwardCommand($tab_gui);
             break;
             // Table Cell
         // Table Cell
         case "ilpctabledatagui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_td");
             include_once "./Services/COPage/classes/class.ilPCTableDataGUI.php";
             $td_gui =& new ilPCTableDataGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret =& $this->ctrl->forwardCommand($td_gui);
             break;
             // Data Table
         // Data Table
         case "ilpcdatatablegui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_dtab");
             include_once "./Services/COPage/classes/class.ilPCDataTableGUI.php";
             $tab_gui =& new ilPCDataTableGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $tab_gui->setStyleId($this->page_gui->getStyleId());
             $tab_gui->setEnableInternalLinks($this->getEnableInternalLinks());
             $tab_gui->setEnableKeywords($this->getEnableKeywords());
             $tab_gui->setEnableAnchors($this->getEnableAnchors());
             $ret =& $this->ctrl->forwardCommand($tab_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->getEnabledInternalLinks());
             $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->getEnabledInternalLinks());
             $this->tpl->setTitle($this->lng->txt("mob") . ": " . ilObject::_lookupTitle($_GET["mob_id"]));
             $ret =& $this->ctrl->forwardCommand($mob_gui);
             break;
             // List
         // List
         case "ilpclistgui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_list");
             include_once "./Services/COPage/classes/class.ilPCListGUI.php";
             $list_gui =& new ilPCListGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $list_gui->setStyleId($this->page_gui->getStyleId());
             $ret =& $this->ctrl->forwardCommand($list_gui);
             break;
             // List Item
         // List Item
         case "ilpclistitemgui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_li");
             include_once "./Services/COPage/classes/class.ilPCListItemGUI.php";
             $list_item_gui =& new ilPCListItemGUI($this->page, $cont_obj, $hier_id, $pc_id);
             //$ret =& $list_item_gui->executeCommand();
             $ret =& $this->ctrl->forwardCommand($list_item_gui);
             break;
             // File List
         // File List
         case "ilpcfilelistgui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_flst");
             include_once "./Services/COPage/classes/class.ilPCFileListGUI.php";
             $file_list_gui =& new ilPCFileListGUI($this->page, $cont_obj, $hier_id, $pc_id);
             // scorm2004-start
             $file_list_gui->setStyleId($this->page_gui->getStyleId());
             // scorm2004-end
             //$ret =& $file_list_gui->executeCommand();
             $ret =& $this->ctrl->forwardCommand($file_list_gui);
             break;
             // File List Item
         // File List Item
         case "ilpcfileitemgui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_flit");
             include_once "./Services/COPage/classes/class.ilPCFileItemGUI.php";
             $file_item_gui =& new ilPCFileItemGUI($this->page, $cont_obj, $hier_id, $pc_id);
             //$ret =& $file_item_gui->executeCommand();
             $ret =& $this->ctrl->forwardCommand($file_item_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->getEnabledSelfAssessment());
             $pc_question_gui->setPageConfig($this->page_gui->getPageConfig());
             if ($this->page_gui->getEnabledSelfAssessment()) {
                 $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;
             // PlaceHolder
         // PlaceHolder
         case "ilpcplaceholdergui":
             $this->tabs_gui->clearTargets();
             $this->tabs_gui->setBackTarget($this->page_gui->page_back_title, $ilCtrl->getLinkTarget($this->page_gui, "edit"));
             $ilHelp->setScreenIdComponent("copg_plach");
             include_once "./Services/COPage/classes/class.ilPCPlaceHolderGUI.php";
             $plch_gui =& new ilPCPlaceHolderGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $plch_gui->setEnableInternalLinks($this->getEnableInternalLinks());
             $plch_gui->setEnableKeywords($this->getEnableKeywords());
             $plch_gui->setEnableAnchors($this->getEnableAnchors());
             $plch_gui->setStyleId($this->page_gui->getStyleId());
             $ret =& $this->ctrl->forwardCommand($plch_gui);
             break;
             // Section
         // Section
         case "ilpcsectiongui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_sec");
             include_once "./Services/COPage/classes/class.ilPCSectionGUI.php";
             $sec_gui =& new ilPCSectionGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $sec_gui->setStyleId($this->page_gui->getStyleId());
             $ret =& $this->ctrl->forwardCommand($sec_gui);
             break;
             // Resources
         // Resources
         case "ilpcresourcesgui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_repobj");
             include_once "./Services/COPage/classes/class.ilPCResourcesGUI.php";
             $res_gui =& new ilPCResourcesGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret =& $this->ctrl->forwardCommand($res_gui);
             break;
             // Login Page elements
         // Login Page elements
         case 'ilpcloginpageelementgui':
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_lpe");
             include_once './Services/COPage/classes/class.ilPCLoginPageElementGUI.php';
             $res_gui = new ilPCLoginPageElementGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret = $this->ctrl->forwardCommand($res_gui);
             break;
             // Map
         // Map
         case "ilpcmapgui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_map");
             include_once "./Services/COPage/classes/class.ilPCMapGUI.php";
             $map_gui =& new ilPCMapGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret =& $this->ctrl->forwardCommand($map_gui);
             break;
             // Tabs
         // Tabs
         case "ilpctabsgui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_tabs");
             include_once "./Services/COPage/classes/class.ilPCTabsGUI.php";
             $tabs_gui =& new ilPCTabsGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $tabs_gui->setStyleId($this->page_gui->getStyleId());
             $ret =& $this->ctrl->forwardCommand($tabs_gui);
             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;
             // Content Include
         // Content Include
         case "ilpccontentincludegui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_incl");
             include_once "./Services/COPage/classes/class.ilPCContentIncludeGUI.php";
             $incl_gui = new ilPCContentIncludeGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret =& $this->ctrl->forwardCommand($incl_gui);
             break;
             // Interactive Image
         // Interactive Image
         case "ilpcinteractiveimagegui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_iim");
             include_once "./Services/COPage/classes/class.ilPCInteractiveImageGUI.php";
             $iim_gui = new ilPCInteractiveImageGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret = $this->ctrl->forwardCommand($iim_gui);
             break;
             // Profile
         // Profile
         case "ilpcprofilegui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_prof");
             include_once "./Services/COPage/classes/class.ilPCProfileGUI.php";
             $prof_gui = new ilPCProfileGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret = $this->ctrl->forwardCommand($prof_gui);
             break;
             // Verification
         // Verification
         case "ilpcverificationgui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_vrfc");
             include_once "./Services/COPage/classes/class.ilPCVerificationGUI.php";
             $vrfc_gui = new ilPCVerificationGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret = $this->ctrl->forwardCommand($vrfc_gui);
             break;
             // Blog
         // Blog
         case "ilpcbloggui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_blog");
             include_once "./Services/COPage/classes/class.ilPCBlogGUI.php";
             $blog_gui = new ilPCBlogGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret = $this->ctrl->forwardCommand($blog_gui);
             break;
             // Question Overview
         // Question Overview
         case "ilpcquestionoverviewgui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_qover");
             include_once "./Services/COPage/classes/class.ilPCQuestionOverviewGUI.php";
             $qover_gui =& new ilPCQuestionOverviewGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret = $this->ctrl->forwardCommand($qover_gui);
             break;
             // Skills
         // Skills
         case "ilpcskillsgui":
             $this->tabs_gui->clearTargets();
             $ilHelp->setScreenIdComponent("copg_skills");
             include_once "./Services/COPage/classes/class.ilPCSkillsGUI.php";
             $skills_gui = new ilPCSkillsGUI($this->page, $cont_obj, $hier_id, $pc_id);
             $ret = $this->ctrl->forwardCommand($skills_gui);
             break;
         default:
             if ($cmd == "pasteFromClipboard") {
                 $ret = $this->pasteFromClipboard($hier_id);
             } else {
                 if ($cmd == "paste") {
                     $ret = $this->paste($hier_id);
                 } else {
                     $ret = $this->{$cmd}();
                 }
             }
             break;
     }
     return $ret;
 }
 /**
  * Render item
  */
 function render()
 {
     global $lng, $ilCtrl;
     // parse settings
     $has_int = $has_ext = $has_radio = false;
     switch ($this->getAllowedLinkTypes()) {
         case self::EXT:
             $has_ext = true;
             break;
         case self::INT:
             $has_int = true;
             break;
         case self::BOTH:
             $has_int = true;
             $has_ext = true;
             $has_radio = true;
             break;
     }
     // external
     if ($has_ext) {
         $title = $has_radio ? $lng->txt("url") : "";
         // external
         $ti = new ilTextInputGUI($title, $this->getPostVar());
         $ti->setMaxLength(200);
         $ti->setSize(50);
     }
     // internal
     if ($has_int) {
         $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", $this->getPostVar());
         $link = array(get_class($this->getParent()), "ilformpropertydispatchgui", get_class($this), "ilinternallinkgui");
         $link = $ilCtrl->getLinkTargetByClass($link, "", false, true, false);
         $ilCtrl->setParameterByClass("ilformpropertydispatchgui", "postvar", "");
         $no_disp_class = strpos($this->getValue(), "|") ? "" : " ilNoDisplay";
         $itpl = new ilTemplate('tpl.prop_link.html', true, true, 'Services/Form');
         $itpl->setVariable("VAL_ID", $this->getPostVar());
         $itpl->setVariable("URL_EDIT", $link);
         $itpl->setVariable("TXT_EDIT", $lng->txt("form_get_link"));
         $itpl->setVariable("CSS_REMOVE", $no_disp_class);
         $itpl->setVariable("TXT_REMOVE", $lng->txt("remove"));
         $ne = new ilNonEditableValueGUI($lng->txt("object"), $this->getPostVar() . "_val", true);
         // hidden field for selected value
         $hidden_type = new ilHiddenInputGUI($this->getPostVar() . "_ajax_type");
         $hidden_id = new ilHiddenInputGUI($this->getPostVar() . "_ajax_id");
         $hidden_target = new ilHiddenInputGUI($this->getPostVar() . "_ajax_target");
     }
     // mode
     if ($has_radio) {
         $ext = new ilRadioOption($lng->txt("form_link_external"), "ext");
         $ext->addSubItem($ti);
         $int = new ilRadioOption($lng->txt("form_link_internal"), "int");
         $int->addSubItem($ne);
         $mode = new ilRadioGroupInputGUI("", $this->getPostVar() . "_mode");
         $mode->addOption($ext);
         $mode->addOption($int);
     } else {
         $mode = new ilHiddenInputGUI($this->getPostVar() . "_mode");
         if ($has_int) {
             $mode->setValue("int");
         } else {
             $mode->setValue("ext");
         }
     }
     // value
     $value = $this->getValue();
     if ($value) {
         if ($has_int && strpos($value, "|")) {
             $mode->setValue("int");
             $value_trans = self::getTranslatedValue($value);
             $value = explode("|", $value);
             $hidden_type->setValue($value[0]);
             $hidden_id->setValue($value[1]);
             $hidden_target->setValue($value[2]);
             $itpl->setVariable("VAL_OBJECT_TYPE", $value_trans["type"]);
             $itpl->setVariable("VAL_OBJECT_NAME", $value_trans["name"]);
         } else {
             if ($has_ext) {
                 $mode->setValue("ext");
                 $ti->setValue($value);
             }
         }
     }
     // #10185 - default for external urls
     if ($has_ext && !$ti->getValue()) {
         $ti->setValue("http://");
     }
     $ne->setValue($itpl->get());
     // to html
     if ($has_radio) {
         $html = $mode->render();
     } else {
         $html = $mode->getToolbarHTML();
         if ($has_ext) {
             $html .= $ti->getToolbarHTML();
         } else {
             $html .= $ne->render() . '<div class="ilFormInfo">' . $ne->getInfo() . '</div>';
         }
     }
     // js for internal link
     if ($has_int) {
         include_once "./Modules/LearningModule/classes/class.ilInternalLinkGUI.php";
         $html .= $hidden_type->getToolbarHTML() . $hidden_id->getToolbarHTML() . $hidden_target->getToolbarHTML() . ilInternalLinkGUI::getInitHTML("");
     }
     return $html;
 }
 /**
  * Edit a single map area
  *
  * @param	boolean		$a_get_next_coordinate		enable next coordinate input
  * @param	boolean		$a_output_new_area			output the new area
  * @param	boolean		$a_save_from				output save form
  * @param	string		$a_edit_property			"" | "link" | "shape"
  */
 function editMapArea($a_get_next_coordinate = false, $a_output_new_area = false, $a_save_form = false, $a_edit_property = "", $a_area_nr = 0)
 {
     global $ilCtrl, $lng, $tpl;
     $area_type = $_SESSION["il_map_edit_area_type"];
     $coords = $_SESSION["il_map_edit_coords"];
     include_once "./Services/MediaObjects/classes/class.ilMapArea.php";
     $cnt_coords = ilMapArea::countCoords($coords);
     $this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "Services/MediaObjects");
     $this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
     if ($a_edit_property != "link") {
         switch ($area_type) {
             // rectangle
             case "Rect":
                 if ($cnt_coords == 0) {
                     ilUtil::sendInfo($lng->txt("cont_click_tl_corner"));
                 }
                 if ($cnt_coords == 1) {
                     ilUtil::sendInfo($lng->txt("cont_click_br_corner"));
                 }
                 break;
                 // circle
             // circle
             case "Circle":
                 if ($cnt_coords == 0) {
                     ilUtil::sendInfo($lng->txt("cont_click_center"));
                 }
                 if ($cnt_coords == 1) {
                     ilUtil::sendInfo($lng->txt("cont_click_circle"));
                 }
                 break;
                 // polygon
             // polygon
             case "Poly":
                 if ($cnt_coords == 0) {
                     ilUtil::sendInfo($lng->txt("cont_click_starting_point"));
                 } else {
                     if ($cnt_coords < 3) {
                         ilUtil::sendInfo($lng->txt("cont_click_next_point"));
                     } else {
                         ilUtil::sendInfo($lng->txt("cont_click_next_or_save"));
                     }
                 }
                 break;
         }
     }
     // map properties input fields (name and link)
     if ($a_save_form) {
         if ($a_edit_property != "shape") {
             // prepare link gui
             $ilCtrl->setParameter($this, "linkmode", "map");
             include_once "./Services/Link/classes/class.ilInternalLinkGUI.php";
             $this->tpl->setCurrentBlock("int_link_prep");
             $this->tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML($ilCtrl->getLinkTargetByClass("ilinternallinkgui", "", false, true, false)));
             $this->tpl->parseCurrentBlock();
         }
         $form = $this->initAreaEditingForm($a_edit_property);
         $this->tpl->setVariable("FORM", $form->getHTML());
     }
     $this->makeMapWorkCopy($a_edit_property, $a_area_nr, $a_output_new_area, $area_type, $coords);
     $edit_mode = $a_get_next_coordinate ? "get_coords" : ($a_output_new_area ? "new_area" : "");
     $output = $this->getImageMapOutput($edit_mode);
     $this->tpl->setVariable("IMAGE_MAP", $output);
     return $this->tpl->get();
 }
 /**
  * Edit data of table
  */
 function editData()
 {
     global $lng, $ilCtrl;
     if (!ilPageEditorGUI::_doJSEditing()) {
         return $this->editDataCl();
     }
     //var_dump($_GET);
     //var_dump($_POST);
     $this->setTabs();
     $this->displayValidationError();
     include_once "./Services/COPage/classes/class.ilPCParagraph.php";
     //$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata2.html", "Services/COPage");
     //$dtpl = $this->tpl;
     $dtpl = new ilTemplate("tpl.tabledata2.html", true, true, "Services/COPage");
     $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
     $dtpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormAction($this, "updateJS"));
     // get all rows
     $xpc = xpath_new_context($this->dom);
     $path = "//PageContent[@HierId='" . $this->getHierId() . "']" . "/Table/TableRow";
     $res =& xpath_eval($xpc, $path);
     for ($i = 0; $i < count($res->nodeset); $i++) {
         $xpc2 = xpath_new_context($this->dom);
         $path2 = "//PageContent[@HierId='" . $this->getHierId() . "']" . "/Table/TableRow[{$i}+1]/TableData";
         $res2 =& xpath_eval($xpc2, $path2);
         // if this is the first row -> col icons
         if ($i == 0) {
             for ($j = 0; $j < count($res2->nodeset); $j++) {
                 if ($j == 0) {
                     $dtpl->touchBlock("empty_td");
                 }
                 if ($j == 0) {
                     if (count($res2->nodeset) == 1) {
                         $move_type = "none";
                     } else {
                         $move_type = "forward";
                     }
                 } else {
                     if ($j == count($res2->nodeset) - 1) {
                         $move_type = "backward";
                     } else {
                         $move_type = "both";
                     }
                 }
                 $dtpl->setCurrentBlock("col_icon");
                 $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
                 $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.svg"));
                 $dtpl->setVariable("COL_ONCLICK", "COL_" . $move_type);
                 $dtpl->setVariable("NR", $j);
                 $dtpl->parseCurrentBlock();
             }
             $dtpl->setCurrentBlock("row");
             $dtpl->parseCurrentBlock();
         }
         for ($j = 0; $j < count($res2->nodeset); $j++) {
             // first col: row icons
             if ($j == 0) {
                 if ($i == 0) {
                     if (count($res->nodeset) == 1) {
                         $move_type = "none";
                     } else {
                         $move_type = "forward";
                     }
                 } else {
                     if ($i == count($res->nodeset) - 1) {
                         $move_type = "backward";
                     } else {
                         $move_type = "both";
                     }
                 }
                 $dtpl->setCurrentBlock("row_icon");
                 $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
                 $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.svg"));
                 $dtpl->setVariable("ROW_ONCLICK", "ROW_" . $move_type);
                 $dtpl->setVariable("NR", $i);
                 $dtpl->parseCurrentBlock();
             }
             // cell
             if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y") {
                 $dtpl->setCurrentBlock("cell");
                 if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update") {
                     $s_text = ilUtil::stripSlashes("cell_" . $i . "_" . $j, false);
                 } else {
                     $s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j), true, false);
                     include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php";
                     $s_text = ilPCParagraphGUI::xml2outputJS($s_text, "TableContent", $this->content_obj->readPCId() . "_" . $i . "_" . $j);
                 }
                 $dtpl->setVariable("PAR_TA_NAME", "cell[" . $i . "][" . $j . "]");
                 $dtpl->setVariable("PAR_TA_ID", "cell_" . $i . "_" . $j);
                 $dtpl->setVariable("PAR_TA_CONTENT", $s_text);
                 $cs = $res2->nodeset[$j]->get_attribute("ColSpan");
                 $rs = $res2->nodeset[$j]->get_attribute("RowSpan");
                 $dtpl->setVariable("WIDTH", "140");
                 $dtpl->setVariable("HEIGHT", "80");
                 if ($cs > 1) {
                     $dtpl->setVariable("COLSPAN", 'colspan="' . $cs . '"');
                     $dtpl->setVariable("WIDTH", 140 + ($cs - 1) * 146);
                 }
                 if ($rs > 1) {
                     $dtpl->setVariable("ROWSPAN", 'rowspan="' . $rs . '"');
                     $dtpl->setVariable("HEIGHT", 80 + ($rs - 1) * 86);
                 }
                 $dtpl->parseCurrentBlock();
             }
         }
         $dtpl->setCurrentBlock("row");
         $dtpl->parseCurrentBlock();
     }
     // init menues
     $types = array("row", "col");
     $moves = array("none", "backward", "both", "forward");
     $commands = array("row" => array("newRowAfter" => "cont_ed_new_row_after", "newRowBefore" => "cont_ed_new_row_before", "moveRowUp" => "cont_ed_row_up", "moveRowDown" => "cont_ed_row_down", "deleteRow" => "cont_ed_delete_row"), "col" => array("newColAfter" => "cont_ed_new_col_after", "newColBefore" => "cont_ed_new_col_before", "moveColLeft" => "cont_ed_col_left", "moveColRight" => "cont_ed_col_right", "deleteCol" => "cont_ed_delete_col"));
     foreach ($types as $type) {
         foreach ($moves as $move) {
             foreach ($commands[$type] as $command => $lang_var) {
                 if ($move == "none" && substr($command, 0, 4) == "move") {
                     continue;
                 }
                 if ($move == "backward" && in_array($command, array("movedown", "moveright")) || $move == "forward" && in_array($command, array("moveup", "moveleft"))) {
                     continue;
                 }
                 $dtpl->setCurrentBlock("menu_item");
                 $dtpl->setVariable("MENU_ITEM_TITLE", $lng->txt($lang_var));
                 $dtpl->setVariable("CMD", $command);
                 $dtpl->setVariable("TYPE", $type);
                 $dtpl->parseCurrentBlock();
             }
             $dtpl->setCurrentBlock("menu");
             $dtpl->setVariable("TYPE", $type);
             $dtpl->setVariable("MOVE", $move);
             $dtpl->parseCurrentBlock();
         }
     }
     $dtpl->setVariable("FORMACTION2", $ilCtrl->getFormAction($this, "tableAction"));
     $dtpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
     // js editing preparation
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initDragDrop();
     ilYuiUtil::initConnection();
     ilYuiUtil::initPanel(false);
     $GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_1_5/tinymce.js");
     $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
     $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
     $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();\n\t\t\tpreloader.src = './templates/default/images/loader.svg';\n\t\t\tilCOPage.setContentCss('" . ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) . ", " . ilUtil::getStyleSheetLocation() . ", ./Services/COPage/css/tiny_extra.css');\n\t\t\tilCOPage.editTD('cell_0_0');\n\t\t\t\t");
     $cfg = $this->getPageConfig();
     /*$tpl->setVariable("IL_TINY_MENU",
     		self::getTinyMenu(
     			$this->getPageObject()->getParentType(),
     			$cfg->getEnableInternalLinks(),
     			$cfg->getEnableWikiLinks(),
     			$cfg->getEnableKeywords(),
     			$this->getStyleId(), true, true,
     			$cfg->getEnableAnchors()
     		));*/
     $dtpl->setVariable("IL_TINY_MENU", ilPageObjectGUI::getTinyMenu($this->pg_obj->getParentType(), $cfg->getEnableInternalLinks(), $cfg->getEnableWikiLinks(), $cfg->getEnableKeywords(), $this->getStyleId(), false, true, $cfg->getEnableAnchors(), false));
     // add int link parts
     if ($cfg->getEnableInternalLinks() || $cfg->getEnableWikiLinks()) {
         include_once "./Services/Link/classes/class.ilInternalLinkGUI.php";
         $dtpl->setCurrentBlock("int_link_prep");
         $dtpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML($ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"), "", false, true, false)));
     }
     $this->tpl->setContent($dtpl->get());
 }