/** * Initializes the needed tooltip libraries. */ static function initLibrary() { global $tpl; if (self::$library_initialized) { return; } // include_once("./Services/YUI/classes/class.ilYuiUtil.php"); // ilYuiUtil::initTooltip(); $tpl->addCss("./Services/UIComponent/Tooltip/lib/qtip_2_2_1/jquery.qtip.min.css"); $tpl->addJavascript("./Services/UIComponent/Tooltip/lib/qtip_2_2_1/jquery.qtip.min.js"); self::$library_initialized = true; }
/** * Adds a tooltip to an HTML element * * @param string $a_el_id element id * @param string $a_el_id tooltip text * @param string $a_el_id element id of container the tooltip should be added to */ static function addTooltip($a_el_id, $a_text, $a_container = "", $a_my = "bottom center", $a_at = "top center", $a_use_htmlspecialchars = true) { global $tpl; if (!self::$initialized) { // include_once("./Services/YUI/classes/class.ilYuiUtil.php"); // ilYuiUtil::initTooltip(); $tpl->addCss("./Services/UIComponent/Tooltip/lib/qtip_2_0_nightly/jquery.qtip.min.css"); $tpl->addJavascript("./Services/UIComponent/Tooltip/lib/qtip_2_0_nightly/jquery.qtip.min.js"); $tpl->addJavascript("./Services/UIComponent/Tooltip/js/ilTooltip.js"); $tpl->addOnLoadCode('il.Tooltip.init();', 3); self::$initialized = true; } $code = self::getTooltip($a_el_id, $a_text, $a_container, $a_my, $a_at, $a_use_htmlspecialchars); $tpl->addOnLoadCode($code); }
/** * Render help button * * @param * @return */ function renderHelpButtons() { global $ilHelp, $lng, $ilCtrl, $tpl, $ilSetting, $ilUser; // screen id if (defined("OH_REF_ID") && OH_REF_ID > 0) { if ($ilHelp->getScreenId() != "") { $this->tpl->setCurrentBlock("screen_id"); $this->tpl->setVariable("SCREEN_ID", $ilHelp->getScreenId()); $this->tpl->parseCurrentBlock(); } } $help_active = false; if ($ilHelp->hasSections()) { $help_active = true; $lng->loadLanguageModule("help"); $this->tpl->setCurrentBlock("help_icon"); // add javascript needed by help (to do: move to help class) $tpl->addJavascript("./Services/Help/js/ilHelp.js"); include_once "./Services/Accordion/classes/class.ilAccordionGUI.php"; $acc = new ilAccordionGUI(); $acc->addJavascript(); $acc->addCss(); $this->tpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_help.png")); $this->tpl->parseCurrentBlock(); include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip("help_tr", $lng->txt("help_open_online_help"), "", "bottom center", "top center", false); } $module_id = (int) $ilSetting->get("help_module"); if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" && $ilSetting->get("help_mode") != "1") { $help_active = true; $lng->loadLanguageModule("help"); $tpl->addJavascript("./Services/Help/js/ilHelp.js"); $this->tpl->setCurrentBlock("help_tt_icon"); $this->tpl->setVariable("IMG_TT_ON", ilUtil::getImagePath("icon_tt.png")); $this->tpl->setVariable("IMG_TT_OFF", ilUtil::getImagePath("icon_tt_off.png")); $this->tpl->parseCurrentBlock(); include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip("help_tt", $lng->txt("help_toggle_tooltips"), "", "bottom center", "top center", false); } if ($help_active) { // always set ajax url $ts = $ilCtrl->getTargetScript(); $ilCtrl->setTargetScript("ilias.php"); $ilHelp->setCtrlPar(); $tpl->addOnLoadCode("il.Help.setAjaxUrl('" . $ilCtrl->getLinkTargetByClass("ilhelpgui", "", "", true) . "');"); $ilCtrl->setTargetScript($ts); } }
public static function buildObjectiveProgressBar($a_has_initial_test, $a_objective_id, array $a_lo_result, $a_list_mode = false, $a_sub = false, $a_tt_suffix = null) { global $lng, $ilCtrl, $ilUser; $tpl = new ilTemplate("tpl.objective_progressbar.html", true, true, "Services/Container"); $tooltip_id = "crsobjtvusr_" . $a_objective_id . "_" . $a_lo_result["type"] . "_" . (int) $a_sub; if ($a_tt_suffix !== null) { $tooltip_id .= "_" . $a_tt_suffix; } $tt_txt = sprintf($lng->txt("crs_loc_tt_info"), $a_lo_result["result_perc"], $a_lo_result["limit_perc"]); // #12970 $perc_resize = (int) $a_lo_result["result_perc"]; /* if($a_lo_result["limit_perc"] && $a_lo_result["result_perc"]) { $perc_resize = min(round($a_lo_result["result_perc"]*(100/$a_lo_result["limit_perc"])), 100); } */ include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php'; include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php'; $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null; // qualifying test if ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED or $a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL and ilLOSettings::getInstanceByObjId($a_lo_result['course_id'])->isInitialTestQualifying()) { $progress_txt = $lng->txt("crs_loc_progress_result_qtest"); $tt_txt = $lng->txt("crs_loc_tab_qtest") . ": " . $tt_txt; // link to test statistics if ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED && $a_lo_result["qtest"]) { $test_url = ilLOUtils::getTestResultLinkForUser($a_lo_result["qtest"], $a_lo_result["user_id"]); } else { if ($a_lo_result["itest"]) { $test_url = ilLOUtils::getTestResultLinkForUser($a_lo_result["itest"], $a_lo_result["user_id"]); } } if ($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED) { $next_step = $lng->txt("crs_loc_progress_objective_complete"); $bar_color = "ilCourseObjectiveProgressBarCompleted"; if ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED && $a_has_initial_test && is_array($a_lo_result["initial"])) { $a_lo_result["initial"]["itest"] = $a_lo_result["itest"]; $initial_sub = self::buildObjectiveProgressBar(true, $a_objective_id, $a_lo_result["initial"], true, true, $a_tt_suffix); } } else { $next_step = $lng->txt("crs_loc_progress_do_qualifying_again"); $bar_color = "ilCourseObjectiveProgressBarFailed"; } } else { if ($a_lo_result["status"]) { $progress_txt = $lng->txt("crs_loc_progress_result_itest"); $tt_txt = $lng->txt("crs_loc_tab_itest") . ": " . $tt_txt; // link to test statistics if ($a_lo_result["itest"]) { $test_url = ilLOUtils::getTestResultLinkForUser($a_lo_result["itest"], $a_lo_result["user_id"]); } $bar_color = "ilCourseObjectiveProgressBarNeutral"; if ($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED) { $next_step = $lng->txt("crs_loc_progress_do_qualifying"); } else { $next_step = $lng->txt("crs_loc_suggested"); } } else { if ((bool) $a_has_initial_test) { $next_step = $lng->txt("crs_loc_progress_no_result_do_initial"); } else { $next_step = $lng->txt("crs_loc_progress_no_result_no_initial"); } } } if ($progress_txt) { if ($test_url) { $tpl->setCurrentBlock("statustxt_bl"); $tpl->setVariable("TXT_PROGRESS_STATUS", $progress_txt); $tpl->setVariable("URL_TEST", $test_url); } else { $tpl->setCurrentBlock("statustxt_no_link_bl"); $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $progress_txt); } $tpl->parseCurrentBlock(); } if ($bar_color) { $limit_pos = (99 - (int) $a_lo_result["limit_perc"]) * -1; $tpl->setCurrentBlock("statusbar_bl"); $tpl->setVariable("PERC_STATUS", $a_lo_result["result_perc"]); $tpl->setVariable("LIMIT_POS", $limit_pos); $tpl->setVariable("PERC_WIDTH", $perc_resize); $tpl->setVariable("PERC_COLOR", $bar_color); $tpl->setVariable("TT_ID", $tooltip_id); $tpl->parseCurrentBlock(); } if ($next_step && !$a_list_mode) { $tpl->setCurrentBlock("nstep_bl"); $tpl->setVariable("TXT_NEXT_STEP", $next_step); $tpl->parseCurrentBlock(); } if ($tt_txt) { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip($tooltip_id, $tt_txt); } if ($initial_sub) { if ($a_list_mode) { $tpl->setVariable("SUB_STYLE", ' style="padding-left: 30px;"'); } else { $tpl->setVariable("SUB_STYLE", ' style="padding-left: 10px;"'); } $tpl->setVariable("SUB_INIT", $initial_sub); } return $tpl->get(); }
/** * Get skill presentation HTML * * @return */ function getSkillHTML($a_top_skill_id, $a_user_id = 0, $a_edit = false) { global $ilUser, $lng, $ilCtrl, $ilSetting; $this->tooltips = array(); if ($a_user_id == 0) { $user = $ilUser; } else { $user = new ilObjUser($a_user_id); } $tpl = new ilTemplate("tpl.skill_pres.html", true, true, "Services/Skill"); include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; include_once "./Services/Skill/classes/class.ilSkillTree.php"; $stree = new ilSkillTree(); include_once "./Services/Skill/classes/class.ilSkillTreeNode.php"; include_once "./Services/Skill/classes/class.ilSkillTreeNodeFactory.php"; // general settings for the action drop down include_once "Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $act_list = new ilAdvancedSelectionListGUI(); $act_list->setListTitle($lng->txt("actions")); $act_list->setSelectionHeaderClass("small"); // $act_list->setLinksMode("il_ContainerItemCommand2"); $act_list->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK); $act_list->setUseImages(false); $b_skills = ilSkillTreeNode::getSkillTreeNodes($a_top_skill_id, true); foreach ($b_skills as $bs) { $path = $stree->getSkillTreePath($bs["id"], $bs["tref"]); // check draft foreach ($path as $p) { if ($p["draft"]) { continue 2; } } reset($path); $se_level = ilPersonalSkill::getSelfEvaluation($user->getId(), $a_top_skill_id, $bs["tref"], $bs["id"]); $skill = ilSkillTreeNodeFactory::getInstance($bs["id"]); $level_data = $skill->getLevelData(); // check, if current self eval level is in current level data $valid_sel_level = false; if ($se_level > 0) { foreach ($level_data as $k => $v) { if ($v["id"] == $se_level) { $valid_sel_level = true; } } } reset($level_data); $found = false; foreach ($level_data as $k => $v) { // level $tpl->setCurrentBlock("level_td"); $tpl->setVariable("VAL_LEVEL", $v["title"]); $tt_id = "skmg_skl_tt_" . self::$skill_tt_cnt; self::$skill_tt_cnt++; $tpl->setVariable("TT_ID", $tt_id); if ($v["description"] != "") { ilTooltipGUI::addTooltip($tt_id, $v["description"]); } $tpl->parseCurrentBlock(); // self evaluation $tpl->setCurrentBlock("self_eval_td"); if ($valid_sel_level && !$found) { $tpl->setVariable("VAL_SELF_EVAL", "x"); $tpl->setVariable("CLASS_SELF_EVAL", "ilSkillSelf"); } else { $tpl->setVariable("VAL_SELF_EVAL", " "); } $tpl->parseCurrentBlock(); if ($v["id"] == $se_level) { $found = true; } // assigned materials if ($this->use_materials) { $mat_cnt = ilPersonalSkill::countAssignedMaterial($user->getId(), $bs["tref"], $v["id"]); if ($mat_cnt == 0) { $tpl->setCurrentBlock("material_td"); $tpl->setVariable("VAL_MATERIAL", " "); $tpl->parseCurrentBlock(); } else { // links to material files $tpl->setCurrentBlock("material_links"); $mat_tt = array(); $cnt = 1; foreach (ilPersonalSkill::getAssignedMaterial($user->getId(), $bs["tref"], $v["id"]) as $item) { $mat_data = $this->getMaterialInfo($item["wsp_id"]); $tpl->setVariable("URL_MATERIAL", $mat_data[1]); $tpl->setVariable("TXT_MATERIAL", $cnt); // tooltip $mat_tt_id = "skmg_skl_tt_mat_" . self::$skill_tt_cnt; self::$skill_tt_cnt++; $tpl->setVariable("TOOLTIP_MATERIAL_ID", $mat_tt_id); if (!$this->offline_mode) { ilTooltipGUI::addTooltip($mat_tt_id, $mat_data[0]); } else { $this->tooltips[] = ilTooltipGUI::getTooltip($mat_tt_id, $mat_data[0]); } $tpl->parseCurrentBlock(); $cnt++; } $tpl->setCurrentBlock("material_td"); $tpl->setVariable("CLASS_MAT", "ilSkillMat"); $tpl->parseCurrentBlock(); } } } $title = $sep = ""; $found = false; foreach ($path as $p) { if ($found) { $title .= $sep . $p["title"]; $sep = " > "; } if ($a_top_skill_id == $p["child"]) { $found = true; } } $tpl->setCurrentBlock("skill"); $tpl->setVariable("BSKILL_TITLE", $title); $tpl->setVariable("TXT_LEVEL", $lng->txt("skmg_level")); $tpl->setVariable("TXT_SELF_EVAL", $lng->txt("skmg_self_evaluation")); if ($this->use_materials) { $tpl->setVariable("TXT_MATERIAL", $lng->txt("skmg_material")); } if ($a_edit) { $act_list->flush(); $act_list->setId("act_" . $a_top_skill_id . "_" . $bs["id"]); $ilCtrl->setParameterByClass("ilpersonalskillsgui", "skill_id", $a_top_skill_id); $ilCtrl->setParameterByClass("ilpersonalskillsgui", "tref_id", $bs["tref"]); $ilCtrl->setParameterByClass("ilpersonalskillsgui", "basic_skill_id", $bs["id"]); if ($this->use_materials) { $act_list->addItem($lng->txt('skmg_assign_materials'), "", $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "assignMaterials")); } $act_list->addItem($lng->txt('skmg_self_evaluation'), "", $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "selfEvaluation")); $tpl->setVariable("ACTIONS2", $act_list->getHTML()); } $tpl->parseCurrentBlock(); } $tpl->setVariable("SKILL_TITLE", ilSkillTreeNode::_lookupTitle($a_top_skill_id)); if ($a_edit) { $act_list->flush(); $act_list->setId("act_" . $a_top_skill_id); $ilCtrl->setParameterByClass("ilpersonalskillsgui", "skill_id", $a_top_skill_id); // $act_list->addItem($lng->txt('skmg_assign_materials'), "", // $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "assignMaterials")); $act_list->addItem($lng->txt('skmg_remove_skill'), "", $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "confirmSkillRemove")); $tpl->setVariable("ACTIONS1", $act_list->getHTML()); } return $tpl->get(); }
private function addTooltips() { $tbl_header_id = 1; foreach ($this->class_array as $class_row) { $tooltip_text = $this->createTooltipText($class_row); ilTooltipGUI::addTooltip("thc_" . $this->getId() . "_" . $tbl_header_id, $tooltip_text, "", "bottom center", "top center", false); $tbl_header_id++; } }
/** * get tabs code as html * @param bool choose tabs or sub tabs * @param bool manual activation * @access Private */ function __getHTML($a_get_sub_tabs, $a_manual, $a_after_tabs_anchor = false) { global $ilCtrl, $lng, $ilUser, $ilPluginAdmin, $ilHelp; // user interface hook [uihk] if (!$this->getSetupMode()) { $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk"); foreach ($pl_names as $pl) { $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl); $gui_class = $ui_plugin->getUIClassInstance(); $resp = $gui_class->modifyGUI("", $a_get_sub_tabs ? "sub_tabs" : "tabs", array("tabs" => $this)); } } // user interface hook [uihk] if (!$this->getSetupMode()) { $cmd = $ilCtrl->getCmd(); $cmdClass = $ilCtrl->getCmdClass(); } if ($a_get_sub_tabs) { $tpl = new ilTemplate("tpl.sub_tabs.html", true, true, "Services/UIComponent/Tabs"); $pre = "sub"; $pre2 = "SUB_"; $sr_pre = "sub_"; } else { $tpl = new ilTemplate("tpl.tabs.html", true, true, "Services/UIComponent/Tabs"); if ($a_after_tabs_anchor) { $tpl->touchBlock("after_tabs"); } $pre = $pre2 = ""; include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; // back 2 tab if ($this->back_2_title != "") { $tpl->setCurrentBlock("back_2_tab"); $tpl->setVariable("BACK_2_ICON", ilGlyphGUI::get(ilGlyphGUI::PREVIOUS, ilGlyphGUI::NO_TEXT)); $tpl->setVariable("BACK_2_TAB_LINK", $this->back_2_target); $tpl->setVariable("BACK_2_TAB_TEXT", $this->back_2_title); $tpl->setVariable("BACK_2_TAB_TARGET", $this->back_2_frame); $tpl->parseCurrentBlock(); } // back tab if ($this->back_title != "") { $tpl->setCurrentBlock("back_tab"); $tpl->setVariable("BACK_ICON", ilGlyphGUI::get(ilGlyphGUI::PREVIOUS, ilGlyphGUI::NO_TEXT)); $tpl->setVariable("BACK_TAB_LINK", $this->back_target); $tpl->setVariable("BACK_TAB_TEXT", $this->back_title); $tpl->setVariable("BACK_TAB_TARGET", $this->back_frame); $tpl->parseCurrentBlock(); } } $targets = $a_get_sub_tabs ? $this->sub_target : $this->target; $i = 0; // do not display one tab only if (count($targets) > 1 || $this->back_title != "" && !$a_get_sub_tabs || count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs) { foreach ($targets as $target) { $i++; if (!is_array($target["cmd"])) { $target["cmd"] = array($target["cmd"]); } if (!$a_manual && (in_array($cmd, $target["cmd"]) || $target["cmd"][0] == "" && count($target["cmd"]) == 1) && (in_array($cmdClass, $target["cmdClass"]) || !$target["cmdClass"])) { $tabtype = $pre . "tabactive"; } else { $tabtype = $pre . "tabinactive"; } if ($a_manual && $target["activate"]) { $tabtype = $pre . "tabactive"; } if ($tabtype == "tabactive" || $tabtype == "subtabactive") { $tpl->setCurrentBlock("sel_text"); $tpl->setVariable("TXT_SELECTED", $lng->txt("stat_selected")); $tpl->parseCurrentBlock(); if (!$this->getSetupMode()) { if ($a_get_sub_tabs) { $part = ilHelpGUI::ID_PART_SUB_SCREEN; } else { $part = ilHelpGUI::ID_PART_SCREEN; } $ilHelp->setDefaultScreenId($part, $target["id"]); } } $tpl->setCurrentBlock($pre . "tab"); $tpl->setVariable("ID", $pre . "tab_" . $target["id"]); // tooltip if (!$this->getSetupMode()) { $ttext = $ilHelp->getTabTooltipText($target["id"]); if ($ttext != "") { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip($pre . "tab_" . $target["id"], $ttext, "", "bottom center", "top center", false); } } // bs-patch: start $tabtype = in_array($tabtype, array("tabactive", "subtabactive")) ? "active" : ""; // bs-patch: end $tpl->setVariable($pre2 . "TAB_TYPE", $tabtype); if (!$this->getSetupMode()) { $hash = $ilUser->getPref("screen_reader_optimization") ? "#after_" . $sr_pre . "tabs" : ""; } $tpl->setVariable($pre2 . "TAB_LINK", $target["link"] . $hash); if ($target["dir_text"]) { $tpl->setVariable($pre2 . "TAB_TEXT", $target["text"]); } else { $tpl->setVariable($pre2 . "TAB_TEXT", $lng->txt($target["text"])); } $tpl->setVariable($pre2 . "TAB_TARGET", $target["frame"]); $tpl->parseCurrentBlock(); } if ($a_get_sub_tabs) { $tpl->setVariable("TXT_SUBTABS", $lng->txt("subtabs")); } else { $tpl->setVariable("TXT_TABS", $lng->txt("tabs")); // non tabbed links include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; foreach ($this->non_tabbed_link as $link) { $tpl->setCurrentBlock("tab"); $tpl->setVariable("TAB_TYPE", "nontabbed"); $tpl->setVariable("TAB_ICON", " " . ilGlyphGUI::get(ilGlyphGUI::NEXT, ilGlyphGUI::NO_TEXT)); $tpl->setVariable("TAB_TEXT", $link["text"]); $tpl->setVariable("TAB_LINK", $link["link"]); $tpl->setVariable("TAB_TARGET", $link["frame"]); $tpl->setVariable("ID", "nontab_" . $link["id"]); $tpl->parseCurrentBlock(); // tooltip if (!$this->getSetupMode()) { $ttext = $ilHelp->getTabTooltipText($link["id"]); if ($ttext != "") { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip("nontab_" . $link["id"], $ttext, "", "bottom center", "top center", false); } } } } return $tpl->get(); } else { return ""; } }
/** * Initializes the preview and loads the needed javascripts and styles. */ private static function initPreview() { if (self::$initialized) { return; } global $tpl, $lng, $ilCtrl; // jquery include_once "./Services/jQuery/classes/class.iljQueryUtil.php"; iljQueryUtil::initjQuery(); // load qtip include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::initLibrary(); // needed scripts & styles $tpl->addJavaScript("./Services/Preview/js/jquery.mousewheel.js"); $tpl->addJavaScript("./Services/Preview/js/ilPreview.js"); $tpl->addCss(ilUtil::getStyleSheetLocation("filesystem", "preview.css", "Services/Preview")); // create loading template $tmpl = new ilTemplate("tpl.preview.html", true, true, "Services/Preview"); $tmpl->setCurrentBlock("no_preview"); $tmpl->setVariable("TXT_NO_PREVIEW", "%%0%%"); $tmpl->parseCurrentBlock(); $initialHtml = str_replace(array("\r\n", "\r"), "\n", $tmpl->get()); $lines = explode("\n", $initialHtml); $new_lines = array(); foreach ($lines as $i => $line) { if (!empty($line)) { $new_lines[] = trim($line); } } $initialHtml = implode($new_lines); // add default texts and values include_once "./Services/JSON/classes/class.ilJsonUtil.php"; $tpl->addOnLoadCode("il.Preview.texts.preview = \"" . self::jsonSafeString($lng->txt("preview")) . "\";"); $tpl->addOnLoadCode("il.Preview.texts.showPreview = \"" . self::jsonSafeString($lng->txt("preview_show")) . "\";"); $tpl->addOnLoadCode("il.Preview.texts.close = \"" . self::jsonSafeString($lng->txt("close")) . "\";"); $tpl->addOnLoadCode("il.Preview.previewSize = " . ilPreviewSettings::getImageSize() . ";"); $tpl->addOnLoadCode("il.Preview.initialHtml = " . ilJsonUtil::encode($initialHtml) . ";"); $tpl->addOnLoadCode("il.Preview.highlightClass = \"ilContainerListItemOuterHighlight\";"); $tpl->addOnLoadCode("il.Preview.init();"); self::$initialized = true; }
public static function buildObjectiveProgressBar($a_has_initial_test, $a_objective_id, array $a_lo_result, $a_list_mode = false) { global $lng; $tpl = new ilTemplate("tpl.objective_progressbar.html", true, true, "Services/Container"); $tooltip_id = "crsobjtvusr_" . $a_objective_id; $tt_txt = sprintf($lng->txt("crs_loc_tt_info"), $a_lo_result["result_perc"], $a_lo_result["limit_perc"]); // #12970 $perc_resize = (int) $a_lo_result["result_perc"]; /* if($a_lo_result["limit_perc"] && $a_lo_result["result_perc"]) { $perc_resize = min(round($a_lo_result["result_perc"]*(100/$a_lo_result["limit_perc"])), 100); } */ $next_step = $progress_txt = $bar_color = null; // qualifying test if ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED) { $progress_txt = $lng->txt("crs_loc_progress_result_qtest"); $tt_txt = $lng->txt("crs_loc_tab_qtest") . ": " . $tt_txt; if ($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED) { $next_step = $lng->txt("crs_loc_progress_objective_complete"); $bar_color = "#80f080"; } else { $next_step = $lng->txt("crs_loc_progress_do_qualifying_again"); $bar_color = "#f08080"; } } else { if ($a_lo_result["status"]) { $progress_txt = $lng->txt("crs_loc_progress_result_itest"); $tt_txt = $lng->txt("crs_loc_tab_itest") . ": " . $tt_txt; $bar_color = "#aaa"; if ($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED) { $next_step = $lng->txt("crs_loc_progress_do_qualifying"); } else { $next_step = $lng->txt("crs_loc_suggested"); } } else { if ((bool) $a_has_initial_test) { $next_step = $lng->txt("crs_loc_progress_no_result_do_initial"); } else { $next_step = $lng->txt("crs_loc_progress_no_result_no_initial"); } } } if ($progress_txt) { $tpl->setCurrentBlock("statustxt_bl"); $tpl->setVariable("TXT_PROGRESS_STATUS", $progress_txt); $tpl->parseCurrentBlock(); } if ($bar_color) { if ($a_lo_result["limit_perc"]) { $limit_pos = (121 - ceil(125 / 100 * $a_lo_result["limit_perc"])) * -1; } else { $limit_pos = -121; } $tpl->setCurrentBlock("statusbar_bl"); $tpl->setVariable("PERC_STATUS", $a_lo_result["result_perc"]); $tpl->setVariable("LIMIT_POS", $limit_pos); $tpl->setVariable("PERC_WIDTH", $perc_resize); $tpl->setVariable("PERC_COLOR", $bar_color); $tpl->setVariable("BG_COLOR", "#fff"); $tpl->setVariable("TT_ID", $tooltip_id); $tpl->parseCurrentBlock(); } if ($next_step && !$a_list_mode) { $tpl->setCurrentBlock("nstep_bl"); $tpl->setVariable("TXT_NEXT_STEP", $next_step); $tpl->parseCurrentBlock(); } if ($tt_txt) { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip($tooltip_id, $tt_txt); } return $tpl->get(); }
function fillHeader() { global $lng; $allcolumnswithwidth = true; foreach ((array) $this->column as $idx => $column) { if (!strlen($column["width"])) { $allcolumnswithwidth = false; } else { if ($column["width"] == "1") { // IE does not like 1 but seems to work with 1% $this->column[$idx]["width"] = "1%"; } } } if ($allcolumnswithwidth) { foreach ((array) $this->column as $column) { $this->tpl->setCurrentBlock("tbl_colgroup_column"); $this->tpl->setVariable("COLGROUP_COLUMN_WIDTH", $column["width"]); $this->tpl->parseCurrentBlock(); } } $ccnt = 0; foreach ((array) $this->column as $column) { $ccnt++; //tooltip if ($column["tooltip"] != "") { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip("thc_" . $this->getId() . "_" . $ccnt, $column["tooltip"]); } if (!$this->enabled["sort"] || $column["sort_field"] == "" || $column["is_checkbox_action_column"]) { $this->tpl->setCurrentBlock("tbl_header_no_link"); if ($column["width"] != "") { $this->tpl->setVariable("TBL_COLUMN_WIDTH_NO_LINK", " width=\"" . $column["width"] . "\""); } if (!$column["is_checkbox_action_column"]) { $this->tpl->setVariable("TBL_HEADER_CELL_NO_LINK", $column["text"]); } else { $this->tpl->setVariable("TBL_HEADER_CELL_NO_LINK", ilUtil::img(ilUtil::getImagePath("spacer.png"), $lng->txt("action"))); } $this->tpl->setVariable("HEAD_CELL_NL_ID", "thc_" . $this->getId() . "_" . $ccnt); if ($column["class"] != "") { $this->tpl->setVariable("TBL_HEADER_CLASS", " " . $column["class"]); } $this->tpl->parseCurrentBlock(); $this->tpl->touchBlock("tbl_header_th"); continue; } if ($column["sort_field"] == $this->order_field && $this->order_direction != "") { $this->tpl->setCurrentBlock("tbl_order_image"); $this->tpl->setVariable("IMG_ORDER_DIR", ilUtil::getImagePath($this->order_direction . "_order.png")); $this->tpl->setVariable("IMG_ORDER_ALT", $this->lng->txt("change_sort_direction")); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("tbl_header_cell"); $this->tpl->setVariable("TBL_HEADER_CELL", $column["text"]); $this->tpl->setVariable("HEAD_CELL_ID", "thc_" . $this->getId() . "_" . $ccnt); // only set width if a value is given for that column if ($column["width"] != "") { $this->tpl->setVariable("TBL_COLUMN_WIDTH", " width=\"" . $column["width"] . "\""); } $lng_sort_column = $this->lng->txt("sort_by_this_column"); $this->tpl->setVariable("TBL_ORDER_ALT", $lng_sort_column); $order_dir = "asc"; if ($column["sort_field"] == $this->order_field) { $order_dir = $this->sort_order; $lng_change_sort = $this->lng->txt("change_sort_direction"); $this->tpl->setVariable("TBL_ORDER_ALT", $lng_change_sort); } if ($column["class"] != "") { $this->tpl->setVariable("TBL_HEADER_CLASS", " " . $column["class"]); } $this->setOrderLink($column["sort_field"], $order_dir); $this->tpl->parseCurrentBlock(); $this->tpl->touchBlock("tbl_header_th"); } $this->tpl->setCurrentBlock("tbl_header"); $this->tpl->parseCurrentBlock(); }
/** * Get selection list HTML */ public function getHTML($a_only_cmd_list_asynch = false) { $items = $this->getItems(); // do not show list, if no item is in list if (count($items) == 0 && !$this->getAsynch()) { return ""; } include_once "./Services/YUI/classes/class.ilYuiUtil.php"; ilYuiUtil::initOverlay(); $GLOBALS["tpl"]->addJavascript("./Services/UIComponent/Overlay/js/ilOverlay.js"); $GLOBALS["tpl"]->addJavascript("./Services/UIComponent/AdvancedSelectionList/js/AdvancedSelectionList.js"); $tpl = new ilTemplate("tpl.adv_selection_list.html", true, true, "Services/UIComponent/AdvancedSelectionList", "DEFAULT", false, true); reset($items); $cnt = 0; if ($this->getAsynch()) { $tpl->setCurrentBlock("asynch_request"); $tpl->setVariable("IMG_LOADER", ilUtil::getImagePath("loader.gif")); $tpl->parseCurrentBlock(); } else { foreach ($items as $item) { if (isset($item["ref_id"])) { $sel_arr[$item["ref_id"]] = isset($item["title"]) ? $item["title"] : ""; } $this->css_row = $this->css_row != "tblrow1_mo" ? "tblrow1_mo" : "tblrow2_mo"; if ($this->getUseImages()) { if ($item["img"]) { $tpl->setCurrentBlock("image"); $tpl->setVariable("IMG_ITEM", $item["img"]); $tpl->setVariable("ALT_ITEM", $item["alt"]); $tpl->parseCurrentBlock(); } else { $tpl->touchBlock("no_image"); } } if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_HREF || $this->getItemLinkClass() != "") { if ($item["frame"]) { $tpl->setCurrentBlock("frame"); $tpl->setVariable("TARGET_ITEM", $item["frame"]); $tpl->parseCurrentBlock(); } if ($this->getItemLinkClass() != "") { $tpl->setCurrentBlock("item_link_class"); $tpl->setVariable("ITEM_LINK_CLASS", $this->getItemLinkClass()); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("href_s"); $tpl->setVariable("HREF_ITEM", 'href="' . $item["link"] . '"'); $tpl->setVariable("ID_ITEM", $this->getId() . "_" . $item["value"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("href_e"); } $tpl->setCurrentBlock("item"); if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_HREF) { if ($item["prevent_background_click"]) { $tpl->setVariable("ONCLICK_ITEM", ''); } else { if ($item["onclick"] == "") { $tpl->setVariable("ONCLICK_ITEM", 'onclick="' . "return il.AdvancedSelectionList.openTarget('" . $item["link"] . "','" . $item["frame"] . "');" . '"'); } else { $tpl->setVariable("ONCLICK_ITEM", 'onclick="' . "return " . $item["onclick"] . ";" . '"'); } } } else { if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SUBMIT) { $tpl->setVariable("ONCLICK_ITEM", 'onclick="return il.AdvancedSelectionList.submitForm(\'' . $this->getId() . '\'' . ", '" . $this->form_mode["select_name"] . "','" . $item["value"] . "'," . "'" . $this->on_click_form_id . "','" . $this->form_mode["button_cmd"] . "');\""); } else { if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SELECT) { $tpl->setVariable("ONCLICK_ITEM", 'onclick="return il.AdvancedSelectionList.selectForm(\'' . $this->getId() . '\'' . ", '" . $this->form_mode["select_name"] . "','" . $item["value"] . "'," . "'" . $item["title"] . "');\""); } else { if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_NOP) { $tpl->setVariable("ONCLICK_ITEM", 'onclick="il.AdvancedSelectionList.clickNop(\'' . $this->getId() . '\'' . ", '" . $this->form_mode["select_name"] . "','" . $item["value"] . "'," . "'" . $item["title"] . "');\""); } } } } $tpl->setVariable("CSS_ROW", $this->css_row); if ($item["html"] == "") { $tpl->setVariable("TXT_ITEM", $item["title"]); } else { $tpl->setVariable("TXT_ITEM", $item["html"]); } $tpl->setVariable("ID_ITEM_TR", $this->getId() . "_" . $item["value"] . "_tr"); if ($item["ttip"] != "") { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip($this->getId() . "_" . $item["value"] . "_tr", $item["ttip"], "", $item["tt_my"], $item["tt_at"], $item["tt_use_htmlspecialchars"]); } $tpl->parseCurrentBlock(); // add item to js object $tpl->setCurrentBlock("js_item"); $tpl->setVariable("IT_ID", $this->getId()); $tpl->setVariable("IT_HID_NAME", $this->form_mode["select_name"]); $tpl->setVariable("IT_HID_VAL", $item["value"]); $tpl->setVariable("IT_TITLE", str_replace("'", "\\'", $item["title"])); $tpl->parseCurrentBlock(); } } $tpl->setCurrentBlock("cmd_table"); $tpl->parseCurrentBlock(); if ($a_only_cmd_list_asynch) { return $tpl->get("cmd_table"); } if ($this->getHeaderIcon() != ilAdvancedSelectionListGUI::NO_ICON) { $tpl->setCurrentBlock("top_img"); switch ($this->getHeaderIcon()) { case ilAdvancedSelectionListGUI::DOWN_ARROW_LIGHT: $tpl->setVariable("IMG_DOWN", ilUtil::getImagePath(ilAdvancedSelectionListGUI::DOWN_ARROW_LIGHT)); break; case ilAdvancedSelectionListGUI::DOWN_ARROW_DARK: $tpl->setVariable("IMG_DOWN", ilUtil::getImagePath(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK)); break; case ilAdvancedSelectionListGUI::DOWN_ARROW_TOPBAR: $tpl->setVariable("IMG_DOWN", ilUtil::getImagePath(ilAdvancedSelectionListGUI::DOWN_ARROW_TOPBAR)); break; default: $tpl->setVariable("IMG_DOWN", $this->getHeaderIcon()); break; } // do not repeat title (accessibility) -> empty alt //$tpl->setVariable("ALT_SEL_TOP", $this->getListTitle()); $tpl->setVariable("ALT_SEL_TOP", ""); $tpl->parseCurrentBlock(); } // output hidden input, if click mode is form submission if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SUBMIT) { $tpl->setCurrentBlock("hidden_input"); $tpl->setVariable("HID", $this->getId()); $tpl->parseCurrentBlock(); } // output hidden input and initialize if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SELECT) { $tpl->setCurrentBlock("hidden_input"); $tpl->setVariable("HID", $this->getId()); $tpl->parseCurrentBlock(); // init hidden input with selected value $tpl->setCurrentBlock("init_hidden_input"); $tpl->setVariable("H2ID", $this->getId()); $tpl->setVariable("HID_NAME", $this->form_mode["select_name"]); $tpl->setVariable("HID_VALUE", $this->getSelectedValue()); $tpl->parseCurrentBlock(); } // js section $tpl->setCurrentBlock("js_section"); if ($this->getAccessKey() > 0) { include_once "./Services/Accessibility/classes/class.ilAccessKeyGUI.php"; $tpl->setVariable("ACCKEY", ilAccessKeyGUI::getAttribute($this->getAccessKey())); } $cfg["trigger_event"] = $this->getTriggerEvent(); $cfg["auto_hide"] = $this->getAutoHide(); if ($this->getSelectCallback() != "") { $cfg["select_callback"] = $this->getSelectCallback(); } $cfg["anchor_id"] = "ilAdvSelListAnchorElement_" . $this->getId(); $cfg["asynch"] = $this->getAsynch() ? true : false; $cfg["asynch_url"] = $this->getAsynchUrl(); $toggle = $this->getAdditionalToggleElement(); if (is_array($toggle)) { $cfg["toggle_el"] = $toggle["el"]; $cfg["toggle_class_on"] = $toggle["class_on"]; } //echo "<br>".htmlentities($this->getAsynchUrl()); include_once "./Services/JSON/classes/class.ilJsonUtil.php"; $tpl->setVariable("TXT_SEL_TOP", $this->getListTitle()); $tpl->setVariable("ID", $this->getId()); $tpl->setVariable("CFG", ilJsonUtil::encode($cfg)); //echo htmlentities(ilJsonUtil::encode($cfg)); $tpl->setVariable("CLASS_SEL_TOP", $this->getSelectionHeaderClass()); if ($this->getSelectionHeaderSpanClass() != "") { $tpl->setVariable("CLASS_SEL_TOP_SPAN", $this->getSelectionHeaderSpanClass()); } // set the async url to an extra template variable // (needed for a mobile skin) $tpl->setVariable("ASYNC_URL", $this->getAsynchUrl()); $tpl->parseCurrentBlock(); // no js sections if (false) { switch ($this->mode) { // links mode case ilAdvancedSelectionListGUI::MODE_LINKS: reset($items); $cnt = 0; foreach ($items as $item) { $tpl->setCurrentBlock("no_js_link"); $tpl->setVariable("LINKS_CLASS", $this->links_mode["link_class"]); $tpl->setVariable("LINKS_HREF", $item["link"]); $tpl->setVariable("LINKS_TXT", $item["title"]); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("no_js_section"); $tpl->parseCurrentBlock(); } break; case ilAdvancedSelectionListGUI::MODE_FORM_SELECT: reset($items); $cnt = 0; foreach ($items as $item) { $tpl->setCurrentBlock("no_js_form_option"); $tpl->setVariable("FRM_OPTION_TXT", $item["title"]); $tpl->setVariable("FRM_OPTION_VAL", $item["value"]); if ($this->getSelectedValue() == $item["value"]) { $tpl->setVariable("SELECTED", ' selected="selected" '); } $tpl->parseCurrentBlock(); } if ($this->form_mode["include_form_tag"]) { $tpl->setCurrentBlock("no_js_form_begin"); $tpl->setVariable("FRM_ID", $this->form_mode["form_id"]); $tpl->setVariable("FRM_CLASS", $this->form_mode["form_class"]); $tpl->setVariable("FRM_ACTION", $this->form_mode["form_action"]); $tpl->setVariable("FRM_TARGET", $this->form_mode["form_target"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("no_js_form_end"); } if ($this->form_mode["button_text"]) { $tpl->setCurrentBlock("no_js_form_button"); $tpl->setVariable("FRM_BT_TXT", $this->form_mode["button_text"]); $tpl->setVariable("FRM_BT_CLASS", $this->form_mode["button_class"]); if ($this->form_mode["button_cmd"] != "") { $tpl->setVariable("FRM_BT_CMD", 'name="cmd[' . $this->form_mode["button_cmd"] . ']"'); } $tpl->parseCurrentBlock(); } $tpl->setVariable("FRM_SELECT_NAME", $this->form_mode["select_name"]); $tpl->setVariable("FRM_SELECT_CLASS", $this->form_mode["select_class"]); if ($this->getAccessKey() > 0) { include_once "./Services/Accessibility/classes/class.ilAccessKeyGUI.php"; $tpl->setVariable("ACCKEYNJS", ilAccessKeyGUI::getAttribute($this->getAccessKey())); } $tpl->setCurrentBlock("no_js_section"); $tpl->parseCurrentBlock(); break; } } return $tpl->get(); }
/** * get flat bookmark list for personal desktop */ function fillRow($a_set) { global $ilUser, $ilCtrl, $lng, $ilSetting, $rbacsetting, $rbacsystem; // mail link $a_set["mail_to"] = ""; if ($this->mail_allowed && $rbacsystem->checkAccessOfUser($a_set['id'], 'internal_mail', ilMailGlobalServices::getMailObjectRefId())) { $a_set['mail_url'] = ilMailFormCall::getLinkTarget($this->topGuiObj, '', array(), array('type' => 'new', 'rcp_to' => urlencode($a_set['login']))); } // check for profile $a_set["profile"] = in_array(ilObjUser::_lookupPref($a_set["id"], "public_profile"), array("y", "g")); // user image if ($this->getCurrentDetailLevel() > 2) { if ($a_set["mail_url"] != "") { $this->tpl->setCurrentBlock("mailto_link"); $this->tpl->setVariable("TXT_MAIL", $lng->txt("mail")); $this->tpl->setVariable("MAIL_URL", $a_set["mail_url"]); $this->tpl->parseCurrentBlock(); } $chatSettings = new ilSetting('chatroom'); if ($chatSettings->get('chat_enabled')) { if (!$this->__showActiveChatsOfUser($a_set["id"])) { // Show invite to chat $this->__showChatInvitation($a_set["id"]); } global $rbacsystem; include_once './Modules/Chatroom/classes/class.ilObjChatroom.php'; if ($a_set["id"] == $ilUser->getId() && $rbacsystem->checkAccess('read', ilObjChatroom::_getPublicRefId())) { $this->tpl->setCurrentBlock('chat_link'); $this->tpl->setVariable('TXT_CHAT_INVITE', $lng->txt('chat_enter_public_room')); $this->tpl->setVariable('TXT_CHAT_INVITE_TOOLTIP', $lng->txt('chat_enter_public_room_tooltip')); // $this->tpl->setVariable('CHAT_LINK','./ilias.php?baseClass=ilChatPresentationGUI&ref_id='.ilObjChat::_getPublicChatRefId()); $this->tpl->setVariable('CHAT_LINK', './ilias.php?baseClass=ilRepositoryGUI&cmd=view&ref_id=' . ilObjChatroom::_getPublicRefId()); $this->tpl->parseCurrentBlock(); } } // user image $this->tpl->setCurrentBlock("usr_image"); $this->tpl->setVariable("USR_IMAGE", ilObjUser::_getPersonalPicturePath($a_set["id"], "xxsmall")); $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture")); $this->tpl->parseCurrentBlock(); $this->tpl->touchBlock("usr_image_space"); $pd_set = new ilSetting("pd"); $osi_server = $pd_set->get("osi_host"); // if (trim($osi_server) != "") // { // instant messengers // 1 indicates to use online status check $im_arr = array("icq" => 0, "yahoo" => 1, "msn" => 0, "aim" => 0, "skype" => 1, "jabber" => 0, "voip" => 0); // use onlinestatus.org // when enabled all instant messengers are checked online and ignores settings above if (trim($osi_server) != "") { $osi_enable = true; } // removed calls to external servers due to // bug 10583, alex 8 Mar 2013 foreach ($im_arr as $im_name => $im_check) { if ($im_id = ilObjUser::_lookupIm($a_set["id"], $im_name)) { $im_url = ""; switch ($im_name) { case "icq": $im_url = "http://http://www.icq.com/people/" . $im_id; break; case "yahoo": $im_url = "http://edit.yahoo.com/config/send_webmesg?target=" . $im_id . "&src=pg"; break; case "msn": $im_url = "http://messenger.live.com"; break; case "aim": //$im_url = "aim:GoIM?screenname=".$im_id; $im_url = "http://aimexpress.aim.com"; break; case "skype": $im_url = "skype:" . $im_id . "?call"; break; } $im_img = ilUtil::getImagePath($im_name . 'online.png'); if ($im_url != "") { $this->tpl->setCurrentBlock("im_link_start"); $this->tpl->setVariable("URL_IM", $im_url); $this->tpl->parseCurrentBlock(); $this->tpl->touchBlock("im_link_end"); } $this->tpl->setCurrentBlock("instant_messengers"); $this->tpl->setVariable("IMG_IM_ICON", $im_img); $this->tpl->setVariable("TXT_IM_ICON", $lng->txt("im_" . $im_name)); $icon_id = "im_" . $im_name . "_usr_" . $a_set["id"]; $this->tpl->setVariable("ICON_ID", $icon_id); include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip($icon_id, $lng->txt("im_" . $im_name) . ": " . $im_id, "", "top center", "bottom center"); $this->tpl->parseCurrentBlock(); } } // } } // username if (!$a_set["profile"]) { $this->tpl->setVariable("USR_LOGIN", $a_set["login"]); } else { if ($this->getCurrentDetailLevel() > 2) { $this->tpl->setVariable("USR_LOGIN", "<br />" . $a_set["login"]); } else { $this->tpl->setVariable("USR_LOGIN", " [" . $a_set["login"] . "]"); } } // profile link if ($a_set["profile"]) { include_once "Services/User/classes/class.ilUserUtil.php"; $user_name = ilUserUtil::getNamePresentation($a_set["id"], false, false, "", false, true, false); $this->tpl->setCurrentBlock("profile_link"); $this->tpl->setVariable("TXT_VIEW", $lng->txt("profile")); // see ilPersonalProfileGUI::getProfilePortfolio() $has_prtf = false; if ($ilSetting->get('user_portfolios')) { include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php"; $has_prtf = ilObjPortfolio::getDefaultPortfolio($a_set["id"]); } if (!$has_prtf) { // (simple) profile: center column $ilCtrl->setParameter($this, "user", $a_set["id"]); $this->tpl->setVariable("LINK_PROFILE", $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML")); } else { // portfolio: fullscreen include_once "Services/Link/classes/class.ilLink.php"; $this->tpl->setVariable("LINK_PROFILE", ilLink::_getLink($a_set["id"], "usr")); $this->tpl->setVariable("LINK_TARGET", "_blank"); } $this->tpl->setVariable("USR_ID", $a_set["id"]); $this->tpl->setVariable("LINK_FULLNAME", $user_name); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setVariable("USR_FULLNAME", ""); } }
/** * Get header action * * @return string */ function getHeaderAction() { global $ilUser, $lng, $tpl; $htpl = new ilTemplate("tpl.header_action.html", true, true, "Services/Repository"); $redraw_js = "il.Object.redrawActionHeader();"; // tags if ($this->tags_enabled) { include_once "./Services/Tagging/classes/class.ilTagging.php"; $tags = ilTagging::getTagsForUserAndObject($this->obj_id, ilObject::_lookupType($this->obj_id), 0, "", $ilUser->getId()); if (count($tags) > 0) { include_once "./Services/Tagging/classes/class.ilTaggingGUI.php"; $lng->loadLanguageModule("tagging"); $this->addHeaderIcon("tags", ilUtil::getImagePath("icon_tag.svg"), $lng->txt("tagging_tags") . ": " . count($tags), ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js), count($tags)); } } // notes and comments $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, true, false); if ($this->notes_enabled || $comments_enabled) { include_once "./Services/Notes/classes/class.ilNote.php"; include_once "./Services/Notes/classes/class.ilNoteGUI.php"; $cnt = ilNote::_countNotesAndComments($this->obj_id, $this->sub_obj_id); if ($this->notes_enabled && $cnt[$this->obj_id][IL_NOTE_PRIVATE] > 0) { $this->addHeaderIcon("notes", ilUtil::getImagePath("note_unlabeled.svg"), $lng->txt("private_notes") . ": " . $cnt[$this->obj_id][IL_NOTE_PRIVATE], ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js), $cnt[$this->obj_id][IL_NOTE_PRIVATE]); } if ($comments_enabled && $cnt[$this->obj_id][IL_NOTE_PUBLIC] > 0) { $lng->loadLanguageModule("notes"); $this->addHeaderIcon("comments", ilUtil::getImagePath("comment_unlabeled.svg"), $lng->txt("notes_public_comments") . ": " . $cnt[$this->obj_id][IL_NOTE_PUBLIC], ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js), $cnt[$this->obj_id][IL_NOTE_PUBLIC]); } } // rating if ($this->rating_enabled) { include_once "./Services/Rating/classes/class.ilRatingGUI.php"; $rating_gui = new ilRatingGUI(); $rating_gui->enableCategories($this->rating_categories_enabled); // never rate sub objects from header action! $rating_gui->setObject($this->obj_id, $this->type); if ($this->rating_text) { $rating_gui->setYourRatingText($this->rating_text); } $this->ctrl->setParameterByClass("ilRatingGUI", "cadh", $this->ajax_hash); $this->ctrl->setParameterByClass("ilRatingGUI", "rnsb", true); if ($this->rating_ctrl_path) { $rating_gui->setCtrlPath($this->rating_ctrl_path); $ajax_url = $this->ctrl->getLinkTargetByClass($this->rating_ctrl_path, "saveRating", "", true, false); } else { // ??? $ajax_url = $this->ctrl->getLinkTargetByClass("ilRatingGUI", "saveRating", "", true, false); } $tpl->addOnLoadCode("il.Object.setRatingUrl('" . $ajax_url . "');"); $this->addHeaderIconHTML("rating", $rating_gui->getHtml(true, $this->checkCommandAccess("read", "", $this->ref_id, $this->type), "il.Object.saveRating(%rating%);")); } if ($this->header_icons) { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; $chunks = array(); foreach ($this->header_icons as $id => $attr) { $id = "headp_" . $id; if (is_array($attr)) { if ($attr["onclick"]) { $htpl->setCurrentBlock("onclick"); $htpl->setVariable("PROP_ONCLICK", $attr["onclick"]); $htpl->parseCurrentBlock(); } if ($attr["status_text"]) { $htpl->setCurrentBlock("status"); $htpl->setVariable("PROP_TXT", $attr["status_text"]); $htpl->parseCurrentBlock(); } if (!$attr["href"]) { $attr["href"] = "#"; } $htpl->setCurrentBlock("prop"); $htpl->setVariable("PROP_ID", $id); $htpl->setVariable("IMG", ilUtil::img($attr["img"])); $htpl->setVariable("PROP_HREF", $attr["href"]); $htpl->parseCurrentBlock(); if ($attr["tooltip"]) { ilTooltipGUI::addTooltip($id, $attr["tooltip"]); } } else { $chunks[] = $attr; } } if (sizeof($chunks)) { $htpl->setVariable("PROP_CHUNKS", implode(" ", $chunks) . " "); } } $htpl->setVariable("ACTION_DROP_DOWN", $this->insertCommands(false, false, "", true)); return $htpl->get(); }
/** * Get header action * * @return string */ function getHeaderAction() { global $ilAccess, $ilBench, $ilUser, $ilCtrl, $lng; $htpl = new ilTemplate("tpl.header_action.html", true, true, "Services/Repository"); $redraw_js = "il.Object.redrawActionHeader();"; // tags if ($this->tags_enabled) { include_once "./Services/Tagging/classes/class.ilTagging.php"; $tags = ilTagging::getTagsForUserAndObject($this->obj_id, ilObject::_lookupType($this->obj_id), 0, "", $ilUser->getId()); if (count($tags) > 0) { include_once "./Services/Tagging/classes/class.ilTaggingGUI.php"; $lng->loadLanguageModule("tagging"); $this->addHeaderIcon("tags", ilUtil::getImagePath("icon_tags_s.png"), $lng->txt("tagging_tags") . ": " . count($tags), ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js), count($tags)); } } // notes and comments $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, true, false); if ($this->notes_enabled || $comments_enabled) { include_once "./Services/Notes/classes/class.ilNote.php"; include_once "./Services/Notes/classes/class.ilNoteGUI.php"; $cnt = ilNote::_countNotesAndComments($this->obj_id, $this->sub_obj_id); if ($this->notes_enabled && $cnt[$this->obj_id][IL_NOTE_PRIVATE] > 0) { $this->addHeaderIcon("notes", ilUtil::getImagePath("note_unlabeled.png"), $lng->txt("private_notes") . ": " . $cnt[$this->obj_id][IL_NOTE_PRIVATE], ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js), $cnt[$this->obj_id][IL_NOTE_PRIVATE]); } if ($comments_enabled && $cnt[$this->obj_id][IL_NOTE_PUBLIC] > 0) { $lng->loadLanguageModule("notes"); $this->addHeaderIcon("comments", ilUtil::getImagePath("comment_unlabeled.png"), $lng->txt("notes_public_comments") . ": " . $cnt[$this->obj_id][IL_NOTE_PUBLIC], ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js), $cnt[$this->obj_id][IL_NOTE_PUBLIC]); } } if ($this->header_icons) { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; $chunks = array(); foreach ($this->header_icons as $id => $attr) { $id = "headp_" . $id; if (is_array($attr)) { if ($attr["onclick"]) { $htpl->setCurrentBlock("onclick"); $htpl->setVariable("PROP_ONCLICK", $attr["onclick"]); $htpl->parseCurrentBlock(); } if ($attr["status_text"]) { $htpl->setCurrentBlock("status"); $htpl->setVariable("PROP_TXT", $attr["status_text"]); $htpl->parseCurrentBlock(); } if (!$attr["href"]) { $attr["href"] = "#"; } $htpl->setCurrentBlock("prop"); $htpl->setVariable("PROP_ID", $id); $htpl->setVariable("IMG", ilUtil::img($attr["img"])); $htpl->setVariable("PROP_HREF", $attr["href"]); $htpl->parseCurrentBlock(); if ($attr["tooltip"]) { ilTooltipGUI::addTooltip($id, $attr["tooltip"]); } } else { $chunks[] = $attr; } } if (sizeof($chunks)) { $htpl->setVariable("PROP_CHUNKS", implode(" ", $chunks) . " "); } } $htpl->setVariable("ACTION_DROP_DOWN", $this->insertCommands(false, false, "", true)); return $htpl->get(); }
/** * Render materials row * * @param * @return */ function renderMaterialsRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0) { global $ilUser, $lng; if ($a_user_id == 0) { $a_user_id = $ilUser->getId(); } foreach ($a_levels as $k => $v) { $mat_cnt = ilPersonalSkill::countAssignedMaterial($a_user_id, $a_tref_id, $v["id"]); if ($mat_cnt == 0) { $a_tpl->setCurrentBlock("val_level_td"); $a_tpl->setVariable("VAL_LEVEL", " "); $a_tpl->parseCurrentBlock(); } else { // links to material files $a_tpl->setCurrentBlock("level_link"); $mat_tt = array(); $cnt = 1; foreach (ilPersonalSkill::getAssignedMaterial($a_user_id, $a_tref_id, $v["id"]) as $item) { $mat_data = $this->getMaterialInfo($item["wsp_id"]); $a_tpl->setVariable("HREF_LINK", $mat_data[1]); $a_tpl->setVariable("TXT_LINK", $cnt); // tooltip $mat_tt_id = "skmg_skl_tt_mat_" . self::$skill_tt_cnt; self::$skill_tt_cnt++; $a_tpl->setVariable("LEVEL_LINK_ID", $mat_tt_id); if (!$this->offline_mode) { ilTooltipGUI::addTooltip($mat_tt_id, $mat_data[0]); } else { $this->tooltips[] = ilTooltipGUI::getTooltip($mat_tt_id, $mat_data[0]); } $a_tpl->parseCurrentBlock(); $cnt++; } $a_tpl->setCurrentBlock("val_level_td"); $a_tpl->setVariable("TD_CLASS", "ilSkillMat"); $a_tpl->parseCurrentBlock(); } } $a_tpl->setCurrentBlock("value_row"); $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("skmg_material")); $a_tpl->parseCurrentBlock(); }
/** * Get Tiny Menu */ static function getTinyMenu($a_par_type, $a_int_links = false, $a_wiki_links = false, $a_keywords = false, $a_style_id = 0, $a_paragraph_styles = true, $a_save_return = true, $a_anchors = false, $a_save_new = true) { global $lng, $ilCtrl; $mathJaxSetting = new ilSetting("MathJax"); include_once "./Services/COPage/classes/class.ilPageEditorSettings.php"; include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; $btpl = new ilTemplate("tpl.tiny_menu.html", true, true, "Services/COPage"); // debug ghost element if (DEVMODE == 1) { $btpl->touchBlock("debug_ghost"); } // bullet list $btpl->touchBlock("blist_button"); ilTooltipGUI::addTooltip("il_edm_blist", $lng->txt("cont_blist"), "iltinymenu_bd"); // numbered list $btpl->touchBlock("nlist_button"); ilTooltipGUI::addTooltip("il_edm_nlist", $lng->txt("cont_nlist"), "iltinymenu_bd"); // list indent $btpl->touchBlock("list_indent"); ilTooltipGUI::addTooltip("ilIndentBut", $lng->txt("cont_list_indent"), "iltinymenu_bd"); // list outdent $btpl->touchBlock("list_outdent"); ilTooltipGUI::addTooltip("ilOutdentBut", $lng->txt("cont_list_outdent"), "iltinymenu_bd"); if ($a_int_links) { $btpl->touchBlock("bb_ilink_button"); ilTooltipGUI::addTooltip("iosEditInternalLinkTrigger", $lng->txt("cont_link_to_internal"), "iltinymenu_bd"); } ilTooltipGUI::addTooltip("il_edm_xlink", $lng->txt("cont_link_to_external"), "iltinymenu_bd"); // remove format $btpl->touchBlock("rformat_button"); ilTooltipGUI::addTooltip("il_edm_rformat", $lng->txt("cont_remove_format"), "iltinymenu_bd"); if ($a_paragraph_styles) { // new paragraph $btpl->setCurrentBlock("new_par"); $btpl->setVariable("IMG_NEWPAR", "+"); $btpl->parseCurrentBlock(); ilTooltipGUI::addTooltip("il_edm_newpar", $lng->txt("cont_insert_new_paragraph"), "iltinymenu_bd"); $btpl->setCurrentBlock("par_edit"); $btpl->setVariable("TXT_PAR_FORMAT", $lng->txt("cont_par_format")); include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php"; $btpl->setVariable("STYLE_SELECTOR", ilPCParagraphGUI::getStyleSelector($a_selected, ilPCParagraphGUI::_getCharacteristics($a_style_id), true)); ilTooltipGUI::addTooltip("ilAdvSelListAnchorText_style_selection", $lng->txt("cont_paragraph_styles"), "iltinymenu_bd"); $btpl->parseCurrentBlock(); } if ($a_keywords) { $btpl->setCurrentBlock("bb_kw_button"); $btpl->setVariable("CC_KW", "kw"); $btpl->parseCurrentBlock(); ilTooltipGUI::addTooltip("il_edm_kw", $lng->txt("cont_text_keyword"), "iltinymenu_bd"); } if ($a_wiki_links) { $btpl->setCurrentBlock("bb_wikilink_button2"); $btpl->setVariable("TXT_WIKI_BUTTON2", $lng->txt("obj_wiki")); $btpl->setVariable("WIKI_BUTTON2_URL", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "")); $btpl->parseCurrentBlock(); $btpl->setCurrentBlock("bb_wikilink_button"); $btpl->setVariable("TXT_WLN2", $lng->txt("obj_wiki")); $btpl->parseCurrentBlock(); ilTooltipGUI::addTooltip("il_edm_wlink", $lng->txt("cont_link_to_wiki"), "iltinymenu_bd"); } $aset = new ilSetting("adve"); include_once "./Services/COPage/classes/class.ilPageContentGUI.php"; foreach (ilPageContentGUI::_getCommonBBButtons() as $c => $st) { // these are handled via drop down now... if (in_array($c, array("com", "quot", "acc", "code"))) { continue; } if (ilPageEditorSettings::lookupSettingByParentType($a_par_type, "active_" . $c, true)) { $cc_code = $c; if ($aset->get("use_physical")) { $cc_code = str_replace(array("str", "emp", "imp"), array("B", "I", "U"), $cc_code); } if ($c != "tex" || $mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) { $btpl->setCurrentBlock("bb_" . $c . "_button"); $btpl->setVariable("CC_" . strtoupper($c), $cc_code); $btpl->parseCurrentBlock(); ilTooltipGUI::addTooltip("il_edm_cc_" . $c, $lng->txt("cont_cc_" . $c), "iltinymenu_bd"); // $btpl->setVariable("TXT_".strtoupper($c), $this->lng->txt("cont_text_".$c)); } } } if ($mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) { ilTooltipGUI::addTooltip("il_edm_tex", $lng->txt("cont_tex"), "iltinymenu_bd"); } ilTooltipGUI::addTooltip("il_edm_fn", $lng->txt("cont_fn"), "iltinymenu_bd"); include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $sdd = new ilAdvancedSelectionListGUI(); $sdd->setPullRight(false); $sdd->setListTitle($lng->txt("save") . "..."); if ($a_save_return) { $btpl->setCurrentBlock("save_return"); $btpl->setVariable("TXT_SAVE_RETURN", $lng->txt("save_return")); $btpl->parseCurrentBlock(); $sdd->addItem($lng->txt("save_return"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(false); return false;"); } if ($a_save_new) { $btpl->setCurrentBlock("save_new"); $btpl->setVariable("TXT_SAVE_NEW", $lng->txt("save_new")); $btpl->parseCurrentBlock(); $sdd->addItem($lng->txt("save_new"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(true); return false;"); } $sdd->addItem($lng->txt("save"), "", "#", "", "", "", "", "", "ilCOPage.cmdSave(null); return false;"); $sdd->addItem($lng->txt("cancel"), "", "#", "", "", "", "", "", "ilCOPage.cmdCancel(); return false;"); if ($a_anchors) { $btpl->setCurrentBlock("bb_anc_button"); $btpl->setVariable("CC_ANC", "anc"); $btpl->parseCurrentBlock(); ilTooltipGUI::addTooltip("il_edm_anc", $lng->txt("cont_anchor"), "iltinymenu_bd"); } $btpl->setVariable("SAVE_DROPDOWN", $sdd->getHTML()); /* // footnote $btpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln")); $btpl->setVariable("TXT_BB_TIP", $this->lng->txt("cont_bb_tip")); $btpl->setVariable("TXT_WLN", $lng->txt("wiki_wiki_page")); */ // $btpl->setVariable("PAR_TA_NAME", $a_ta_name); $btpl->setVariable("TXT_SAVE", $lng->txt("save")); $btpl->setVariable("TXT_CANCEL", $lng->txt("cancel")); $btpl->setVariable("TXT_CHAR_FORMAT", $lng->txt("cont_char_format")); $btpl->setVariable("TXT_LISTS", $lng->txt("cont_lists")); $btpl->setVariable("TXT_LINKS", $lng->txt("cont_links")); $btpl->setVariable("TXT_MORE_FUNCTIONS", $lng->txt("cont_more_functions")); $btpl->setVariable("TXT_SAVING", $lng->txt("cont_saving")); include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php"; $btpl->setVariable("CHAR_STYLE_SELECTOR", ilPCParagraphGUI::getCharStyleSelector($a_par_type)); ilTooltipGUI::addTooltip("ilAdvSelListAnchorElement_char_style_selection", $lng->txt("cont_more_character_styles"), "iltinymenu_bd"); return $btpl->get(); }
/** * Render help button * * @param * @return */ function renderHelpButtons() { global $ilHelp, $lng, $ilCtrl, $tpl, $ilSetting, $ilUser; // screen id if (defined("OH_REF_ID") && OH_REF_ID > 0) { if ($ilHelp->getScreenId() != "") { if ($this->getMode() == self::MODE_FULL) { $this->tpl->setCurrentBlock("screen_id"); $this->tpl->setVariable("SCREEN_ID", $ilHelp->getScreenId()); $this->tpl->parseCurrentBlock(); } } } $help_active = false; include_once "./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php"; $helpl = new ilGroupedListGUI(); $helpl->setAsDropDown(true, true); if ($ilHelp->hasSections()) { $help_active = true; $lng->loadLanguageModule("help"); //$this->tpl->setCurrentBlock("help_icon"); // add javascript needed by help (to do: move to help class) $tpl->addJavascript("./Services/Help/js/ilHelp.js"); include_once "./Services/Accordion/classes/class.ilAccordionGUI.php"; $acc = new ilAccordionGUI(); $acc->addJavascript(); $acc->addCss(); include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip("help_tr", $lng->txt("help_open_online_help"), "", "bottom center", "top center", false); $helpl->addEntry("<span> </span> " . $lng->txt("help_topcis"), "#", "", "il.Help.listHelp(event, false);"); } $module_id = (int) $ilSetting->get("help_module"); if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" && $ilSetting->get("help_mode") != "1") { $help_active = true; $lng->loadLanguageModule("help"); $tpl->addJavascript("./Services/Help/js/ilHelp.js"); include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip("help_tt", $lng->txt("help_toggle_tooltips"), "", "bottom center", "top center", false); $helpl->addEntry('<span id="help_tt_switch_on" class="glyphicon glyphicon-ok"></span> ' . $lng->txt("help_tooltips"), "#", "", "return il.Help.switchTooltips(event);"); } if ($help_active) { $this->tpl->setCurrentBlock("help"); $this->tpl->setVariable("TXT_HELP", $lng->txt("help")); $this->tpl->setVariable("HELP_SELECT", $helpl->getHTML()); $this->tpl->parseCurrentBlock(); // always set ajax url $ts = $ilCtrl->getTargetScript(); $ilCtrl->setTargetScript("ilias.php"); $ilHelp->setCtrlPar(); $tpl->addOnLoadCode("il.Help.setAjaxUrl('" . $ilCtrl->getLinkTargetByClass("ilhelpgui", "", "", true) . "');"); $ilCtrl->setTargetScript($ts); } }
/** * 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(); }
/** * Get HTML * * @param * @return */ function getHTML() { global $ilCtrl; $tpl = new ilTemplate("tpl.grouped_list.html", true, true, "Services/UIComponent/GroupedList"); $tt_calls = ""; foreach ($this->items as $i) { switch ($i["type"]) { case "sep": $tpl->touchBlock("sep"); $tpl->touchBlock("item"); break; case "next_col": $tpl->touchBlock("next_col"); $tpl->touchBlock("item"); break; case "group_head": $tpl->setCurrentBlock("group_head"); if ($i["add_class"] != "") { $tpl->setVariable("ADD_CLASS", $i["add_class"]); } $tpl->setVariable("GROUP_HEAD", $i["content"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("item"); break; case "entry": if ($i["href"] != "") { $tpl->setCurrentBlock("linked_entry"); if ($i["add_class"] != "") { $tpl->setVariable("ADD_CLASS", $i["add_class"]); } $tpl->setVariable("HREF", $i["href"]); $tpl->setVariable("TXT_ENTRY", $i["content"]); if ($i["target"] != "") { $tpl->setVariable("TARGET", 'target="' . $i["target"] . '"'); } else { $tpl->setVariable("TARGET", 'target="_top"'); } if ($i["onclick"] != "") { $tpl->setVariable("ONCLICK", 'onclick="' . $i["onclick"] . '"'); } if ($i["id"] != "") { $tpl->setVariable("ID", 'id="' . $i["id"] . '"'); } $tpl->parseCurrentBlock(); $tpl->touchBlock("item"); if ($i["ttip"] != "" && $i["id"] != "") { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; if ($ilCtrl->isAsynch()) { $tt_calls .= " " . ilTooltipGUI::getTooltip($i["id"], $i["ttip"], "", $i["tt_my"], $i["tt_at"], $i["tt_use_htmlspecialchars"]); } else { ilTooltipGUI::addTooltip($i["id"], $i["ttip"], "", $i["tt_my"], $i["tt_at"], $i["tt_use_htmlspecialchars"]); } } } else { $tpl->setCurrentBlock("unlinked_entry"); if ($i["add_class"] != "") { $tpl->setVariable("ADD_CLASS2", $i["add_class"]); } $tpl->setVariable("TXT_ENTRY2", $i["content"]); $tpl->parseCurrentBlock(); } break; } } if ($this->multi_column) { $tpl->touchBlock("multi_start"); $tpl->touchBlock("multi_end"); } if ($tt_calls != "") { $tpl->setCurrentBlock("script"); $tpl->setVariable("TT_CALLS", $tt_calls); $tpl->parseCurrentBlock(); } if ($this->getAsDropDown()) { if ($this->dd_pullright) { $tpl->setVariable("LIST_CLASS", "dropdown-menu pull-right"); } else { $tpl->setVariable("LIST_CLASS", "dropdown-menu"); } $tpl->setVariable("LIST_ROLE", "menu"); } else { $tpl->setVariable("LIST_CLASS", ""); $tpl->setVariable("LIST_ROLE", ""); } return $tpl->get(); }
/** * Get selection list HTML */ public function getHTML($a_only_cmd_list_asynch = false) { $items = $this->getItems(); // do not show list, if no item is in list if (count($items) == 0 && !$this->getAsynch() && $this->getGroupedList() == null) { return ""; } /* bootstrap made this obsolete ?! include_once("./Services/YUI/classes/class.ilYuiUtil.php"); ilYuiUtil::initOverlay(); $GLOBALS["tpl"]->addJavascript("./Services/UIComponent/Overlay/js/ilOverlay.js"); */ $GLOBALS["tpl"]->addJavascript("./Services/UIComponent/AdvancedSelectionList/js/AdvancedSelectionList.js"); $tpl = new ilTemplate("tpl.adv_selection_list.html", true, true, "Services/UIComponent/AdvancedSelectionList", "DEFAULT", false, true); reset($items); $cnt = 0; if ($this->getAsynch()) { $tpl->setCurrentBlock("asynch_request"); $tpl->setVariable("IMG_LOADER", ilUtil::getImagePath("loader.svg")); $tpl->parseCurrentBlock(); } else { if ($this->getGroupedList() != null) { $tpl->setVariable("GROUPED_LIST_HTML", $this->getGroupedList()->getHTML()); } else { foreach ($items as $item) { if (isset($item["ref_id"])) { $sel_arr[$item["ref_id"]] = isset($item["title"]) ? $item["title"] : ""; } $this->css_row = $this->css_row != "tblrow1_mo" ? "tblrow1_mo" : "tblrow2_mo"; if ($this->getUseImages()) { if ($item["img"]) { $tpl->setCurrentBlock("image"); $tpl->setVariable("IMG_ITEM", $item["img"]); $tpl->setVariable("ALT_ITEM", $item["alt"]); $tpl->parseCurrentBlock(); } else { $tpl->touchBlock("no_image"); } } if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_HREF || $this->getItemLinkClass() != "") { if ($item["frame"]) { $tpl->setCurrentBlock("frame"); $tpl->setVariable("TARGET_ITEM", $item["frame"]); $tpl->parseCurrentBlock(); } if ($this->getItemLinkClass() != "") { $tpl->setCurrentBlock("item_link_class"); $tpl->setVariable("ITEM_LINK_CLASS", $this->getItemLinkClass()); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("href_s"); $tpl->setVariable("HREF_ITEM", 'href="' . $item["link"] . '"'); $tpl->setVariable("ID_ITEM", $this->getId() . "_" . $item["value"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("href_e"); } $tpl->setCurrentBlock("item"); if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_HREF) { if ($item["prevent_background_click"]) { $tpl->setVariable("ONCLICK_ITEM", ''); } else { if ($item["onclick"] == "") { $tpl->setVariable("ONCLICK_ITEM", 'onclick="' . "return il.AdvancedSelectionList.openTarget('" . $item["link"] . "','" . $item["frame"] . "');" . '"'); } else { $tpl->setVariable("ONCLICK_ITEM", 'onclick="' . "return " . $item["onclick"] . ";" . '"'); } } } else { if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SUBMIT) { $tpl->setVariable("ONCLICK_ITEM", 'onclick="return il.AdvancedSelectionList.submitForm(\'' . $this->getId() . '\'' . ", '" . $this->form_mode["select_name"] . "','" . $item["value"] . "'," . "'" . $this->on_click_form_id . "','" . $this->form_mode["button_cmd"] . "');\""); } else { if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SELECT) { $tpl->setVariable("ONCLICK_ITEM", 'onclick="return il.AdvancedSelectionList.selectForm(\'' . $this->getId() . '\'' . ", '" . $this->form_mode["select_name"] . "','" . $item["value"] . "'," . "'" . $item["title"] . "');\""); } else { if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_NOP) { $tpl->setVariable("ONCLICK_ITEM", 'onclick="il.AdvancedSelectionList.clickNop(\'' . $this->getId() . '\'' . ", '" . $this->form_mode["select_name"] . "','" . $item["value"] . "'," . "'" . $item["title"] . "');\""); } } } } $tpl->setVariable("CSS_ROW", $this->css_row); if ($item["html"] == "") { $tpl->setVariable("TXT_ITEM", $item["title"]); } else { $tpl->setVariable("TXT_ITEM", $item["html"]); } $tpl->setVariable("ID_ITEM_TR", $this->getId() . "_" . $item["value"] . "_tr"); if ($item["ttip"] != "") { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip($this->getId() . "_" . $item["value"] . "_tr", $item["ttip"], "", $item["tt_my"], $item["tt_at"], $item["tt_use_htmlspecialchars"]); } $tpl->parseCurrentBlock(); // add item to js object $tpl->setCurrentBlock("js_item"); $tpl->setVariable("IT_ID", $this->getId()); $tpl->setVariable("IT_HID_NAME", $this->form_mode["select_name"]); $tpl->setVariable("IT_HID_VAL", $item["value"]); $tpl->setVariable("IT_TITLE", str_replace("'", "\\'", $item["title"])); $tpl->parseCurrentBlock(); } // output hidden input, if click mode is form submission if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SUBMIT) { $tpl->setCurrentBlock("hidden_input"); $tpl->setVariable("HID", $this->getId()); $tpl->parseCurrentBlock(); } // output hidden input and initialize if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SELECT) { $tpl->setCurrentBlock("hidden_input"); $tpl->setVariable("HID", $this->getId()); $tpl->parseCurrentBlock(); // init hidden input with selected value $tpl->setCurrentBlock("init_hidden_input"); $tpl->setVariable("H2ID", $this->getId()); $tpl->setVariable("HID_NAME", $this->form_mode["select_name"]); $tpl->setVariable("HID_VALUE", $this->getSelectedValue()); $tpl->parseCurrentBlock(); } } } if ($a_only_cmd_list_asynch) { $tpl->touchBlock("cmd_table"); return $tpl->get("cmd_table"); } if ($this->getGroupedList() == null) { $tpl->setCurrentBlock("dd_content"); if ($this->getPullRight()) { $tpl->setVariable("UL_CLASS", "dropdown-menu pull-right"); } else { $tpl->setVariable("UL_CLASS", "dropdown-menu"); } $tpl->setVariable("TABLE_ID", $this->getId()); $tpl->parseCurrentBlock(); } if ($this->getHeaderIcon() != ilAdvancedSelectionListGUI::NO_ICON) { $tpl->setCurrentBlock("top_img"); switch ($this->getHeaderIcon()) { case ilAdvancedSelectionListGUI::ICON_CONFIG: $tpl->setVariable("IMG_SPAN_STYLE", ilAdvancedSelectionListGUI::ICON_CONFIG); break; case ilAdvancedSelectionListGUI::DOWN_ARROW_DARK: default: $tpl->setVariable("IMG_SPAN_STYLE", ilAdvancedSelectionListGUI::ICON_ARROW); break; } $tpl->parseCurrentBlock(); } if ($this->getAsynch()) { $tpl->setCurrentBlock("asynch_bl"); $tpl->setVariable("ASYNCH_URL", $this->getAsynchUrl()); $tpl->setVariable("ASYNCH_ID", $this->getId()); $tpl->setVariable("ASYNCH_TRIGGER_ID", $this->getId()); $tpl->parseCurrentBlock(); } // js section $tpl->setCurrentBlock("js_section"); if ($this->getAccessKey() > 0) { include_once "./Services/Accessibility/classes/class.ilAccessKeyGUI.php"; $tpl->setVariable("ACCKEY", ilAccessKeyGUI::getAttribute($this->getAccessKey())); } $cfg["trigger_event"] = $this->getTriggerEvent(); $cfg["auto_hide"] = $this->getAutoHide(); if ($this->getSelectCallback() != "") { $cfg["select_callback"] = $this->getSelectCallback(); } $cfg["anchor_id"] = "ilAdvSelListAnchorElement_" . $this->getId(); $cfg["asynch"] = $this->getAsynch() ? true : false; $cfg["asynch_url"] = $this->getAsynchUrl(); $toggle = $this->getAdditionalToggleElement(); if (is_array($toggle)) { $cfg["toggle_el"] = $toggle["el"]; $cfg["toggle_class_on"] = $toggle["class_on"]; } //echo "<br>".htmlentities($this->getAsynchUrl()); include_once "./Services/JSON/classes/class.ilJsonUtil.php"; $tpl->setVariable("CFG", ilJsonUtil::encode($cfg)); //echo htmlentities(ilJsonUtil::encode($cfg)); $tpl->setVariable("TXT_SEL_TOP", $this->getListTitle()); $tpl->setVariable("ID", $this->getId()); //$tpl->setVariable("CLASS_SEL_TOP", $this->getSelectionHeaderClass()); switch ($this->getStyle()) { case self::STYLE_DEFAULT: $tpl->setVariable("BTN_CLASS", "btn btn-sm btn-default"); $tpl->setVariable("TAG", "button"); break; case self::STYLE_EMPH: $tpl->setVariable("BTN_CLASS", "btn btn-sm btn-primary"); $tpl->setVariable("TAG", "button"); break; case self::STYLE_LINK_BUTTON: $tpl->setVariable("BTN_CLASS", "btn btn-sm btn-link"); $tpl->setVariable("TAG", "button"); break; case self::STYLE_LINK: $tpl->setVariable("BTN_CLASS", ""); $tpl->setVariable("TAG", "a"); break; } if ($this->getSelectionHeaderSpanClass() != "") { $tpl->setVariable("CLASS_SEL_TOP_SPAN", $this->getSelectionHeaderSpanClass()); } // set the async url to an extra template variable // (needed for a mobile skin) // $tpl->setVariable("ASYNC_URL", $this->getAsynchUrl()); $tpl->parseCurrentBlock(); return $tpl->get(); }