19 declare(strict_types=1);
40 protected \ilLanguage
$lng;
41 protected \ILIAS\Container\StandardGUIRequest
$request;
75 $this->renderer = $container_renderer;
76 $this->content_style_domain = $DIC
82 $this->
lng = $domain->lng();
88 $mode = $this->domain->content()->mode($this->container);
89 $user = $this->domain->user();
90 $access = $this->domain->access();
91 $lng = $this->domain->lng();
93 $is_manage = $mode->isAdminMode();
94 $is_order = $mode->isOrderingMode();
108 $this->loc_settings->getInitialTest() &&
109 $this->loc_settings->isGeneralInitialTestVisible() &&
110 !$this->loc_settings->isInitialTestStart() &&
118 $this->output_html .= $this->
renderTest($this->loc_settings->getInitialTest(), null,
true);
120 $this->loc_settings->getQualifiedTest() &&
121 $this->loc_settings->isGeneralQualifiedTestVisible()
123 $this->output_html .= $this->
renderTest($this->loc_settings->getQualifiedTest(), null,
false);
138 $access->checkAccess(
'write',
'', $this->container->getRefId())
141 if (!$is_manage && !$is_order) {
142 $this->
showButton(
'askReset', $lng->txt(
'crs_reset_results'));
156 $lng = $this->domain->lng();
162 $this->objective_list_gui = new \ilCourseObjectiveListGUI();
163 $this->objective_list_gui->setContainerObject($this->container_gui);
164 if (
$ilSetting->get(
"icon_position_in_lists") ===
"item_rows") {
165 $this->objective_list_gui->enableIcon(
true);
170 $acc = new \ilAccordionGUI();
171 $acc->setUseSessionStorage(
true);
172 $acc->setAllowMultiOpened(
true);
174 $acc->setId(
"crsobjtv_" . $this->container->getId());
176 $this->renderer->addCustomBlock(
'lobj', $lng->txt(
'crs_objectives'));
181 $has_lo_page =
false;
183 foreach ($objective_ids as $objective_id) {
187 !isset($lur_data[$objective_id]) or
189 $this->container->getId(),
197 if ($html = $this->
renderObjective((
int) $objective_id, $has_lo_page, $acc, $lur_data[$objective_id] ?? null)) {
198 $this->renderer->addItemToBlock(
'lobj',
'lobj', $objective_id, $html);
204 if (!$a_is_order && $obj_cnt > 1) {
205 $this->
showButton(
"", $lng->txt(
"crs_show_all_obj"),
"",
"crs_show_all_obj_btn");
206 $this->
showButton(
"", $lng->txt(
"crs_hide_all_obj"),
"",
"crs_hide_all_obj_btn");
207 $acc->setShowAllElement(
"crs_show_all_obj_btn");
208 $acc->setHideAllElement(
"crs_hide_all_obj_btn");
213 $this->output_html .= $this->renderer->getHTML();
215 $this->renderer->resetDetails();
219 $this->output_html .=
"<div class='ilCrsObjAcc'>" . $acc->getHTML() .
"</div>";
225 ?
int $a_objective_id,
226 bool $a_is_initial =
false 228 $tree = $this->domain->repositoryTree();
229 $lng = $this->domain->lng();
232 if ($a_test_ref_id) {
233 $node_data = $tree->getNodeData($a_test_ref_id);
235 if (!isset($node_data[
'child']) || !$node_data[
'child']) {
240 if ($a_objective_id) {
246 $node_data[
'objective_id'] = $a_objective_id;
247 $node_data[
'objective_status'] =
false;
256 ? $lng->txt(
'crs_loc_itest_info')
257 : $lng->txt(
'crs_loc_qtest_info')
261 $node_data[
'objective_id'] = 0;
264 $node_data[
'title'] = $title;
266 return "<div class='ilContObjectivesViewTestItem'>" . $this->renderer->getItemRenderer()->renderItem($node_data) .
"</div>";
415 bool &$a_has_lo_page,
417 array $a_lo_result = null
419 $ilUser = $this->domain->user();
420 $lng = $this->domain->lng();
422 $objective = new \ilCourseObjective($this->container, $a_objective_id);
429 $objectives_lm_obj = new \ilCourseObjectiveMaterials($a_objective_id);
433 foreach ($objectives_lm_obj->getMaterials() as $item) {
434 $sort_map[$item[
"lm_ass_id"]] = $item[
"position"];
437 $is_manage = $this->container_gui->isActiveAdministrationPanel();
438 $is_order = $this->container_gui->isActiveOrdering();
440 $sort_content = array();
442 $access = $this->domain->access();
443 foreach ($items as $item) {
445 if (!$access->checkAccess(
'visible',
'', $item[
"ref_id"])) {
453 $item_list_gui2 = $this->renderer->getItemRenderer()->getItemGUI($item);
454 $item_list_gui2->enableIcon(
true);
456 if ($is_order || $a_accordion) {
457 $item_list_gui2->enableCommands(
true,
true);
458 $item_list_gui2->enableProperties(
false);
461 $chapters = $objectives_lm_obj->getChapters();
462 if (count($chapters)) {
463 $has_sections =
false;
464 foreach ($chapters as $chapter) {
465 if ($chapter[
'ref_id'] != $item[
'child']) {
468 $has_sections =
true;
470 $title = $item[
'title'] .
472 " (" . $lng->txt(
'obj_' . $chapter[
'type']) .
")";
474 $item_list_gui2->setDefaultCommandParameters(array(
475 "obj_id" => $chapter[
'obj_id'],
476 "focus_id" => $chapter[
'obj_id'],
477 "focus_return" => $this->container->getRefId()));
480 $item_list_gui2->setPositionInputField(
481 "[lobj][" . $a_objective_id .
"][" . $chapter[
'lm_ass_id'] .
"]",
482 sprintf(
'%d', $chapter[
'position'] * 10)
486 $sub_item_html = $item_list_gui2->getListItemHTML(
487 (
int) $item[
'ref_id'],
488 (
int) $item[
'obj_id'],
495 (
string) $chapter[
'position'],
499 ) .
"_" . strtolower($title) .
"_" . $chapter[
'lm_ass_id'];
500 $sort_content[$sort_key] = $sub_item_html;
504 $this->rendered_items[$item[
'child']] =
true;
506 if ($lm_ass_id = $objectives_lm_obj->isAssigned((
int) $item[
'ref_id'],
true)) {
508 $item_list_gui2->setPositionInputField(
509 "[lobj][" . $a_objective_id .
"][" . $lm_ass_id .
"]",
510 sprintf(
'%d', $sort_map[$lm_ass_id] * 10)
514 $sub_item_html = $item_list_gui2->getListItemHTML(
522 $sort_key = str_pad((
string) $sort_map[$lm_ass_id], 5,
"0", STR_PAD_LEFT) .
"_" . strtolower($item[
'title']) .
"_" . $lm_ass_id;
523 $sort_content[$sort_key] = $sub_item_html;
528 $this->objective_list_gui->enableCommands(
false);
534 $this->objective_list_gui->setPositionInputField(
535 "[lobj][" . $a_objective_id .
"][0]",
536 (
string) ($objective->__getPosition() * 10)
540 ksort($sort_content);
542 foreach ($sort_content as $sub_item_html) {
543 $this->objective_list_gui->addSubItemHTML($sub_item_html);
546 return $this->objective_list_gui->getObjectiveListItemHTML(
549 $objective->getTitle(),
550 $objective->getDescription(),
551 ($is_manage || $is_order)
554 $acc_content = $sort_content;
556 $initial_shown =
false;
561 $initial_test_obj_id &&
562 $this->loc_settings->hasSeparateInitialTests() &&
570 $initial_shown =
true;
571 } elseif ($this->loc_settings->hasSeparateQualifiedTests()) {
581 $a_has_lo_page =
true;
583 $page_gui = new \ilLOPageGUI($objective->getObjectiveId());
585 $page_gui->setStyleId(
586 $this->content_style_domain->getEffectiveStyleId()
588 $page_gui->setPresentationTitle(
"");
589 $page_gui->setTemplateOutput(
false);
590 $page_gui->setHeader(
"");
592 $co_page =
"<div class='ilContObjectiveIntro'>" . $page_gui->showPage() .
"</div>";
595 $a_accordion->addItem(
599 ($this->request->getObjectiveId() == $objective->getObjectiveId())
608 $ilUser = $this->domain->user();
609 $initial_status = null;
615 $lur = new \ilLOUserResults($this->container->getId(), $ilUser->getId());
616 foreach ($lur->getCourseResultsForUserPresentation() as $objective_id => $types) {
632 $result[
"initial_status"] = $initial_status;
637 $res[$objective_id] = $result;
661 int $a_perc_result = null,
662 int $a_perc_limit = null,
663 int $a_compare_value = null,
664 string $a_caption = null,
665 string $a_url = null,
666 string $a_tt_id = null,
667 string $a_tt_txt = null,
668 string $a_next_step = null,
670 int $a_sub_style = 30,
671 string $a_main_text =
'',
672 string $a_required_text =
'' 676 $tpl = new \ilTemplate(
"tpl.objective_progressmeter.html",
true,
true,
"Services/Container");
678 $lng = $DIC->language();
679 $lng->loadLanguageModule(
'crs');
683 if (is_numeric($a_perc_result)) {
684 $uiFactory = $DIC->ui()->factory();
685 $uiRenderer = $DIC->ui()->renderer();
687 $pMeter = $uiFactory->chart()->progressMeter()->standard(
689 (
int) $a_perc_result,
691 (
int) $a_compare_value
693 $tpl->setVariable(
'PROGRESS_METER', $uiRenderer->render($pMeter));
699 $button->setCaption($a_caption,
false);
700 $button->setUrl($a_url);
702 $tpl->setCurrentBlock(
"statustxt_bl");
703 $tpl->setVariable(
"TXT_PROGRESS_STATUS", $button->render());
705 $tpl->setCurrentBlock(
"statustxt_no_link_bl");
706 $tpl->setVariable(
"TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
708 $tpl->parseCurrentBlock();
713 $tpl->setVariable(
"TXT_NEXT_STEP", $a_next_step);
723 $tpl->setVariable(
"SUB_STYLE",
' style="padding-left: ' . $a_sub_style .
'px;"');
724 $tpl->setVariable(
"SUB_INIT", $a_sub);
734 bool $a_has_initial_test,
740 if ($a_lo_result === null) {
741 $a_lo_result[
"type"] = null;
743 if (!isset($a_lo_result[
"type"])) {
744 $a_lo_result[
"type"] = null;
747 $lng = $DIC->language();
748 $lng->loadLanguageModule(
'crs');
752 $is_qualified_initial =
759 $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null;
763 $is_qualified_initial) {
764 if ($has_completed) {
765 $next_step = $lng->txt(
"crs_loc_progress_objective_complete");
767 $next_step = $lng->txt(
"crs_loc_progress_do_qualifying_again");
771 if ($a_lo_result[
"status"] ?? 0) {
774 $lng->txt(
"crs_loc_progress_do_qualifying") :
775 $lng->txt(
"crs_loc_suggested");
777 $next_step = $a_has_initial_test ?
778 $lng->txt(
"crs_loc_progress_no_result_do_initial") :
779 $lng->txt(
"crs_loc_progress_no_result_no_initial");
789 bool $a_has_initial_test,
792 bool $a_list_mode =
false,
794 string $a_tt_suffix = null
798 $lng = $DIC->language();
799 $lng->loadLanguageModule(
'crs');
803 $tooltip_id =
"crsobjtvusr_" . $a_objective_id .
"_" . $a_lo_result[
"type"] .
"_" . ((
int) $a_sub);
804 if ($a_tt_suffix !== null) {
805 $tooltip_id .=
"_" . $a_tt_suffix;
809 $lng->txt(
"crs_loc_tt_info"),
810 $a_lo_result[
"result_perc"] ??
'0',
811 $a_lo_result[
"limit_perc"] ??
'0' 820 $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null;
821 $compare_value = null;
824 $is_qualified_initial) {
825 $progress_txt = $lng->txt(
"crs_loc_progress_result_qtest");
826 $tt_txt = $lng->txt(
"crs_loc_tab_qtest") .
": " . $tt_txt;
828 if ($has_completed) {
829 $next_step = $lng->txt(
"crs_loc_progress_objective_complete");
830 $bar_color =
"ilCourseObjectiveProgressBarCompleted";
834 $a_has_initial_test &&
835 is_array($a_lo_result[
"initial"])) {
836 $a_lo_result[
"initial"][
"itest"] = $a_lo_result[
"itest"];
839 #$initial_sub = self::buildObjectiveProgressBar(true, $a_objective_id, $a_lo_result["initial"], true, true, $a_tt_suffix); 840 $compare_value = $a_lo_result[
'initial'][
'result_perc'];
843 $next_step = $lng->txt(
"crs_loc_progress_do_qualifying_again");
844 $bar_color =
"ilCourseObjectiveProgressBarFailed";
849 if ($a_lo_result[
"status"] ?? 0) {
850 $progress_txt = $lng->txt(
"crs_loc_progress_result_itest");
851 $tt_txt = $lng->txt(
"crs_loc_tab_itest") .
": " . $tt_txt;
853 $bar_color =
"ilCourseObjectiveProgressBarNeutral";
854 $next_step = $has_completed
855 ? $lng->txt(
"crs_loc_progress_do_qualifying")
856 : $lng->txt(
"crs_loc_suggested");
860 $next_step = $a_has_initial_test
861 ? $lng->txt(
"crs_loc_progress_no_result_do_initial")
862 : $lng->txt(
"crs_loc_progress_no_result_no_initial");
867 $relevant_test_id = ($a_lo_result[
"qtest"] ?? 0)
868 ?: ($a_lo_result[
"itest"] ?? 0);
869 if ($relevant_test_id) {
873 $main_text = $lng->txt(
'crs_loc_itest_info');
875 $main_text = $lng->txt(
'crs_loc_qtest_info');
880 return self::renderProgressMeter(
881 $a_lo_result[
"result_perc"] ?? null,
882 $a_lo_result[
"limit_perc"] ?? null,
896 $lng->txt(
'crs_lobj_pm_min_goal')
902 array $a_lo_result = null
906 $renderer = $DIC->ui()->renderer();
907 $ui_factory = $DIC->ui()->factory();
909 $tpl = new \ilTemplate(
"tpl.objective_accordion_title.html",
true,
true,
"Services/Container");
914 self::buildObjectiveProgressBar(
915 $this->loc_settings->worksWithInitialTest(),
922 $tpl->setVariable(
"TITLE", $this->
lng->txt(
"crs_loc_learning_objective") .
": " . trim($a_objective->
getTitle()));
923 $tpl->setVariable(
"DESCRIPTION", nl2br(trim($a_objective->
getDescription())));
927 if ($this->loc_settings->worksWithInitialTest()) {
928 if (array_key_exists(
'initial', $a_lo_result)) {
929 $initial_res = (
int) ($a_lo_result[
'initial'][
'result_perc'] ?? 0);
930 $initial_lim = (
int) ($a_lo_result[
'initial'][
'limit_perc'] ?? 100);
934 isset($a_lo_result[
'result_perc'])
936 $initial_res = (
int) $a_lo_result[
'result_perc'];
937 $initial_lim = (
int) $a_lo_result[
'limit_perc'];
941 if ($initial_res !== null) {
943 $a_lo_result[
"itest"],
944 $a_lo_result[
"user_id"]
948 $tpl->setCurrentBlock(
'i_with_link');
952 $ui_factory->button()->shy(
953 $this->
lng->txt(
'crs_objective_result_details'),
958 $tpl->parseCurrentBlock();
961 $tpl->setCurrentBlock(
'res_initial');
965 $this->
lng->txt(
'crs_objective_result_summary_initial'),
967 (
int) $initial_lim .
'%' 970 $tpl->parseCurrentBlock();
977 $qual_res = (
int) $a_lo_result[
'result_perc'];
978 $qual_lim = (
int) $a_lo_result[
'limit_perc'];
981 if ($qual_res !== null) {
983 $a_lo_result[
"qtest"],
984 $a_lo_result[
"user_id"]
988 $tpl->setCurrentBlock(
'q_with_link');
992 $ui_factory->button()->shy(
993 $this->
lng->txt(
'crs_objective_result_details'),
998 $tpl->parseCurrentBlock();
1000 $tpl->setCurrentBlock(
'res_qualifying');
1004 $this->
lng->txt(
'crs_objective_result_summary_qualifying'),
1006 (
int) $qual_lim .
'%' 1009 $tpl->parseCurrentBlock();
1014 $summary = self::getObjectiveResultSummary(
1015 $this->loc_settings->worksWithInitialTest(),
1019 if (strlen($summary)) {
1020 $tpl->setCurrentBlock(
'objective_summary');
1021 $tpl->setVariable(
'SUMMARY_TXT', $summary);
1022 $tpl->parseCurrentBlock();
1026 $tpl->setVariable(
"ANCHOR_ID",
"objtv_acc_" . $a_objective->
getObjectiveId());
1033 $tpl = new \ilTemplate(
"tpl.objective_accordion_content.html",
true,
true,
"Services/Container");
1034 foreach ($a_items as $item) {
1035 $tpl->setCurrentBlock(
"items_bl");
1036 $tpl->setVariable(
"ITEM", $item);
1037 $tpl->parseCurrentBlock();
1045 string $a_target =
'',
1048 $ilToolbar = $this->gui->toolbar();
1049 $ilCtrl = $this->gui->ctrl();
1052 $ilToolbar->addButton(
1054 $ilCtrl->getLinkTarget($this->container_gui, $a_cmd),
static hasActiveRun(int $a_container_id, int $a_test_ref_id, int $a_objective_id)
buildAccordionTitle(\ilCourseObjective $a_objective, array $a_lo_result=null)
ilCourseObjectiveListGUI $objective_list_gui
ilLOTestAssignments $test_assignments
ILIAS Container StandardGUIRequest $request
static getObjectiveResultSummary(bool $a_has_initial_test, int $a_objective_id, array $a_lo_result)
Get objective result summary.
renderObjective(int $a_objective_id, bool &$a_has_lo_page, \ilAccordionGUI $a_accordion=null, array $a_lo_result=null)
static hasResults(int $a_container_id, int $a_user_id)
ilContainerRenderer $renderer
showObjectives(bool $a_is_order=false)
ILIAS Style Content Object ObjectFacade $content_style_domain
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
ilLOSettings $loc_settings
static _lookupObjId(int $ref_id)
static _lookupTitle(int $a_obj_id)
static getTestResultLinkForUser(int $a_test_ref_id, int $a_user_id)
static _existsAndNotEmpty(string $a_parent_type, int $a_id, string $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages) ...
ilContainerGUI $container_gui
static _lookupTitle(int $obj_id)
InternalDomainService $domain
__construct()
Constructor setup ILIAS global object public.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static buildObjectiveProgressBar(bool $a_has_initial_test, int $a_objective_id, array $a_lo_result, bool $a_list_mode=false, bool $a_sub=false, string $a_tt_suffix=null)
Render progressbar(s) for given objective and result data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static renderProgressMeter(int $a_perc_result=null, int $a_perc_limit=null, int $a_compare_value=null, string $a_caption=null, string $a_url=null, string $a_tt_id=null, string $a_tt_txt=null, string $a_next_step=null, bool $a_sub=false, int $a_sub_style=30, string $a_main_text='', string $a_required_text='')
Render progress meter.
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
check condition
buildAccordionContent(array $a_items)
static getInstanceByObjId(int $a_obj_id)
showButton(string $a_cmd, string $a_text, string $a_target='', string $a_id="")
static getItemsByObjective(int $objective_id)
Get objective items.
renderTest(int $a_test_ref_id, ?int $a_objective_id, bool $a_is_initial=false)
static getInstance(int $a_container_id)
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder...
const TYPE_TEST_QUALIFIED
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...