25 include_once(
"./Services/Container/classes/class.ilContainerContentGUI.php");
91 global
$lng,$ilTabs,$ilAccess;
97 include_once
'Services/Object/classes/class.ilObjectListGUIFactory.php';
99 $tpl =
new ilTemplate(
"tpl.container_page.html",
true,
true,
"Services/Container");
104 include_once
'./Modules/Course/classes/Objectives/class.ilLOUserResults.php';
107 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
109 $ilToolbar->addButton(
110 $lng->txt(
'crs_reset_results'),
126 include_once
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
131 if(!$is_manage && !$is_order)
142 $this->loc_settings->getQualifiedTest() &&
143 $this->loc_settings->isGeneralQualifiedTestVisible()
146 $this->output_html .= $this->
renderTest($this->loc_settings->getQualifiedTest(), null,
false,
true);
157 include_once
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
164 include_once
'./Modules/Course/classes/Objectives/class.ilLOUserResults.php';
167 if (!$is_manage && !$is_order)
169 $this->
showButton(
'askReset',$lng->txt(
'crs_reset_results'));
174 $tpl->setVariable(
'CONTAINER_PAGE_CONTENT',$this->output_html);
190 include_once(
'./Modules/Course/classes/class.ilCourseObjectiveResultCache.php');
196 $info_tpl =
new ilTemplate(
'tpl.crs_objectives_view_info_table.html',
true,
true,
'Modules/Course');
197 $info_tpl->setVariable(
"INFO_STRING",$lng->txt(
'crs_objectives_info_'.$status));
199 $this->output_html .= $info_tpl->get();
216 $has_container_page =
false;
222 $has_container_page =
true;
229 include_once
'./Modules/Course/classes/class.ilCourseObjective.php';
235 include_once(
'./Modules/Course/classes/class.ilCourseObjectiveListGUI.php');
237 $this->objective_list_gui->setContainerObject($this->
getContainerGUI());
238 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
240 $this->objective_list_gui->enableIcon(
true);
246 include_once
"Services/Accordion/classes/class.ilAccordionGUI.php";
248 $acc->setUseSessionStorage(
true);
249 $acc->setAllowMultiOpened(
true);
251 $acc->setId(
"crsobjtv_".$this->container_obj->getId());
255 $this->renderer->addCustomBlock(
'lobj',$lng->txt(
'crs_objectives'));
262 $has_lo_page =
false;
264 foreach($objective_ids as $objective_id)
266 include_once
'./Modules/Course/classes/Objectives/class.ilLOUtils.php';
270 !isset($lur_data[$objective_id]) or
272 $this->container_obj->getId(),
281 if($html = $this->
renderObjective($objective_id, $has_lo_page, $acc, $lur_data[$objective_id]))
283 $this->renderer->addItemToBlock(
'lobj',
'lobj', $objective_id, $html);
289 if (!$a_is_order && $obj_cnt > 1)
291 $this->
showButton(
"", $lng->txt(
"crs_show_all_obj"),
"",
"crs_show_all_obj_btn");
292 $this->
showButton(
"", $lng->txt(
"crs_hide_all_obj"),
"",
"crs_hide_all_obj_btn");
293 $acc->setShowAllElement(
"crs_show_all_obj_btn");
294 $acc->setHideAllElement(
"crs_hide_all_obj_btn");
297 if(!$has_container_page && $has_lo_page)
300 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
301 $GLOBALS[
"tpl"]->setVariable(
"LOCATION_CONTENT_STYLESHEET",
303 $GLOBALS[
"tpl"]->setCurrentBlock(
"SyntaxStyle");
304 $GLOBALS[
"tpl"]->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
306 $GLOBALS[
"tpl"]->parseCurrentBlock();
314 $this->output_html .=
$output_html.$this->renderer->getHTML();
316 $this->renderer->resetDetails();
321 $this->output_html .=
"<div class='ilCrsObjAcc'>".$acc->getHTML().
"</div>";
353 protected function renderTest($a_test_ref_id, $a_objective_id, $a_is_initial =
false, $a_add_border =
false, $a_lo_result = array())
356 $node_data =
$GLOBALS[
'tree']->getNodeData($a_test_ref_id);
369 $node_data[
'objective_id'] = $a_objective_id;
370 $node_data[
'objective_status'] =
386 ? $this->lng->txt(
'crs_loc_itest_info')
387 : $this->lng->txt(
'crs_loc_qtest_info')
391 $node_data[
'objective_id'] = 0;
394 $node_data[
'title'] = $title;
396 return "<div class='ilContObjectivesViewTestItem'>".$this->renderItem($node_data).
"</div>";
406 public function showMaterials($a_tpl,$a_mode = null,$a_is_manage =
false,$a_as_accordion =
false)
408 global $ilAccess,
$lng;
412 if (is_array($this->items[
"_all"]))
420 foreach($this->items[
"_all"] as $k => $item_data)
422 if($a_mode == self::MATERIALS_TESTS and $item_data[
'type'] !=
'tst')
426 if ($item_data[
'type'] ==
'itgr')
433 if($this->objective_map[
"test_i"] && $item_data[
"child"] == $this->objective_map[
"test_i"])
437 if($this->objective_map[
"test_q"] && $item_data[
"child"] == $this->objective_map[
"test_q"])
443 if($this->rendered_items[$item_data[
"child"]] !==
true &&
444 !$this->renderer->hasItem($item_data[
"child"]))
446 $this->rendered_items[$item_data[
'child']] =
true;
449 $html = $this->
renderItem($item_data,$position++,$a_mode == self::MATERIALS_TESTS ?
false :
true);
452 $item_r[] = array(
"html" => $html,
"id" => $item_data[
"child"],
"type" => $item_data[
"type"]);
458 if (count($item_r) > 0)
466 case self::MATERIALS_TESTS:
468 $this->renderer->addTypeBlock($block_id);
471 case self::MATERIALS_OTHER:
473 $this->renderer->addCustomBlock($block_id, $lng->txt(
'crs_other_resources'));
479 $this->renderer->addCustomBlock($block_id, $lng->txt(
'content'));
484 if ($a_mode != self::MATERIALS_TESTS)
489 foreach($item_r as $h)
491 if(!$this->renderer->hasItem($h[
"id"]))
493 $this->renderer->addItemToBlock($block_id, $h[
"type"], $h[
"id"], $h[
"html"]);
497 $this->output_html .= $this->renderer->getHTML();
503 case self::MATERIALS_TESTS:
504 $txt = $lng->txt(
'objs_tst');
507 case self::MATERIALS_OTHER:
508 $txt = $lng->txt(
'crs_other_resources');
512 include_once
"Services/Accordion/classes/class.ilAccordionGUI.php";
514 $acc->setId(
"crsobjtvmat".$a_mode.
"_".$this->container_obj->getId());
516 $acc_content = array();
517 foreach($item_r as $h)
519 $acc_content[] = $h[
"html"];
523 $this->output_html .= $acc->getHTML();
531 $objective_map = array();
532 include_once
'./Modules/Course/classes/class.ilCourseObjective.php';
537 include_once(
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
538 foreach($objective_ids as $objective_id)
542 $objective_map[
"material"][$mat_ref_id][] = $objective_id;
544 if(!isset($objective_map[
"names"][$objective_id]))
547 $objective_map[
"names"][$objective_id] = $objective->getTitle();
553 $tst = $this->loc_settings->getInitialTest();
556 $objective_map[
"test_i"] = $tst;
558 $tst = $this->loc_settings->getQualifiedTest();
561 $objective_map[
"test_q"] = $tst;
565 return $objective_map;
572 $item_ref_id = $a_item[
"ref_id"];
574 if(is_array($this->objective_map))
577 if(isset($this->objective_map[
"material"][$item_ref_id]))
580 foreach($this->objective_map[
"material"][$item_ref_id] as $objective_id)
582 $ilCtrl->setParameterByClass(
'ilcourseobjectivesgui',
'objective_id', $objective_id);
583 $url = $ilCtrl->getLinkTargetByClass(array(
'illoeditorgui',
'ilcourseobjectivesgui'),
'edit');
584 $ilCtrl->setParameterByClass(
'ilcourseobjectivesgui',
'objective_id',
'');
587 'desc' => $lng->txt(
'crs_loc_tab_materials').
': ',
590 'name' => $this->objective_map[
"names"][$objective_id]
594 if($this->objective_map[
"test_i"] == $item_ref_id)
596 $ilCtrl->setParameterByClass(
'illoeditorgui',
'tt', 1);
600 'link' => $ilCtrl->getLinkTargetByClass(
'illoeditorgui',
'testOverview'),
601 'name' => $lng->txt(
'crs_loc_tab_itest')
603 $ilCtrl->setParameterByClass(
'illoeditorgui',
'tt', 0);
605 if($this->objective_map[
"test_q"] == $item_ref_id)
607 $ilCtrl->setParameterByClass(
'illoeditorgui',
'tt', 2);
611 'link' => $ilCtrl->getLinkTargetByClass(
'illoeditorgui',
'testOverview'),
612 'name' => $lng->txt(
'crs_loc_tab_qtest')
614 $ilCtrl->setParameterByClass(
'illoeditorgui',
'tt', 0);
620 $a_item_list_gui->
setItemDetailLinks($details, $lng->txt(
'crs_loc_settings_tbl').
': ');
641 if($a_item[
'objective_id'])
646 if($this->loc_settings->getQualifiedTest() == $a_item[
'ref_id'])
650 include_once
'./Services/AccessControl/classes/class.ilConditionHandler.php';
652 if(!$fullfilled || $a_item[
'objective_status'])
657 include_once
'./Modules/Course/classes/Objectives/class.ilLOUserResults.php';
661 $a_item[
'objective_id'],
671 $this->lng->txt(
'crs_loc_passes_reached'),
676 elseif($this->loc_settings->getQualifiedTest() == $a_item[
'ref_id'])
678 include_once
'./Modules/Course/classes/class.ilCourseObjective.php';
685 $this->lng->txt(
'crs_loc_passes_left'),
686 (($poss_pass -
$res[
'tries']) > 0) ? ($poss_pass -
$res[
'tries']) : 1,
694 protected function updateResult($a_res,$a_item_ref_id,$a_objective_id,$a_user_id)
697 if($this->loc_settings->getQualifiedTest() == $a_item_ref_id)
700 include_once
'./Modules/Test/classes/class.ilObjTest.php';
701 include_once
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
708 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestRun.php';
714 ($a_res[
'tries'] > 0) ? --$a_res[
'tries'] : 0;
715 $a_res[
'is_final'] = 0;
737 include_once(
'./Modules/Course/classes/class.ilCourseObjective.php');
740 include_once(
'./Services/Container/classes/class.ilContainerSorting.php');
741 include_once(
'./Services/Object/classes/class.ilObjectActivation.php');
747 include_once(
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
752 foreach($objectives_lm_obj->getMaterials() as $item)
754 $sort_map[$item[
"lm_ass_id"]] = $item[
"position"];
760 $sort_content = array();
762 foreach($items as $item)
770 $item_list_gui2->enableIcon(
true);
772 if($is_order || $a_accordion)
774 $item_list_gui2->enableCommands(
true,
true);
775 $item_list_gui2->enableProperties(
false);
778 $chapters = $objectives_lm_obj->getChapters();
781 $has_sections =
false;
782 foreach($chapters as $chapter)
784 if($chapter[
'ref_id'] != $item[
'child'])
788 $has_sections =
true;
790 include_once
'./Modules/LearningModule/classes/class.ilLMObject.php';
791 $title = $item[
'title'].
792 " › ".ilLMObject::_lookupTitle($chapter[
'obj_id']).
793 " (".$lng->txt(
'obj_'.$chapter[
'type']).
")";
795 $item_list_gui2->setDefaultCommandParameters(array(
796 "obj_id" => $chapter[
'obj_id'],
797 "focus_id" => $chapter[
'obj_id'],
798 "focus_return" => $this->container_obj->getRefId()));
802 $item_list_gui2->setPositionInputField(
"[lobj][".$a_objective_id.
"][".$chapter[
'lm_ass_id'].
"]",
803 sprintf(
'%d', $chapter[
'position']*10));
806 $sub_item_html = $item_list_gui2->getListItemHTML($item[
'ref_id'],
807 $item[
'obj_id'], $title, $item[
'description']);
810 $sort_key = str_pad($chapter[
'position'], 5, 0, STR_PAD_LEFT).
"_".strtolower($title).
"_".$chapter[
'lm_ass_id'];
811 $sort_content[$sort_key] = $sub_item_html;
815 $this->rendered_items[$item[
'child']] =
true;
817 if($lm_ass_id = $objectives_lm_obj->isAssigned($item[
'ref_id'],
true))
821 $item_list_gui2->setPositionInputField(
"[lobj][".$a_objective_id.
"][".$lm_ass_id.
"]",
822 sprintf(
'%d', $sort_map[$lm_ass_id]*10));
825 $sub_item_html = $item_list_gui2->getListItemHTML($item[
'ref_id'],
826 $item[
'obj_id'], $item[
'title'], $item[
'description']);
829 $sort_key = str_pad($sort_map[$lm_ass_id], 5, 0, STR_PAD_LEFT).
"_".strtolower($item[
'title']).
"_".$lm_ass_id;
830 $sort_content[$sort_key] = $sub_item_html;
836 $this->objective_list_gui->enableCommands(
false);
840 $this->objective_list_gui->enableCommands(
true);
845 $this->objective_list_gui->setPositionInputField(
"[lobj][".$a_objective_id.
"][0]",
846 $objective->__getPosition()*10);
849 ksort($sort_content);
853 foreach($sort_content as $sub_item_html)
855 $this->objective_list_gui->addSubItemHTML($sub_item_html);
858 return $this->objective_list_gui->getListItemHTML(
861 $objective->getTitle(),
862 $objective->getDescription(),
863 ($is_manage || $is_order));
867 $acc_content = $sort_content;
869 $initial_shown =
false;
870 if($this->loc_settings->getInitialTest() &&
872 !$a_lo_result[
"initial_status"])
874 $acc_content[] = $this->
renderTest($this->loc_settings->getInitialTest(), $a_objective_id,
true,
false, $a_lo_result);
875 $initial_shown =
true;
878 if(!$initial_shown &&
879 $this->loc_settings->getQualifiedTest() &&
880 $this->loc_settings->isQualifiedTestPerObjectiveVisible())
882 $acc_content[] = $this->
renderTest($this->loc_settings->getQualifiedTest(), $a_objective_id,
false,
false, $a_lo_result);
886 include_once(
"./Services/COPage/classes/class.ilPageUtil.php");
889 $a_has_lo_page =
true;
891 include_once
'Modules/Course/classes/Objectives/class.ilLOPageGUI.php';
892 $page_gui =
new ilLOPageGUI($objective->getObjectiveId());
894 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
896 $page_gui->setPresentationTitle(
"");
897 $page_gui->setTemplateOutput(
false);
898 $page_gui->setHeader(
"");
900 $co_page =
"<div class='ilContObjectiveIntro'>".$page_gui->showPage().
"</div>";
903 $a_accordion->addItem(
906 $this->buildAccordionContent($acc_content)
967 include_once
"Modules/Course/classes/Objectives/class.ilLOUserResults.php";
969 foreach($lur->getCourseResultsForUserPresentation() as $objective_id => $types)
974 $initial_status = $types[ilLOUserResults::TYPE_INITIAL][
"status"];
980 $result = $types[ilLOUserResults::TYPE_QUALIFIED];
981 $result[
"type"] = ilLOUserResults::TYPE_QUALIFIED;
985 $result = $types[ilLOUserResults::TYPE_INITIAL];
986 $result[
"type"] = ilLOUserResults::TYPE_INITIAL;
989 $result[
"initial_status"] = $initial_status;
1001 $tpl =
new ilTemplate(
"tpl.objective_progressbar.html",
true,
true,
"Services/Container");
1003 $tooltip_id =
"crsobjtvusr_".$a_objective_id;
1005 $tt_txt = sprintf($lng->txt(
"crs_loc_tt_info"),
1006 $a_lo_result[
"result_perc"], $a_lo_result[
"limit_perc"]);
1009 $perc_resize = (int)$a_lo_result[
"result_perc"];
1017 $next_step = $progress_txt = $bar_color = null;
1022 $progress_txt = $lng->txt(
"crs_loc_progress_result_qtest");
1023 $tt_txt = $lng->txt(
"crs_loc_tab_qtest").
": ".$tt_txt;
1027 $next_step = $lng->txt(
"crs_loc_progress_objective_complete");
1028 $bar_color =
"#80f080";
1032 $next_step = $lng->txt(
"crs_loc_progress_do_qualifying_again");
1033 $bar_color =
"#f08080";
1039 if($a_lo_result[
"status"])
1041 $progress_txt = $lng->txt(
"crs_loc_progress_result_itest");
1042 $tt_txt = $lng->txt(
"crs_loc_tab_itest").
": ".$tt_txt;
1044 $bar_color =
"#aaa";
1048 $next_step = $lng->txt(
"crs_loc_progress_do_qualifying");
1052 $next_step = $lng->txt(
"crs_loc_suggested");
1058 if((
bool)$a_has_initial_test)
1060 $next_step = $lng->txt(
"crs_loc_progress_no_result_do_initial");
1064 $next_step = $lng->txt(
"crs_loc_progress_no_result_no_initial");
1071 $tpl->setCurrentBlock(
"statustxt_bl");
1072 $tpl->setVariable(
"TXT_PROGRESS_STATUS", $progress_txt);
1073 $tpl->parseCurrentBlock();
1078 if($a_lo_result[
"limit_perc"])
1080 $limit_pos = (121-ceil(125/100*$a_lo_result[
"limit_perc"]))*-1;
1087 $tpl->setCurrentBlock(
"statusbar_bl");
1088 $tpl->setVariable(
"PERC_STATUS", $a_lo_result[
"result_perc"]);
1089 $tpl->setVariable(
"LIMIT_POS", $limit_pos);
1090 $tpl->setVariable(
"PERC_WIDTH", $perc_resize);
1091 $tpl->setVariable(
"PERC_COLOR", $bar_color);
1092 $tpl->setVariable(
"BG_COLOR",
"#fff");
1093 $tpl->setVariable(
"TT_ID", $tooltip_id);
1094 $tpl->parseCurrentBlock();
1097 if($next_step && !$a_list_mode)
1099 $tpl->setCurrentBlock(
"nstep_bl");
1100 $tpl->setVariable(
"TXT_NEXT_STEP", $next_step);
1101 $tpl->parseCurrentBlock();
1106 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1115 $tpl =
new ilTemplate(
"tpl.objective_accordion_title.html",
true,
true,
"Services/Container");
1119 $tpl->setVariable(
"PROGRESS_BAR", self::buildObjectiveProgressBar(
1120 (
bool)$this->loc_settings->getInitialTest(),
1128 $tpl->setVariable(
"TITLE", $this->lng->txt(
"crs_loc_learning_objective").
": ".trim($a_objective->
getTitle()));
1136 $tpl =
new ilTemplate(
"tpl.objective_accordion_content.html",
true,
true,
"Services/Container");
1137 foreach($a_items as $item)
1139 $tpl->setCurrentBlock(
"items_bl");
1140 $tpl->setVariable(
"ITEM", $item);
1141 $tpl->parseCurrentBlock();
1153 protected function showButton($a_cmd,$a_text,$a_target =
'', $a_id =
"")
1158 $ilToolbar->addButton($a_text,
1159 $ilCtrl->getLinkTarget($this->getContainerGUI(),$a_cmd),
1160 $a_target,
"",
'', $a_id);