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(); }
/** * Create test result link * @param type $a_type * @param type $a_objective_id */ protected function createTestResultLink($a_type, $a_objective_id) { include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php'; $assignments = ilLOTestAssignments::getInstance($this->getParentContainer()->getId()); $test_ref_id = $assignments->getTestByObjective($a_objective_id, $a_type); if (!$test_ref_id) { return ''; } include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php'; return ilLOUtils::getTestResultLinkForUser($test_ref_id, $this->getUserId()); }