ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilContainerObjectiveGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
5
15{
19 private $logger = null;
20
24 protected $tabs;
25
29 protected $toolbar;
30
31 protected $force_details = 0;
32
36 protected $loc_settings;
37
38 const MATERIALS_TESTS = 1;
39 const MATERIALS_OTHER = 2;
40
41 private $output_html = '';
42
43 private $test_assignments = null;
44
52 public function __construct($a_container_gui)
53 {
54 global $DIC;
55
56 $this->tabs = $DIC->tabs();
57 $this->access = $DIC->access();
58 $this->user = $DIC->user();
59 $this->settings = $DIC->settings();
60 $this->ctrl = $DIC->ctrl();
61 $this->toolbar = $DIC->toolbar();
62 $lng = $DIC->language();
63 $this->logger = $DIC->logger()->crs();
64
65 $this->lng = $lng;
66 parent::__construct($a_container_gui);
67
68 $this->initDetails();
69 $this->initTestAssignments();
70 }
71
76 public function getTestAssignments()
77 {
79 }
80
84 public function getSettings()
85 {
87 }
88
89
90
98 public function getDetailsLevel($a_objective_id)
99 {
100 // no details anymore
101 return self::DETAILS_ALL;
102 }
103
110 public function getMainContent()
111 {
113 $ilTabs = $this->tabs;
114 $ilAccess = $this->access;
116 $ilCtrl = $this->ctrl;
117
118 // see bug #7452
119 // $ilTabs->setSubTabActive($this->getContainerObject()->getType().'_content');
120
121
122 include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
123
124 $tpl = new ilTemplate("tpl.container_page.html", true, true, "Services/Container");
125
126 if ($ilAccess->checkAccess('write', '', $this->getContainerObject()->getRefId())) {
127 // check for results
128 include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
129 if (ilLOUserResults::hasResults($this->getContainerObject()->getId(), $ilUser->getId())) {
130 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
131 $ilToolbar = new ilToolbarGUI();
132 $ilToolbar->addButton(
133 $lng->txt('crs_reset_results'),
134 $ilCtrl->getLinkTargetByClass(get_class($this->getContainerGUI()), 'reset')
135 );
136 }
137 }
138
139 // Feedback
140 // @todo
141 // $this->__showFeedBack();
142
143 $this->items = $this->getContainerObject()->getSubItems($this->getContainerGUI()->isActiveAdministrationPanel());
144
145 $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
146 $is_order = $this->getContainerGUI()->isActiveOrdering();
147
148 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
149 $this->loc_settings = ilLOSettings::getInstanceByObjId($this->getContainerObject()->getId());
150
151 $this->initRenderer();
152
153 if (!$is_manage && !$is_order) {
154 // currently inactive
155 // $this->showStatus($tpl);
156 }
157 if (!$is_manage) {
158 $this->showObjectives($tpl, $is_order);
159
160 // $this->showMaterials($tpl,self::MATERIALS_TESTS, false, !$is_order);
161
162 // check for results
163 include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
164 $has_results = ilLOUserResults::hasResults($this->getContainerObject()->getId(), $ilUser->getId());
165
166 include_once './Modules/Test/classes/class.ilObjTestAccess.php';
167 $tst_obj_id = ilObject::_lookupObjId($this->loc_settings->getInitialTest());
168
169 if (
170 $this->loc_settings->getInitialTest() &&
171 $this->loc_settings->isGeneralInitialTestVisible() &&
172 !$this->loc_settings->isInitialTestStart() &&
174 ) {
175 $this->output_html .= $this->renderTest($this->loc_settings->getInitialTest(), null, true, true);
176 } elseif (
177 $this->loc_settings->getQualifiedTest() &&
178 $this->loc_settings->isGeneralQualifiedTestVisible()
179 ) {
180 $this->output_html .= $this->renderTest($this->loc_settings->getQualifiedTest(), null, false, true);
181 }
182
183 $this->showMaterials($tpl, self::MATERIALS_OTHER, false, !$is_order);
184 } else {
185 $this->showMaterials($tpl, null, $is_manage);
186 }
187
188 // reset results by setting or for admins
189 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
190 if (
191 ilLOSettings::getInstanceByObjId($this->getContainerObject()->getId())->isResetResultsEnabled() or
192 $ilAccess->checkAccess('write', '', $this->getContainerObject()->getRefId())
193 ) {
194 if ($has_results) {
195 if (!$is_manage && !$is_order) {
196 $this->showButton('askReset', $lng->txt('crs_reset_results'));
197 }
198 }
199 }
200
201 $tpl->setVariable('CONTAINER_PAGE_CONTENT', $this->output_html);
202
203 return $tpl->get();
204 }
205
213 public function showStatus($tpl)
214 {
217
218 include_once('./Modules/Course/classes/class.ilCourseObjectiveResultCache.php');
219
220 $status = ilCourseObjectiveResultCache::getStatus($ilUser->getId(), $this->getContainerObject()->getId());
221 if ($status == IL_OBJECTIVE_STATUS_EMPTY) {
222 return;
223 }
224 $info_tpl = new ilTemplate('tpl.crs_objectives_view_info_table.html', true, true, 'Modules/Course');
225 $info_tpl->setVariable("INFO_STRING", $lng->txt('crs_objectives_info_' . $status));
226
227 $this->output_html .= $info_tpl->get();
228 }
229
237 public function showObjectives($a_tpl, $a_is_order = false)
238 {
242
244
245 // get embedded blocks
246 $has_container_page = false;
247 if (!$a_is_order) {
248 $output_html = $this->getContainerGUI()->getContainerPageHTML();
249 if ($output_html != "") {
250 $has_container_page = true;
251 $this->output_html .= $this->insertPageEmbeddedBlocks($output_html);
252 }
253 unset($output_html);
254 }
255
256 // All objectives
257 include_once './Modules/Course/classes/class.ilCourseObjective.php';
258 if (!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) {
259 return false;
260 }
261
262 include_once('./Modules/Course/classes/class.ilCourseObjectiveListGUI.php');
263 $this->objective_list_gui = new ilCourseObjectiveListGUI();
264 $this->objective_list_gui->setContainerObject($this->getContainerGUI());
265 if ($ilSetting->get("icon_position_in_lists") == "item_rows") {
266 $this->objective_list_gui->enableIcon(true);
267 }
268
269 $acc = null;
270 if (!$a_is_order) {
271 include_once "Services/Accordion/classes/class.ilAccordionGUI.php";
272 $acc = new ilAccordionGUI();
273 $acc->setUseSessionStorage(true);
274 $acc->setAllowMultiOpened(true);
275 $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
276 $acc->setId("crsobjtv_" . $this->container_obj->getId());
277 } else {
278 $this->renderer->addCustomBlock('lobj', $lng->txt('crs_objectives'));
279 }
280
281 $lur_data = $this->parseLOUserResults();
282
283 $has_initial = ilLOSettings::getInstanceByObjId($this->container_obj->getId())->worksWithInitialTest();
284
285 $has_lo_page = false;
286 $obj_cnt = 0;
287 foreach ($objective_ids as $objective_id) {
288 include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
289 if (
290 $has_initial &&
291 (
292 !isset($lur_data[$objective_id]) or
294 $this->container_obj->getId(),
295 ilLOSettings::getInstanceByObjId($this->container_obj->getId())->getInitialTest(),
296 $objective_id
297 )
298 )
299 ) {
300 $lur_data[$objective_id] = array("type" => ilLOSettings::TYPE_TEST_INITIAL);
301 }
302
303 if ($html = $this->renderObjective($objective_id, $has_lo_page, $acc, $lur_data[$objective_id])) {
304 $this->renderer->addItemToBlock('lobj', 'lobj', $objective_id, $html);
305 }
306 $obj_cnt++;
307 }
308
309 // buttons for showing/hiding all objectives
310 if (!$a_is_order && $obj_cnt > 1) {
311 $this->showButton("", $lng->txt("crs_show_all_obj"), "", "crs_show_all_obj_btn");
312 $this->showButton("", $lng->txt("crs_hide_all_obj"), "", "crs_hide_all_obj_btn");
313 $acc->setShowAllElement("crs_show_all_obj_btn");
314 $acc->setHideAllElement("crs_hide_all_obj_btn");
315 }
316
317 if (!$has_container_page && $has_lo_page) {
318 // add core co page css
319 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
320 $tpl->setVariable(
321 "LOCATION_CONTENT_STYLESHEET",
323 );
324 $tpl->setCurrentBlock("SyntaxStyle");
325 $tpl->setVariable(
326 "LOCATION_SYNTAX_STYLESHEET",
328 );
329 $tpl->parseCurrentBlock();
330 }
331
332 // order/block
333 if ($a_is_order) {
334 $this->addFooterRow();
335
336 $this->output_html .= $output_html . $this->renderer->getHTML();
337
338 $this->renderer->resetDetails();
339 }
340 // view/accordion
341 else {
342 $this->output_html .= "<div class='ilCrsObjAcc'>" . $acc->getHTML() . "</div>";
343 }
344 }
345
353 public function addFooterRow()
354 {
355 // no details
356 return;
357
358 /*
359 $ilCtrl = $this->ctrl;
360
361 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getContainerObject()->getRefId());
362 $ilCtrl->setParameterByClass("ilrepositorygui", "details_level", "1");
363 $url = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
364 $this->renderer->addDetailsLevel(2, $url, ($this->details_level == self::DETAILS_TITLE));
365
366 $ilCtrl->setParameterByClass("ilrepositorygui", "details_level", "2");
367 $url = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
368 $this->renderer->addDetailsLevel(3, $url, ($this->details_level == self::DETAILS_ALL));
369
370 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
371 */
372 }
373
374 protected function renderTest($a_test_ref_id, $a_objective_id, $a_is_initial = false, $a_add_border = false, $a_lo_result = array())
375 {
376 global $DIC;
377
378 $tree = $DIC->repositoryTree();
379
380 $node_data = [];
381 if ($a_test_ref_id) {
382 $node_data = $tree->getNodeData($a_test_ref_id);
383 }
384 if (!$node_data['child']) {
385 return '';
386 }
387
388 // update ti
389 if ($a_objective_id) {
390 if ($a_is_initial) {
391 $title = sprintf($this->lng->txt('crs_loc_itst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
392 } else {
393 $title = sprintf($this->lng->txt('crs_loc_qtst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
394 }
395 $node_data['objective_id'] = $a_objective_id;
396 $node_data['objective_status'] =
397 (
398 $a_lo_result['status'] == ilLOUserResults::STATUS_COMPLETED ?
399 false :
400 false
401 );
402 } else {
403 $obj_id = ilObject::_lookupObjId($a_test_ref_id);
404 $title = ilObject::_lookupTitle($obj_id);
405
406 $title .= (
407 ' (' .
408 (
409 $a_is_initial
410 ? $this->lng->txt('crs_loc_itest_info')
411 : $this->lng->txt('crs_loc_qtest_info')
412 ) .
413 ')'
414 );
415 $node_data['objective_id'] = 0;
416 }
417
418 $node_data['title'] = $title;
419
420 return "<div class='ilContObjectivesViewTestItem'>" . $this->renderItem($node_data) . "</div>";
421 }
422
430 public function showMaterials($a_tpl, $a_mode = null, $a_is_manage = false, $a_as_accordion = false)
431 {
432 $ilAccess = $this->access;
434
436
437 if (is_array($this->items["_all"])) {
438 $this->objective_map = $this->buildObjectiveMap();
439
440 // all rows
441 $item_r = array();
442
443 $position = 1;
444 foreach ($this->items["_all"] as $k => $item_data) {
445 if ($a_mode == self::MATERIALS_TESTS and $item_data['type'] != 'tst') {
446 continue;
447 }
448 if ($item_data['type'] == 'itgr') {
449 continue;
450 }
451 if (!$a_is_manage) {
452 // if test object is qualified or initial do not show here
453 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
454 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
455 $assignments = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
456 if ($assignments->getTypeByTest($item_data['child']) != ilLOSettings::TYPE_TEST_UNDEFINED) {
457 continue;
458 }
459 }
460
461 if ($this->rendered_items[$item_data["child"]] !== true &&
462 !$this->renderer->hasItem($item_data["child"])) {
463 $this->rendered_items[$item_data['child']] = true;
464
465 // TODO: Position (DONE ?)
466 $html = $this->renderItem($item_data, $position++, $a_mode == self::MATERIALS_TESTS ? false : true);
467 if ($html != "") {
468 $item_r[] = array("html" => $html, "id" => $item_data["child"], "type" => $item_data["type"]);
469 }
470 }
471 }
472
473 // if we have at least one item, output the block
474 if (count($item_r) > 0) {
475 if (!$a_as_accordion) {
476 $pos = 0;
477
478 switch ($a_mode) {
480 $block_id = "tst";
481 $this->renderer->addTypeBlock($block_id);
482 break;
483
485 $block_id = "oth";
486 $this->renderer->addCustomBlock($block_id, $lng->txt('crs_other_resources'));
487 break;
488
489 // manage
490 default:
491 $block_id = "all";
492 $this->renderer->addCustomBlock($block_id, $lng->txt('content'));
493 break;
494 }
495
496 // :TODO:
497 if ($a_mode != self::MATERIALS_TESTS) {
498 $pos = $this->getItemGroupsHTML();
499 }
500
501 foreach ($item_r as $h) {
502 if (!$this->renderer->hasItem($h["id"])) {
503 $this->renderer->addItemToBlock($block_id, $h["type"], $h["id"], $h["html"]);
504 }
505 }
506
507 $this->output_html .= $this->renderer->getHTML();
508 } else {
509 switch ($a_mode) {
511 $txt = $lng->txt('objs_tst');
512 break;
513
515 $txt = $lng->txt('crs_other_resources');
516 break;
517 }
518
519 include_once "Services/Accordion/classes/class.ilAccordionGUI.php";
520 $acc = new ilAccordionGUI();
521 $acc->setId("crsobjtvmat" . $a_mode . "_" . $this->container_obj->getId());
522
523 $acc_content = array();
524 foreach ($item_r as $h) {
525 $acc_content[] = $h["html"];
526 }
527 $acc->addItem($txt, $this->buildAccordionContent($acc_content));
528
529 $this->output_html .= $acc->getHTML();
530 }
531 }
532 }
533 }
534
535 protected function buildObjectiveMap()
536 {
537 $objective_map = array();
538 include_once './Modules/Course/classes/class.ilCourseObjective.php';
539 // begin-patch lok
540 if (count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) {
541 // end-patch lok
542 include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
543 foreach ($objective_ids as $objective_id) {
544 foreach (ilCourseObjectiveMaterials::_getAssignedMaterials($objective_id) as $mat_ref_id) {
545 $objective_map["material"][$mat_ref_id][] = $objective_id;
546
547 if (!isset($objective_map["names"][$objective_id])) {
548 $objective = new ilCourseObjective($this->getContainerObject(), $objective_id);
549 $objective_map["names"][$objective_id] = $objective->getTitle();
550 }
551 }
552 }
553
554 // initial/qualifying test
555 $tst = $this->loc_settings->getInitialTest();
556 if ($tst) {
557 $objective_map["test_i"] = $tst;
558 }
559 $tst = $this->loc_settings->getQualifiedTest();
560 if ($tst) {
561 $objective_map["test_q"] = $tst;
562 }
563
564 // objective test assignments
565 include_once 'Modules/Course/classes/Objectives/class.ilLOSettings.php';
566 include_once 'Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
567 $ass_test = new ilLOTestAssignments($this->getContainerObject()->getId());
568 foreach ($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_INITIAL) as $ass) {
569 $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
570 $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
571 }
572 foreach ($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_QUALIFIED) as $ass) {
573 $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
574 $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
575 }
576 }
577
578 return $objective_map;
579 }
580
581 protected function addItemDetails(ilObjectListGUI $a_item_list_gui, array $a_item)
582 {
584 $ilCtrl = $this->ctrl;
586
587 $item_ref_id = $a_item["ref_id"];
588
589 if (is_array($this->objective_map)) {
590 $details = array();
591 if (isset($this->objective_map["material"][$item_ref_id])) {
592 // #12965
593 foreach ($this->objective_map["material"][$item_ref_id] as $objective_id) {
594 $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $objective_id);
595 $url = $ilCtrl->getLinkTargetByClass(array('illoeditorgui', 'ilcourseobjectivesgui'), 'edit');
596 $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', '');
597
598 $details[] = array(
599 'desc' => $lng->txt('crs_loc_tab_materials') . ': ',
600 'target' => '_top',
601 'link' => $url,
602 'name' => $this->objective_map["names"][$objective_id]
603 );
604 }
605 }
606 if ($this->objective_map["test_i"] == $item_ref_id) {
607 $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1);
608 $details[] = array(
609 'desc' => '',
610 'target' => '_top',
611 'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'),
612 'name' => $lng->txt('crs_loc_tab_itest')
613 );
614 $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
615 }
616 if ($this->objective_map["test_q"] == $item_ref_id) {
617 $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2);
618 $details[] = array(
619 'desc' => '',
620 'target' => '_top',
621 'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'),
622 'name' => $lng->txt('crs_loc_tab_qtest')
623 );
624 $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
625 }
626
627 // #15367
628 if (is_array($this->objective_map["test_ass"][$item_ref_id])) {
629 foreach ($this->objective_map["test_ass"][$item_ref_id] as $type => $items) {
631 $caption = $lng->txt('crs_loc_tab_itest');
632 $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1);
633 } else {
634 $caption = $lng->txt('crs_loc_tab_qtest');
635 $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2);
636 }
637 foreach ($items as $objtv_title) {
638 $details[] = array(
639 'desc' => '',
640 'target' => '_top',
641 'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testsOverview'),
642 'name' => $caption . " (" . $this->lng->txt("crs_loc_learning_objective") . ": " . $objtv_title . ")"
643 );
644 }
645 $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
646 }
647 }
648
649 if (sizeof($details)) {
650 $a_item_list_gui->enableItemDetailLinks(true);
651 $a_item_list_gui->setItemDetailLinks($details, $lng->txt('crs_loc_settings_tbl') . ': ');
652 } else {
653 $a_item_list_gui->enableItemDetailLinks(false);
654 }
655 }
656
657 // order
658 if ($this->getContainerGUI()->isActiveOrdering()) {
659 $a_item_list_gui->enableCommands(true, true);
660 $a_item_list_gui->enableProperties(false);
661 }
662 // view
663 elseif (!$this->getContainerGUI()->isActiveAdministrationPanel()) {
664 $a_item_list_gui->enableCommands(true, true);
665 $a_item_list_gui->enableProperties(false);
666 }
667
668 if ($a_item['objective_id']) {
669 $a_item_list_gui->setDefaultCommandParameters(array('objective_id' => $a_item['objective_id']));
670
671
672 if ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) {
673 $a_item_list_gui->setConditionTarget($this->getContainerObject()->getRefId(), $a_item['objective_id'], 'lobj');
674 // check conditions of target
675 include_once './Services/Conditions/classes/class.ilConditionHandler.php';
676 $fullfilled = ilConditionHandler::_checkAllConditionsOfTarget($this->getContainerObject()->getRefId(), $a_item['objective_id'], 'lobj');
677 if (!$fullfilled || $a_item['objective_status']) {
678 $a_item_list_gui->disableTitleLink(true);
679 }
680 }
681 include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
683 $this->getContainerObject()->getId(),
684 $ilUser->getId(),
685 $a_item['objective_id'],
687 );
688
689 $res = $this->updateResult($res, $a_item['ref_id'], $a_item['objective_id'], $ilUser->getId());
690
691 if ($res['is_final']) {
692 $a_item_list_gui->disableTitleLink(true);
693 $a_item_list_gui->enableProperties(true);
694 $a_item_list_gui->addCustomProperty(
695 $this->lng->txt('crs_loc_passes_reached'),
696 '',
697 true
698 );
699 } elseif ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) {
700 include_once './Modules/Course/classes/class.ilCourseObjective.php';
701 $poss_pass = ilCourseObjective::lookupMaxPasses($a_item['objective_id']);
702
703 if ($poss_pass) {
704 $a_item_list_gui->enableProperties(true);
705 $a_item_list_gui->addCustomProperty(
706 $this->lng->txt('crs_loc_passes_left'),
707 (($poss_pass - $res['tries']) > 0) ? ($poss_pass - $res['tries']) : 1,
708 false
709 );
710 }
711 }
712 }
713 }
714
715 protected function updateResult($a_res, $a_item_ref_id, $a_objective_id, $a_user_id)
716 {
717 if ($this->loc_settings->getQualifiedTest() == $a_item_ref_id) {
718 // Check for existing test run, and decrease tries, reset final if run exists
719 include_once './Modules/Test/classes/class.ilObjTest.php';
720 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
722 $a_item_ref_id,
723 $a_user_id
724 );
725
726 if ($active) {
727 include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
729 ilObject::_lookupObjId($a_item_ref_id),
730 $a_objective_id,
731 $a_user_id
732 )) {
733 ($a_res['tries'] > 0) ? --$a_res['tries'] : 0;
734 $a_res['is_final'] = 0;
735 }
736 }
737 }
738 return $a_res;
739 }
740
751 protected function renderObjective($a_objective_id, &$a_has_lo_page, ilAccordionGUI $a_accordion = null, array $a_lo_result = null)
752 {
755
756 include_once('./Modules/Course/classes/class.ilCourseObjective.php');
757 $objective = new ilCourseObjective($this->getContainerObject(), $a_objective_id);
758
759 include_once('./Services/Container/classes/class.ilContainerSorting.php');
760 include_once('./Services/Object/classes/class.ilObjectActivation.php');
761 $items = ilObjectActivation::getItemsByObjective($a_objective_id);
762
763 // sorting is handled by ilCourseObjectiveMaterials
764 // $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj',$a_objective_id,$items);
765
766 include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
767 $objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
768
769 // #13381 - map material assignment to position
770 $sort_map = array();
771 foreach ($objectives_lm_obj->getMaterials() as $item) {
772 $sort_map[$item["lm_ass_id"]] = $item["position"];
773 }
774
775 $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
776 $is_order = $this->getContainerGUI()->isActiveOrdering();
777
778 $sort_content = array();
779
780 foreach ($items as $item) {
781 if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) {
782 continue;
783 }
784
785 $item_list_gui2 = $this->getItemGUI($item);
786 $item_list_gui2->enableIcon(true);
787
788 if ($is_order || $a_accordion) {
789 $item_list_gui2->enableCommands(true, true);
790 $item_list_gui2->enableProperties(false);
791 }
792
793 $chapters = $objectives_lm_obj->getChapters();
794 if (count($chapters)) {
795 $has_sections = false;
796 foreach ($chapters as $chapter) {
797 if ($chapter['ref_id'] != $item['child']) {
798 continue;
799 }
800 $has_sections = true;
801
802 include_once './Modules/LearningModule/classes/class.ilLMObject.php';
803 $title = $item['title'] .
804 " &rsaquo; " . ilLMObject::_lookupTitle($chapter['obj_id']) .
805 " (" . $lng->txt('obj_' . $chapter['type']) . ")";
806
807 $item_list_gui2->setDefaultCommandParameters(array(
808 "obj_id" => $chapter['obj_id'],
809 "focus_id" => $chapter['obj_id'],
810 "focus_return" => $this->container_obj->getRefId()));
811
812 if ($is_order) {
813 $item_list_gui2->setPositionInputField(
814 "[lobj][" . $a_objective_id . "][" . $chapter['lm_ass_id'] . "]",
815 sprintf('%d', $chapter['position'] * 10)
816 );
817 }
818
819 $sub_item_html = $item_list_gui2->getListItemHTML(
820 $item['ref_id'],
821 $item['obj_id'],
822 $title,
823 $item['description']
824 );
825
826 // #13381 - use materials order
827 $sort_key = str_pad($chapter['position'], 5, 0, STR_PAD_LEFT) . "_" . strtolower($title) . "_" . $chapter['lm_ass_id'];
828 $sort_content[$sort_key] = $sub_item_html;
829 }
830 }
831
832 $this->rendered_items[$item['child']] = true;
833
834 if ($lm_ass_id = $objectives_lm_obj->isAssigned($item['ref_id'], true)) {
835 if ($is_order) {
836 $item_list_gui2->setPositionInputField(
837 "[lobj][" . $a_objective_id . "][" . $lm_ass_id . "]",
838 sprintf('%d', $sort_map[$lm_ass_id] * 10)
839 );
840 }
841
842 $sub_item_html = $item_list_gui2->getListItemHTML(
843 $item['ref_id'],
844 $item['obj_id'],
845 $item['title'],
846 $item['description']
847 );
848
849 // #13381 - use materials order
850 $sort_key = str_pad($sort_map[$lm_ass_id], 5, 0, STR_PAD_LEFT) . "_" . strtolower($item['title']) . "_" . $lm_ass_id;
851 $sort_content[$sort_key] = $sub_item_html;
852 }
853 }
854
855 if ($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL) {
856 $this->objective_list_gui->enableCommands(false);
857 } else {
858 $this->objective_list_gui->enableCommands(true);
859 }
860
861 if ($is_order) {
862 $this->objective_list_gui->setPositionInputField(
863 "[lobj][" . $a_objective_id . "][0]",
864 $objective->__getPosition() * 10
865 );
866 }
867
868 ksort($sort_content);
869
870 if (!$a_accordion) {
871 foreach ($sort_content as $sub_item_html) {
872 $this->objective_list_gui->addSubItemHTML($sub_item_html);
873 }
874
875 return $this->objective_list_gui->getObjectiveListItemHTML(
876 0,
877 $a_objective_id,
878 $objective->getTitle(),
879 $objective->getDescription(),
880 ($is_manage || $is_order)
881 );
882 } else {
883 $acc_content = $sort_content;
884
885 $initial_shown = false;
886 $initial_test_ref_id = $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL);
887 $initial_test_obj_id = ilObject::_lookupObjId($initial_test_ref_id);
888 include_once './Modules/Test/classes/class.ilObjTestAccess.php';
889
890 if (
891 $initial_test_obj_id &&
892 $this->getSettings()->hasSeparateInitialTests() &&
894 ) {
895 $acc_content[] = $this->renderTest(
896 $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL),
897 $a_objective_id,
898 true,
899 false,
900 $a_lo_result
901 );
902 $initial_shown = true;
903 } elseif ($this->getSettings()->hasSeparateQualifiedTests()) {
904 $acc_content[] = $this->renderTest(
905 $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_QUALIFIED),
906 $a_objective_id,
907 false,
908 false,
909 $a_lo_result
910 );
911 }
912
913
914 /*
915 if($this->loc_settings->getInitialTest() &&
916 $this->loc_settings->getType() == ilLOSettings::LOC_INITIAL_SEL &&
917 !$a_lo_risult["initial_status"])
918 {
919 $acc_content[] = $this->renderTest($this->loc_settings->getInitialTest(), $a_objective_id, true, false, $a_lo_result);
920 $initial_shown = true;
921 }
922 if(!$initial_shown &&
923 $this->loc_settings->getQualifiedTest() &&
924 $this->loc_settings->isQualifiedTestPerObjectiveVisible())
925 {
926 $acc_content[] = $this->renderTest($this->loc_settings->getQualifiedTest(), $a_objective_id, false, false, $a_lo_result);
927 }
928 */
929
930 $co_page = null;
931 include_once("./Services/COPage/classes/class.ilPageUtil.php");
932 if (ilPageUtil::_existsAndNotEmpty("lobj", $objective->getObjectiveId())) {
933 $a_has_lo_page = true;
934
935 include_once 'Modules/Course/classes/Objectives/class.ilLOPageGUI.php';
936 $page_gui = new ilLOPageGUI($objective->getObjectiveId());
937
938 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
939 $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0));
940 $page_gui->setPresentationTitle("");
941 $page_gui->setTemplateOutput(false);
942 $page_gui->setHeader("");
943
944 $co_page = "<div class='ilContObjectiveIntro'>" . $page_gui->showPage() . "</div>";
945 }
946
947 $a_accordion->addItem(
948 $this->buildAccordionTitle($objective, $a_lo_result),
949 $co_page .
950 $this->buildAccordionContent($acc_content),
951 (isset($_GET["oobj"]) && (int) $_GET["oobj"] == $objective->getObjectiveId())
952 );
953 }
954 }
955
963 protected function initDetails()
964 {
966
967 // no details
968 return;
969 }
970
971 protected function initTestAssignments()
972 {
973 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
974 $this->test_assignments = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
975 }
976
981 protected function parseLOUserResults()
982 {
984
985 $res = array();
986
987 include_once "Modules/Course/classes/Objectives/class.ilLOTestAssignments.php";
988 $lo_ass = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
989
990 include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
991 $lur = new ilLOUserResults($this->getContainerObject()->getId(), $ilUser->getId());
992 foreach ($lur->getCourseResultsForUserPresentation() as $objective_id => $types) {
993 // show either initial or qualified for objective
994 if (isset($types[ilLOUserResults::TYPE_INITIAL])) {
995 $initial_status = $types[ilLOUserResults::TYPE_INITIAL]["status"];
996 }
997
998 // qualified test has priority
999 if (isset($types[ilLOUserResults::TYPE_QUALIFIED])) {
1002 $result["initial"] = $types[ilLOUserResults::TYPE_INITIAL];
1003 } else {
1006 }
1007
1008 $result["initial_status"] = $initial_status;
1009
1010 $result["itest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL);
1011 $result["qtest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
1012
1013 $res[$objective_id] = $result;
1014 }
1015
1016 return $res;
1017 }
1018
1034 public static function renderProgressBar(
1035 $a_perc_result = null,
1036 $a_perc_limit = null,
1037 $a_css = null,
1038 $a_caption = null,
1039 $a_url = null,
1040 $a_tt_id = null,
1041 $a_tt_txt = null,
1042 $a_next_step = null,
1043 $a_sub = false,
1044 $a_sub_style = 30
1045 ) {
1046 global $DIC;
1047
1048 $tpl = new ilTemplate("tpl.objective_progressbar.html", true, true, "Services/Container");
1049
1050 if ($a_perc_result !== null) {
1051 $tpl->setCurrentBlock("statusbar_bl");
1052 $tpl->setVariable("PERC_STATUS", $a_perc_result);
1053 $tpl->setVariable("PERC_WIDTH", $a_perc_result);
1054 $tpl->setVariable("PERC_COLOR", $a_css);
1055 if ($a_perc_limit) {
1056 // :TODO: magic?
1057 $limit_pos = (99 - (int) $a_perc_limit) * -1;
1058 $tpl->setVariable("LIMIT_POS", $limit_pos);
1059 }
1060 if ($a_tt_txt &&
1061 $a_tt_id) {
1062 $tpl->setVariable("TT_ID", $a_tt_id);
1063 }
1064 $tpl->parseCurrentBlock();
1065 }
1066
1067 if ($a_caption) {
1068 if ($a_url) {
1069 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1070 $button = ilLinkButton::getInstance();
1071 $button->setCaption($a_caption, false);
1072 $button->setUrl($a_url);
1073
1074 $tpl->setCurrentBlock("statustxt_bl");
1075 $tpl->setVariable("TXT_PROGRESS_STATUS", $button->render());
1076 $tpl->parseCurrentBlock();
1077 } else {
1078 $tpl->setCurrentBlock("statustxt_no_link_bl");
1079 $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
1080 $tpl->parseCurrentBlock();
1081 }
1082 }
1083
1084 if ($a_next_step) {
1085 #$tpl->setCurrentBlock("nstep_bl");
1086 $tpl->setVariable("TXT_NEXT_STEP", $a_next_step);
1087 #$tpl->parseCurrentBlock();
1088 }
1089
1090 if ($a_tt_id &&
1091 $a_tt_txt) {
1092 include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1093 ilTooltipGUI::addTooltip($a_tt_id, $a_tt_txt);
1094 }
1095
1096 if ($a_sub) {
1097 $tpl->setVariable("SUB_STYLE", ' style="padding-left: ' . $a_sub_style . 'px;"');
1098 $tpl->setVariable("SUB_INIT", $a_sub);
1099 }
1100
1101 return $tpl->get();
1102 }
1103
1121 public static function renderProgressMeter(
1122 $a_perc_result = null,
1123 $a_perc_limit = null,
1124 $a_compare_value = null,
1125 $a_caption = null,
1126 $a_url = null,
1127 $a_tt_id = null,
1128 $a_tt_txt = null,
1129 $a_next_step = null,
1130 $a_sub = false,
1131 $a_sub_style = 30,
1132 $a_main_text = '',
1133 $a_required_text = ''
1134 ) {
1135 global $DIC;
1136
1137 $tpl = new ilTemplate("tpl.objective_progressmeter.html", true, true, "Services/Container");
1138
1139 $lng = $DIC->language();
1140 $lng->loadLanguageModule('crs');
1141
1142
1143
1144 if (is_numeric($a_perc_result)) {
1145 $uiFactory = $DIC->ui()->factory();
1146 $uiRenderer = $DIC->ui()->renderer();
1147
1148 $pMeter = $uiFactory->chart()->progressMeter()->standard(
1149 100,
1150 (int) $a_perc_result,
1151 (int) $a_perc_limit,
1152 (int) $a_compare_value
1153 );
1154 if (strlen($a_main_text)) {
1155 #$pMeter = $pMeter->withMainText($a_main_text);
1156 }
1157 if (strlen($a_required_text)) {
1158 #$pMeter = $pMeter->withRequiredText($a_required_text);
1159 }
1160 $tpl->setVariable('PROGRESS_METER', $uiRenderer->render($pMeter));
1161 }
1162
1163
1164 if ($a_next_step) {
1165 //$tpl->setCurrentBlock("nstep_bl");
1166 $tpl->setVariable("TXT_NEXT_STEP", $a_next_step);
1167 //$tpl->parseCurrentBlock();
1168 }
1169
1170 if ($a_tt_id &&
1171 $a_tt_txt) {
1172 include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1173 ilTooltipGUI::addTooltip($a_tt_id, $a_tt_txt);
1174 }
1175
1176 if ($a_sub) {
1177 $tpl->setVariable("SUB_STYLE", ' style="padding-left: ' . $a_sub_style . 'px;"');
1178 $tpl->setVariable("SUB_INIT", $a_sub);
1179 }
1180
1181 return $tpl->get();
1182 }
1183
1191 public static function getObjectiveResultSummary($a_has_initial_test, $a_objective_id, $a_lo_result)
1192 {
1193 global $DIC;
1194
1195 $lng = $DIC->language();
1196 $lng->loadLanguageModule('crs');
1197
1198 $is_qualified =
1199 ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED);
1200 $is_qualified_initial =
1201 (
1202 $a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
1203 ilLOSettings::getInstanceByObjId($a_lo_result['course_id'])->isInitialTestQualifying()
1204 );
1205 $has_completed =
1206 ($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED);
1207
1208 $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null;
1209
1210 if (
1211 $is_qualified ||
1212 $is_qualified_initial) {
1213 if ($has_completed) {
1214 $next_step = $lng->txt("crs_loc_progress_objective_complete");
1215 } else {
1216 $next_step = $lng->txt("crs_loc_progress_do_qualifying_again");
1217 }
1218 } // initial test
1219 else {
1220 if ($a_lo_result["status"]) {
1221 $next_step =
1222 $has_completed ?
1223 $lng->txt("crs_loc_progress_do_qualifying") :
1224 $lng->txt("crs_loc_suggested");
1225 } else {
1226 $next_step = (bool) $a_has_initial_test ?
1227 $lng->txt("crs_loc_progress_no_result_do_initial") :
1228 $lng->txt("crs_loc_progress_no_result_no_initial");
1229 }
1230 }
1231 return $next_step;
1232 }
1233
1245 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)
1246 {
1247 global $DIC;
1248
1249 $lng = $DIC->language();
1250 $lng->loadLanguageModule('crs');
1251
1252 // tooltip (has to be unique!)
1253
1254 $tooltip_id = "crsobjtvusr_" . $a_objective_id . "_" . $a_lo_result["type"] . "_" . ((int) $a_sub);
1255 if ($a_tt_suffix !== null) {
1256 $tooltip_id .= "_" . $a_tt_suffix;
1257 }
1258
1259 $tt_txt = sprintf(
1260 $lng->txt("crs_loc_tt_info"),
1261 $a_lo_result["result_perc"],
1262 $a_lo_result["limit_perc"]
1263 );
1264
1265
1266 include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
1267 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
1268
1269 $is_qualified = ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED);
1270 $is_qualified_initial = ($a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
1271 ilLOSettings::getInstanceByObjId($a_lo_result['course_id'])->isInitialTestQualifying());
1272 $has_completed = ($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED);
1273
1274 $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null;
1275 $compare_value = null;
1276
1277 if ($is_qualified ||
1278 $is_qualified_initial) {
1279 $progress_txt = $lng->txt("crs_loc_progress_result_qtest");
1280 $tt_txt = $lng->txt("crs_loc_tab_qtest") . ": " . $tt_txt;
1281
1282 if ($has_completed) {
1283 $next_step = $lng->txt("crs_loc_progress_objective_complete");
1284 $bar_color = "ilCourseObjectiveProgressBarCompleted";
1285
1286 // render 2nd progressbar if there is also an initial test
1287 if ($is_qualified &&
1288 $a_has_initial_test &&
1289 is_array($a_lo_result["initial"])) {
1290 $a_lo_result["initial"]["itest"] = $a_lo_result["itest"];
1291
1292 // force list mode to get rid of next step
1293 #$initial_sub = self::buildObjectiveProgressBar(true, $a_objective_id, $a_lo_result["initial"], true, true, $a_tt_suffix);
1294 $compare_value = $a_lo_result['initial']['result_perc'];
1295 }
1296 } else {
1297 $next_step = $lng->txt("crs_loc_progress_do_qualifying_again");
1298 $bar_color = "ilCourseObjectiveProgressBarFailed";
1299 }
1300 }
1301 // initial test
1302 else {
1303 if ($a_lo_result["status"]) {
1304 $progress_txt = $lng->txt("crs_loc_progress_result_itest");
1305 $tt_txt = $lng->txt("crs_loc_tab_itest") . ": " . $tt_txt;
1306
1307 $bar_color = "ilCourseObjectiveProgressBarNeutral";
1308 $next_step = $has_completed
1309 ? $lng->txt("crs_loc_progress_do_qualifying")
1310 : $lng->txt("crs_loc_suggested");
1311 }
1312 // not attempted: no progress bar
1313 else {
1314 $next_step = (bool) $a_has_initial_test
1315 ? $lng->txt("crs_loc_progress_no_result_do_initial")
1316 : $lng->txt("crs_loc_progress_no_result_no_initial");
1317 }
1318 }
1319
1320 // link to test statistics
1321 $relevant_test_id = $a_lo_result["qtest"]
1322 ? $a_lo_result["qtest"]
1323 : $a_lo_result["itest"];
1324 if ($relevant_test_id) {
1325 $test_url = ilLOUtils::getTestResultLinkForUser($relevant_test_id, $a_lo_result["user_id"]);
1326 }
1327
1328 $main_text = $lng->txt('crs_loc_itest_info');
1329 if ($a_lo_result['type'] == ilLOSettings::TYPE_TEST_QUALIFIED) {
1330 $main_text = $lng->txt('crs_loc_qtest_info');
1331 }
1332
1333
1334
1336 $a_lo_result["result_perc"],
1337 $a_lo_result["limit_perc"],
1338 $compare_value,
1339 $progress_txt,
1340 $test_url,
1341 $tooltip_id,
1342 $tt_txt,
1343 $a_list_mode
1344 ? null
1345 : $next_step,
1346 $initial_sub,
1347 $a_list_mode
1348 ? 30
1349 : 10,
1350 $main_text,
1351 $lng->txt('crs_lobj_pm_min_goal')
1352 );
1353 }
1354
1361 protected function buildAccordionTitle(ilCourseObjective $a_objective, array $a_lo_result = null)
1362 {
1363 global $DIC;
1364
1365 $renderer = $DIC->ui()->renderer();
1366 $ui_factory = $DIC->ui()->factory();
1367
1368 $tpl = new ilTemplate("tpl.objective_accordion_title.html", true, true, "Services/Container");
1369
1370 if ($a_lo_result) {
1371 $tpl->setVariable(
1372 "PROGRESS_BAR",
1373 self::buildObjectiveProgressBar(
1374 (bool) $this->loc_settings->worksWithInitialTest(),
1375 $a_objective->getObjectiveId(),
1376 $a_lo_result
1377 )
1378 );
1379 }
1380
1381 $tpl->setVariable("TITLE", $this->lng->txt("crs_loc_learning_objective") . ": " . trim($a_objective->getTitle()));
1382 $tpl->setVariable("DESCRIPTION", nl2br(trim($a_objective->getDescription())));
1383
1384 $initial_res = null;
1385 $initial_lim = null;
1386 if ($this->loc_settings->worksWithInitialTest()) {
1387 if (array_key_exists('initial', $a_lo_result)) {
1388 $initial_res = (int) $a_lo_result['initial']['result_perc'];
1389 $initial_lim = (int) $a_lo_result['initial']['limit_perc'];
1390 }
1391 if (
1392 $a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
1393 isset($a_lo_result['result_perc'])
1394 ) {
1395 $initial_res = (int) $a_lo_result['result_perc'];
1396 $initial_lim = (int) $a_lo_result['limit_perc'];
1397 }
1398 }
1399
1400 if ($initial_res !== null) {
1401
1403 $a_lo_result["itest"],
1404 $a_lo_result["user_id"]
1405 );
1406
1407 if (strlen($link)) {
1408 $tpl->setCurrentBlock('i_with_link');
1409 $tpl->setVariable(
1410 'IBTN',
1411 $renderer->render(
1412 $ui_factory->button()->shy(
1413 $this->lng->txt('crs_objective_result_details'),
1414 $link
1415 )
1416 )
1417 );
1418 $tpl->parseCurrentBlock();
1419 }
1420
1421 $tpl->setCurrentBlock('res_initial');
1422 $tpl->setVariable(
1423 'IRESULT',
1424 sprintf(
1425 $this->lng->txt('crs_objective_result_summary_initial'),
1426 (int) $initial_res . '%',
1427 (int) $initial_lim . '%'
1428 )
1429 );
1430 $tpl->parseCurrentBlock();
1431 }
1432
1433 $qual_res = null;
1434 $qual_lim = null;
1435
1436 if ($a_lo_result['type'] == ilLOUserResults::TYPE_QUALIFIED) {
1437
1438 $qual_res = (int) $a_lo_result['result_perc'];
1439 $qual_lim = (int) $a_lo_result['limit_perc'];
1440 }
1441
1442 if ($qual_res !== null) {
1443
1445 $a_lo_result["qtest"],
1446 $a_lo_result["user_id"]
1447 );
1448
1449 if (strlen($link)) {
1450 $tpl->setCurrentBlock('q_with_link');
1451 $tpl->setVariable(
1452 'QBTN',
1453 $renderer->render(
1454 $ui_factory->button()->shy(
1455 $this->lng->txt('crs_objective_result_details'),
1456 $link
1457 )
1458 )
1459 );
1460 $tpl->parseCurrentBlock();
1461 }
1462 $tpl->setCurrentBlock('res_qualifying');
1463 $tpl->setVariable(
1464 'QRESULT',
1465 sprintf(
1466 $this->lng->txt('crs_objective_result_summary_qualifying'),
1467 (int) $qual_res . '%',
1468 (int) $qual_lim . '%'
1469 )
1470 );
1471 $tpl->parseCurrentBlock();
1472 }
1473
1474 $this->logger->dump($a_lo_result);
1475
1477 (bool) $this->loc_settings->worksWithInitialTest(),
1478 $a_objective->getObjectiveId(),
1479 $a_lo_result
1480 );
1481 if (strlen($summary)) {
1482 $tpl->setCurrentBlock('objective_summary');
1483 $tpl->setVariable('SUMMARY_TXT', $summary);
1484 $tpl->parseCurrentBlock();
1485 }
1486
1487 // #15510
1488 $tpl->setVariable("ANCHOR_ID", "objtv_acc_" . $a_objective->getObjectiveId());
1489
1490 return $tpl->get();
1491 }
1492
1493 protected function buildAccordionContent(array $a_items)
1494 {
1495 $tpl = new ilTemplate("tpl.objective_accordion_content.html", true, true, "Services/Container");
1496 foreach ($a_items as $item) {
1497 $tpl->setCurrentBlock("items_bl");
1498 $tpl->setVariable("ITEM", $item);
1499 $tpl->parseCurrentBlock();
1500 }
1501 return $tpl->get();
1502 }
1503
1511 protected function showButton($a_cmd, $a_text, $a_target = '', $a_id = "")
1512 {
1513 $ilToolbar = $this->toolbar;
1514 $ilCtrl = $this->ctrl;
1515
1516 // #11842
1517 $ilToolbar->addButton(
1518 $a_text,
1519 $ilCtrl->getLinkTarget($this->getContainerGUI(), $a_cmd),
1520 $a_target,
1521 "",
1522 '',
1523 $a_id
1524 );
1525 }
1526}
$result
user()
Definition: user.php:4
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
const IL_OBJECTIVE_STATUS_EMPTY
Accordion user interface class.
static _checkAllConditionsOfTarget($a_target_ref_id, $a_target_id, $a_target_type="", $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
Parent class of all container content GUIs.
initRenderer()
Init container renderer.
getContainerObject()
Get container object.
getContainerGUI()
Get container GUI object.
renderItem($a_item_data, $a_position=0, $a_force_icon=false, $a_pos_prefix="")
Render an item.
insertPageEmbeddedBlocks($a_output_html)
Insert blocks into container page.
getItemGroupsHTML($a_pos=0)
Get item groups HTML.
getItemGUI($item_data, $a_show_path=false)
Get ListGUI object for item.
clearAdminCommandsDetermination()
cleaer administration commands determination
GUI class for course objective view.
renderObjective($a_objective_id, &$a_has_lo_page, ilAccordionGUI $a_accordion=null, array $a_lo_result=null)
render objective
parseLOUserResults()
Parse learning objective results.
static renderProgressMeter( $a_perc_result=null, $a_perc_limit=null, $a_compare_value=null, $a_caption=null, $a_url=null, $a_tt_id=null, $a_tt_txt=null, $a_next_step=null, $a_sub=false, $a_sub_style=30, $a_main_text='', $a_required_text='')
Render progress bar(s)
buildAccordionTitle(ilCourseObjective $a_objective, array $a_lo_result=null)
showButton($a_cmd, $a_text, $a_target='', $a_id="")
show action button
static buildObjectiveProgressBar($a_has_initial_test, $a_objective_id, array $a_lo_result, $a_list_mode=false, $a_sub=false, $a_tt_suffix=null)
Render progressbar(s) for given objective and result data.
addItemDetails(ilObjectListGUI $a_item_list_gui, array $a_item)
static renderProgressBar( $a_perc_result=null, $a_perc_limit=null, $a_css=null, $a_caption=null, $a_url=null, $a_tt_id=null, $a_tt_txt=null, $a_next_step=null, $a_sub=false, $a_sub_style=30)
Render progress bar(s)
__construct($a_container_gui)
Constructor.
getDetailsLevel($a_objective_id)
get details level
updateResult($a_res, $a_item_ref_id, $a_objective_id, $a_user_id)
showMaterials($a_tpl, $a_mode=null, $a_is_manage=false, $a_as_accordion=false)
Show all other (no assigned tests, no assigned materials) materials.
renderTest($a_test_ref_id, $a_objective_id, $a_is_initial=false, $a_add_border=false, $a_lo_result=array())
showObjectives($a_tpl, $a_is_order=false)
show objectives
getMainContent()
Impementation of abstract method getMainContent.
static getObjectiveResultSummary($a_has_initial_test, $a_objective_id, $a_lo_result)
Get objective result summary.
getTestAssignments()
Get test assignments object.
List gui for course objectives.
class ilCourseObjectiveMaterials
static _getAssignedMaterials($a_objective_id)
get assigned materials
static getStatus($a_usr_id, $a_crs_id)
get status of user
class ilcourseobjective
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
static lookupMaxPasses($a_objective_id)
static _getObjectiveIds($course_id, $a_activated_only=false)
static _lookupTitle($a_obj_id)
Lookup title.
(Course) learning objective page GUI class
static getInstanceByObjId($a_obj_id)
get singleton instance
Settings for LO courses.
static getInstance($a_container_id)
Get instance by container id.
static lookupRunExistsForObjective($a_test_id, $a_objective_id, $a_user_id)
@global type $ilDB
static hasResults($a_container_id, $a_user_id)
static lookupResult($a_course_obj_id, $a_user_id, $a_objective_id, $a_tst_type)
Lookup user result.
static hasActiveRun($a_container_id, $a_test_ref_id, $a_objective_id)
static getTestResultLinkForUser($a_test_ref_id, $a_user_id)
static getInstance()
Factory.
static getSyntaxStylePath()
get syntax style path
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static checkCondition($a_obj_id, $a_operator, $a_value, $a_usr_id)
check condition
static isParticipantsLastPassActive($testRefId, $userId)
static getItemsByObjective($a_objective_id)
Get objective items.
Class ilObjectListGUI.
setConditionTarget($a_ref_id, $a_obj_id, $a_target_type)
enableCommands($a_status, $a_std_only=false)
En/disable commands.
setDefaultCommandParameters(array $a_params)
enableProperties($a_status)
En/disable properties.
enableItemDetailLinks($a_status)
enable item detail links E.g Direct links to chapters or pages
addCustomProperty( $a_property="", $a_value="", $a_alert=false, $a_newline=false)
add custom property
setItemDetailLinks($a_detail_links, $a_intro_txt='')
set items detail links
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _existsAndNotEmpty($a_parent_type, $a_id, $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages)
special template class to simplify handling of ITX/PEAR
static addTooltip( $a_el_id, $a_text, $a_container="", $a_my="bottom center", $a_at="top center", $a_use_htmlspecialchars=true)
Adds a tooltip to an HTML element.
$txt
Definition: error.php:13
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17
$type
$url
foreach($_POST as $key=> $value) $res
settings()
Definition: settings.php:2