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();
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;
265 return "<div class='ilContObjectivesViewTestItem'>" . $this->
renderer->getItemRenderer()->renderItem($node_data) .
"</div>";
414 bool &$a_has_lo_page,
416 ?array $a_lo_result =
null 418 $ilUser = $this->domain->user();
419 $lng = $this->domain->lng();
421 $objective = new \ilCourseObjective($this->container, $a_objective_id);
428 $objectives_lm_obj = new \ilCourseObjectiveMaterials($a_objective_id);
432 foreach ($objectives_lm_obj->getMaterials() as $item) {
433 $sort_map[$item[
"lm_ass_id"]] = $item[
"position"];
436 $is_manage = $this->container_gui->isActiveAdministrationPanel();
437 $is_order = $this->container_gui->isActiveOrdering();
439 $sort_content = array();
441 $access = $this->domain->access();
442 foreach ($items as $item) {
444 if (!$access->checkAccess(
'visible',
'', $item[
"ref_id"])) {
452 $item_list_gui2 = $this->
renderer->getItemRenderer()->getItemGUI($item);
453 $item_list_gui2->enableIcon(
true);
455 if ($is_order || $a_accordion) {
456 $item_list_gui2->enableCommands(
true,
true);
457 $item_list_gui2->enableProperties(
false);
460 $chapters = $objectives_lm_obj->getChapters();
461 if (count($chapters)) {
462 $has_sections =
false;
463 foreach ($chapters as $chapter) {
464 if ($chapter[
'ref_id'] != $item[
'child']) {
467 $has_sections =
true;
469 $title = $item[
'title'] .
471 " (" . $lng->txt(
'obj_' . $chapter[
'type']) .
")";
473 $item_list_gui2->setDefaultCommandParameters(array(
474 "obj_id" => $chapter[
'obj_id'],
475 "focus_id" => $chapter[
'obj_id'],
476 "focus_return" => $this->container->getRefId()));
479 $item_list_gui2->setPositionInputField(
480 "[lobj][" . $a_objective_id .
"][" . $chapter[
'lm_ass_id'] .
"]",
481 sprintf(
'%d', $chapter[
'position'] * 10)
485 $sub_item_html = $item_list_gui2->getListItemHTML(
486 (
int) $item[
'ref_id'],
487 (
int) $item[
'obj_id'],
494 (
string) $chapter[
'position'],
498 ) .
"_" . strtolower($title) .
"_" . $chapter[
'lm_ass_id'];
499 $sort_content[$sort_key] = $sub_item_html;
503 $this->rendered_items[$item[
'child']] =
true;
505 if ($lm_ass_id = $objectives_lm_obj->isAssigned((
int) $item[
'ref_id'],
true)) {
507 $item_list_gui2->setPositionInputField(
508 "[lobj][" . $a_objective_id .
"][" . $lm_ass_id .
"]",
509 sprintf(
'%d', $sort_map[$lm_ass_id] * 10)
513 $sub_item_html = $item_list_gui2->getListItemHTML(
521 $sort_key = str_pad((
string) $sort_map[$lm_ass_id], 5,
"0", STR_PAD_LEFT) .
"_" . strtolower($item[
'title']) .
"_" . $lm_ass_id;
522 $sort_content[$sort_key] = $sub_item_html;
527 $this->objective_list_gui->enableCommands(
false);
533 $this->objective_list_gui->setPositionInputField(
534 "[lobj][" . $a_objective_id .
"][0]",
535 (
string) ($objective->__getPosition() * 10)
539 ksort($sort_content);
541 foreach ($sort_content as $sub_item_html) {
542 $this->objective_list_gui->addSubItemHTML($sub_item_html);
545 return $this->objective_list_gui->getObjectiveListItemHTML(
548 $objective->getTitle(),
549 $objective->getDescription(),
550 ($is_manage || $is_order)
553 $acc_content = $sort_content;
555 $initial_shown =
false;
560 $initial_test_obj_id &&
561 $this->loc_settings->hasSeparateInitialTests() &&
569 $initial_shown =
true;
570 } elseif ($this->loc_settings->hasSeparateQualifiedTests()) {
580 $a_has_lo_page =
true;
582 $page_gui = new \ilLOPageGUI($objective->getObjectiveId());
584 $page_gui->setStyleId(
585 $this->content_style_domain->getEffectiveStyleId()
587 $page_gui->setPresentationTitle(
"");
588 $page_gui->setTemplateOutput(
false);
589 $page_gui->setHeader(
"");
591 $co_page =
"<div class='ilContObjectiveIntro'>" . $page_gui->showPage() .
"</div>";
594 $a_accordion->addItem(
598 ($this->request->getObjectiveId() == $objective->getObjectiveId())
607 $ilUser = $this->domain->user();
608 $initial_status =
null;
614 $lur = new \ilLOUserResults($this->container->getId(), $ilUser->getId());
615 foreach ($lur->getCourseResultsForUserPresentation() as $objective_id => $types) {
631 $result[
"initial_status"] = $initial_status;
636 $res[$objective_id] = $result;
660 ?
int $a_perc_result =
null,
661 ?
int $a_perc_limit =
null,
662 ?
int $a_compare_value =
null,
663 ?
string $a_caption =
null,
664 ?
string $a_url =
null,
665 ?
string $a_tt_id =
null,
666 ?
string $a_tt_txt =
null,
667 ?
string $a_next_step =
null,
669 int $a_sub_style = 30,
670 string $a_main_text =
'',
671 string $a_required_text =
'' 675 $tpl = new \ilTemplate(
"tpl.objective_progressmeter.html",
true,
true,
"components/ILIAS/Container");
677 $lng = $DIC->language();
678 $lng->loadLanguageModule(
'crs');
682 if (is_numeric($a_perc_result)) {
683 $uiFactory = $DIC->ui()->factory();
684 $uiRenderer = $DIC->ui()->renderer();
686 $pMeter = $uiFactory->chart()->progressMeter()->standard(
688 (
int) $a_perc_result,
690 (
int) $a_compare_value
692 $tpl->setVariable(
'PROGRESS_METER', $uiRenderer->render($pMeter));
698 $button->setCaption($a_caption,
false);
699 $button->setUrl($a_url);
701 $tpl->setCurrentBlock(
"statustxt_bl");
702 $tpl->setVariable(
"TXT_PROGRESS_STATUS", $button->render());
704 $tpl->setCurrentBlock(
"statustxt_no_link_bl");
705 $tpl->setVariable(
"TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
707 $tpl->parseCurrentBlock();
712 $tpl->setVariable(
"TXT_NEXT_STEP", $a_next_step);
717 $tpl->setVariable(
"SUB_STYLE",
' style="padding-left: ' . $a_sub_style .
'px;"');
718 $tpl->setVariable(
"SUB_INIT", $a_sub);
728 bool $a_has_initial_test,
734 if ($a_lo_result ===
null) {
735 $a_lo_result[
"type"] =
null;
737 if (!isset($a_lo_result[
"type"])) {
738 $a_lo_result[
"type"] =
null;
741 $lng = $DIC->language();
742 $lng->loadLanguageModule(
'crs');
746 $is_qualified_initial =
753 $next_step = $progress_txt = $bar_color = $test_url = $initial_sub =
null;
757 $is_qualified_initial) {
758 if ($has_completed) {
759 $next_step = $lng->txt(
"crs_loc_progress_objective_complete");
761 $next_step = $lng->txt(
"crs_loc_progress_do_qualifying_again");
765 if ($a_lo_result[
"status"] ?? 0) {
768 $lng->txt(
"crs_loc_progress_do_qualifying") :
769 $lng->txt(
"crs_loc_suggested");
771 $next_step = $a_has_initial_test ?
772 $lng->txt(
"crs_loc_progress_no_result_do_initial") :
773 $lng->txt(
"crs_loc_progress_no_result_no_initial");
783 bool $a_has_initial_test,
786 bool $a_list_mode =
false,
788 ?
string $a_tt_suffix =
null 792 $lng = $DIC->language();
793 $lng->loadLanguageModule(
'crs');
797 $tooltip_id =
"crsobjtvusr_" . $a_objective_id .
"_" . $a_lo_result[
"type"] .
"_" . ((
int) $a_sub);
798 if ($a_tt_suffix !==
null) {
799 $tooltip_id .=
"_" . $a_tt_suffix;
803 $lng->txt(
"crs_loc_tt_info"),
804 $a_lo_result[
"result_perc"] ??
'0',
805 $a_lo_result[
"limit_perc"] ??
'0' 814 $next_step = $progress_txt = $bar_color = $test_url = $initial_sub =
null;
815 $compare_value =
null;
818 $is_qualified_initial) {
819 $progress_txt = $lng->txt(
"crs_loc_progress_result_qtest");
820 $tt_txt = $lng->txt(
"crs_loc_tab_qtest") .
": " . $tt_txt;
822 if ($has_completed) {
823 $next_step = $lng->txt(
"crs_loc_progress_objective_complete");
824 $bar_color =
"ilCourseObjectiveProgressBarCompleted";
828 $a_has_initial_test &&
829 is_array($a_lo_result[
"initial"])) {
830 $a_lo_result[
"initial"][
"itest"] = $a_lo_result[
"itest"];
833 #$initial_sub = self::buildObjectiveProgressBar(true, $a_objective_id, $a_lo_result["initial"], true, true, $a_tt_suffix); 834 $compare_value = $a_lo_result[
'initial'][
'result_perc'];
837 $next_step = $lng->txt(
"crs_loc_progress_do_qualifying_again");
838 $bar_color =
"ilCourseObjectiveProgressBarFailed";
843 if ($a_lo_result[
"status"] ?? 0) {
844 $progress_txt = $lng->txt(
"crs_loc_progress_result_itest");
845 $tt_txt = $lng->txt(
"crs_loc_tab_itest") .
": " . $tt_txt;
847 $bar_color =
"ilCourseObjectiveProgressBarNeutral";
848 $next_step = $has_completed
849 ? $lng->txt(
"crs_loc_progress_do_qualifying")
850 : $lng->txt(
"crs_loc_suggested");
854 $next_step = $a_has_initial_test
855 ? $lng->txt(
"crs_loc_progress_no_result_do_initial")
856 : $lng->txt(
"crs_loc_progress_no_result_no_initial");
861 $relevant_test_id = ($a_lo_result[
"qtest"] ?? 0)
862 ?: ($a_lo_result[
"itest"] ?? 0);
863 if ($relevant_test_id) {
867 $main_text = $lng->txt(
'crs_loc_itest_info');
869 $main_text = $lng->txt(
'crs_loc_qtest_info');
874 return self::renderProgressMeter(
875 $a_lo_result[
"result_perc"] ??
null,
876 $a_lo_result[
"limit_perc"] ?? null,
890 $lng->txt(
'crs_lobj_pm_min_goal')
896 ?array $a_lo_result =
null 900 $renderer = $DIC->ui()->renderer();
901 $ui_factory = $DIC->ui()->factory();
903 $tpl = new \ilTemplate(
"tpl.objective_accordion_title.html",
true,
true,
"components/ILIAS/Container");
908 self::buildObjectiveProgressBar(
909 $this->loc_settings->worksWithInitialTest(),
916 $tpl->setVariable(
"TITLE", $this->
lng->txt(
"crs_loc_learning_objective") .
": " . trim($a_objective->
getTitle()));
917 $tpl->setVariable(
"DESCRIPTION", nl2br(trim($a_objective->
getDescription())));
921 if ($this->loc_settings->worksWithInitialTest()) {
922 if (array_key_exists(
'initial', $a_lo_result)) {
923 $initial_res = (
int) ($a_lo_result[
'initial'][
'result_perc'] ?? 0);
924 $initial_lim = (
int) ($a_lo_result[
'initial'][
'limit_perc'] ?? 100);
928 isset($a_lo_result[
'result_perc'])
930 $initial_res = (
int) $a_lo_result[
'result_perc'];
931 $initial_lim = (
int) $a_lo_result[
'limit_perc'];
935 if ($initial_res !==
null) {
937 $a_lo_result[
"itest"],
938 $a_lo_result[
"user_id"]
942 $tpl->setCurrentBlock(
'i_with_link');
946 $ui_factory->button()->shy(
947 $this->
lng->txt(
'crs_objective_result_details'),
952 $tpl->parseCurrentBlock();
955 $tpl->setCurrentBlock(
'res_initial');
959 $this->
lng->txt(
'crs_objective_result_summary_initial'),
961 (
int) $initial_lim .
'%' 964 $tpl->parseCurrentBlock();
971 $qual_res = (
int) $a_lo_result[
'result_perc'];
972 $qual_lim = (
int) $a_lo_result[
'limit_perc'];
975 if ($qual_res !==
null) {
977 $a_lo_result[
"qtest"],
978 $a_lo_result[
"user_id"]
982 $tpl->setCurrentBlock(
'q_with_link');
986 $ui_factory->button()->shy(
987 $this->
lng->txt(
'crs_objective_result_details'),
992 $tpl->parseCurrentBlock();
994 $tpl->setCurrentBlock(
'res_qualifying');
998 $this->
lng->txt(
'crs_objective_result_summary_qualifying'),
1000 (
int) $qual_lim .
'%' 1003 $tpl->parseCurrentBlock();
1008 $summary = self::getObjectiveResultSummary(
1009 $this->loc_settings->worksWithInitialTest(),
1013 if (strlen($summary)) {
1014 $tpl->setCurrentBlock(
'objective_summary');
1015 $tpl->setVariable(
'SUMMARY_TXT', $summary);
1016 $tpl->parseCurrentBlock();
1020 $tpl->setVariable(
"ANCHOR_ID",
"objtv_acc_" . $a_objective->
getObjectiveId());
1027 $tpl = new \ilTemplate(
"tpl.objective_accordion_content.html",
true,
true,
"components/ILIAS/Container");
1028 foreach ($a_items as $item) {
1029 $tpl->setCurrentBlock(
"items_bl");
1030 $tpl->setVariable(
"ITEM", $item);
1031 $tpl->parseCurrentBlock();
1039 string $a_target =
'',
1042 $ilToolbar = $this->gui->toolbar();
1043 $ilCtrl = $this->gui->ctrl();
1046 $ilToolbar->addButton(
1048 $ilCtrl->getLinkTarget($this->container_gui, $a_cmd),
static hasActiveRun(int $a_container_id, int $a_test_ref_id, int $a_objective_id)
const string OPERATOR_FINISHED
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.
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)
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.
ilLOSettings $loc_settings
static _lookupObjId(int $ref_id)
static _lookupTitle(int $a_obj_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 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.
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
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.
buildAccordionTitle(\ilCourseObjective $a_objective, ?array $a_lo_result=null)
renderTest(int $a_test_ref_id, ?int $a_objective_id, bool $a_is_initial=false)
static getInstance(int $a_container_id)
const TYPE_TEST_QUALIFIED
renderObjective(int $a_objective_id, bool &$a_has_lo_page, ?\ilAccordionGUI $a_accordion=null, ?array $a_lo_result=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
check condition for a specific user and object
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...