/** * List templates */ function listTemplates() { // list pages include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; $pages = ilWikiPage::getAllPages($this->wiki->getId()); $options = array("" => $this->lng->txt("please_select")); foreach ($pages as $p) { //if (!in_array($p["id"], $ipages_ids)) //{ $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true); //} } $this->toolbar->setFormAction($this->ctrl->getFormAction($this)); $this->toolbar->setOpenFormTag(true); $this->toolbar->setCloseFormTag(false); if (count($options) > 0) { include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $si = new ilSelectInputGUI($this->lng->txt("wiki_pages"), "templ_page_id"); $si->setOptions($options); $this->toolbar->addInputItem($si); $this->toolbar->addFormButton($this->lng->txt("wiki_add_template"), "add"); $this->toolbar->addSeparator(); } // empty page as template? include_once "./Services/Form/classes/class.ilCheckboxInputGUI.php"; $cb = new ilCheckboxInputGUI($this->lng->txt("wiki_empty_page_template"), "empty_page_templ"); $cb->setChecked($this->wiki->getEmptyPageTemplate()); $this->toolbar->addInputItem($cb, true); $this->toolbar->addFormButton($this->lng->txt("save"), "saveTemplateSettings"); include_once "./Modules/Wiki/classes/class.ilWikiPageTemplatesTableGUI.php"; $tab = new ilWikiPageTemplatesTableGUI($this, "listTemplates", $this->wiki->getId()); $tab->setOpenFormTag(false); $tab->setCloseFormTag(true); $this->tpl->setContent($tab->getHTML()); }
/** * Fill table row */ protected function fillRow($d) { global $lng, $ilCtrl; $this->tpl->setVariable("ID", $d["id"]); if ($d["deadline"] > 0) { $this->tpl->setVariable("TXT_DEADLINE", ilDatePresentation::formatDate(new ilDateTime($d["deadline"], IL_CAL_UNIX))); } if ($d["start_time"] > 0) { $this->tpl->setVariable("TXT_START_TIME", ilDatePresentation::formatDate(new ilDateTime($d["start_time"], IL_CAL_UNIX))); } $this->tpl->setVariable("TXT_INSTRUCTIONS", ilUtil::shortenText($d["instruction"], 200, true)); if ($d["mandatory"]) { $this->tpl->setVariable("TXT_MANDATORY", $lng->txt("yes")); } else { $this->tpl->setVariable("TXT_MANDATORY", $lng->txt("no")); } if ($d["peer"]) { $this->tpl->setVariable("TXT_PEER", $lng->txt("yes") . " (" . $d["peer_min"] . ")"); } else { $this->tpl->setVariable("TXT_PEER", $lng->txt("no")); } $this->tpl->setVariable("TXT_TITLE", $d["title"]); $this->tpl->setVariable("TXT_TYPE", $d["type"]); $this->tpl->setVariable("ORDER_VAL", $d["order_val"]); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]); $this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTarget($this->parent_obj, "editAssignment")); }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl, $ilAccess; $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); // user if ($a_set["user_id"] > 0) { $this->tpl->setCurrentBlock("user_info"); $user_obj = new ilObjUser($a_set["user_id"]); $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin()); $this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author")); $this->tpl->parseCurrentBlock(); } // access if ($enable_internal_rss) { $this->tpl->setCurrentBlock("access"); $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility")); if ($a_set["visibility"] == NEWS_PUBLIC || $a_set["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $a_set["context_obj_id"])) { $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public")); } else { $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users")); } $this->tpl->parseCurrentBlock(); } // last update if ($a_set["creation_date"] != $a_set["update_date"]) { $this->tpl->setCurrentBlock("ni_update"); $this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update")); $this->tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["update_date"], IL_CAL_DATETIME))); $this->tpl->parseCurrentBlock(); } // creation date $this->tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME))); $this->tpl->setVariable("TXT_CREATED", $lng->txt("created")); // title $this->tpl->setVariable("VAL_TITLE", $a_set["title"]); // content if ($a_set["content"] != "") { $this->tpl->setCurrentBlock("content"); $this->tpl->setVariable("VAL_CONTENT", ilUtil::shortenText($a_set["content"], 80, true, true), true); $this->tpl->parseCurrentBlock(); } $perm_ref_id = $this->perm_ref_id > 0 ? $this->perm_ref_id : $a_set["ref_id"]; if ($ilAccess->checkAccess("write", "", $perm_ref_id)) { $this->tpl->setCurrentBlock("edit"); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $ilCtrl->setParameterByClass("ilnewsitemgui", "news_item_id", $a_set["id"]); $this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNewsItem")); $this->tpl->parseCurrentBlock(); } // context $this->tpl->setVariable("CONTEXT", $lng->txt("obj_" . $a_set["context_obj_type"]) . ":<br />" . ilObject::_lookupTitle($a_set["context_obj_id"])); $this->tpl->setVariable("VAL_ID", $a_set["id"]); }
/** * overwritten from base class */ function getDescription() { global $ilSetting; if (ilObjLinkResourceAccess::_checkDirectLink($this->obj_id)) { $this->__readLink(); $desc = $this->link_data['description']; // #10682 if ($ilSetting->get("rep_shorten_description")) { $desc = ilUtil::shortenText($desc, $ilSetting->get("rep_shorten_description_length"), true); } return $desc; } return parent::getDescription(); }
/** * overwritten method from base class * @access public * @param integer obj_id * @param integer array options * @return string */ function formatHeader(&$tpl, $a_obj_id, $a_option) { global $lng, $ilias, $ilCtrl; $tpl->setCurrentBlock("icon"); $tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_sahs_s.png")); $tpl->setVariable("TXT_ALT_IMG", $this->slm_obj->getTitle()); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("link"); $tpl->setVariable("TITLE", ilUtil::shortenText($this->slm_obj->getTitle() . "", $this->textwidth, true)); $tpl->setVariable("LINK_TARGET", $ilCtrl->getLinkTargetByClass("ilobjscorm2004learningmodulegui", "showOrganization")); $tpl->setVariable("TARGET", " target=\"" . $this->frame_target . "\""); $tpl->parseCurrentBlock(); $tpl->touchBlock("element"); }
/** * overwritten method from base class * @access public * @param integer obj_id * @param integer array options * @return string */ function formatHeader(&$tpl, $a_obj_id, $a_option) { global $lng, $ilias; $tpl->setCurrentBlock("icon"); $tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_lm_s.png", false, "output", $this->offlineMode())); $tpl->setVariable("TXT_ALT_IMG", $lng->txt("obj_" . $this->lm_obj->getType())); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("link"); $tpl->setVariable("TITLE", ilUtil::shortenText($this->lm_obj->getTitle(), $this->textwidth, true)); $tpl->setVariable("LINK_TARGET", $this->buildLinkTarget("", "")); $tpl->setVariable("TARGET", " target=\"" . $this->frame_target . "\""); $tpl->parseCurrentBlock(); $tpl->touchBlock("element"); }
public function parseGlobalOptions(stdClass $a_options, ilChart $a_chart) { $spider = new stdClass(); $spider->active = true; $spider->highlight = new stdClass(); $spider->highlight->mode = "line"; $spider->legs = new stdClass(); $spider->legs->fillStyle = ilChart::renderColor("#000", "0.7"); switch (count($a_chart->getLegLabels())) { case 4: case 6: $spider->legs->legStartAngle = 10; break; default: $spider->legs->legStartAngle = 0; break; } $spider->legs->data = array(); $max_str_len = 0; foreach ($a_chart->getLegLabels() as $l) { $l = ilUtil::shortenText($l, 80, true); $label = new stdClass(); $label->label = $l; $spider->legs->data[] = $label; $max_str_len = max($max_str_len, strlen($l)); } // depending on caption length if ($max_str_len > 60) { $font_size = 10; } else { if ($max_str_len > 30) { $font_size = 12; } else { $font_size = 15; } } $spider->legs->font = $font_size . "px Arial"; $spider->spiderSize = 0.7; $spider->lineWidth = 1; $spider->pointSize = 0; $spider->connection = new StdClass(); $spider->connection->width = 2; $spider->legMin = 1.0E-7; $spider->legMax = $a_chart->getYAxisMax(); $a_options->series->spider = $spider; }
/** * overwritten method from base class * @access public * @param integer obj_id * @param integer array options * @return string */ function formatHeader(&$tpl, $a_obj_id, $a_option) { global $lng, $ilias; //$tpl = new ilTemplate("tpl.tree.html", true, true, "Services/UIComponent/Explorer"); $tpl->setCurrentBlock("icon"); $tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_mep_s.png")); $tpl->setVariable("TXT_ALT_IMG", ilUtil::shortenText($this->media_pool->getTitle(), $this->textwidth, true)); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("link"); $tpl->setVariable("TITLE", ilUtil::shortenText($this->media_pool->getTitle(), $this->textwidth, true)); $tpl->setVariable("LINK_TARGET", $this->target); $tpl->setVariable("TARGET", " target=\"" . $this->frame_target . "\""); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("element"); $tpl->parseCurrentBlock(); //$this->output[] = $tpl->get(); }
/** * fill row * @global type $ilObjDataCache * @global ilRbacReview $rbacreview * @param array $a_set */ function fillRow($a_set) { global $ilObjDataCache, $rbacreview; $title = $ilObjDataCache->lookupTitle($rbacreview->getObjectOfRole($a_set["role"])); $this->tpl->setVariable("VAL_ID", $a_set['mapping_id']); $this->tpl->setVariable("VAL_TITLE", ilUtil::shortenText($title, 30, true)); $this->tpl->setVariable("VAL_ROLE", $a_set["role_name"]); $this->tpl->setVariable("VAL_GROUP", $a_set["dn"]); $this->tpl->setVariable("VAL_URL", $a_set["url"]); $this->tpl->setVariable("VAL_MEMBER", $a_set["member_attribute"]); $this->tpl->setVariable("VAL_INFO", ilUtil::prepareFormOutput($a_set['info'])); $this->ctrl->setParameter($this->getParentObject(), 'mapping_id', $a_set['mapping_id']); $this->tpl->setVariable("EDIT_URL", $this->ctrl->getLinkTarget($this->getParentObject(), 'addRoleMapping')); $this->tpl->setVariable("EDIT_TXT", $this->lng->txt('copy')); $this->ctrl->setParameter($this->getParentObject(), 'mapping_id', $a_set['mapping_id']); $this->tpl->setVariable("COPY_URL", $this->ctrl->getLinkTarget($this->getParentObject(), 'editRoleMapping')); $this->tpl->setVariable("COPY_TXT", $this->lng->txt('edit')); }
/** * overwritten method from base class * @access public * @param integer obj_id * @param integer array options * @return string */ function formatHeader(&$tpl, $a_obj_id, $a_option) { global $lng, $ilias; $tpl->setCurrentBlock("icon"); $tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_lm_s.png")); $tpl->setVariable("TXT_ALT_IMG", $lng->txt("obj_" . $this->lm_obj->getType())); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("link"); $tpl->setVariable("TITLE", ilUtil::shortenText($this->lm_obj->getTitle(), $this->textwidth, true)); if ($this->lm_obj->getType() == "lm") { $this->ctrl->setParameterByClass("ilObjLearningModuleGUI", "obj_id", ""); $link = $this->ctrl->getLinkTargetByClass("ilObjLearningModuleGUI", "chapters"); } else { $this->ctrl->setParameterByClass("ilObjDlBookGUI", "obj_id", ""); $link = $this->ctrl->getLinkTargetByClass("ilObjDlBookGUI", "chapters"); } $tpl->setVariable("LINK_TARGET", $link); $tpl->setVariable("TARGET", " target=\"" . $this->frame_target . "\""); $tpl->parseCurrentBlock(); //$tpl->setCurrentBlock("row"); //$tpl->parseCurrentBlock(); $tpl->touchBlock("element"); }
function _getHeaderTitleDescription() { global $ilDB; $id = ilObjSystemFolder::_getId(); $q = "SELECT title,description FROM object_translation " . "WHERE obj_id = " . $ilDB->quote($id, 'integer') . " " . "AND lang_default = 1"; $r = $this->ilias->db->query($q); $row = $r->fetchRow(DB_FETCHMODE_OBJECT); $description = $row->description; $q = "SELECT title,description FROM object_translation " . "WHERE obj_id = " . $ilDB->quote($id, 'integer') . " " . "AND lang_code = " . $ilDB->quote($this->ilias->account->getPref("language"), 'text') . " " . "AND NOT lang_default = 1"; $r = $this->ilias->db->query($q); $row = $r->fetchRow(DB_FETCHMODE_OBJECT); if ($row) { $description = ilUtil::shortenText($row->description, MAXLENGTH_OBJ_DESC, true); } return $description; }
/** * inserts sequential learning module navigation * at template variable LMNAVIGATION_CONTENT */ function ilLMNavigation() { global $ilUser; include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; include_once "./Services/Accessibility/classes/class.ilAccessKeyGUI.php"; $page_id = $this->getCurrentPageId(); if (empty($page_id)) { return; } // process navigation for free page if (!$this->lm_tree->isInTree($page_id)) { if ($this->offlineMode() || $_GET["back_pg"] == "") { return; } $limpos = strpos($_GET["back_pg"], ":"); if ($limpos > 0) { $back_pg = substr($_GET["back_pg"], 0, $limpos); } else { $back_pg = $_GET["back_pg"]; } if (!$this->lm->cleanFrames()) { $back_href = $this->getLink($this->lm->getRefId(), "layout", $back_pg, $_GET["frame"], "", "reduce"); $back_target = ""; } else { $back_href = $this->getLink($this->lm->getRefId(), "layout", $back_pg, "", "", "reduce"); $back_target = 'target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" '; } $back_img = ilUtil::getImagePath("nav_arr2_L.png", false, "output", $this->offlineMode()); $this->tpl->setCurrentBlock("ilLMNavigation_Prev"); $this->tpl->setVariable("IMG_PREV", $back_img); $this->tpl->setVariable("HREF_PREV", $back_href); $this->tpl->setVariable("FRAME_PREV", $back_target); $this->tpl->setVariable("TXT_PREV", $this->lng->txt("back")); $this->tpl->setVariable("ALT_PREV", $this->lng->txt("back")); $this->tpl->setVariable("PREV_ACC_KEY", ilAccessKeyGUI::getAttribute(ilAccessKey::PREVIOUS)); $this->tpl->setVariable("SPACER_PREV", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("ilLMNavigation_Prev2"); $this->tpl->setVariable("IMG_PREV2", $back_img); $this->tpl->setVariable("HREF_PREV2", $back_href); $this->tpl->setVariable("FRAME_PREV2", $back_target); $this->tpl->setVariable("TXT_PREV2", $this->lng->txt("back")); $this->tpl->setVariable("ALT_PREV2", $this->lng->txt("back")); $this->tpl->setVariable("SPACER_PREV2", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->parseCurrentBlock(); return; } // determine successor page_id $found = false; // empty chapter if ($this->chapter_has_no_active_page && ilLMObject::_lookupType($_GET["obj_id"]) == "st") { $c_id = $_GET["obj_id"]; } else { if ($this->deactivated_page) { $c_id = $_GET["obj_id"]; } else { $c_id = $page_id; } } while (!$found) { $succ_node = $this->lm_tree->fetchSuccessorNode($c_id, "pg"); $c_id = $succ_node["obj_id"]; $active = ilLMPage::_lookupActive($c_id, $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation")); if ($succ_node["obj_id"] > 0 && ($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && ($this->lm->getPublicAccessMode() == "selected" && !ilLMObject::_isPagePublic($succ_node["obj_id"]))) { $found = false; } else { if ($succ_node["obj_id"] > 0 && !$active) { // look, whether activation data should be shown $act_data = ilLMPage::_lookupActivationData((int) $succ_node["obj_id"], $this->lm->getType()); if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) { $found = true; } else { $found = false; } } else { $found = true; } } } $succ_str = $succ_node !== false ? " -> " . $succ_node["obj_id"] . "_" . $succ_node["type"] : ""; // determine predecessor page id $found = false; if ($this->deactivated_page) { $c_id = $_GET["obj_id"]; } else { $c_id = $page_id; } while (!$found) { $pre_node = $this->lm_tree->fetchPredecessorNode($c_id, "pg"); $c_id = $pre_node["obj_id"]; $active = ilLMPage::_lookupActive($c_id, $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation")); if ($pre_node["obj_id"] > 0 && ($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && ($this->lm->getPublicAccessMode() == "selected" && !ilLMObject::_isPagePublic($pre_node["obj_id"]))) { $found = false; } else { if ($pre_node["obj_id"] > 0 && !$active) { // look, whether activation data should be shown $act_data = ilLMPage::_lookupActivationData((int) $pre_node["obj_id"], $this->lm->getType()); if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) { $found = true; } else { $found = false; } } else { $found = true; } } } $pre_str = $pre_node !== false ? $pre_node["obj_id"] . "_" . $pre_node["type"] . " -> " : ""; // determine target frame $framestr = !empty($_GET["frame"]) ? "frame=" . $_GET["frame"] . "&" : ""; // Determine whether the view of a learning resource should // be shown in the frameset of ilias, or in a separate window. $showViewInFrameset = true; if ($pre_node != "") { // get presentation title $prev_title = ilLMPageObject::_getPresentationTitle($pre_node["obj_id"], $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), false, 0, $this->lang); $prev_title = ilUtil::shortenText($prev_title, 50, true); $prev_img = ilUtil::getImagePath("nav_arr_L.png", false, "output", $this->offlineMode()); if (!$this->lm->cleanFrames()) { $prev_href = $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"], $_GET["frame"]); $prev_target = ""; } else { if ($showViewInFrameset && !$this->offlineMode()) { $prev_href = $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"]); $prev_target = 'target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" '; } else { $prev_href = $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"]); $prev_target = 'target="_top" '; } } if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && ($this->lm->getPublicAccessMode() == 'selected' && !ilLMObject::_isPagePublic($pre_node["obj_id"]))) { $output = $this->lng->txt("msg_page_not_public"); } $this->tpl->setCurrentBlock("ilLMNavigation_Prev"); $this->tpl->setVariable("IMG_PREV", $prev_img); $this->tpl->setVariable("HREF_PREV", $prev_href); $this->tpl->setVariable("FRAME_PREV", $prev_target); $this->tpl->setVariable("TXT_PREV", $prev_title); $this->tpl->setVariable("ALT_PREV", $this->lng->txt("previous")); $this->tpl->setVariable("SPACER_PREV", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->setVariable("PREV_ACC_KEY", ilAccessKeyGUI::getAttribute(ilAccessKey::PREVIOUS)); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("ilLMNavigation_Prev2"); $this->tpl->setVariable("IMG_PREV2", $prev_img); $this->tpl->setVariable("HREF_PREV2", $prev_href); $this->tpl->setVariable("FRAME_PREV2", $prev_target); $this->tpl->setVariable("TXT_PREV2", $prev_title); $this->tpl->setVariable("ALT_PREV2", $this->lng->txt("previous")); $this->tpl->setVariable("SPACER_PREV2", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->parseCurrentBlock(); } if ($succ_node != "") { // get presentation title $succ_title = ilLMPageObject::_getPresentationTitle($succ_node["obj_id"], $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), false, 0, $this->lang); $succ_title = ilUtil::shortenText($succ_title, 50, true); $succ_img = ilUtil::getImagePath("nav_arr_R.png", false, "output", $this->offlineMode()); if (!$this->lm->cleanFrames()) { $succ_href = $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"], $_GET["frame"]); $succ_target = ""; } else { if ($showViewInFrameset && !$this->offlineMode()) { $succ_href = $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"]); $succ_target = ' target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" '; } else { $succ_href = $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"]); $succ_target = ' target="_top" '; } } if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && ($this->lm->getPublicAccessMode() == 'selected' && !ilLMObject::_isPagePublic($pre_node["obj_id"]))) { $output = $this->lng->txt("msg_page_not_public"); } $this->tpl->setCurrentBlock("ilLMNavigation_Next"); $this->tpl->setVariable("IMG_SUCC", $succ_img); $this->tpl->setVariable("HREF_SUCC", $succ_href); $this->tpl->setVariable("FRAME_SUCC", $succ_target); $this->tpl->setVariable("TXT_SUCC", $succ_title); $this->tpl->setVariable("ALT_SUCC", $this->lng->txt("next")); $this->tpl->setVariable("SPACER_SUCC", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->setVariable("NEXT_ACC_KEY", ilAccessKeyGUI::getAttribute(ilAccessKey::NEXT)); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("ilLMNavigation_Next2"); $this->tpl->setVariable("IMG_SUCC2", $succ_img); $this->tpl->setVariable("HREF_SUCC2", $succ_href); $this->tpl->setVariable("FRAME_SUCC2", $succ_target); $this->tpl->setVariable("TXT_SUCC2", $succ_title); $this->tpl->setVariable("ALT_SUCC2", $this->lng->txt("next")); $this->tpl->setVariable("SPACER_SUCC2", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->parseCurrentBlock(); // check if successor page is not restricted if (!$this->offlineMode()) { if ($this->lm->getRestrictForwardNavigation()) { if ($this->getTracker()->hasPredIncorrectAnswers($succ_node["obj_id"])) { $this->tpl->addOnLoadCode("\$('.ilc_page_rnav_RightNavigation').addClass('ilNoDisplay');"); } } } } }
/** * write description to db (static) * * @param int $a_obj_id object id * @param string $a_desc description * @access public */ function _writeDescription($a_obj_id, $a_desc) { global $ilDB, $objDefinition; $desc = ilUtil::shortenText($a_desc, MAXLENGTH_OBJ_DESC, true); $q = "UPDATE object_data " . "SET " . "description = " . $ilDB->quote($desc, "text") . "," . "last_update = " . $ilDB->now() . " " . "WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer"); $ilDB->manipulate($q); if ($objDefinition->isRBACObject($this->getType())) { // Update long description $res = $ilDB->query("SELECT * FROM object_description WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer')); if ($res->numRows()) { $values = array('description' => array('clob', $this->getLongDescription())); $ilDB->update('object_description', $values, array('obj_id' => array('integer', $this->getId()))); } else { $values = array('description' => array('clob', $this->getLongDescription()), 'obj_id' => array('integer', $this->getId())); $ilDB->insert('object_description', $values); } } }
/** * Fill table row */ protected function fillRow($term) { global $lng, $ilCtrl; include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); $ilCtrl->setParameterByClass("ilobjglossarygui", "term_id", $term["id"]); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]); $ilCtrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term["id"]); // actions drop down if ($this->glossary->getId() == $term["glo_id"]) { $list = new ilAdvancedSelectionListGUI(); $list->addItem($lng->txt("cont_edit_term"), "", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "editTerm")); if (count($defs) > 1) { $list->addItem($lng->txt("cont_edit_definitions"), "", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listDefinitions")); } else { if (count($defs) == 1) { $ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", $defs[0]["id"]); $list->addItem($lng->txt("cont_edit_definition"), "", $ilCtrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit")); } } $list->addItem($lng->txt("cont_add_definition"), "", $ilCtrl->getLinkTargetByClass("ilobjglossarygui", "addDefinition")); $ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", ""); $list->setId("act_term_" . $term["id"]); $list->setListTitle($lng->txt("actions")); $this->tpl->setVariable("ACTIONS", $list->getHTML()); } for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; /*if ($this->glossary->getId() == $term["glo_id"]) { // up if ($j > 0) { $this->tpl->setCurrentBlock("move_up"); $this->tpl->setVariable("TXT_UP", $lng->txt("up")); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_UP", $ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionUp")); $this->tpl->parseCurrentBlock(); } // down if ($j+1 < count($defs)) { $this->tpl->setCurrentBlock("move_down"); $this->tpl->setVariable("TXT_DOWN", $lng->txt("down")); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_DOWN", $ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionDown")); $this->tpl->parseCurrentBlock(); } // delete $this->tpl->setCurrentBlock("delete"); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_DELETE", $ilCtrl->getLinkTarget($this->parent_obj, "confirmDefinitionDeletion")); $this->tpl->setVariable("TXT_DELETE", $lng->txt("delete")); $this->tpl->parseCurrentBlock(); // edit $this->tpl->setCurrentBlock("edit"); $ilCtrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term["id"]); $ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", $def["id"]); $this->tpl->setVariable("LINK_EDIT", $ilCtrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit")); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $this->tpl->parseCurrentBlock(); }*/ // text $this->tpl->setCurrentBlock("definition"); $short_str = $def["short_text"]; // replace tex // if a tex end tag is missing a tex end tag $ltexs = strrpos($short_str, "[tex]"); $ltexe = strrpos($short_str, "[/tex]"); if ($ltexs > $ltexe) { $page = new ilGlossaryDefPage($def["id"]); $page->buildDom(); $short_str = $page->getFirstParagraphText(); $short_str = strip_tags($short_str, "<br>"); $ltexe = strpos($short_str, "[/tex]", $ltexs); $short_str = ilUtil::shortenText($short_str, $ltexe + 6, true); } $short_str = ilUtil::insertLatexImages($short_str); $short_str = ilPCParagraph::xml2output($short_str); $this->tpl->setVariable("DEF_SHORT", $short_str); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("definition_row"); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("check_col"); $this->tpl->setVariable("CHECKBOX_ID", $term["id"]); $this->tpl->parseCurrentBlock(); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); // usage if (in_array("usage", $this->getSelectedColumns())) { $nr_usage = ilGlossaryTerm::getNumberOfUsages($term["id"]); if ($nr_usage > 0 && $this->glossary->getId() == $term["glo_id"]) { $this->tpl->setCurrentBlock("link_usage"); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]); $this->tpl->setVariable("LUSAGE", ilGlossaryTerm::getNumberOfUsages($term["id"])); $this->tpl->setVariable("LINK_USAGE", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages")); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", ""); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("usage"); $this->tpl->setVariable("USAGE", ilGlossaryTerm::getNumberOfUsages($term["id"])); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("td_usage"); $this->tpl->parseCurrentBlock(); } // glossary title if (in_array($this->glossary->getVirtualMode(), array("level", "subtree"))) { $this->tpl->setCurrentBlock("glossary"); $this->tpl->setVariable("GLO_TITLE", ilObject::_lookupTitle($term["glo_id"])); $this->tpl->parseCurrentBlock(); } // output language if (in_array("language", $this->getSelectedColumns())) { $this->tpl->setCurrentBlock("td_lang"); $this->tpl->setVariable("TEXT_LANGUAGE", $lng->txt("meta_l_" . $term["language"])); $this->tpl->parseCurrentBlock(); } foreach ($this->adv_cols_order as $c) { if ($c["id"] == 0) { $this->tpl->setCurrentBlock("td"); $this->tpl->setVariable("TD_VAL", $term["term"]); $this->tpl->parseCurrentBlock(); } else { if (in_array("md_" . $c["id"], $this->selected_cols)) { $id = (int) $c["id"]; $val = " "; if (isset($term["md_" . $id . "_presentation"])) { $pb = $term["md_" . $id . "_presentation"]->getHTML(); if ($pb) { $val = $pb; } } $this->tpl->setCurrentBlock("td"); $this->tpl->setVariable("TD_VAL", $val); $this->tpl->parseCurrentBlock(); } } } }
/** * Render main menu entry * * @param * @return */ function renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target = "_top") { global $lng, $ilNavigationHistory, $ilSetting, $rbacsystem, $ilCtrl; $id = strtolower($a_id); $id_up = strtoupper($a_id); $a_tpl->setCurrentBlock("entry_" . $id); include_once "./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php"; // repository if ($a_id == "repository") { $gl = new ilGroupedListGUI(); $gl->setAsDropDown(true); include_once "./Services/Link/classes/class.ilLink.php"; $icon = ilUtil::img(ilObject::_getIcon(ilObject::_lookupObjId(1), "tiny")); $gl->addEntry($icon . " " . $a_txt . " - " . $lng->txt("rep_main_page"), ilLink::_getStaticLink(1, 'root', true), "_top"); $items = $ilNavigationHistory->getItems(); reset($items); $cnt = 0; $first = true; foreach ($items as $k => $item) { if ($cnt >= 10) { break; } if (!isset($item["ref_id"]) || !isset($_GET["ref_id"]) || ($item["ref_id"] != $_GET["ref_id"] || !$first)) { if ($cnt == 0) { $gl->addGroupHeader($lng->txt("last_visited"), "ilLVNavEnt"); } $obj_id = ilObject::_lookupObjId($item["ref_id"]); $cnt++; $icon = ilUtil::img(ilObject::_getIcon($obj_id, "tiny")); $ititle = ilUtil::shortenText(strip_tags($item["title"]), 50, true); // #11023 $gl->addEntry($icon . " " . $ititle, $item["link"], "_top", "", "ilLVNavEnt"); } $first = false; } if ($cnt > 0) { $gl->addEntry("» " . $lng->txt("remove_entries"), "#", "", "return il.MainMenu.removeLastVisitedItems('" . $ilCtrl->getLinkTargetByClass("ilnavigationhistorygui", "removeEntries", "", true) . "');", "ilLVNavEnt"); } $a_tpl->setVariable("REP_EN_OV", $gl->getHTML()); } // desktop if ($a_id == "desktop") { $gl = new ilGroupedListGUI(); $gl->setAsDropDown(true); // overview $gl->addEntry($lng->txt("overview"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSelectedItems", "_top", "", "", "mm_pd_sel_items", ilHelp::getMainMenuTooltip("mm_pd_sel_items"), "left center", "right center", false); // my groups and courses, if both is available if ($ilSetting->get('disable_my_offers') == 0 && $ilSetting->get('disable_my_memberships') == 0) { $gl->addEntry($lng->txt("my_courses_groups"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToMemberships", "_top", "", "", "mm_pd_crs_grp", ilHelp::getMainMenuTooltip("mm_pd_crs_grp"), "left center", "right center", false); } // bookmarks if (!$this->ilias->getSetting("disable_bookmarks")) { $gl->addEntry($lng->txt("bookmarks"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToBookmarks", "_top", "", "", "mm_pd_bookm", ilHelp::getMainMenuTooltip("mm_pd_bookm"), "left center", "right center", false); } // private notes if (!$this->ilias->getSetting("disable_notes")) { $gl->addEntry($lng->txt("notes_and_comments"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNotes", "_top", "", "", "mm_pd_notes", ilHelp::getMainMenuTooltip("mm_pd_notes"), "left center", "right center", false); } // news if ($ilSetting->get("block_activated_news")) { $gl->addEntry($lng->txt("news"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNews", "_top", "", "", "mm_pd_news", ilHelp::getMainMenuTooltip("mm_pd_news"), "left center", "right center", false); } // overview is always active $gl->addSeparator(); $separator = false; if (!$ilSetting->get("disable_personal_workspace")) { // workspace $gl->addEntry($lng->txt("personal_workspace"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace", "_top", "", "", "mm_pd_wsp", ilHelp::getMainMenuTooltip("mm_pd_wsp"), "left center", "right center", false); $separator = true; } // portfolio if ($ilSetting->get('user_portfolios')) { $gl->addEntry($lng->txt("portfolio"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio", "_top", "", "", "mm_pd_port", ilHelp::getMainMenuTooltip("mm_pd_port"), "left center", "right center", false); $separator = true; } // skills $skmg_set = new ilSetting("skmg"); if ($skmg_set->get("enable_skmg")) { $gl->addEntry($lng->txt("skills"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSkills", "_top", "", "", "mm_pd_skill", ilHelp::getMainMenuTooltip("mm_pd_skill"), "left center", "right center", false); $separator = true; } // Learning Progress include_once "Services/Tracking/classes/class.ilObjUserTracking.php"; if (ilObjUserTracking::_enabledLearningProgress() && (ilObjUserTracking::_hasLearningProgressOtherUsers() || ilObjUserTracking::_hasLearningProgressLearner())) { //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI")); $gl->addEntry($lng->txt("learning_progress"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToLP", "_top", "", "", "mm_pd_lp", ilHelp::getMainMenuTooltip("mm_pd_lp"), "left center", "right center", false); $separator = true; } if ($separator) { $gl->addSeparator(); } $separator = false; // calendar include_once './Services/Calendar/classes/class.ilCalendarSettings.php'; $settings = ilCalendarSettings::_getInstance(); if ($settings->isEnabled()) { $gl->addEntry($lng->txt("calendar"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToCalendar", "_top", "", "", "mm_pd_cal", ilHelp::getMainMenuTooltip("mm_pd_cal"), "left center", "right center", false); $separator = true; } // mail if ($this->mail) { $gl->addEntry($lng->txt('mail'), 'ilias.php?baseClass=ilMailGUI', '_top', "", "", "mm_pd_mail", ilHelp::getMainMenuTooltip("mm_pd_mail"), "left center", "right center", false); $separator = true; } // contacts if (!$this->ilias->getSetting('disable_contacts') && ($this->ilias->getSetting('disable_contacts_require_mail') || $rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId()))) { $gl->addEntry($lng->txt('mail_addressbook'), 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToContacts', '_top', "", "", "mm_pd_contacts", ilHelp::getMainMenuTooltip("mm_pd_contacts"), "left center", "right center", false); $separator = true; } if ($separator) { $gl->addSeparator(); } // profile $gl->addEntry($lng->txt("personal_profile"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile", "_top", "", "", "mm_pd_profile", ilHelp::getMainMenuTooltip("mm_pd_profile"), "left center", "right center", false); // settings $gl->addEntry($lng->txt("personal_settings"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings", "_top", "", "", "mm_pd_sett", ilHelp::getMainMenuTooltip("mm_pd_sett"), "left center", "right center", false); $a_tpl->setVariable("DESK_CONT_OV", $gl->getHTML()); } if (IS_PAYMENT_ENABLED) { // shop if ($a_id == "shop") { $gl = new ilGroupedListGUI(); $gl->setAsDropDown(true); // shop_content $gl->addEntry($lng->txt("content"), "ilias.php?baseClass=ilShopController&cmd=firstpage", "_top"); // shoppingcart include_once 'Services/Payment/classes/class.ilPaymentShoppingCart.php'; global $ilUser; $objShoppingCart = new ilPaymentShoppingCart($ilUser); $items = $objShoppingCart->getEntries(); if (count($items) > 0) { $gl->addEntry($lng->txt("shoppingcart") . ' (' . count($items) . ')', "ilias.php?baseClass=ilShopController&cmdClass=ilshopshoppingcartgui", "_top"); } $a_tpl->setVariable("SHOP_CONT_OV", $gl->getHTML()); } } $a_tpl->setVariable("TXT_" . $id_up, $a_txt); $a_tpl->setVariable("SCRIPT_" . $id_up, $a_script); $a_tpl->setVariable("TARGET_" . $id_up, $a_target); if ($this->active == $a_id || $this->active == "" && $a_id == "repository") { //$a_tpl->setVariable("MM_CLASS", "MMActive"); $a_tpl->setVariable("SEL", '<span class="ilAccHidden">(' . $lng->txt("stat_selected") . ')</span>'); } else { //$a_tpl->setVariable("MM_CLASS", "MMInactive"); } if ($a_id == "repository") { include_once "./Services/Accessibility/classes/class.ilAccessKey.php"; if (ilAccessKey::getKey(ilAccessKey::LAST_VISITED) != "") { $a_tpl->setVariable("ACC_KEY_REPOSITORY", 'accesskey="' . ilAccessKey::getKey(ilAccessKey::LAST_VISITED) . '"'); } } if ($a_id == "desktop") { include_once "./Services/Accessibility/classes/class.ilAccessKey.php"; if (ilAccessKey::getKey(ilAccessKey::PERSONAL_DESKTOP) != "") { $a_tpl->setVariable("ACC_KEY_DESKTOP", 'accesskey="' . ilAccessKey::getKey(ilAccessKey::PERSONAL_DESKTOP) . '"'); } } $a_tpl->parseCurrentBlock(); }
/** * Shorten short text * * @param * @return */ function shortenShortText($text) { $a_length = 196; if ($this->getTermId() > 0) { include_once "./Modules/Glossary/classes/class.ilObjGlossary.php"; include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; $glo_id = ilGlossaryTerm::_lookGlossaryId($this->getTermId()); $snippet_length = ilObjGlossary::lookupSnippetLength($glo_id); if ($snippet_length > 0) { $a_length = $snippet_length; } } $text = str_replace("<br/>", "<br>", $text); $text = strip_tags($text, "<br>"); if (is_int(strpos(substr($text, $a_length - 16 - 5, 10), "[tex]"))) { $offset = 5; } $short = ilUtil::shortenText($text, $a_length - 16 + $offset, true); // make short text longer, if tex end tag is missing $ltexs = strrpos($short, "[tex]"); $ltexe = strrpos($short, "[/tex]"); if ($ltexs > $ltexe) { $ltexe = strpos($text, "[/tex]", $ltexs); if ($ltexe > 0) { $short = ilUtil::shortenText($text, $ltexe + 6, true); } } $short = ilUtil::shortenText($text, $a_length, true); return $short; }
/** * get title for presentation. * Special handling for auto generated appointments * * @access public * @return */ public function getPresentationTitle($a_shorten = true) { global $lng; if ($this->getTranslationType() == IL_CAL_TRANSLATION_NONE) { $title = $this->getTitle(); } elseif (strlen($this->getSubtitle())) { // parse dynamic title? if (preg_match("/#([a-z]+)#/", $this->getSubtitle(), $matches)) { $subtitle = $this->parseDynamicTitle($matches[1]); } else { $subtitle = $lng->txt($this->getSubtitle()); } $title = $this->getTitle() . (strlen($subtitle) ? ' (' . $subtitle . ')' : ''); } else { $title = $this->getTitle(); } if ($a_shorten) { return ilUtil::shortenText(ilUtil::shortenWords($title, 20), 40, true); } return $title; }
/** * Fill table row */ protected function fillRow($term) { global $lng, $ilCtrl; $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]); for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; if ($this->glossary->getId() == $term["glo_id"]) { // up if ($j > 0) { $this->tpl->setCurrentBlock("move_up"); $this->tpl->setVariable("TXT_UP", $lng->txt("up")); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_UP", $ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionUp")); $this->tpl->parseCurrentBlock(); } // down if ($j + 1 < count($defs)) { $this->tpl->setCurrentBlock("move_down"); $this->tpl->setVariable("TXT_DOWN", $lng->txt("down")); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_DOWN", $ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionDown")); $this->tpl->parseCurrentBlock(); } // delete $this->tpl->setCurrentBlock("delete"); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_DELETE", $ilCtrl->getLinkTarget($this->parent_obj, "confirmDefinitionDeletion")); $this->tpl->setVariable("TXT_DELETE", $lng->txt("delete")); $this->tpl->parseCurrentBlock(); // edit $this->tpl->setCurrentBlock("edit"); $ilCtrl->setParameterByClass("ilpageobjectgui", "term_id", $term["id"]); $ilCtrl->setParameterByClass("ilpageobjectgui", "def", $def["id"]); $this->tpl->setVariable("LINK_EDIT", $ilCtrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilpageobjectgui"), "edit")); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $this->tpl->parseCurrentBlock(); } // text $this->tpl->setCurrentBlock("definition"); $short_str = $def["short_text"]; // replace tex // if a tex end tag is missing a tex end tag $ltexs = strrpos($short_str, "[tex]"); $ltexe = strrpos($short_str, "[/tex]"); if ($ltexs > $ltexe) { $page =& new ilPageObject("gdf", $def["id"]); $page->buildDom(); $short_str = $page->getFirstParagraphText(); $short_str = strip_tags($short_str, "<br>"); $ltexe = strpos($short_str, "[/tex]", $ltexs); $short_str = ilUtil::shortenText($short_str, $ltexe + 6, true); } $short_str = ilUtil::insertLatexImages($short_str); $short_str = ilPCParagraph::xml2output($short_str); $this->tpl->setVariable("DEF_SHORT", $short_str); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("definition_row"); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("check_col"); $this->tpl->setVariable("CHECKBOX_ID", $term["id"]); $this->tpl->parseCurrentBlock(); // edit term link $this->tpl->setCurrentBlock("edit_term"); $this->tpl->setVariable("TEXT_TERM", $term["term"]); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); if ($this->glossary->getId() == $term["glo_id"]) { $this->tpl->setVariable("LINK_EDIT_TERM", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "editTerm")); $this->tpl->setVariable("TXT_EDIT_TERM", $lng->txt("edit")); } $this->tpl->parseCurrentBlock(); // usage $nr_usage = ilGlossaryTerm::getNumberOfUsages($term["id"]); if ($nr_usage > 0 && $this->glossary->getId() == $term["glo_id"]) { $this->tpl->setCurrentBlock("link_usage"); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]); $this->tpl->setVariable("LUSAGE", ilGlossaryTerm::getNumberOfUsages($term["id"])); $this->tpl->setVariable("LINK_USAGE", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages")); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", ""); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("usage"); $this->tpl->setVariable("USAGE", ilGlossaryTerm::getNumberOfUsages($term["id"])); $this->tpl->parseCurrentBlock(); } // glossary title if (in_array($this->glossary->getVirtualMode(), array("level", "subtree"))) { $this->tpl->setCurrentBlock("glossary"); $this->tpl->setVariable("GLO_TITLE", ilObject::_lookupTitle($term["glo_id"])); $this->tpl->parseCurrentBlock(); } // output term and language $this->tpl->setVariable("TEXT_LANGUAGE", $lng->txt("meta_l_" . $term["language"])); }
/** * get title for presentation. * Special handling for auto generated appointments * * @access public * @return */ public function getPresentationTitle($a_shorten = true) { global $ilUser, $lng; if ($this->getTranslationType() == IL_CAL_TRANSLATION_NONE) { $title = $this->getTitle(); } else { $title = $this->getTitle() . ' (' . $lng->txt($this->getSubtitle()) . ')'; } if ($a_shorten) { return ilUtil::shortenText(ilUtil::shortenWords($title, 20), 40, true); } return $title; }
/** * Get subitems of container * * @param bool administration panel enabled * @param bool side blocks enabled * * @return array */ function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false, $a_get_single = 0) { global $objDefinition, $ilBench, $tree, $ilObjDataCache, $ilUser, $rbacsystem, $ilSetting; // Caching if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]) && !$a_get_single) { return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]; } $type_grps = $this->getGroupedObjTypes(); $objects = $tree->getChilds($this->getRefId(), "title"); // using long descriptions? $short_desc = $ilSetting->get("rep_shorten_description"); $short_desc_max_length = $ilSetting->get("rep_shorten_description_length"); if (!$short_desc || $short_desc_max_length != ilObject::TITLE_LENGTH) { // using (part of) shortened description if ($short_desc && $short_desc_max_length && $short_desc_max_length < ilObject::TITLE_LENGTH) { foreach ($objects as $key => $object) { $objects[$key]["description"] = ilUtil::shortenText($object["description"], $short_desc_max_length, true); } } else { $obj_ids = array(); foreach ($objects as $key => $object) { $obj_ids[] = $object["obj_id"]; } if (sizeof($obj_ids)) { $long_desc = ilObject::getLongDescriptions($obj_ids); foreach ($objects as $key => $object) { // #12166 - keep translation, ignore long description if ($ilObjDataCache->isTranslatedDescription($object["obj_id"])) { $long_desc[$object["obj_id"]] = $object["description"]; } if ($short_desc && $short_desc_max_length) { $long_desc[$object["obj_id"]] = ilUtil::shortenText($long_desc[$object["obj_id"]], $short_desc_max_length, true); } $objects[$key]["description"] = $long_desc[$object["obj_id"]]; } } } } $found = false; $all_ref_ids = array(); if (!self::$data_preloaded) { include_once "./Services/Object/classes/class.ilObjectListGUIPreloader.php"; $preloader = new ilObjectListGUIPreloader(ilObjectListGUI::CONTEXT_REPOSITORY); } include_once 'Services/Container/classes/class.ilContainerSorting.php'; $sort = ilContainerSorting::_getInstance($this->getId()); // TODO: check this // get items attached to a session include_once './Modules/Session/classes/class.ilEventItems.php'; $event_items = ilEventItems::_getItemsOfContainer($this->getRefId()); foreach ($objects as $key => $object) { if ($a_get_single > 0 && $object["child"] != $a_get_single) { continue; } // hide object types in devmode if ($objDefinition->getDevMode($object["type"]) || $object["type"] == "adm" || $object["type"] == "rolf") { continue; } // remove inactive plugins if ($objDefinition->isInactivePlugin($object["type"])) { continue; } // BEGIN WebDAV: Don't display hidden Files, Folders and Categories if (in_array($object['type'], array('file', 'fold', 'cat'))) { include_once 'Modules/File/classes/class.ilObjFileAccess.php'; if (ilObjFileAccess::_isFileHidden($object['title'])) { $this->setHiddenFilesFound(true); if (!$a_admin_panel_enabled) { continue; } } } // END WebDAV: Don't display hidden Files, Folders and Categories // including event items! if (!self::$data_preloaded) { $preloader->addItem($object["obj_id"], $object["type"], $object["child"]); } // filter out items that are attached to an event if (in_array($object['ref_id'], $event_items)) { continue; } // filter side block items if (!$a_include_side_block && $objDefinition->isSideBlock($object['type'])) { continue; } $all_ref_ids[] = $object["child"]; } // data preloader if (!self::$data_preloaded) { $preloader->preload(); unset($preloader); self::$data_preloaded = true; } foreach ($objects as $key => $object) { // see above, objects were filtered if (!in_array($object["child"], $all_ref_ids)) { continue; } // group object type groups together (e.g. learning resources) $type = $objDefinition->getGroupOfObj($object["type"]); if ($type == "") { $type = $object["type"]; } // this will add activation properties $this->addAdditionalSubItemInformation($object); $this->items[$type][$key] = $object; $this->items["_all"][$key] = $object; if ($object["type"] != "sess") { $this->items["_non_sess"][$key] = $object; } } $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block] = $sort->sortItems($this->items); return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]; }
/** * Creates output * recursive method * @access private * @param integer * @param array * @return string */ function formatObject($a_node_id, $a_option, $jsApi) { global $lng, $ilBench; //echo "scorm: ".$a_option["title"]." >> ".implode(", ",$a_option["tab"])."<br>"; if (!isset($a_node_id) or !is_array($a_option)) { $this->ilias->raiseError(get_class($this) . "::formatObject(): Missing parameter or wrong datatype! " . "node_id: " . $a_node_id . " options:" . var_dump($a_option), $this->ilias->error_obj->WARNING); } $tpl = new ilTemplate("tpl.sahs_tree.html", true, true, "Modules/ScormAicc"); if ($a_option["c_type"] == "sos") { return; } if ($a_option["c_type"] == "srs") { return; } $ilBench->start("SCORMExplorer", "renderIcons"); if (is_array($a_option["tab"])) { //test if there are any tabs foreach ($a_option["tab"] as $picture) { if ($picture == 'plus') { $target = $this->createTarget('+', $a_node_id); $tpl->setCurrentBlock("expander"); $tpl->setVariable("LINK_TARGET_EXPANDER", $target); $tpl->setVariable("IMGPATH", ilUtil::getImagePath("browser/plus.png")); $tpl->parseCurrentBlock(); } if ($picture == 'minus' && $this->show_minus) { $target = $this->createTarget('-', $a_node_id); $tpl->setCurrentBlock("expander"); $tpl->setVariable("LINK_TARGET_EXPANDER", $target); $tpl->setVariable("IMGPATH", ilUtil::getImagePath("browser/minus.png")); $tpl->parseCurrentBlock(); } if ($picture == 'blank' or $picture == 'winkel' or $picture == 'hoch' or $picture == 'quer' or $picture == 'ecke') { $picture = 'blank'; $tpl->setCurrentBlock("lines"); $tpl->setVariable("IMGPATH_LINES", ilUtil::getImagePath("browser/" . $picture . ".png")); $tpl->parseCurrentBlock(); } } } $ilBench->stop("SCORMExplorer", "renderIcons"); $ilBench->start("SCORMExplorer", "initSCORMItem"); $sc_object =& new ilSCORMItem($a_node_id); $id_ref = $sc_object->getIdentifierRef(); $ilBench->stop("SCORMExplorer", "initSCORMItem"); $ilBench->start("SCORMExplorer", "initResource"); //$sc_res =& new ilSCORMResource(); $sc_res_id = ilSCORMResource::_lookupIdByIdRef($id_ref, $sc_object->getSLMId()); $ilBench->stop("SCORMExplorer", "initResource"); $scormtype = strtolower(ilSCORMResource::_lookupScormType($sc_res_id)); $ilBench->start("SCORMExplorer", "renderLink"); $ilBench->start("SCORMExplorer", "renderLink_OutputIcons"); if ($this->output_icons) { if ($this->isClickable($a_option["c_type"], $a_node_id, $sc_object)) { $this->getOutputIcons($tpl, $a_option, $a_node_id, $scormtype); } } $ilBench->stop("SCORMExplorer", "renderLink_OutputIcons"); if ($this->isClickable($a_option["c_type"], $a_node_id, $sc_object)) { $ilBench->start("SCORMExplorer", "renderLink_parseLinkBlock"); $tpl->setCurrentBlock("link"); $frame_target = $this->buildFrameTarget($a_option["c_type"], $a_node_id, $a_option["obj_id"]); if ($frame_target != "") { $tpl->setVariable("TITLE", ilUtil::shortenText($a_option["title"], $this->textwidth, true)); $tpl->setVariable("LINK_TARGET", "javascript:void(0);"); if ($jsApi == true) { $tpl->setVariable("ONCLICK", " onclick=\"parent.API.IliasLaunch('" . $a_node_id . "');return false;\""); } else { $tpl->setVariable("ONCLICK", " onclick=\"parent.APIFRAME.setupApi();parent.APIFRAME.API." . ($scormtype == 'asset' ? 'IliasLaunchAsset' : 'IliasLaunchSahs') . "('" . $a_node_id . "');return false;\""); } } $tpl->parseCurrentBlock(); $ilBench->stop("SCORMExplorer", "renderLink_parseLinkBlock"); } else { $tpl->setCurrentBlock("text"); $tpl->setVariable("OBJ_TITLE", ilUtil::shortenText($a_option["title"], $this->textwidth, true)); $tpl->parseCurrentBlock(); } $ilBench->stop("SCORMExplorer", "renderLink"); $ilBench->start("SCORMExplorer", "formatItemTable"); $this->formatItemTable($tpl, $a_node_id, $a_option["c_type"]); $ilBench->stop("SCORMExplorer", "formatItemTable"); $tpl->setCurrentBlock("row"); $tpl->parseCurrentBlock(); $this->output[] = $tpl->get(); }
/** * Creates output * recursive method * @access private * @param integer * @param array * @return string */ function formatObject(&$tpl, $a_node_id, $a_option, $a_obj_id = 0) { global $lng; if (!isset($a_node_id) or !is_array($a_option)) { $this->ilias->raiseError(get_class($this) . "::formatObject(): Missing parameter or wrong datatype! " . "node_id: " . $a_node_id . " options:" . var_dump($a_option), $this->ilias->error_obj->WARNING); } $pic = false; foreach ((array) $a_option["tab"] as $picture) { if ($picture == 'plus') { $tpl->setCurrentBlock("expander"); $tpl->setVariable("EXP_DESC", $lng->txt("collapsed")); $tpl->setVariable("LINK_NAME", $a_node_id); if (!$this->getAsynchExpanding()) { $target = $this->createTarget('+', $a_node_id, $a_option["highlighted_subtree"]); $tpl->setVariable("LINK_TARGET_EXPANDER", $target); } else { $target = $this->createTarget('+', $a_node_id, $a_option["highlighted_subtree"], false); $tpl->setVariable("ONCLICK_TARGET_EXPANDER", " onclick=\"return il.Explorer.refresh('tree_div', '" . $target . "');\""); $tpl->setVariable("LINK_TARGET_EXPANDER", "#"); } $tpl->setVariable("IMGPATH", $this->getImage("browser/plus.png")); $tpl->parseCurrentBlock(); $pic = true; } if ($picture == 'forceexp') { $tpl->setCurrentBlock("expander"); $tpl->setVariable("EXP_DESC", $lng->txt("expanded")); $target = $this->createTarget('+', $a_node_id); $tpl->setVariable("LINK_NAME", $a_node_id); $tpl->setVariable("LINK_TARGET_EXPANDER", $target); $tpl->setVariable("IMGPATH", $this->getImage("browser/forceexp.png")); $tpl->parseCurrentBlock(); $pic = true; } if ($picture == 'minus' && $this->show_minus) { $tpl->setCurrentBlock("expander"); $tpl->setVariable("EXP_DESC", $lng->txt("expanded")); $tpl->setVariable("LINK_NAME", $a_node_id); if (!$this->getAsynchExpanding()) { $target = $this->createTarget('-', $a_node_id, $a_option["highlighted_subtree"]); $tpl->setVariable("LINK_TARGET_EXPANDER", $target); } else { $target = $this->createTarget('-', $a_node_id, $a_option["highlighted_subtree"], false); $tpl->setVariable("ONCLICK_TARGET_EXPANDER", " onclick=\"return il.Explorer.refresh('tree_div', '" . $target . "');\""); $tpl->setVariable("LINK_TARGET_EXPANDER", "#"); } $tpl->setVariable("IMGPATH", $this->getImage("browser/minus.png")); $tpl->parseCurrentBlock(); $pic = true; } /* if ($picture == 'blank' or $picture == 'winkel' or $picture == 'hoch' or $picture == 'quer' or $picture == 'ecke') { $picture = "blank"; $tpl->setCurrentBlock("lines"); $tpl->setVariable("IMGPATH_LINES", $this->getImage("browser/".$picture.".png")); $tpl->parseCurrentBlock(); } */ } if (!$pic) { $tpl->setCurrentBlock("blank"); $tpl->setVariable("BLANK_PATH", $this->getImage("browser/blank.png")); $tpl->parseCurrentBlock(); } if ($this->output_icons) { $tpl->setCurrentBlock("icon"); $tpl->setVariable("ICON_IMAGE", $this->getImage("icon_" . $a_option["type"] . "_s.png", $a_option["type"], $a_obj_id)); $tpl->setVariable("TARGET_ID", "iconid_" . $a_node_id); $this->iconList[] = "iconid_" . $a_node_id; $tpl->setVariable("TXT_ALT_IMG", $this->getImageAlt($lng->txt("icon") . " " . $lng->txt($a_option["desc"]), $a_option["type"], $a_obj_id)); $tpl->parseCurrentBlock(); } if (strlen($sel = $this->buildSelect($a_node_id, $a_option['type']))) { $tpl->setCurrentBlock('select'); $tpl->setVariable('OBJ_SEL', $sel); $tpl->parseCurrentBlock(); } if ($this->isClickable($a_option["type"], $a_node_id, $a_obj_id)) { $tpl->setCurrentBlock("link"); //$target = (strpos($this->target, "?") === false) ? // $this->target."?" : $this->target."&"; //$tpl->setVariable("LINK_TARGET", $target.$this->target_get."=".$a_node_id.$this->params_get); $tpl->setVariable("LINK_TARGET", $this->buildLinkTarget($a_node_id, $a_option["type"])); $style_class = $this->getNodeStyleClass($a_node_id, $a_option["type"]); if ($style_class != "") { $tpl->setVariable("A_CLASS", ' class="' . $style_class . '" '); } if (($onclick = $this->buildOnClick($a_node_id, $a_option["type"], $a_option["title"])) != "") { $tpl->setVariable("ONCLICK", "onClick=\"{$onclick}\""); } //$tpl->setVariable("LINK_NAME", $a_node_id); $tpl->setVariable("TITLE", ilUtil::shortenText($this->buildTitle($a_option["title"], $a_node_id, $a_option["type"]), $this->textwidth, true)); $tpl->setVariable("DESC", ilUtil::shortenText($this->buildDescription($a_option["description"], $a_node_id, $a_option["type"]), $this->textwidth, true)); $frame_target = $this->buildFrameTarget($a_option["type"], $a_node_id, $a_option["obj_id"]); if ($frame_target != "") { $tpl->setVariable("TARGET", " target=\"" . $frame_target . "\""); } $tpl->parseCurrentBlock(); } else { $tpl->setCurrentBlock("text"); $tpl->setVariable("OBJ_TITLE", ilUtil::shortenText($this->buildTitle($a_option["title"], $a_node_id, $a_option["type"]), $this->textwidth, true)); $tpl->setVariable("OBJ_DESC", ilUtil::shortenText($this->buildDescription($a_option["desc"], $a_node_id, $a_option["type"]), $this->textwidth, true)); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("list_item"); $tpl->parseCurrentBlock(); $tpl->touchBlock("element"); }
function formatObject(&$tpl, $a_node_id, $a_option, $a_obj_id = 0) { global $lng; if (!isset($a_node_id) or !is_array($a_option)) { $this->ilias->raiseError(get_class($this) . "::formatObject(): Missing parameter or wrong datatype! " . "node_id: " . $a_node_id . " options:" . var_dump($a_option), $this->ilias->error_obj->WARNING); } $pic = false; foreach ($a_option["tab"] as $picture) { if ($picture == 'plus') { $tpl->setCurrentBlock("expander"); $tpl->setVariable("EXP_DESC", $lng->txt("expand")); $target = $this->createTarget('+', $a_node_id); $tpl->setVariable("LINK_NAME", $a_node_id); $tpl->setVariable("LINK_TARGET_EXPANDER", $target); $tpl->setVariable("IMGPATH", $this->getImage("browser/plus.png")); $tpl->parseCurrentBlock(); $pic = true; } if ($picture == 'minus' && $this->show_minus) { $tpl->setCurrentBlock("expander"); $tpl->setVariable("EXP_DESC", $lng->txt("collapse")); $target = $this->createTarget('-', $a_node_id); $tpl->setVariable("LINK_NAME", $a_node_id); $tpl->setVariable("LINK_TARGET_EXPANDER", $target); $tpl->setVariable("IMGPATH", $this->getImage("browser/minus.png")); $tpl->parseCurrentBlock(); $pic = true; } } if (!$pic) { $tpl->setCurrentBlock("blank"); $tpl->setVariable("BLANK_PATH", $this->getImage("browser/blank.png")); $tpl->parseCurrentBlock(); } if ($this->output_icons) { $tpl->setCurrentBlock("icon"); $tpl->setVariable("ICON_IMAGE", $this->getImage("icon_" . $a_option["type"] . ".svg", $a_option["type"], $a_obj_id)); $tpl->setVariable("TARGET_ID", "iconid_" . $a_node_id); $this->iconList[] = "iconid_" . $a_node_id; $tpl->setVariable("TXT_ALT_IMG", $lng->txt($a_option["desc"])); $tpl->parseCurrentBlock(); } if (strlen($formItem = $this->buildFormItem($a_node_id, $a_option['type']))) { $tpl->setCurrentBlock('check'); $tpl->setVariable('OBJ_CHECK', $formItem); $tpl->parseCurrentBlock(); } if ($this->isClickable($a_option["type"], $a_node_id, $a_obj_id)) { $tpl->setCurrentBlock("link"); //$target = (strpos($this->target, "?") === false) ? // $this->target."?" : $this->target."&"; //$tpl->setVariable("LINK_TARGET", $target.$this->target_get."=".$a_node_id.$this->params_get); $tpl->setVariable("LINK_TARGET", $this->buildLinkTarget($a_node_id, $a_option["type"])); $style_class = $this->getNodeStyleClass($a_node_id, $a_option["type"]); if ($style_class != "") { $tpl->setVariable("A_CLASS", ' class="' . $style_class . '" '); } if (($onclick = $this->buildOnClick($a_node_id, $a_option["type"], $a_option["title"])) != "") { $tpl->setVariable("ONCLICK", "onClick=\"{$onclick}\""); } $tpl->setVariable("LINK_NAME", $a_node_id); $tpl->setVariable("TITLE", $this->buildTitle($a_option["title"], $a_node_id, $a_option["type"])); $tpl->setVariable("DESC", ilUtil::shortenText($this->buildDescription($a_option["description"], $a_node_id, $a_option["type"]), $this->textwidth, true)); $frame_target = $this->buildFrameTarget($a_option["type"], $a_node_id, $a_option["obj_id"]); if ($frame_target != "") { $tpl->setVariable("TARGET", " target=\"" . $frame_target . "\""); } $tpl->parseCurrentBlock(); } else { $tpl->setCurrentBlock("text"); $tpl->setVariable("OBJ_TITLE", $this->buildTitle($a_option["title"], $a_node_id, $a_option["type"])); $tpl->setVariable("OBJ_DESC", ilUtil::shortenText($this->buildDescription($a_option["desc"], $a_node_id, $a_option["type"]), $this->textwidth, true)); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("list_item"); $tpl->parseCurrentBlock(); $tpl->touchBlock("element"); }
/** * Get list data. */ function getListRowData() { global $ilUser, $lng, $ilCtrl; $data = array(); foreach ($this->notes as $note) { switch ($note->getLabel()) { case IL_NOTE_UNLABELED: $img = ilUtil::getImagePath("note_unlabeled.png"); $alt = $lng->txt("note"); break; case IL_NOTE_IMPORTANT: $img = ilUtil::getImagePath("note_important.png"); $alt = $lng->txt("note") . ", " . $lng->txt("important"); break; case IL_NOTE_QUESTION: $img = ilUtil::getImagePath("note_question.png"); $alt = $lng->txt("note") . ", " . $lng->txt("question"); break; case IL_NOTE_PRO: $img = ilUtil::getImagePath("note_pro.png"); $alt = $lng->txt("note") . ", " . $lng->txt("pro"); break; case IL_NOTE_CONTRA: $img = ilUtil::getImagePath("note_contra.png"); $alt = $lng->txt("note") . ", " . $lng->txt("contra"); break; } // details $target = $note->getObject(); // new notes do not have subject anymore $title = $note->getSubject(); if (!$title) { $title = ilUtil::shortenText($note->getText(), 75, true, true); } $data[] = array("subject" => $title, "img" => $img, "alt" => $alt, "text" => ilUtil::shortenText($note->getText(), 150, true, true), "date" => $note->getCreationDate(), "id" => $note->getId(), "obj_type" => $target["obj_type"], "obj_id" => $target["obj_id"], "rep_obj_id" => $target["rep_obj_id"]); } $this->setData($data); }
/** * save all measurements */ function save() { global $ilDB, $ilUser; if ($this->isDbBenchEnabled() && is_object($ilUser) && $this->db_enabled_user == $ilUser->getLogin()) { if (is_array($this->db_bench) && is_object($ilDB)) { $this->db_bench_stop_rec = true; $ilDB->manipulate("DELETE FROM benchmark"); foreach ($this->db_bench as $b) { $ilDB->insert("benchmark", array("duration" => array("float", $this->microtimeDiff($b["start"], $b["stop"])), "sql_stmt" => array("clob", $b["sql"]))); } } $this->enableDbBench(false); } // log slow requests //define("LOG_SLOW_REQUESTS", (float) "0.1"); if (defined("SLOW_REQUEST_TIME") && SLOW_REQUEST_TIME > 0) { $t1 = explode(" ", $GLOBALS['ilGlobalStartTime']); $t2 = explode(" ", microtime()); $diff = $t2[0] - $t1[0] + $t2[1] - $t1[1]; if ($diff > SLOW_REQUEST_TIME) { global $ilIliasIniFile; $diff = round($diff, 4); include_once "./Services/Logging/classes/class.ilLog.php"; $slow_request_log = new ilLog($ilIliasIniFile->readVariable("log", "slow_request_log_path"), $ilIliasIniFile->readVariable("log", "slow_request_log_file"), CLIENT_ID); $slow_request_log->write("SLOW REQUEST (" . $diff . "), Client:" . CLIENT_ID . ", GET: " . str_replace("\n", " ", print_r($_GET, true)) . ", POST: " . ilUtil::shortenText(str_replace("\n", " ", print_r($_POST, true)), 800, true)); } } }
/** * Fill table row */ protected function fillRow($term) { global $lng, $ilCtrl; $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); if ($this->glossary->getPresentationMode() == "full_def") { $this->tpl->setCurrentBlock("fd_td"); $this->tpl->setVariable("FULL_DEF", $this->parent_obj->listDefinitions($_GET["ref_id"], $term["id"], true)); $this->tpl->parseCurrentBlock(); } else { for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; if (count($defs) > 1) { $this->tpl->setCurrentBlock("definition"); $this->tpl->setVariable("DEF_TEXT", $lng->txt("cont_definition") . " " . ($j + 1)); $this->tpl->parseCurrentBlock(); } // check dirty short texts $this->tpl->setCurrentBlock("definition"); if ($def["short_text_dirty"]) { $def = new ilGlossaryDefinition($def["id"]); $def->updateShortText(); $short_str = $def->getShortText(); } else { $short_str = $def["short_text"]; } // replace tex // if a tex end tag is missing a tex end tag $ltexs = strrpos($short_str, "[tex]"); $ltexe = strrpos($short_str, "[/tex]"); if ($ltexs > $ltexe) { $page = new ilGlossaryDefPage($def["id"]); $page->buildDom(); $short_str = $page->getFirstParagraphText(); $short_str = strip_tags($short_str, "<br>"); $ltexe = strpos($short_str, "[/tex]", $ltexs); $short_str = ilUtil::shortenText($short_str, $ltexe + 6, true); } if (!$this->offline) { $short_str = ilUtil::insertLatexImages($short_str); } else { $short_str = ilUtil::buildLatexImages($short_str, $this->parent_obj->getOfflineDirectory()); } $short_str = ilPCParagraph::xml2output($short_str); $this->tpl->setVariable("DEF_SHORT", $short_str); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("definition_row"); $this->tpl->parseCurrentBlock(); } // $this->tpl->touchBlock("def_td"); // display additional column 'glossary' for meta glossaries if ($this->glossary->isVirtual()) { $this->tpl->setCurrentBlock("glossary_row"); $glo_title = ilObject::_lookupTitle($term["glo_id"]); $this->tpl->setVariable("GLO_TITLE", $glo_title); $this->tpl->parseCurrentBlock(); } } $ilCtrl->clearParameters($this->parent_obj); // advanced metadata foreach ($this->adv_cols_order as $c) { if ($c["id"] == 0) { $this->tpl->setCurrentBlock("link_start"); if (!$this->offline) { if (!empty($filter)) { $ilCtrl->setParameter($this->parent_obj, "term", $filter); $ilCtrl->setParameter($this->parent_obj, "oldoffset", $_GET["oldoffset"]); } $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "offset", $_GET["offset"]); $this->tpl->setVariable("LINK_VIEW_TERM", $ilCtrl->getLinkTarget($this->parent_obj, "listDefinitions")); $ilCtrl->clearParameters($this->parent_obj); } else { $this->tpl->setVariable("LINK_VIEW_TERM", "term_" . $term["id"] . ".html"); } $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("link_end"); $this->tpl->setVariable("ANCHOR_TERM", "term_" . $term["id"]); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("td"); $this->tpl->setVariable("TEXT", $term["term"]); $this->tpl->parseCurrentBlock(); } else { $id = $c["id"]; $f = $this->adv_fields[$c["id"]]; $this->tpl->setCurrentBlock("td"); switch ($f["type"]) { case ilAdvancedMDFieldDefinition::TYPE_DATETIME: $val = $term["md_" . $id] > 0 ? ilDatePresentation::formatDate(new ilDateTime($term["md_" . $id], IL_CAL_UNIX)) : " "; break; case ilAdvancedMDFieldDefinition::TYPE_DATE: $val = $term["md_" . $id] > 0 ? ilDatePresentation::formatDate(new ilDate($term["md_" . $id], IL_CAL_UNIX)) : " "; break; default: $val = $term["md_" . $id] != "" ? $term["md_" . $id] : " "; break; } $this->tpl->setVariable("TEXT", $val); $this->tpl->parseCurrentBlock(); } } }
/** * get data of parent node from tree and object_data * @access private * @param object db db result object containing node_data * @return array 2-dim (int/str) node_data * TODO: select description twice for compability. Please use 'desc' in future only */ function fetchNodeData($a_row) { global $objDefinition, $lng, $ilBench, $ilDB; //$ilBench->start("Tree", "fetchNodeData_getRow"); $data = $a_row; $data["desc"] = $a_row["description"]; // for compability //$ilBench->stop("Tree", "fetchNodeData_getRow"); // multilingual support systemobjects (sys) & categories (db) //$ilBench->start("Tree", "fetchNodeData_readDefinition"); if (is_object($objDefinition)) { $translation_type = $objDefinition->getTranslationType($data["type"]); } //$ilBench->stop("Tree", "fetchNodeData_readDefinition"); if ($translation_type == "sys") { //$ilBench->start("Tree", "fetchNodeData_getLangData"); if ($data["type"] == "rolf" and $data["obj_id"] != ROLE_FOLDER_ID) { $data["description"] = $lng->txt("obj_" . $data["type"] . "_local_desc") . $data["title"] . $data["desc"]; $data["desc"] = $lng->txt("obj_" . $data["type"] . "_local_desc") . $data["title"] . $data["desc"]; $data["title"] = $lng->txt("obj_" . $data["type"] . "_local"); } else { $data["title"] = $lng->txt("obj_" . $data["type"]); $data["description"] = $lng->txt("obj_" . $data["type"] . "_desc"); $data["desc"] = $lng->txt("obj_" . $data["type"] . "_desc"); } //$ilBench->stop("Tree", "fetchNodeData_getLangData"); } elseif ($translation_type == "db") { // Try to retrieve object translation from cache if ($this->isCacheUsed() && array_key_exists($data["obj_id"] . '.' . $lang_code, $this->translation_cache)) { $key = $data["obj_id"] . '.' . $lang_code; $data["title"] = $this->translation_cache[$key]['title']; $data["description"] = $this->translation_cache[$key]['description']; $data["desc"] = $this->translation_cache[$key]['desc']; } else { // Object translation is not in cache, read it from database //$ilBench->start("Tree", "fetchNodeData_getTranslation"); $query = 'SELECT title,description FROM object_translation ' . 'WHERE obj_id = %s ' . 'AND lang_code = %s ' . 'AND NOT lang_default = %s'; $res = $ilDB->queryF($query, array('integer', 'text', 'integer'), array($data['obj_id'], $this->lang_code, 1)); $row = $ilDB->fetchObject($res); if ($row) { $data["title"] = $row->title; $data["description"] = ilUtil::shortenText($row->description, MAXLENGTH_OBJ_DESC, true); $data["desc"] = $row->description; } //$ilBench->stop("Tree", "fetchNodeData_getTranslation"); // Store up to 1000 object translations in cache if ($this->isCacheUsed() && count($this->translation_cache) < 1000) { $key = $data["obj_id"] . '.' . $lang_code; $this->translation_cache[$key] = array(); $this->translation_cache[$key]['title'] = $data["title"]; $this->translation_cache[$key]['description'] = $data["description"]; $this->translation_cache[$key]['desc'] = $data["desc"]; } } } // TODO: Handle this switch by module.xml definitions if ($data['type'] == 'crsr' or $data['type'] == 'catr') { include_once './Services/ContainerReference/classes/class.ilContainerReference.php'; $data['title'] = ilContainerReference::_lookupTargetTitle($data['obj_id']); } return $data ? $data : array(); }
/** * Creates output * recursive method * @access private * @param integer * @param array * @return string */ function formatObject($a_node_id, $a_option) { global $lng; if (!isset($a_node_id) or !is_array($a_option)) { $this->ilias->raiseError(get_class($this) . "::formatObject(): Missing parameter or wrong datatype! " . "node_id: " . $a_node_id . " options:" . var_dump($a_option), $this->ilias->error_obj->WARNING); } $tpl = new ilTemplate("tpl.sahs_tree.html", true, true, "Modules/ScormAicc"); if ($a_option["c_type"] == "sos") { return; } if ($a_option["c_type"] == "srs") { return; } if (is_array($a_option["tab"])) { //test if there are any tabs foreach ($a_option["tab"] as $picture) { $pic = false; if ($picture == 'plus') { $target = $this->createTarget('+', $a_node_id); $tpl->setCurrentBlock("expander"); $tpl->setVariable("LINK_TARGET_EXPANDER", $target); $tpl->setVariable("IMGPATH", ilUtil::getImagePath("browser/plus.png")); $tpl->parseCurrentBlock(); $pic = true; } if ($picture == 'minus' && $this->show_minus) { $target = $this->createTarget('-', $a_node_id); $tpl->setCurrentBlock("expander"); $tpl->setVariable("LINK_TARGET_EXPANDER", $target); $tpl->setVariable("IMGPATH", ilUtil::getImagePath("browser/minus.png")); $tpl->parseCurrentBlock(); $pic = true; } if (!$pic) { $picture = 'blank'; $tpl->setCurrentBlock("lines"); $tpl->setVariable("IMGPATH_LINES", ilUtil::getImagePath("browser/" . $picture . ".png")); $tpl->parseCurrentBlock(); } } } if ($this->output_icons) { if ($this->isClickable($a_option["c_type"], $a_node_id) && !$a_option["c_type"] == "sbl") { $this->getOutputIcons($tpl, $a_option, $a_node_id); } } if ($this->isClickable($a_option["c_type"], $a_node_id)) { $tpl->setCurrentBlock("link"); //$target = (strpos($this->target, "?") === false) ? // $this->target."?" : $this->target."&"; //$tpl->setVariable("LINK_TARGET", $target.$this->target_get."=".$a_node_id.$this->params_get); //$tpl->setVariable("TITLE", ilUtil::shortenText($a_option["title"], $this->textwidth, true)); $frame_target = $this->buildFrameTarget($a_option["c_type"], $a_node_id, $a_option["obj_id"]); if ($frame_target != "") { // if ($this->api == 1) // { // $tpl->setVariable("TITLE", ilUtil::shortenText($a_option["title"], $this->textwidth, true)); // $tpl->setVariable("TARGET", " target=\"".$frame_target."\""); // //$tpl->setVariable("LINK_TARGET", $this->buildLinkTarget($a_node_id, $a_option["c_type"])); // $tpl->setVariable("LINK_TARGET", $this->buildLinkTarget($a_node_id, $a_option["c_type"])); // } // else // { if ($a_option["c_type"] == "sbl") { $tpl->setVariable("TITLE", ilUtil::shortenText($a_option["title"] . " ({$a_node_id})", $this->textwidth, true)); $tpl->setVariable("TARGET", " target=\"" . $frame_target . "\""); $tpl->setVariable("LINK_TARGET", $this->buildLinkTarget($a_node_id, $a_option["c_type"])); } else { $tpl->setVariable("TITLE", ilUtil::shortenText($a_option["title"] . " ({$a_node_id})", $this->textwidth, true)); $tpl->setVariable("LINK_TARGET", "javascript:void(0);"); $tpl->setVariable("ONCLICK", " onclick=\"parent.APIFRAME.setupApi();parent.APIFRAME.API.IliasLaunchSahs('" . $a_node_id . "');return false;\""); // } } } $tpl->parseCurrentBlock(); } else { $tpl->setCurrentBlock("text"); $tpl->setVariable("OBJ_TITLE", ilUtil::shortenText($a_option["title"], $this->textwidth, true)); $tpl->parseCurrentBlock(); } $this->formatItemTable($tpl, $a_node_id, $a_option["c_type"]); $tpl->setCurrentBlock("row"); $tpl->parseCurrentBlock(); $this->output[] = $tpl->get(); }
/** * Save comment for learner (asynch) */ function saveCommentForLearnersObject() { $this->checkPermission("write"); $res = array("result" => false); if ($this->ctrl->isAsynch()) { $ass_id = (int) $_POST["ass_id"]; $user_id = (int) $_POST["mem_id"]; $comment = trim($_POST["comm"]); if ($ass_id && $user_id) { // team upload? if (is_object($this->ass) && $this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { $team_id = $this->ass->getTeamId($user_id); $user_ids = $this->ass->getTeamMembers($team_id); } else { $user_ids = array($user_id); } $all_members = new ilExerciseMembers($this->object); $all_members = $all_members->getMembers(); $reci_ids = array(); foreach ($user_ids as $user_id) { if (in_array($user_id, $all_members)) { ilExAssignment::updateCommentForUser($ass_id, $user_id, ilUtil::stripSlashes($comment)); if (trim($comment)) { $reci_ids[] = $user_id; } } } if (sizeof($reci_ids)) { // send notification $this->object->sendFeedbackFileNotification(null, $reci_ids, $ass_id, true); } $res = array("result" => true, "snippet" => ilUtil::shortenText($comment, 25, true)); } } echo json_encode($res); exit; }
/** * Creates output * recursive method * @access private * @param integer * @param array * @return string */ function formatObject(&$tpl, $a_node_id, $a_option, $a_obj_id = 0) { global $lng; if (!isset($a_node_id) or !is_array($a_option)) { $this->ilias->raiseError(get_class($this) . "::formatObject(): Missing parameter or wrong datatype! " . "node_id: " . $a_node_id . " options:" . var_dump($a_option), $this->ilias->error_obj->WARNING); } if ($this->output_icons) { $tpl->setCurrentBlock("icon"); $tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_" . $a_option["type"] . ".png")); $tpl->setVariable("PAGE_ID", $a_node_id); //$this->iconList[] = "iconid_".$a_node_id; $tpl->setVariable("TXT_ALT_IMG", $lng->txt($a_option["desc"])); $tpl->parseCurrentBlock(); } if (!$a_option["container"]) { $tpl->setCurrentBlock("checkbox"); $tpl->setVariable("PAGE_ID", $a_node_id); if (ilLMObject::_isPagePublic($a_node_id)) { $tpl->setVariable("CHECKED", "checked=\"checked\""); } $tpl->parseCurrentBlock(); } else { $childs = $this->tree->getChilds($a_node_id); foreach ($childs as $node) { if ($node["type"] == "pg") { $pages[] = $node["child"]; } } $js_pages = ilUtil::array_php2js($pages); $tpl->setVariable("ONCLICK", " onclick=\"alterCheckboxes('PublicSelector','page_',{$js_pages}); return false;\""); } $tpl->setCurrentBlock("text"); $tpl->setVariable("PAGE_ID", $a_node_id); $tpl->setVariable("OBJ_TITLE", ilUtil::shortenText($a_option["title"], $this->textwidth, true)); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("element"); $tpl->parseCurrentBlock(); //$this->output[] = $tpl->get(); }