public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
 {
     global $lng, $ilCtrl, $tpl;
     parent::__construct($a_id, $a_id_type, $a_parent_node_id);
     $lng->loadLanguageModule("dcl");
     if (isset($_REQUEST['table_id'])) {
         $this->table_id = $_REQUEST['table_id'];
     } elseif ($a_id > 0) {
         $this->table_id = $this->object->getMainTableId();
     }
     /**
      * @var ilCtrl $ilCtrl
      */
     if (!$ilCtrl->isAsynch()) {
         ilYuiUtil::initConnection();
         ilOverlayGUI::initJavascript();
         $tpl->addJavaScript('Modules/DataCollection/js/ilDataCollection.js');
         $tpl->addJavaScript("Modules/DataCollection/js/datacollection.js");
         $this->tpl->addOnLoadCode("ilDataCollection.setEditUrl('" . $ilCtrl->getLinkTargetByClass(array('ilrepositorygui', 'ilobjdatacollectiongui', 'ildatacollectionrecordeditgui'), 'edit', '', true) . "');");
         $this->tpl->addOnLoadCode("ilDataCollection.setCreateUrl('" . $ilCtrl->getLinkTargetByClass(array('ilrepositorygui', 'ilobjdatacollectiongui', 'ildatacollectionrecordeditgui'), 'create', '', true) . "');");
         $this->tpl->addOnLoadCode("ilDataCollection.setSaveUrl('" . $ilCtrl->getLinkTargetByClass(array('ilrepositorygui', 'ilobjdatacollectiongui', 'ildatacollectionrecordeditgui'), 'save', '', true) . "');");
         $this->tpl->addOnLoadCode("ilDataCollection.setDataUrl('" . $ilCtrl->getLinkTargetByClass(array('ilrepositorygui', 'ilobjdatacollectiongui', 'ildatacollectionrecordeditgui'), 'getRecordData', '', true) . "');");
     }
     $ilCtrl->saveParameter($this, "table_id");
 }
 public function __construct(ilLanguage $lng, ilTemplate $tpl)
 {
     $this->lng = $lng;
     $this->tpl = $tpl;
     $this->initialVisibilityEnabled = false;
     $this->questionOBJ = null;
     parent::__construct('qpl_lac_legend');
 }
 public function getHTML()
 {
     global $ilCtrl, $tpl, $lng, $ilUser;
     if (!$this->isContainer) {
         #return '';
     }
     if ($_GET['baseClass'] == 'ilSearchController') {
         //			return '';
     }
     include_once "Services/jQuery/classes/class.iljQueryUtil.php";
     iljQueryUtil::initjQuery();
     iljQueryUtil::initjQueryUI();
     $this->tpl = new ilTemplate('tpl.main_menu_search.html', true, true, 'Services/Search');
     if ($ilUser->getId() != ANONYMOUS_USER_ID && (int) $_GET["ref_id"] > 0) {
         $this->tpl->setCurrentBlock("position");
         $this->tpl->setVariable('TXT_GLOBALLY', $lng->txt("search_globally"));
         $this->tpl->setVariable('TXT_CURRENT_POSITION', $lng->txt("search_at_current_position"));
         $this->tpl->setVariable('REF_ID', (int) $_GET["ref_id"]);
         $this->tpl->setVariable('ROOT_ID', ROOT_FOLDER_ID);
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock("position_hid");
         $this->tpl->setVariable('ROOT_ID_HID', ROOT_FOLDER_ID);
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable('FORMACTION', 'ilias.php?baseClass=ilSearchController&cmd=post' . '&rtoken=' . $ilCtrl->getRequestToken() . '&fallbackCmd=remoteSearch');
     $this->tpl->setVariable('BTN_SEARCH', $this->lng->txt('search'));
     // $this->tpl->setVariable('ID_AUTOCOMPLETE', "mm_sr_auto");
     $this->tpl->setVariable('AC_DATASOURCE', "ilias.php?baseClass=ilSearchController&cmd=autoComplete");
     $this->tpl->setVariable('IMG_MM_SEARCH', ilUtil::img(ilUtil::getImagePath("icon_seas_s.png")));
     if ($ilUser->getId() != ANONYMOUS_USER_ID) {
         $this->tpl->setVariable('HREF_SEARCH_LINK', "ilias.php?baseClass=ilSearchController");
         $this->tpl->setVariable('TXT_SEARCH_LINK', $lng->txt("last_search_result"));
         $this->tpl->setVariable('TXT_SEARCH', $lng->txt("search"));
         include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $ov = new ilOverlayGUI("mm_search_menu");
         //$ov->setTrigger("main_menu_search", "none",
         //	"main_menu_search", "tr", "br");
         //$ov->setAnchor("main_menu_search", "tr", "br");
         $ov->setAutoHide(false);
         $ov->add();
     }
     return $this->tpl->get();
 }
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilDB, $lng, $ilPluginAdmin, $ilTabs, $tree;
     $ilTabs->clearTargets();
     $this->ctrl->saveParameter($this, "sequence");
     $this->ctrl->saveParameter($this, "active_id");
     $this->initAssessmentSettings();
     require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
     $this->dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this->object);
     $this->dynamicQuestionSetConfig->loadFromDb();
     $testSessionFactory = new ilTestSessionFactory($this->object);
     $this->testSession = $testSessionFactory->getSession($_GET['active_id']);
     $this->ensureExistingTestSession($this->testSession);
     $this->initProcessLocker($this->testSession->getActiveId());
     $testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
     $this->testSequence = $testSequenceFactory->getSequenceByTestSession($this->testSession);
     $this->testSequence->loadFromDb();
     include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
     iljQueryUtil::initjQuery();
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initConnectionWithAnimation();
     if ($this->object->getKioskMode()) {
         include_once 'Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php';
         ilOverlayGUI::initJavascript();
     }
     $this->handlePasswordProtectionRedirect();
     $cmd = $this->ctrl->getCmd();
     $nextClass = $this->ctrl->getNextClass($this);
     switch ($nextClass) {
         case 'ilassquestionpagegui':
             $questionId = $this->testSequence->getQuestionForSequence($this->calculateSequence());
             require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
             $page_gui = new ilAssQuestionPageGUI($questionId);
             $ret = $this->ctrl->forwardCommand($page_gui);
             break;
         case 'ilassquestionhintrequestgui':
             $questionGUI = $this->object->createQuestionGUI("", $this->testSequenceFactory->getSequenceByTestSession()->getQuestionForSequence($this->calculateSequence()));
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
             $gui = new ilAssQuestionHintRequestGUI($this, self::CMD_SHOW_QUESTION, $this->testSession, $questionGUI);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ildynamicquestionsetstatistictablegui':
             $this->ctrl->forwardCommand($this->buildQuestionSetFilteredStatisticTableGUI());
             break;
         case 'iltestpasswordprotectiongui':
             require_once 'Modules/Test/classes/class.ilTestPasswordProtectionGUI.php';
             $gui = new ilTestPasswordProtectionGUI($this->ctrl, $this->tpl, $this->lng, $this, $this->passwordChecker);
             $ret = $this->ctrl->forwardCommand($gui);
             break;
         default:
             $cmd .= 'Cmd';
             $ret =& $this->{$cmd}();
             break;
     }
     return $ret;
 }
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilDB, $lng, $ilPluginAdmin, $ilTabs, $tree;
     $ilTabs->clearTargets();
     $this->ctrl->saveParameter($this, "sequence");
     $this->ctrl->saveParameter($this, "active_id");
     require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
     $this->dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this->object);
     $this->dynamicQuestionSetConfig->loadFromDb();
     $testSessionFactory = new ilTestSessionFactory($this->object);
     $this->testSession = $testSessionFactory->getSession($_GET['active_id']);
     $testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
     $this->testSequence = $testSequenceFactory->getSequence($this->testSession);
     $this->testSequence->loadFromDb();
     include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
     iljQueryUtil::initjQuery();
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initConnectionWithAnimation();
     if ($this->object->getKioskMode()) {
         include_once 'Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php';
         ilOverlayGUI::initJavascript();
     }
     $cmd = $this->ctrl->getCmd();
     $nextClass = $this->ctrl->getNextClass($this);
     switch ($nextClass) {
         case 'ilassquestionhintrequestgui':
             $questionGUI = $this->object->createQuestionGUI("", $this->testSequenceFactory->getSequence()->getQuestionForSequence($this->calculateSequence()));
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
             $gui = new ilAssQuestionHintRequestGUI($this, $this->testSession, $questionGUI);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilfilteredquestionstablegui':
             $this->ctrl->forwardCommand($this->buildFilteredQuestionsTableGUI());
             break;
         default:
             $cmd .= 'Cmd';
             $ret =& $this->{$cmd}();
             break;
     }
     return $ret;
 }
 /**
  * Show search form
  * @return boolean
  */
 protected function showSearchForm()
 {
     global $ilCtrl, $lng;
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_usr_search.html', 'Services/Search');
     // include js needed
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     ilOverlayGUI::initJavascript();
     $this->tpl->addJavascript("./Services/Search/js/Search.js");
     $this->tpl->setVariable('FORM_ACTION', $GLOBALS['ilCtrl']->getFormAction($this, 'performSearch'));
     $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->search_cache->getQuery()));
     include_once "./Services/UIComponent/Button/classes/class.ilSubmitButton.php";
     $btn = ilSubmitButton::getInstance();
     $btn->setCommand("performSearch");
     $btn->setCaption("search");
     $this->tpl->setVariable("SUBMIT_BTN", $btn->render());
     return true;
 }
 function addToolbar($root_node)
 {
     global $lng, $ilToolbar, $tpl;
     $create_list_gui = ilCloudConnector::getItemCreationListGUIClass($this->getService());
     $list_gui_html = $create_list_gui->getGroupedListItemsHTML($this->getPermUploadItems(), $this->getPermCreateFolders());
     if ($list_gui_html) {
         // toolbar
         $ov_id = "il_add_new_cld_item_v";
         $ov_trigger_id = $ov_id . "_tr";
         $toolbar_locator = new ilLocatorGUI();
         $toolbar_locator->addItem($this->getGuiClass()->object->getTitle(), ilCloudPluginFileTreeGUI::getLinkToFolder($root_node));
         $ilToolbar->setId('xcld_toolbar');
         $ilToolbar->addText("<div class='xcld_locator'>" . $toolbar_locator->getHtml() . "</div>");
         $ilToolbar->addSeparator();
         $ilToolbar->addButton($lng->txt("cld_add_new_item"), "#", "", "", "", $ov_trigger_id, 'submit emphsubmit');
         include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $ov = new ilOverlayGUI($ov_id);
         $ov->add();
         $ov->addTrigger($ov_trigger_id, "click", $ov_trigger_id, false, "tl", "tr");
         $tpl->setVariable("SELECT_OBJTYPE_REPOS", '<div id="' . $ov_id . '" class="ilOverlay ilNoDisplay">' . $list_gui_html . '</div>');
     }
 }
 /**
  * SCO preview
  */
 function sco_preview()
 {
     global $tpl, $ilCtrl, $lng;
     // init main template
     $tpl = new ilTemplate("tpl.main.html", true, true);
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     $tpl->setBodyClass("");
     $tpl->setCurrentBlock("ContentStyle");
     $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->slm_object->getStyleSheetId()));
     $tpl->parseCurrentBlock();
     // get javascript
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     iljQueryUtil::initjQuery();
     iljQueryUtil::initjQueryUI();
     $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/pure.js");
     $tpl->addJavaScript("./Modules/Scorm2004/scripts/pager.js");
     $tpl->addOnLoadCode("pager.Init();");
     $tree = new ilTree($this->slm_object->getId());
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $meta = new ilMD($this->node_object->getSLMId(), $this->node_object->getId(), $this->node_object->getType());
     $desc_ids = $meta->getGeneral()->getDescriptionIds();
     $sco_description = $meta->getGeneral()->getDescription($desc_ids[0])->getDescription();
     // get sco template
     $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
     // navigation
     $lk = ilObjSAHSLearningModule::getAffectiveLocalization($this->node_object->getSLMId());
     ilSCORM2004Asset::renderNavigation($sco_tpl, "", $lk);
     // meta page (description and objectives)
     ilSCORM2004Asset::renderMetaPage($sco_tpl, $this->node_object, $this->node_object->getType());
     // init export (this initialises glossary template)
     ilSCORM2004PageGUI::initExport();
     $terms = $this->node_object->getGlossaryTermIds();
     // render page
     foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()), true, 'page') as $page) {
         $page_obj = new ilSCORM2004PageGUI($this->node_object->getType(), $page["obj_id"], 0, $this->slm_object->getId());
         $page_obj->setPresentationTitle($page["title"]);
         $page_obj->setOutputMode(IL_PAGE_PREVIEW);
         $page_obj->setStyleId($this->slm_object->getStyleSheetId());
         if (count($terms) > 1) {
             $page_obj->setGlossaryOverviewInfo(ilSCORM2004ScoGUI::getGlossaryOverviewId(), $this->node_object);
         }
         $sco_tpl->setCurrentBlock("page_preview");
         $html = $ilCtrl->getHTML($page_obj);
         //$sco_tpl->setVariable("PAGE_PRV", $page_obj->showPage("export"));
         $sco_tpl->setVariable("PAGE_PRV", $html);
         $sco_tpl->parseCurrentBlock();
     }
     $output = $sco_tpl->get();
     // append glossary entries on the sco level
     $output .= ilSCORM2004PageGUI::getGlossaryHTML($this->node_object);
     //insert questions
     require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
     $output = preg_replace_callback("/{{{{{(Question;)(il__qst_[0-9]+)}}}}}/", array(get_class($this), 'insertQuestion'), $output);
     //		$output = preg_replace("/&#123;/","",$output);
     //		$output = preg_replace("/&#125;/","",$output);
     $output = "<script>var ScormApi=null;" . ilQuestionExporter::questionsJS() . "</script>" . $output;
     $lk = ilObjSAHSLearningModule::getAffectiveLocalization($this->node_object->getSLMId());
     //		include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php");
     //		ilSCORM2004PageGUI::addPreparationJavascript($tpl, $lk);
     $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/question_handling.js");
     $tpl->addCss("./Modules/Scorm2004/templates/default/question_handling.css");
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     ilOverlayGUI::initJavascript();
     //inline JS
     $output .= '<script type="text/javascript" src="./Modules/Scorm2004/scripts/questions/question_handling.js"></script>';
     $tpl->setVariable("CONTENT", $output);
 }
 /**
  * Get HTML for rating of an object (and a user)
  */
 function getHTML()
 {
     global $lng;
     $categories = array();
     if ($this->enable_categories) {
         $categories = ilRatingCategory::getAllForObject($this->obj_id);
     }
     $may_rate = $this->getUserId() != ANONYMOUS_USER_ID;
     $has_overlay = false;
     if ($may_rate || $categories) {
         $has_overlay = true;
     }
     $ttpl = new ilTemplate("tpl.rating_input.html", true, true, "Services/Rating");
     // user rating
     $user_rating = 0;
     if ($may_rate) {
         $user_rating = round(ilRating::getRatingForUserAndObject($this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type, $this->getUserId()));
     }
     // (1) overall rating
     $rating = ilRating::getOverallRatingForObject($this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type);
     for ($i = 1; $i <= 5; $i++) {
         if ($i == $user_rating) {
             $ttpl->setCurrentBlock("rating_mark");
             $ttpl->setVariable("SRC_MARK", ilUtil::getImagePath("icon_rate_marker.png"));
             $ttpl->parseCurrentBlock();
         }
         $ttpl->setCurrentBlock("rating_icon");
         if ($rating["avg"] >= $i) {
             $ttpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_rate_on.png"));
         } else {
             if ($rating["avg"] + 1 <= $i) {
                 $ttpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_rate_off.png"));
             } else {
                 $nr = round(($rating["avg"] + 1 - $i) * 10);
                 $ttpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_rate_{$nr}.png"));
             }
         }
         $ttpl->setVariable("ALT_ICON", "(" . $i . "/5)");
         $ttpl->parseCurrentBlock();
     }
     $ttpl->setCurrentBlock("rating_icon");
     if ($rating["cnt"] == 0) {
         $tt = $lng->txt("rat_not_rated_yet");
     } else {
         if ($rating["cnt"] == 1) {
             $tt = $lng->txt("rat_one_rating");
         } else {
             $tt = sprintf($lng->txt("rat_nr_ratings"), $rating["cnt"]);
         }
     }
     include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
     ilTooltipGUI::addTooltip($this->id . "_tt", $tt);
     if ($rating["cnt"] > 0) {
         $ttpl->setCurrentBlock("rat_nr");
         $ttpl->setVariable("RT_NR", $rating["cnt"]);
         $ttpl->parseCurrentBlock();
     }
     // add overlay (trigger)
     if ($has_overlay) {
         include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $ov = new ilOverlayGUI($this->id);
         $ov->setTrigger("tr_" . $this->id, "click", "tr_" . $this->id);
         $ov->add();
         $ttpl->setCurrentBlock("act_rat_start");
         $ttpl->setVariable("ID", $this->id);
         $ttpl->setVariable("SRC_ARROW", ilUtil::getImagePath("mm_down_arrow_dark.png"));
         $ttpl->parseCurrentBlock();
         $ttpl->setCurrentBlock("act_rat_end");
         $ttpl->setVariable("SRC_ARROW", ilUtil::getImagePath("mm_down_arrow_dark.png"));
         $ttpl->parseCurrentBlock();
     }
     $ttpl->parseCurrentBlock();
     // (2) user rating
     if ($has_overlay) {
         $ttpl->setVariable("RATING_DETAILS", $this->renderDetails("rtov_", $may_rate, $categories));
         $ttpl->setCurrentBlock("user_rating");
         $ttpl->setVariable("ID", $this->id);
         $ttpl->parseCurrentBlock();
     }
     $ttpl->setVariable("TTID", $this->id);
     return $ttpl->get();
 }
 /**
  * Fill table row
  */
 protected function fillRow($member)
 {
     global $lng, $ilCtrl;
     include_once "./Services/Object/classes/class.ilObjectFactory.php";
     $member_id = $member["usr_id"];
     if (!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id, false))) {
         return;
     }
     $has_no_team_yet = substr($member["team_id"], 0, 3) == "nty";
     if (!$has_no_team_yet) {
         // mail sent
         if ($this->sent_col) {
             if (ilExAssignment::lookupStatusSentOfUser($this->ass_id, $member_id)) {
                 $this->tpl->setCurrentBlock("mail_sent");
                 if (($st = ilExAssignment::lookupSentTimeOfUser($this->ass_id, $member_id)) > 0) {
                     $this->tpl->setVariable("TXT_MAIL_SENT", sprintf($lng->txt("exc_sent_at"), ilDatePresentation::formatDate(new ilDateTime($st, IL_CAL_DATETIME))));
                 } else {
                     $this->tpl->setVariable("TXT_MAIL_SENT", $lng->txt("sent"));
                 }
                 $this->tpl->parseCurrentBlock();
             } else {
                 $this->tpl->setCurrentBlock("mail_sent");
                 $this->tpl->setVariable("TXT_MAIL_SENT", "&nbsp;");
                 $this->tpl->parseCurrentBlock();
             }
         }
         // checkbox
         $this->tpl->setVariable("VAL_CHKBOX", ilUtil::formCheckbox(0, "member[{$member_id}]", 1));
         $this->tpl->setVariable("VAL_ID", $member_id);
     }
     $file_info = ilExAssignment::getDownloadedFilesInfoForTableGUIS($this->parent_obj, $this->exc_id, $this->type, $this->ass_id, $member_id, $this->parent_cmd);
     // name and login
     if (!isset($member["team"])) {
         $this->tpl->setVariable("TXT_NAME", $member["name"]);
         if (in_array("login", $this->selected)) {
             $this->tpl->setVariable("TXT_LOGIN", "[" . $member["login"] . "]");
         }
         if (in_array("image", $this->selected)) {
             // image
             $this->tpl->setVariable("USR_IMAGE", $mem_obj->getPersonalPicturePath("xxsmall"));
             $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
         }
     } else {
         $this->tpl->setCurrentBlock("team_member");
         asort($member["team"]);
         foreach ($member["team"] as $member_name) {
             $this->tpl->setVariable("TXT_MEMBER_NAME", $member_name);
             $this->tpl->parseCurrentBlock();
         }
         if (!$has_no_team_yet) {
             $this->tpl->setCurrentBlock("team_log");
             $ilCtrl->setParameter($this->parent_obj, "lmem", $member_id);
             $this->tpl->setVariable("HREF_LOG", $ilCtrl->getLinkTarget($this->parent_obj, "showTeamLog"));
             $this->tpl->setVariable("TXT_LOG", $lng->txt("exc_team_log"));
             $ilCtrl->setParameter($this->parent_obj, "lmem", "");
             $this->tpl->parseCurrentBlock();
         } else {
             // #11957
             $this->tpl->setCurrentBlock("team_info");
             $this->tpl->setVariable("TXT_TEAM_INFO", $lng->txt("exc_no_team_yet"));
             $this->tpl->setVariable("TXT_CREATE_TEAM", $lng->txt("exc_create_team"));
             $ilCtrl->setParameter($this->parent_obj, "lmem", $member_id);
             $this->tpl->setVariable("URL_CREATE_TEAM", $ilCtrl->getLinkTarget($this->getParentObject(), "createSingleMemberTeam"));
             $ilCtrl->setParameter($this->parent_obj, "lmem", "");
             if ($file_info["files"]["count"]) {
                 $this->tpl->setVariable("TEAM_FILES_INFO", "<br />" . $file_info["files"]["txt"] . ": " . $file_info["files"]["count"]);
             }
             $this->tpl->parseCurrentBlock();
         }
     }
     if (!$has_no_team_yet) {
         $this->tpl->setVariable("VAL_LAST_SUBMISSION", $file_info["last_submission"]["value"]);
         $this->tpl->setVariable("TXT_LAST_SUBMISSION", $file_info["last_submission"]["txt"]);
         $this->tpl->setVariable("TXT_SUBMITTED_FILES", $file_info["files"]["txt"]);
         $this->tpl->setVariable("VAL_SUBMITTED_FILES", $file_info["files"]["count"]);
         if ($file_info["files"]["download_url"]) {
             $this->tpl->setCurrentBlock("download_link");
             $this->tpl->setVariable("LINK_DOWNLOAD", $file_info["files"]["download_url"]);
             $this->tpl->setVariable("TXT_DOWNLOAD", $file_info["files"]["download_txt"]);
             $this->tpl->parseCurrentBlock();
         }
         if ($file_info["files"]["download_new_url"]) {
             $this->tpl->setCurrentBlock("download_link");
             $this->tpl->setVariable("LINK_NEW_DOWNLOAD", $file_info["files"]["download_new_url"]);
             $this->tpl->setVariable("TXT_NEW_DOWNLOAD", $file_info["files"]["download_new_txt"]);
             $this->tpl->parseCurrentBlock();
         }
         // note
         $this->tpl->setVariable("TXT_NOTE", $lng->txt("exc_note_for_tutor"));
         $this->tpl->setVariable("NAME_NOTE", "notice[{$member_id}]");
         $this->tpl->setVariable("VAL_NOTE", ilUtil::prepareFormOutput(ilExAssignment::lookupNoticeOfUser($this->ass_id, $member_id)));
         // comment for learner
         $lcomment_value = ilExAssignment::lookupCommentForUser($this->ass_id, $member_id);
         $overlay_id = "excasscomm_" . $this->ass_id . "_" . $member_id;
         $overlay_trigger_id = $overlay_id . "_tr";
         $overlay = new ilOverlayGUI($overlay_id);
         $overlay->setAnchor($overlay_trigger_id);
         $overlay->setTrigger($overlay_trigger_id, "click", $overlay_trigger_id);
         $overlay->add();
         $this->tpl->setVariable("LCOMMENT_ID", $overlay_id . "_snip");
         $this->tpl->setVariable("LCOMMENT_SNIPPET", ilUtil::shortenText($lcomment_value, 25, true));
         $this->tpl->setVariable("COMMENT_OVERLAY_TRIGGER_ID", $overlay_trigger_id);
         $this->tpl->setVariable("COMMENT_OVERLAY_TRIGGER_TEXT", $lng->txt("exc_comment_for_learner_edit"));
         $lcomment_form = new ilPropertyFormGUI();
         $lcomment_form->setId($overlay_id);
         $lcomment_form->setPreventDoubleSubmission(false);
         $lcomment = new ilTextAreaInputGUI($lng->txt("exc_comment_for_learner"), "lcomment_" . $this->ass_id . "_" . $member_id);
         $lcomment->setInfo($lng->txt("exc_comment_for_learner_info"));
         $lcomment->setValue($lcomment_value);
         $lcomment->setCols(45);
         $lcomment->setRows(10);
         $lcomment_form->addItem($lcomment);
         $lcomment_form->addCommandButton("save", $lng->txt("save"));
         // $lcomment_form->addCommandButton("cancel", $lng->txt("cancel"));
         $this->overlay_tpl->setCurrentBlock("overlay_bl");
         $this->overlay_tpl->setVariable("COMMENT_OVERLAY_ID", $overlay_id);
         $this->overlay_tpl->setVariable("COMMENT_OVERLAY_FORM", $lcomment_form->getHTML());
         $this->overlay_tpl->parseCurrentBlock();
         // solved
         //$this->tpl->setVariable("CHKBOX_SOLVED",
         //	ilUtil::formCheckbox($this->exc->members_obj->getStatusByMember($member_id),"solved[$member_id]",1));
         $status = ilExAssignment::lookupStatusOfUser($this->ass_id, $member_id);
         $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
         $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
         $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
         $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
         if (($sd = ilExAssignment::lookupStatusTimeOfUser($this->ass_id, $member_id)) > 0) {
             $this->tpl->setCurrentBlock("status_date");
             $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
             $this->tpl->setVariable('VAL_STATUS_DATE', ilDatePresentation::formatDate(new ilDateTime($sd, IL_CAL_DATETIME)));
             $this->tpl->parseCurrentBlock();
         }
         switch ($status) {
             case "passed":
                 $pic = "scorm/passed.svg";
                 break;
             case "failed":
                 $pic = "scorm/failed.svg";
                 break;
             default:
                 $pic = "scorm/not_attempted.svg";
                 break;
         }
         $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
         $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $status));
         // mark
         $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
         $this->tpl->setVariable("NAME_MARK", "mark[{$member_id}]");
         $mark = ilExAssignment::lookupMarkOfUser($this->ass_id, $member_id);
         $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
         // feedback
         $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
         if (($ft = ilExAssignment::lookupFeedbackTimeOfUser($this->ass_id, $member_id)) > 0) {
             $this->tpl->setCurrentBlock("feedback_date");
             $this->tpl->setVariable("TXT_FEEDBACK_MAIL_SENT", sprintf($lng->txt("exc_sent_at"), ilDatePresentation::formatDate(new ilDateTime($ft, IL_CAL_DATETIME))));
             $this->tpl->parseCurrentBlock();
         }
         // feedback mail
         $this->tpl->setVariable("LINK_FEEDBACK", $ilCtrl->getLinkTarget($this->parent_obj, "redirectFeedbackMail"));
         $this->tpl->setVariable("TXT_FEEDBACK", $lng->txt("exc_send_mail"));
         if ($this->type == ilExAssignment::TYPE_UPLOAD_TEAM) {
             $feedback_id = "t" . $member["team_id"];
         } else {
             $feedback_id = $member_id;
         }
         // file feedback
         $cnt_files = $this->storage->countFeedbackFiles($feedback_id);
         $ilCtrl->setParameter($this->parent_obj, "fsmode", "feedback");
         $this->tpl->setVariable("LINK_FILE_FEEDBACK", $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
         if ($cnt_files == 0) {
             $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_add_feedback_file"));
         } else {
             $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_fb_files") . " (" . $cnt_files . ")");
         }
         // peer review / rating
         if (!isset($member["team"]) && $this->peer_review) {
             $this->tpl->setCurrentBlock("peer_review_bl");
             $this->tpl->setVariable("TXT_PEER_REVIEW", $lng->txt("exc_peer_review_show"));
             $ilCtrl->setParameter($this->parent_obj, "grd", 1);
             $this->tpl->setVariable("LINK_PEER_REVIEW", $ilCtrl->getLinkTarget($this->parent_obj, "showPersonalPeerReview"));
             $ilCtrl->setParameter($this->parent_obj, "grd", "");
             $rating = new ilRatingGUI();
             $rating->setObject($this->ass_id, "ass", $member_id, "peer");
             $rating->setUserId(0);
             $this->tpl->setVariable("VAL_RATING", $rating->getHTML(true, false));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->touchBlock("member_has_no_team_bl");
     }
 }
 /**
  * Get selection list HTML
  */
 public function getHTML()
 {
     global $lng;
     $items = $this->getItems();
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     $overlay = new ilOverlayGUI("ilChkboxListOverlay_" . $this->getId());
     $overlay->setAnchor("ilChkboxListAnchorEl_" . $this->getId());
     $overlay->setTrigger("ilChkboxListTrigger_" . $this->getId());
     $overlay->setAutoHide(false);
     //$overlay->setSize("300px", "300px");
     $overlay->add();
     $tpl = new ilTemplate("tpl.checkbox_list_overlay.html", true, true, "Services/UIComponent/CheckboxListOverlay", "DEFAULT", false, true);
     $tpl->setCurrentBlock("top_img");
     switch ($this->getHeaderIcon()) {
         case ilCheckboxListOverlayGUI::DOWN_ARROW_LIGHT:
             $tpl->setVariable("IMG_DOWN", ilUtil::getImagePath(ilCheckboxListOverlayGUI::DOWN_ARROW_LIGHT));
             break;
         case ilCheckboxListOverlayGUI::DOWN_ARROW_DARK:
             $tpl->setVariable("IMG_DOWN", ilUtil::getImagePath(ilCheckboxListOverlayGUI::DOWN_ARROW_DARK));
             break;
         default:
             $tpl->setVariable("IMG_DOWN", $this->getHeaderIcon());
             break;
     }
     // do not repeat title (accessibility) -> empty alt
     $tpl->setVariable("TXT_SEL_TOP", $this->getLinkTitle());
     $tpl->setVariable("ALT_SEL_TOP", "");
     $tpl->setVariable("CLASS_SEL_TOP", $this->getSelectionHeaderClass());
     $tpl->parseCurrentBlock();
     reset($items);
     foreach ($items as $k => $v) {
         $tpl->setCurrentBlock("list_entry");
         $tpl->setVariable("VAR", $this->getFieldVar());
         $tpl->setVariable("VAL_ENTRY", $k);
         $tpl->setVariable("TXT_ENTRY", $v["txt"]);
         if ($v["selected"]) {
             $tpl->setVariable("CHECKED", "checked='checked'");
         }
         $tpl->parseCurrentBlock();
     }
     $tpl->setVariable("ID", $this->getId());
     $tpl->setVariable("HIDDEN_VAR", $this->getHiddenVar());
     $tpl->setVariable("CMD_SUBMIT", $this->getFormCmd());
     $tpl->setVariable("VAL_SUBMIT", $lng->txt("refresh"));
     return $tpl->get();
 }
 function getExerciseInfo($a_assignment_id, $a_add_submit = false)
 {
     include_once "Modules/Exercise/classes/class.ilExAssignment.php";
     $ass = new ilExAssignment($a_assignment_id);
     $exercise_id = $ass->getExerciseId();
     if (!$exercise_id) {
         return;
     }
     // is the assignment still open?
     $times_up = false;
     if ($ass->getDeadline() && $ass->getDeadline() - time() <= 0) {
         $times_up = true;
     }
     // exercise goto
     include_once "./Services/Link/classes/class.ilLink.php";
     $exc_ref_id = array_shift(ilObject::_getAllReferences($exercise_id));
     $exc_link = ilLink::_getStaticLink($exc_ref_id, "exc");
     $info = sprintf($this->lng->txt("prtf_exercise_info"), $ass->getTitle(), "<a href=\"" . $exc_link . "\">" . ilObject::_lookupTitle($exercise_id) . "</a>");
     // submit button
     if ($a_add_submit && !$times_up) {
         $this->ctrl->setParameter($this, "exc", $exercise_id);
         $this->ctrl->setParameter($this, "ass", $a_assignment_id);
         $submit_link = $this->ctrl->getLinkTarget($this, "finalize");
         $this->ctrl->setParameter($this, "ass", "");
         $this->ctrl->setParameter($this, "exc", "");
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("prtf_finalize_portfolio");
         $button->setPrimary(true);
         $button->setUrl($submit_link);
         $info .= " " . $button->render();
     }
     // submitted files
     $submitted = ilExAssignment::getDeliveredFiles($exercise_id, $a_assignment_id, $this->user_id, true);
     if ($submitted) {
         $submitted = array_pop($submitted);
         $this->ctrl->setParameter($this, "ass", $a_assignment_id);
         $dl_link = $this->ctrl->getLinkTarget($this, "downloadExcSubFile");
         $this->ctrl->setParameter($this, "ass", "");
         $rel = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("download");
         $button->setUrl($dl_link);
         $info .= "<br />" . sprintf($this->lng->txt("prtf_exercise_submitted_info"), ilDatePresentation::formatDate(new ilDateTime($submitted["ts"], IL_CAL_DATETIME)), $button->render());
         ilDatePresentation::setUseRelativeDates($rel);
     }
     // work instructions incl. files
     $tooltip = "";
     $ass = $ass->getInstruction();
     if ($ass) {
         $tooltip .= nl2br($ass);
     }
     $ass_files = ilExAssignment::getFiles($exercise_id, $a_assignment_id);
     if (count($ass_files) > 0) {
         $tooltip .= "<br /><br />";
         foreach ($ass_files as $file) {
             $this->ctrl->setParameter($this, "ass", $a_assignment_id);
             $this->ctrl->setParameter($this, "file", urlencode($file["name"]));
             $dl_link = $this->ctrl->getLinkTarget($this, "downloadExcAssFile");
             $this->ctrl->setParameter($this, "file", "");
             $this->ctrl->setParameter($this, "ass", "");
             $tooltip .= $file["name"] . ": <a href=\"" . $dl_link . "\">" . $this->lng->txt("download") . "</a>";
         }
     }
     if ($tooltip) {
         $ol_id = "exc_ass_" . $a_assignment_id;
         include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $overlay = new ilOverlayGUI($ol_id);
         // overlay
         $overlay->setAnchor($ol_id . "_tr");
         $overlay->setTrigger($ol_id . "_tr", "click", $ol_id . "_tr");
         $overlay->setAutoHide(false);
         // $overlay->setCloseElementId($cl_id);
         $overlay->add();
         // trigger
         $overlay->addTrigger($ol_id . "_tr", "click", $ol_id . "_tr");
         $info .= "<div id=\"" . $ol_id . "_tr\"><a href=\"#\">" . $this->lng->txt("exc_instruction") . "</a></div>" . "<div id=\"" . $ol_id . "\" style=\"display:none; background-color:white; border: 1px solid #bbb; padding: 10px;\">" . $tooltip . "</div>";
     }
     return $info;
 }
 /**
  * Show search form
  * @return boolean
  */
 protected function showSearchForm()
 {
     global $ilCtrl, $lng;
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_usr_search.html', 'Services/Search');
     // include js needed
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     ilOverlayGUI::initJavascript();
     $this->tpl->addJavascript("./Services/Search/js/Search.js");
     $this->tpl->setVariable('FORM_ACTION', $GLOBALS['ilCtrl']->getFormAction($this, 'performSearch'));
     $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->search_cache->getQuery()));
     $this->tpl->setVariable("TXT_SEARCH", $lng->txt("search"));
     return true;
 }
 /**
  * Fill table row
  */
 protected function fillRow($d)
 {
     global $lng, $ilCtrl;
     $this->tpl->setVariable("TXT_ASS_TITLE", $d["title"]);
     $file_info = ilExAssignment::getDownloadedFilesInfoForTableGUIS($this->parent_obj, $this->exc_id, $d["type"], $d["id"], $this->part_id, $this->parent_cmd);
     $has_no_team_yet = false;
     if ($d["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) {
         $members = ilExAssignment::getTeamMembersByAssignmentId($d["id"], $this->part_id);
         // #11957
         if (sizeof($members)) {
             $this->tpl->setCurrentBlock("ass_members");
             foreach ($members as $member_id) {
                 $this->tpl->setVariable("TXT_MEMBER_NAME", ilObjUser::_lookupFullname($member_id));
                 $this->tpl->parseCurrentBlock();
             }
             $ilCtrl->setParameter($this->parent_obj, "lpart", $this->part_id);
             $this->tpl->setVariable("HREF_LOG", $ilCtrl->getLinkTarget($this->parent_obj, "showTeamLog"));
             $this->tpl->setVariable("TXT_LOG", $lng->txt("exc_team_log"));
             $ilCtrl->setParameter($this->parent_obj, "lpart", "");
         } else {
             // #11957
             $has_no_team_yet = true;
             $this->tpl->setCurrentBlock("team_info");
             $this->tpl->setVariable("TXT_TEAM_INFO", $lng->txt("exc_no_team_yet"));
             $this->tpl->setVariable("TXT_CREATE_TEAM", $lng->txt("exc_create_team"));
             $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
             $ilCtrl->setParameter($this->parent_obj, "lpart", $this->part_id);
             $this->tpl->setVariable("URL_CREATE_TEAM", $ilCtrl->getLinkTarget($this->getParentObject(), "createSingleMemberTeam"));
             $ilCtrl->setParameter($this->parent_obj, "lpart", "");
             $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
             if ($file_info["files"]["count"]) {
                 $this->tpl->setVariable("TEAM_FILES_INFO", "<br />" . $file_info["files"]["txt"] . ": " . $file_info["files"]["count"]);
             }
             $this->tpl->parseCurrentBlock();
         }
     }
     if (!$has_no_team_yet) {
         $this->tpl->setVariable("VAL_CHKBOX", ilUtil::formCheckbox(0, "assid[" . $d["id"] . "]", 1));
         $this->tpl->setVariable("VAL_ID", $d["id"]);
         $this->tpl->setVariable("VAL_LAST_SUBMISSION", $file_info["last_submission"]["value"]);
         $this->tpl->setVariable("TXT_LAST_SUBMISSION", $file_info["last_submission"]["txt"]);
         $this->tpl->setVariable("TXT_SUBMITTED_FILES", $file_info["files"]["txt"]);
         $this->tpl->setVariable("VAL_SUBMITTED_FILES", $file_info["files"]["count"]);
         if ($file_info["files"]["download_url"]) {
             $this->tpl->setCurrentBlock("download_link");
             $this->tpl->setVariable("LINK_DOWNLOAD", $file_info["files"]["download_url"]);
             $this->tpl->setVariable("TXT_DOWNLOAD", $file_info["files"]["download_txt"]);
             $this->tpl->parseCurrentBlock();
         }
         if ($file_info["files"]["download_new_url"]) {
             $this->tpl->setCurrentBlock("download_link");
             $this->tpl->setVariable("LINK_NEW_DOWNLOAD", $file_info["files"]["download_new_url"]);
             $this->tpl->setVariable("TXT_NEW_DOWNLOAD", $file_info["files"]["download_new_txt"]);
             $this->tpl->parseCurrentBlock();
         }
         // note
         $this->tpl->setVariable("TXT_NOTE", $lng->txt("exc_note_for_tutor"));
         $this->tpl->setVariable("NAME_NOTE", "notice[" . $d["id"] . "]");
         $this->tpl->setVariable("VAL_NOTE", ilUtil::prepareFormOutput(ilExAssignment::lookupNoticeOfUser($d["id"], $this->part_id)));
         // comment for learner
         $lcomment_value = ilExAssignment::lookupCommentForUser($d["id"], $this->part_id);
         $overlay_id = "excasscomm_" . $d["id"] . "_" . $this->part_id;
         $overlay_trigger_id = $overlay_id . "_tr";
         $overlay = new ilOverlayGUI($overlay_id);
         $overlay->setAnchor($overlay_trigger_id);
         $overlay->setTrigger($overlay_trigger_id, "click", $overlay_trigger_id);
         $overlay->add();
         $this->tpl->setVariable("LCOMMENT_ID", $overlay_id . "_snip");
         $this->tpl->setVariable("LCOMMENT_SNIPPET", ilUtil::shortenText($lcomment_value, 25, true));
         $this->tpl->setVariable("COMMENT_OVERLAY_TRIGGER_ID", $overlay_trigger_id);
         $this->tpl->setVariable("COMMENT_OVERLAY_TRIGGER_TEXT", $lng->txt("exc_comment_for_learner_edit"));
         $lcomment_form = new ilPropertyFormGUI();
         $lcomment_form->setId($overlay_id);
         $lcomment_form->setPreventDoubleSubmission(false);
         $lcomment = new ilTextAreaInputGUI($lng->txt("exc_comment_for_learner"), "lcomment_" . $d["id"] . "_" . $this->part_id);
         $lcomment->setInfo($lng->txt("exc_comment_for_learner_info"));
         $lcomment->setValue($lcomment_value);
         $lcomment->setCols(45);
         $lcomment->setRows(5);
         $lcomment_form->addItem($lcomment);
         //$lcomment_form->addCommandButton("save", $lng->txt("save"));
         // $lcomment_form->addCommandButton("cancel", $lng->txt("cancel"));
         $this->overlay_tpl->setCurrentBlock("overlay_bl");
         $this->overlay_tpl->setVariable("COMMENT_OVERLAY_ID", $overlay_id);
         $this->overlay_tpl->setVariable("COMMENT_OVERLAY_FORM", $lcomment_form->getHTML());
         $this->overlay_tpl->parseCurrentBlock();
         /*			
         $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("exc_comment_for_learner"));
         $this->tpl->setVariable("NAME_LCOMMENT",
         	"lcomment[".$d["id"]."]");
         $lpcomment = ilExAssignment::lookupCommentForUser($d["id"], $this->part_id);
         $this->tpl->setVariable("VAL_LCOMMENT",
         	ilUtil::prepareFormOutput($lpcomment));
         */
         // solved
         //$this->tpl->setVariable("CHKBOX_SOLVED",
         //	ilUtil::formCheckbox($this->exc->members_obj->getStatusByMember($member_id),"solved[$member_id]",1));
         $status = ilExAssignment::lookupStatusOfUser($d["id"], $this->part_id);
         $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
         $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
         $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
         $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
         if (($sd = ilExAssignment::lookupStatusTimeOfUser($d["id"], $this->part_id)) > 0) {
             $this->tpl->setCurrentBlock("status_date");
             $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
             $this->tpl->setVariable('VAL_STATUS_DATE', ilDatePresentation::formatDate(new ilDateTime($sd, IL_CAL_DATETIME)));
             $this->tpl->parseCurrentBlock();
         }
         switch ($status) {
             case "passed":
                 $pic = "scorm/passed.svg";
                 break;
             case "failed":
                 $pic = "scorm/failed.svg";
                 break;
             default:
                 $pic = "scorm/not_attempted.svg";
                 break;
         }
         $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
         $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $status));
         // mark
         $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
         $this->tpl->setVariable("NAME_MARK", "mark[" . $d["id"] . "]");
         $mark = ilExAssignment::lookupMarkOfUser($d["id"], $this->part_id);
         $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
         // feedback
         $ilCtrl->setParameter($this->parent_obj, "member_id", $this->part_id);
         if (($ft = ilExAssignment::lookupFeedbackTimeOfUser($d["id"], $this->part_id)) > 0) {
             $this->tpl->setCurrentBlock("feedback_date");
             $this->tpl->setVariable("TXT_FEEDBACK_MAIL_SENT", sprintf($lng->txt("exc_sent_at"), ilDatePresentation::formatDate(new ilDateTime($ft, IL_CAL_DATETIME))));
             $this->tpl->parseCurrentBlock();
         }
         $ilCtrl->setParameter($this, "rcp_to", $this->user->getLogin());
         $this->tpl->setVariable("LINK_FEEDBACK", $ilCtrl->getLinkTarget($this->parent_obj, "redirectFeedbackMail"));
         //"ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".$mem_obj->getLogin());
         $this->tpl->setVariable("TXT_FEEDBACK", $lng->txt("exc_send_mail"));
         $ilCtrl->setParameter($this->parent_obj, "rcp_to", "");
         if ($d["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) {
             $feedback_id = "t" . ilExAssignment::getTeamIdByAssignment($d["id"], $this->part_id);
         } else {
             $feedback_id = $this->part_id;
         }
         $storage = new ilFSStorageExercise($this->exc_id, $d["id"]);
         $cnt_files = $storage->countFeedbackFiles($feedback_id);
         $ilCtrl->setParameter($this->parent_obj, "fsmode", "feedbackpart");
         $this->tpl->setVariable("LINK_FILE_FEEDBACK", $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
         if ($cnt_files == 0) {
             $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_add_feedback_file"));
         } else {
             $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_fb_files") . " (" . $cnt_files . ")");
         }
         // peer review / rating
         if ($d["type"] != ilExAssignment::TYPE_UPLOAD_TEAM && $d["peer"]) {
             $this->tpl->setCurrentBlock("peer_review_bl");
             $this->tpl->setVariable("TXT_PEER_REVIEW", $lng->txt("exc_peer_review_show"));
             $ilCtrl->setParameter($this->parent_obj, "grd", 2);
             $this->tpl->setVariable("LINK_PEER_REVIEW", $ilCtrl->getLinkTarget($this->parent_obj, "showPersonalPeerReview"));
             $ilCtrl->setParameter($this->parent_obj, "grd", "");
             $rating = new ilRatingGUI();
             $rating->setObject($d["id"], "ass", $this->part_id, "peer");
             $rating->setUserId(0);
             $this->tpl->setVariable("VAL_RATING", $rating->getHTML(true, false));
             $this->tpl->parseCurrentBlock();
         }
         $ilCtrl->setParameter($this->parent_obj, "ass_id", $_GET["ass_id"]);
     } else {
         $this->tpl->touchBlock("member_has_no_team_bl");
     }
 }
 /**
  * Add new item selection to current page incl. toolbar (trigger) and overlay
  */
 public function render()
 {
     global $ilToolbar, $tpl, $lng;
     if ($this->mode == ilObjectDefinition::MODE_WORKSPACE) {
         if (!$this->parsePersonalWorkspace()) {
             return;
         }
     } else {
         if (!$this->parseRepository()) {
             return;
         }
     }
     $ov_id = "il_add_new_item_ov";
     $ov_trigger_id = $ov_id . "_tr";
     include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     $ov = new ilOverlayGUI($ov_id);
     //		$ov->setAnchor($ov_trigger_id, "tl", "tr");
     //		$ov->setTrigger($ov_trigger_id, "click", $ov_trigger_id);
     $ov->add();
     // trigger
     $ov->addTrigger($ov_trigger_id, "click", $ov_trigger_id, false, "tl", "tr");
     // toolbar
     $ilToolbar->addButton($lng->txt("cntr_add_new_item"), "#", "", "", "", $ov_trigger_id, 'submit emphsubmit');
     // css?
     $tpl->setVariable("SELECT_OBJTYPE_REPOS", '<div id="' . $ov_id . '" style="display:none;" class="ilOverlay">' . $this->getHTML() . '</div>');
 }
 /**
  * desc
  *
  * @param
  * @return
  */
 function renderMainMenuListEntries($a_tpl, $a_call_get = true)
 {
     global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilAccess;
     // personal desktop
     if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID) {
         /*$this->renderEntry($a_tpl, "desktop",
         		$lng->txt("personal_desktop"),
         		$this->getScriptTarget("ilias.php?baseClass=ilPersonalDesktopGUI"),
         		$this->target);*/
         //			$this->renderDropDown($a_tpl, "desktop");
         $this->renderEntry($a_tpl, "desktop", $lng->txt("personal_desktop"), "#");
         include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $ov = new ilOverlayGUI("mm_desk_ov");
         $ov->setTrigger("mm_desk_tr");
         $ov->setAnchor("mm_desk_tr");
         $ov->setAutoHide(false);
         $ov->add();
     }
     // repository
     if ($ilAccess->checkAccess('visible', '', ROOT_FOLDER_ID)) {
         include_once './Services/Link/classes/class.ilLink.php';
         $nd = $tree->getNodeData(ROOT_FOLDER_ID);
         $title = $nd["title"];
         if ($title == "ILIAS") {
             $title = $lng->txt("repository");
         }
         //$this->renderEntry($a_tpl, "repository",
         //	$title,
         //	ilLink::_getStaticLink(1,'root',true),
         //	$this->target);
         if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID || IS_PAYMENT_ENABLED) {
             $this->renderEntry($a_tpl, "repository", $title, "#");
             include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
             $ov = new ilOverlayGUI("mm_rep_ov");
             $ov->setTrigger("mm_rep_tr");
             $ov->setAnchor("mm_rep_tr");
             $ov->setAutoHide(false);
             $ov->add();
         }
     }
     // search
     include_once 'Services/Search/classes/class.ilSearchSettings.php';
     if ($rbacsystem->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) {
         /*			$this->renderEntry($a_tpl, "search",
         				$lng->txt("search"),
         				$this->getScriptTarget('ilias.php?baseClass=ilSearchController'),
         				$this->target); */
     }
     // webshop
     if (IS_PAYMENT_ENABLED) {
         $title = $lng->txt("shop");
         $this->renderEntry($a_tpl, "shop", $title, "#");
         include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $ov = new ilOverlayGUI("mm_shop_ov");
         $ov->setTrigger("mm_shop_tr");
         $ov->setAnchor("mm_shop_tr");
         $ov->setAutoHide(false);
         $ov->add();
     }
     // administration
     if (ilMainMenuGUI::_checkAdministrationPermission()) {
         //$this->renderEntry($a_tpl, "administration",
         //	$lng->txt("administration"),
         //	$this->getScriptTarget("ilias.php?baseClass=ilAdministrationGUI"),
         //	$this->target);
         $this->renderDropDown($a_tpl, "administration");
     }
     // navigation history
     /*		require_once("Services/Navigation/classes/class.ilNavigationHistoryGUI.php");
     		$nav_hist = new ilNavigationHistoryGUI();
     		$nav_html = $nav_hist->getHTML();
     		if ($nav_html != "")
     		{
     
     			$a_tpl->setCurrentBlock("nav_history");
     			$a_tpl->setVariable("TXT_LAST_VISITED", $lng->txt("last_visited"));
     			$a_tpl->setVariable("NAVIGATION_HISTORY", $nav_html);
     			$a_tpl->parseCurrentBlock();
     		}*/
     if ($a_call_get) {
         return $a_tpl->get();
     }
     return "";
 }
 /**
  * Show search form
  * @return boolean
  */
 protected function showSearchForm()
 {
     global $ilCtrl, $lng;
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_search.html', 'Services/Search');
     // include js needed
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     ilOverlayGUI::initJavascript();
     $this->tpl->addJavascript("./Services/Search/js/Search.js");
     $this->tpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this, 'performSearch'));
     $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->search_cache->getQuery()));
     $this->tpl->setVariable("TXT_SEARCH", $lng->txt("search"));
     $this->tpl->setVariable("TXT_OPTIONS", $lng->txt("options"));
     $this->tpl->setVariable("ARR_IMG", ilUtil::img(ilUtil::getImagePath("mm_down_arrow_dark.png")));
     $this->tpl->setVariable("TXT_COMBINATION", $lng->txt("search_term_combination"));
     $this->tpl->setVariable('TXT_COMBINATION_DEFAULT', ilSearchSettings::getInstance()->getDefaultOperator() == ilSearchSettings::OPERATOR_AND ? $lng->txt('search_all_words') : $lng->txt('search_any_word'));
     $this->tpl->setVariable('TXT_TYPE_DEFAULT', $lng->txt("search_off"));
     $this->tpl->setVariable("TXT_AREA", $lng->txt("search_area"));
     $this->tpl->setVariable("TXT_FILTER_BY_TYPE", $lng->txt("search_filter_by_type"));
     $this->tpl->setVariable('FORM', $this->form->getHTML());
     // search area form
     $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML());
     $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
     return true;
 }
 function getExerciseInfo($a_assignment_id)
 {
     global $lng, $ilCtrl, $ilUser;
     include_once "Modules/Exercise/classes/class.ilExAssignment.php";
     $ass = new ilExAssignment($a_assignment_id);
     $exercise_id = $ass->getExerciseId();
     if (!$exercise_id) {
         return;
     }
     // is the assignment still open?
     $times_up = false;
     if ($ass->getDeadline() && $ass->getDeadline() - time() <= 0) {
         $times_up = true;
     }
     // exercise goto
     include_once "./Services/Link/classes/class.ilLink.php";
     $exc_ref_id = array_shift(ilObject::_getAllReferences($exercise_id));
     $exc_link = ilLink::_getStaticLink($exc_ref_id, "exc");
     $info = sprintf($lng->txt("blog_exercise_info"), $ass->getTitle(), "<a href=\"" . $exc_link . "\">" . ilObject::_lookupTitle($exercise_id) . "</a>");
     // submit button
     if (!$times_up) {
         $ilCtrl->setParameter($this, "exc", $exercise_id);
         $ilCtrl->setParameter($this, "ass", $a_assignment_id);
         $submit_link = $ilCtrl->getLinkTarget($this, "finalize");
         $ilCtrl->setParameter($this, "ass", "");
         $ilCtrl->setParameter($this, "exc", "");
         $info .= " <a class=\"submit emphsubmit\" href=\"" . $submit_link . "\">" . $lng->txt("blog_finalize_blog") . "</a>";
     }
     // submitted files
     $submitted = ilExAssignment::getDeliveredFiles($exercise_id, $a_assignment_id, $ilUser->getId(), true);
     if ($submitted) {
         $submitted = array_pop($submitted);
         $ilCtrl->setParameter($this, "ass", $a_assignment_id);
         $dl_link = $ilCtrl->getLinkTarget($this, "downloadExcSubFile");
         $ilCtrl->setParameter($this, "ass", "");
         $rel = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         $info .= "<br />" . sprintf($lng->txt("blog_exercise_submitted_info"), ilDatePresentation::formatDate(new ilDateTime($submitted["ts"], IL_CAL_DATETIME)), "<a href=\"" . $dl_link . "\" class=\"submit\">" . $lng->txt("download") . "</a>");
         ilDatePresentation::setUseRelativeDates($rel);
     }
     // work instructions incl. files
     $tooltip = "";
     $ass = $ass->getInstruction();
     if ($ass) {
         $tooltip .= nl2br($ass);
     }
     $ass_files = ilExAssignment::getFiles($exercise_id, $a_assignment_id);
     if (count($ass_files) > 0) {
         $tooltip .= "<br /><br />";
         foreach ($ass_files as $file) {
             $ilCtrl->setParameter($this, "ass", $a_assignment_id);
             $ilCtrl->setParameter($this, "file", urlencode($file["name"]));
             $dl_link = $ilCtrl->getLinkTarget($this, "downloadExcAssFile");
             $ilCtrl->setParameter($this, "file", "");
             $ilCtrl->setParameter($this, "ass", "");
             $tooltip .= $file["name"] . ": <a href=\"" . $dl_link . "\">" . $lng->txt("download") . "</a>";
         }
     }
     if ($tooltip) {
         $ol_id = "exc_ass_" . $a_assignment_id;
         include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $overlay = new ilOverlayGUI($ol_id);
         // overlay
         $overlay->setAnchor($ol_id . "_tr");
         $overlay->setTrigger($ol_id . "_tr", "click", $ol_id . "_tr");
         $overlay->add();
         $info .= "<div id=\"" . $ol_id . "_tr\"><a href=\"#\">" . $lng->txt("exc_instruction") . "</a></div>" . "<div id=\"" . $ol_id . "\" style=\"display:none; padding:10px;\" class=\"ilOverlay\">" . $tooltip . "</div>";
     }
     return "<div>" . $info . "</div>";
 }
 /**
  * Show search form
  * @return boolean
  */
 protected function showSearchForm()
 {
     global $ilCtrl, $lng;
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_search.html', 'Services/Search');
     // include js needed
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     ilOverlayGUI::initJavascript();
     $this->tpl->addJavascript("./Services/Search/js/Search.js");
     include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
     $this->tpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this, 'performSearch'));
     $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->search_cache->getQuery()));
     include_once "./Services/UIComponent/Button/classes/class.ilSubmitButton.php";
     $btn = ilSubmitButton::getInstance();
     $btn->setCommand("performSearch");
     $btn->setCaption("search");
     $this->tpl->setVariable("SUBMIT_BTN", $btn->render());
     $this->tpl->setVariable("TXT_OPTIONS", $lng->txt("options"));
     $this->tpl->setVariable("ARR_IMG", ilGlyphGUI::get(ilGlyphGUI::CARET));
     $this->tpl->setVariable("TXT_COMBINATION", $lng->txt("search_term_combination"));
     $this->tpl->setVariable('TXT_COMBINATION_DEFAULT', ilSearchSettings::getInstance()->getDefaultOperator() == ilSearchSettings::OPERATOR_AND ? $lng->txt('search_all_words') : $lng->txt('search_any_word'));
     $this->tpl->setVariable("TXT_AREA", $lng->txt("search_area"));
     if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) {
         $this->tpl->setCurrentBlock("type_sel");
         $this->tpl->setVariable('TXT_TYPE_DEFAULT', $lng->txt("search_off"));
         $this->tpl->setVariable("ARR_IMGT", ilGlyphGUI::get(ilGlyphGUI::CARET));
         $this->tpl->setVariable("TXT_FILTER_BY_TYPE", $lng->txt("search_filter_by_type"));
         $this->tpl->setVariable('FORM', $this->form->getHTML());
         $this->tpl->parseCurrentBlock();
     }
     // search area form
     $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML());
     $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
     return true;
 }
 /**
  * Fill footer row
  */
 function fillFooter()
 {
     global $lng, $ilCtrl, $ilUser;
     $footer = false;
     // select all checkbox
     if (strlen($this->getFormName()) && strlen($this->getSelectAllCheckbox()) && $this->dataExists()) {
         $this->tpl->setCurrentBlock("select_all_checkbox");
         $this->tpl->setVariable("SELECT_ALL_TXT_SELECT_ALL", $lng->txt("select_all"));
         $this->tpl->setVariable("SELECT_ALL_CHECKBOX_NAME", $this->getSelectAllCheckbox());
         $this->tpl->setVariable("SELECT_ALL_FORM_NAME", $this->getFormName());
         $this->tpl->setVariable("CHECKBOXNAME", "chb_select_all_" . $this->unique_id);
         $this->tpl->parseCurrentBlock();
     }
     // table footer numinfo
     if ($this->enabled["numinfo"] && $this->enabled["footer"]) {
         $start = $this->offset + 1;
         // compute num info
         if (!$this->dataExists()) {
             $start = 0;
         }
         $end = $this->offset + $this->limit;
         if ($end > $this->max_count or $this->limit == 0) {
             $end = $this->max_count;
         }
         if ($this->max_count > 0) {
             if ($this->lang_support) {
                 $numinfo = "(" . $start . " - " . $end . " " . strtolower($this->lng->txt("of")) . " " . $this->max_count . ")";
             } else {
                 $numinfo = "(" . $start . " - " . $end . " of " . $this->max_count . ")";
             }
         }
         if ($this->max_count > 0) {
             if ($this->getEnableNumInfo()) {
                 $this->tpl->setCurrentBlock("tbl_footer_numinfo");
                 $this->tpl->setVariable("NUMINFO", $numinfo);
                 $this->tpl->parseCurrentBlock();
             }
         }
         $footer = true;
     }
     // table footer linkbar
     if ($this->enabled["linkbar"] && $this->enabled["footer"] && $this->limit != 0 && $this->max_count > 0) {
         $layout = array("link" => $this->footer_style, "prev" => $this->footer_previous, "next" => $this->footer_next);
         //if (!$this->getDisplayAsBlock())
         //{
         $linkbar = $this->getLinkbar("1");
         $this->tpl->setCurrentBlock("tbl_footer_linkbar");
         $this->tpl->setVariable("LINKBAR", $linkbar);
         $this->tpl->parseCurrentBlock();
         $linkbar = true;
         //}
         $footer = true;
     }
     // column selector
     if (count($this->getSelectableColumns()) > 0) {
         $items = array();
         foreach ($this->getSelectableColumns() as $k => $c) {
             $items[$k] = array("txt" => $c["txt"], "selected" => $this->isColumnSelected($k));
         }
         include_once "./Services/UIComponent/CheckboxListOverlay/classes/class.ilCheckboxListOverlayGUI.php";
         $cb_over = new ilCheckboxListOverlayGUI("tbl_" . $this->getId());
         $cb_over->setLinkTitle($lng->txt("columns"));
         $cb_over->setItems($items);
         //$cb_over->setUrl("./ilias.php?baseClass=ilTablePropertiesStorage&table_id=".
         //		$this->getId()."&cmd=saveSelectedFields&user_id=".$ilUser->getId());
         $cb_over->setFormCmd($this->getParentCmd());
         $cb_over->setFieldVar("tblfs" . $this->getId());
         $cb_over->setHiddenVar("tblfsh" . $this->getId());
         $cb_over->setSelectionHeaderClass("ilTableMenuItem");
         $column_selector = $cb_over->getHTML();
         $footer = true;
     }
     if ($this->getShowTemplates() && is_object($ilUser)) {
         // template handling
         if (isset($_REQUEST["tbltplcrt"]) && $_REQUEST["tbltplcrt"]) {
             if ($this->saveTemplate($_REQUEST["tbltplcrt"])) {
                 ilUtil::sendSuccess($lng->txt("tbl_template_created"));
             }
         } else {
             if (isset($_REQUEST["tbltpldel"]) && $_REQUEST["tbltpldel"]) {
                 if ($this->deleteTemplate($_REQUEST["tbltpldel"])) {
                     ilUtil::sendSuccess($lng->txt("tbl_template_deleted"));
                 }
             }
         }
         $create_id = "template_create_overlay_" . $this->getId();
         $delete_id = "template_delete_overlay_" . $this->getId();
         $list_id = "template_stg_" . $this->getId();
         include_once "./Services/Table/classes/class.ilTableTemplatesStorage.php";
         $storage = new ilTableTemplatesStorage();
         $templates = $storage->getNames($this->getContext(), $ilUser->getId());
         include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         // form to delete template
         if (count($templates)) {
             $overlay = new ilOverlayGUI($delete_id);
             $overlay->setTrigger($list_id . "_delete");
             $overlay->setAnchor("ilAdvSelListAnchorElement_" . $list_id);
             $overlay->setAutoHide(false);
             $overlay->add();
             $lng->loadLanguageModule("form");
             $this->tpl->setCurrentBlock("template_editor_delete_item");
             $this->tpl->setVariable("TEMPLATE_DELETE_OPTION_VALUE", "");
             $this->tpl->setVariable("TEMPLATE_DELETE_OPTION", "- " . $lng->txt("form_please_select") . " -");
             $this->tpl->parseCurrentBlock();
             foreach ($templates as $name) {
                 $this->tpl->setVariable("TEMPLATE_DELETE_OPTION_VALUE", $name);
                 $this->tpl->setVariable("TEMPLATE_DELETE_OPTION", $name);
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->setCurrentBlock("template_editor_delete");
             $this->tpl->setVariable("TEMPLATE_DELETE_ID", $delete_id);
             $this->tpl->setVariable("TXT_TEMPLATE_DELETE", $lng->txt("tbl_template_delete"));
             $this->tpl->setVariable("TXT_TEMPLATE_DELETE_SUBMIT", $lng->txt("delete"));
             $this->tpl->setVariable("TEMPLATE_DELETE_CMD", $this->parent_cmd);
             $this->tpl->parseCurrentBlock();
         }
         // form to save new template
         $overlay = new ilOverlayGUI($create_id);
         $overlay->setTrigger($list_id . "_create");
         $overlay->setAnchor("ilAdvSelListAnchorElement_" . $list_id);
         $overlay->setAutoHide(false);
         $overlay->add();
         $this->tpl->setCurrentBlock("template_editor");
         $this->tpl->setVariable("TEMPLATE_CREATE_ID", $create_id);
         $this->tpl->setVariable("TXT_TEMPLATE_CREATE", $lng->txt("tbl_template_create"));
         $this->tpl->setVariable("TXT_TEMPLATE_CREATE_SUBMIT", $lng->txt("save"));
         $this->tpl->setVariable("TEMPLATE_CREATE_CMD", $this->parent_cmd);
         $this->tpl->parseCurrentBlock();
         // load saved template
         include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
         $alist = new ilAdvancedSelectionListGUI();
         $alist->setId($list_id);
         $alist->addItem($lng->txt("tbl_template_create"), "create", "#");
         if (count($templates)) {
             $alist->addItem($lng->txt("tbl_template_delete"), "delete", "#");
             foreach ($templates as $name) {
                 $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_tpl", urlencode($name));
                 $alist->addItem($name, $name, $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
                 $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_tpl", "");
             }
         }
         $alist->setListTitle($lng->txt("tbl_templates"));
         $this->tpl->setVariable("TEMPLATE_SELECTOR", "&nbsp;" . $alist->getHTML());
     }
     if ($footer) {
         $this->tpl->setCurrentBlock("tbl_footer");
         $this->tpl->setVariable("COLUMN_COUNT", $this->getColumnCount());
         if ($this->getDisplayAsBlock()) {
             $this->tpl->setVariable("BLK_CLASS", "Block");
         }
         $this->tpl->parseCurrentBlock();
         // top navigation, if number info or linkbar given
         if ($numinfo != "" || $linkbar != "" || $column_selector != "" || count($this->filters) > 0 || count($this->optional_filters) > 0) {
             if (is_object($ilUser) && (count($this->filters) || count($this->optional_filters))) {
                 $this->tpl->setCurrentBlock("filter_activation");
                 $this->tpl->setVariable("TXT_ACTIVATE_FILTER", $lng->txt("show_filter"));
                 $this->tpl->setVariable("FILA_ID", $this->getId());
                 if ($this->getId() != "") {
                     $this->tpl->setVariable("SAVE_URLA", "./ilias.php?baseClass=ilTablePropertiesStorage&table_id=" . $this->getId() . "&cmd=showFilter&user_id=" . $ilUser->getId());
                 }
                 $this->tpl->parseCurrentBlock();
                 if (!$this->getDisableFilterHiding()) {
                     $this->tpl->setCurrentBlock("filter_deactivation");
                     $this->tpl->setVariable("TXT_HIDE", $lng->txt("hide_filter"));
                     if ($this->getId() != "") {
                         $this->tpl->setVariable("SAVE_URL", "./ilias.php?baseClass=ilTablePropertiesStorage&table_id=" . $this->getId() . "&cmd=hideFilter&user_id=" . $ilUser->getId());
                         $this->tpl->setVariable("FILD_ID", $this->getId());
                     }
                     $this->tpl->parseCurrentBlock();
                 }
             }
             if ($numinfo != "" && $this->getEnableNumInfo()) {
                 $this->tpl->setCurrentBlock("top_numinfo");
                 $this->tpl->setVariable("NUMINFO", $numinfo);
                 $this->tpl->parseCurrentBlock();
             }
             if ($linkbar != "" && !$this->getDisplayAsBlock()) {
                 $linkbar = $this->getLinkbar("2");
                 $this->tpl->setCurrentBlock("top_linkbar");
                 $this->tpl->setVariable("LINKBAR", $linkbar);
                 $this->tpl->parseCurrentBlock();
             }
             // column selector
             $this->tpl->setVariable("COLUMN_SELECTOR", $column_selector);
             // row selector
             if ($this->getShowRowsSelector() && is_object($ilUser)) {
                 include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
                 $alist = new ilAdvancedSelectionListGUI();
                 $alist->setId("sellst_rows_" . $this->getId());
                 $hpp = $ilUser->getPref("hits_per_page") != 9999 ? $ilUser->getPref("hits_per_page") : $lng->txt("unlimited");
                 $options = array(0 => $lng->txt("default") . " (" . $hpp . ")", 5 => 5, 10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 100 => 100, 200 => 200, 400 => 400, 800 => 800);
                 foreach ($options as $k => $v) {
                     $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_trows", $k);
                     $alist->addItem($v, $k, $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
                     $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_trows", "");
                 }
                 $alist->setListTitle($this->getRowSelectorLabel() ? $this->getRowSelectorLabel() : $lng->txt("rows"));
                 $this->tpl->setVariable("ROW_SELECTOR", $alist->getHTML());
             }
             // export
             if (count($this->export_formats) && $this->dataExists()) {
                 include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
                 $alist = new ilAdvancedSelectionListGUI();
                 $alist->setId("sellst_xpt");
                 foreach ($this->export_formats as $format => $caption_lng_id) {
                     $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_xpt", $format);
                     $url = $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd);
                     $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_xpt", "");
                     $caption = $lng->txt($caption_lng_id);
                     //this part is necessary, because the labels for xls- and csv-Export are fetched from the ilias-lang-files, while the label for pdf-export is fetched from the lang-file of the plugin. If the ilias-lang-file does not contain a translation for the caption_lng_id, it will set it into '-'es. In that case the caption comes from the plugin and we just use the string that is there.
                     if (strpos($caption, '-') === 0 && strpos($caption, '-', strlen($caption) - 1) === strlen($caption) - 1) {
                         $alist->addItem($caption_lng_id, $format, $url);
                     } else {
                         $alist->addItem($lng->txt($caption_lng_id), $format, $url);
                     }
                 }
                 $alist->setListTitle($lng->txt("export"));
                 $this->tpl->setVariable("EXPORT_SELECTOR", "&nbsp;" . $alist->getHTML());
             }
             $this->tpl->setCurrentBlock("top_navigation");
             $this->tpl->setVariable("COLUMN_COUNT", $this->getColumnCount());
             if ($this->getDisplayAsBlock()) {
                 $this->tpl->setVariable("BLK_CLASS", "Block");
             }
             $this->tpl->parseCurrentBlock();
         }
     }
 }
 /**
  * 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();
         }
     }
 }