ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Containter\Content\ObjectiveRenderer Class Reference
+ Collaboration diagram for ILIAS\Containter\Content\ObjectiveRenderer:

Public Member Functions

 renderObjectives ()
 
 getContent ()
 
 showObjectives (bool $a_is_order=false)
 

Static Public Member Functions

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. More...
 
static getObjectiveResultSummary (bool $a_has_initial_test, int $a_objective_id, array $a_lo_result)
 Get objective result summary. More...
 
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. More...
 

Data Fields

const MATERIALS_TESTS = 1
 
const MATERIALS_OTHER = 2
 
const CHECKBOX_NONE = 0
 
const CHECKBOX_ADMIN = 1
 
const CHECKBOX_DOWNLOAD = 2
 

Protected Member Functions

 renderTest (int $a_test_ref_id, ?int $a_objective_id, bool $a_is_initial=false)
 
 renderObjective (int $a_objective_id, bool &$a_has_lo_page, \ilAccordionGUI $a_accordion=null, array $a_lo_result=null)
 
 parseLOUserResults ()
 
 buildAccordionTitle (\ilCourseObjective $a_objective, array $a_lo_result=null)
 
 buildAccordionContent (array $a_items)
 
 showButton (string $a_cmd, string $a_text, string $a_target='', string $a_id="")
 

Protected Attributes

array $rendered_items
 
ilCourseObjectiveListGUI $objective_list_gui
 
ilLanguage $lng
 
ILIAS Container StandardGUIRequest $request
 
ILIAS Style Content Object ObjectFacade $content_style_domain
 
ilLOTestAssignments $test_assignments
 
ilContainerRenderer $renderer
 
ilLOSettings $loc_settings
 
ilContainerGUI $container_gui
 
ilContainer $container
 
string $view_mode
 
InternalGUIService $gui
 
InternalDomainService $domain
 
array $list_gui = []
 
string $output_html = ""
 

Detailed Description

Todo:
currently too fat for a renderer, more a GUI class
Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 30 of file class.ObjectiveRenderer.php.

Member Function Documentation

◆ buildAccordionContent()

ILIAS\Containter\Content\ObjectiveRenderer::buildAccordionContent ( array  $a_items)
protected

Definition at line 1031 of file class.ObjectiveRenderer.php.

Referenced by ILIAS\Containter\Content\ObjectiveRenderer\renderObjective().

1031  : string
1032  {
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();
1038  }
1039  return $tpl->get();
1040  }
+ Here is the caller graph for this function:

◆ buildAccordionTitle()

ILIAS\Containter\Content\ObjectiveRenderer::buildAccordionTitle ( \ilCourseObjective  $a_objective,
array  $a_lo_result = null 
)
protected

Definition at line 900 of file class.ObjectiveRenderer.php.

References $DIC, ilCourseObjective\getDescription(), ilCourseObjective\getObjectiveId(), ilLOUtils\getTestResultLinkForUser(), ilCourseObjective\getTitle(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilLOUserResults\TYPE_INITIAL, ilLOUserResults\TYPE_QUALIFIED, and ilLOUserResults\TYPE_UNDEFINED.

Referenced by ILIAS\Containter\Content\ObjectiveRenderer\renderObjective().

903  : string {
904  global $DIC;
905 
906  $renderer = $DIC->ui()->renderer();
907  $ui_factory = $DIC->ui()->factory();
908 
909  $tpl = new \ilTemplate("tpl.objective_accordion_title.html", true, true, "Services/Container");
910 
911  if ($a_lo_result) {
912  $tpl->setVariable(
913  "PROGRESS_BAR",
914  self::buildObjectiveProgressBar(
915  $this->loc_settings->worksWithInitialTest(),
916  $a_objective->getObjectiveId(),
917  $a_lo_result
918  )
919  );
920  }
921 
922  $tpl->setVariable("TITLE", $this->lng->txt("crs_loc_learning_objective") . ": " . trim($a_objective->getTitle()));
923  $tpl->setVariable("DESCRIPTION", nl2br(trim($a_objective->getDescription())));
924 
925  $initial_res = null;
926  $initial_lim = null;
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);
931  }
932  if (
933  ($a_lo_result['type'] ?? \ilLOUserResults::TYPE_UNDEFINED) == \ilLOUserResults::TYPE_INITIAL &&
934  isset($a_lo_result['result_perc'])
935  ) {
936  $initial_res = (int) $a_lo_result['result_perc'];
937  $initial_lim = (int) $a_lo_result['limit_perc'];
938  }
939  }
940 
941  if ($initial_res !== null) {
943  $a_lo_result["itest"],
944  $a_lo_result["user_id"]
945  );
946 
947  if (strlen($link)) {
948  $tpl->setCurrentBlock('i_with_link');
949  $tpl->setVariable(
950  'IBTN',
951  $renderer->render(
952  $ui_factory->button()->shy(
953  $this->lng->txt('crs_objective_result_details'),
954  $link
955  )
956  )
957  );
958  $tpl->parseCurrentBlock();
959  }
960 
961  $tpl->setCurrentBlock('res_initial');
962  $tpl->setVariable(
963  'IRESULT',
964  sprintf(
965  $this->lng->txt('crs_objective_result_summary_initial'),
966  $initial_res . '%',
967  (int) $initial_lim . '%'
968  )
969  );
970  $tpl->parseCurrentBlock();
971  }
972 
973  $qual_res = null;
974  $qual_lim = null;
975 
976  if (($a_lo_result['type'] ?? \ilLOUserResults::TYPE_UNDEFINED) == \ilLOUserResults::TYPE_QUALIFIED) {
977  $qual_res = (int) $a_lo_result['result_perc'];
978  $qual_lim = (int) $a_lo_result['limit_perc'];
979  }
980 
981  if ($qual_res !== null) {
983  $a_lo_result["qtest"],
984  $a_lo_result["user_id"]
985  );
986 
987  if (strlen($link)) {
988  $tpl->setCurrentBlock('q_with_link');
989  $tpl->setVariable(
990  'QBTN',
991  $renderer->render(
992  $ui_factory->button()->shy(
993  $this->lng->txt('crs_objective_result_details'),
994  $link
995  )
996  )
997  );
998  $tpl->parseCurrentBlock();
999  }
1000  $tpl->setCurrentBlock('res_qualifying');
1001  $tpl->setVariable(
1002  'QRESULT',
1003  sprintf(
1004  $this->lng->txt('crs_objective_result_summary_qualifying'),
1005  $qual_res . '%',
1006  (int) $qual_lim . '%'
1007  )
1008  );
1009  $tpl->parseCurrentBlock();
1010  }
1011 
1012  //$this->logger->dump($a_lo_result);
1013 
1014  $summary = self::getObjectiveResultSummary(
1015  $this->loc_settings->worksWithInitialTest(),
1016  $a_objective->getObjectiveId(),
1017  $a_lo_result ?? []
1018  );
1019  if (strlen($summary)) {
1020  $tpl->setCurrentBlock('objective_summary');
1021  $tpl->setVariable('SUMMARY_TXT', $summary);
1022  $tpl->parseCurrentBlock();
1023  }
1024 
1025  // #15510
1026  $tpl->setVariable("ANCHOR_ID", "objtv_acc_" . $a_objective->getObjectiveId());
1027 
1028  return $tpl->get();
1029  }
global $DIC
Definition: feed.php:28
static getTestResultLinkForUser(int $a_test_ref_id, int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildObjectiveProgressBar()

static ILIAS\Containter\Content\ObjectiveRenderer::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 
)
static

Render progressbar(s) for given objective and result data.

Definition at line 788 of file class.ObjectiveRenderer.php.

References $DIC, ilLOSettings\getInstanceByObjId(), ilLOUtils\getTestResultLinkForUser(), ILIAS\Repository\int(), ilLOUserResults\STATUS_COMPLETED, ilLOUserResults\TYPE_INITIAL, ilLOUserResults\TYPE_QUALIFIED, and ilLOSettings\TYPE_TEST_QUALIFIED.

795  : string {
796  global $DIC;
797 
798  $lng = $DIC->language();
799  $lng->loadLanguageModule('crs');
800 
801  // tooltip (has to be unique!)
802 
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;
806  }
807 
808  $tt_txt = sprintf(
809  $lng->txt("crs_loc_tt_info"),
810  $a_lo_result["result_perc"] ?? '0',
811  $a_lo_result["limit_perc"] ?? '0'
812  );
813 
814 
815  $is_qualified = ($a_lo_result["type"] == \ilLOUserResults::TYPE_QUALIFIED);
816  $is_qualified_initial = ($a_lo_result['type'] == \ilLOUserResults::TYPE_INITIAL &&
817  \ilLOSettings::getInstanceByObjId($a_lo_result['course_id'] ?? 0)->isInitialTestQualifying());
818  $has_completed = (($a_lo_result["status"] ?? 0) == \ilLOUserResults::STATUS_COMPLETED);
819 
820  $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null;
821  $compare_value = null;
822 
823  if ($is_qualified ||
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;
827 
828  if ($has_completed) {
829  $next_step = $lng->txt("crs_loc_progress_objective_complete");
830  $bar_color = "ilCourseObjectiveProgressBarCompleted";
831 
832  // render 2nd progressbar if there is also an initial test
833  if ($is_qualified &&
834  $a_has_initial_test &&
835  is_array($a_lo_result["initial"])) {
836  $a_lo_result["initial"]["itest"] = $a_lo_result["itest"];
837 
838  // force list mode to get rid of next step
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'];
841  }
842  } else {
843  $next_step = $lng->txt("crs_loc_progress_do_qualifying_again");
844  $bar_color = "ilCourseObjectiveProgressBarFailed";
845  }
846  }
847  // initial test
848  else {
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;
852 
853  $bar_color = "ilCourseObjectiveProgressBarNeutral";
854  $next_step = $has_completed
855  ? $lng->txt("crs_loc_progress_do_qualifying")
856  : $lng->txt("crs_loc_suggested");
857  }
858  // not attempted: no progress bar
859  else {
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");
863  }
864  }
865 
866  // link to test statistics
867  $relevant_test_id = ($a_lo_result["qtest"] ?? 0)
868  ?: ($a_lo_result["itest"] ?? 0);
869  if ($relevant_test_id) {
870  $test_url = \ilLOUtils::getTestResultLinkForUser($relevant_test_id, $a_lo_result["user_id"] ?? 0);
871  }
872 
873  $main_text = $lng->txt('crs_loc_itest_info');
874  if ($a_lo_result['type'] == \ilLOSettings::TYPE_TEST_QUALIFIED) {
875  $main_text = $lng->txt('crs_loc_qtest_info');
876  }
877 
878 
879 
880  return self::renderProgressMeter(
881  $a_lo_result["result_perc"] ?? null,
882  $a_lo_result["limit_perc"] ?? null,
883  $compare_value,
884  $progress_txt,
885  $test_url,
886  $tooltip_id,
887  $tt_txt,
888  $a_list_mode
889  ? null
890  : $next_step,
891  (bool) $initial_sub,
892  $a_list_mode
893  ? 30
894  : 10,
895  $main_text,
896  $lng->txt('crs_lobj_pm_min_goal')
897  );
898  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: feed.php:28
static getTestResultLinkForUser(int $a_test_ref_id, int $a_user_id)
static getInstanceByObjId(int $a_obj_id)
+ Here is the call graph for this function:

◆ getContent()

ILIAS\Containter\Content\ObjectiveRenderer::getContent ( )

◆ getObjectiveResultSummary()

static ILIAS\Containter\Content\ObjectiveRenderer::getObjectiveResultSummary ( bool  $a_has_initial_test,
int  $a_objective_id,
array  $a_lo_result 
)
static

Get objective result summary.

Definition at line 733 of file class.ObjectiveRenderer.php.

References $DIC, ilLOSettings\getInstanceByObjId(), ILIAS\Repository\int(), ilLOUserResults\STATUS_COMPLETED, ilLOUserResults\TYPE_INITIAL, and ilLOUserResults\TYPE_QUALIFIED.

737  : string {
738  global $DIC;
739 
740  if ($a_lo_result === null) {
741  $a_lo_result["type"] = null;
742  }
743  if (!isset($a_lo_result["type"])) {
744  $a_lo_result["type"] = null;
745  }
746 
747  $lng = $DIC->language();
748  $lng->loadLanguageModule('crs');
749 
750  $is_qualified =
751  ($a_lo_result["type"] == \ilLOUserResults::TYPE_QUALIFIED);
752  $is_qualified_initial =
753  (
754  $a_lo_result['type'] == \ilLOUserResults::TYPE_INITIAL &&
755  \ilLOSettings::getInstanceByObjId($a_lo_result['course_id'] ?? 0)->isInitialTestQualifying()
756  );
757  $has_completed = (int) ($a_lo_result["status"] ?? 0) === \ilLOUserResults::STATUS_COMPLETED;
758 
759  $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null;
760 
761  if (
762  $is_qualified ||
763  $is_qualified_initial) {
764  if ($has_completed) {
765  $next_step = $lng->txt("crs_loc_progress_objective_complete");
766  } else {
767  $next_step = $lng->txt("crs_loc_progress_do_qualifying_again");
768  }
769  } // initial test
770  else {
771  if ($a_lo_result["status"] ?? 0) {
772  $next_step =
773  $has_completed ?
774  $lng->txt("crs_loc_progress_do_qualifying") :
775  $lng->txt("crs_loc_suggested");
776  } else {
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");
780  }
781  }
782  return $next_step;
783  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: feed.php:28
static getInstanceByObjId(int $a_obj_id)
+ Here is the call graph for this function:

◆ parseLOUserResults()

ILIAS\Containter\Content\ObjectiveRenderer::parseLOUserResults ( )
protected

Definition at line 606 of file class.ObjectiveRenderer.php.

References $res, ilLOTestAssignments\getInstance(), ilLOUserResults\TYPE_INITIAL, ilLOUserResults\TYPE_QUALIFIED, ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

Referenced by ILIAS\Containter\Content\ObjectiveRenderer\showObjectives().

606  : array
607  {
608  $ilUser = $this->domain->user();
609  $initial_status = null;
610 
611  $res = array();
612 
613  $lo_ass = \ilLOTestAssignments::getInstance($this->container->getId());
614 
615  $lur = new \ilLOUserResults($this->container->getId(), $ilUser->getId());
616  foreach ($lur->getCourseResultsForUserPresentation() as $objective_id => $types) {
617  // show either initial or qualified for objective
618  if (isset($types[\ilLOUserResults::TYPE_INITIAL])) {
619  $initial_status = $types[\ilLOUserResults::TYPE_INITIAL]["status"];
620  }
621 
622  // qualified test has priority
623  if (isset($types[\ilLOUserResults::TYPE_QUALIFIED])) {
624  $result = $types[\ilLOUserResults::TYPE_QUALIFIED];
625  $result["type"] = \ilLOUserResults::TYPE_QUALIFIED;
626  $result["initial"] = $types[\ilLOUserResults::TYPE_INITIAL] ?? null;
627  } else {
628  $result = $types[\ilLOUserResults::TYPE_INITIAL];
629  $result["type"] = \ilLOUserResults::TYPE_INITIAL;
630  }
631 
632  $result["initial_status"] = $initial_status;
633 
634  $result["itest"] = $lo_ass->getTestByObjective($objective_id, \ilLOSettings::TYPE_TEST_INITIAL);
635  $result["qtest"] = $lo_ass->getTestByObjective($objective_id, \ilLOSettings::TYPE_TEST_QUALIFIED);
636 
637  $res[$objective_id] = $result;
638  }
639 
640  return $res;
641  }
$res
Definition: ltiservices.php:69
static getInstance(int $a_container_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderObjective()

ILIAS\Containter\Content\ObjectiveRenderer::renderObjective ( int  $a_objective_id,
bool &  $a_has_lo_page,
\ilAccordionGUI  $a_accordion = null,
array  $a_lo_result = null 
)
protected
Parameters
int$a_objective_id
bool$a_has_lo_page
\ilAccordionGUI | null$a_accordionif not given, returned as string
array | null$a_lo_result
Returns
string
Exceptions

Definition at line 413 of file class.ObjectiveRenderer.php.

References ilPageUtil\_existsAndNotEmpty(), ilObject\_lookupObjId(), ilLMObject\_lookupTitle(), ILIAS\Containter\Content\ObjectiveRenderer\buildAccordionContent(), ILIAS\Containter\Content\ObjectiveRenderer\buildAccordionTitle(), ilObjTestAccess\checkCondition(), ilObjectActivation\getItemsByObjective(), ilConditionHandler\OPERATOR_FINISHED, ILIAS\Containter\Content\ObjectiveRenderer\renderTest(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

Referenced by ILIAS\Containter\Content\ObjectiveRenderer\showObjectives().

418  : string {
419  $ilUser = $this->domain->user();
420  $lng = $this->domain->lng();
421 
422  $objective = new \ilCourseObjective($this->container, $a_objective_id);
423 
424  $items = \ilObjectActivation::getItemsByObjective($a_objective_id);
425 
426  // sorting is handled by ilCourseObjectiveMaterials
427  // $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj',$a_objective_id,$items);
428 
429  $objectives_lm_obj = new \ilCourseObjectiveMaterials($a_objective_id);
430 
431  // #13381 - map material assignment to position
432  $sort_map = array();
433  foreach ($objectives_lm_obj->getMaterials() as $item) {
434  $sort_map[$item["lm_ass_id"]] = $item["position"];
435  }
436 
437  $is_manage = $this->container_gui->isActiveAdministrationPanel();
438  $is_order = $this->container_gui->isActiveOrdering();
439 
440  $sort_content = array();
441 
442  $access = $this->domain->access();
443  foreach ($items as $item) {
444 
445  if (!$access->checkAccess('visible', '', $item["ref_id"])) {
446  continue;
447  }
448  /*
449  if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) {
450  continue;
451  }*/
452 
453  $item_list_gui2 = $this->renderer->getItemRenderer()->getItemGUI($item);
454  $item_list_gui2->enableIcon(true);
455 
456  if ($is_order || $a_accordion) {
457  $item_list_gui2->enableCommands(true, true);
458  $item_list_gui2->enableProperties(false);
459  }
460 
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']) {
466  continue;
467  }
468  $has_sections = true;
469 
470  $title = $item['title'] .
471  " &rsaquo; " . \ilLMObject::_lookupTitle($chapter['obj_id']) .
472  " (" . $lng->txt('obj_' . $chapter['type']) . ")";
473 
474  $item_list_gui2->setDefaultCommandParameters(array(
475  "obj_id" => $chapter['obj_id'],
476  "focus_id" => $chapter['obj_id'],
477  "focus_return" => $this->container->getRefId()));
478 
479  if ($is_order) {
480  $item_list_gui2->setPositionInputField(
481  "[lobj][" . $a_objective_id . "][" . $chapter['lm_ass_id'] . "]",
482  sprintf('%d', $chapter['position'] * 10)
483  );
484  }
485 
486  $sub_item_html = $item_list_gui2->getListItemHTML(
487  (int) $item['ref_id'],
488  (int) $item['obj_id'],
489  $title,
490  $item['description']
491  );
492 
493  // #13381 - use materials order
494  $sort_key = str_pad(
495  (string) $chapter['position'],
496  5,
497  "0",
498  STR_PAD_LEFT
499  ) . "_" . strtolower($title) . "_" . $chapter['lm_ass_id'];
500  $sort_content[$sort_key] = $sub_item_html;
501  }
502  }
503 
504  $this->rendered_items[$item['child']] = true;
505 
506  if ($lm_ass_id = $objectives_lm_obj->isAssigned((int) $item['ref_id'], true)) {
507  if ($is_order) {
508  $item_list_gui2->setPositionInputField(
509  "[lobj][" . $a_objective_id . "][" . $lm_ass_id . "]",
510  sprintf('%d', $sort_map[$lm_ass_id] * 10)
511  );
512  }
513 
514  $sub_item_html = $item_list_gui2->getListItemHTML(
515  $item['ref_id'],
516  $item['obj_id'],
517  $item['title'],
518  $item['description']
519  );
520 
521  // #13381 - use materials order
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;
524  }
525  }
526 
527  //if ($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL) {
528  $this->objective_list_gui->enableCommands(false);
529  //} else {
530  // $this->objective_list_gui->enableCommands(true);
531  //}
532 
533  if ($is_order) {
534  $this->objective_list_gui->setPositionInputField(
535  "[lobj][" . $a_objective_id . "][0]",
536  (string) ($objective->__getPosition() * 10)
537  );
538  }
539 
540  ksort($sort_content);
541  if (!$a_accordion) {
542  foreach ($sort_content as $sub_item_html) {
543  $this->objective_list_gui->addSubItemHTML($sub_item_html);
544  }
545 
546  return $this->objective_list_gui->getObjectiveListItemHTML(
547  0,
548  $a_objective_id,
549  $objective->getTitle(),
550  $objective->getDescription(),
551  ($is_manage || $is_order)
552  );
553  } else {
554  $acc_content = $sort_content;
555 
556  $initial_shown = false;
557  $initial_test_ref_id = $this->test_assignments->getTestByObjective($a_objective_id, \ilLOSettings::TYPE_TEST_INITIAL);
558  $initial_test_obj_id = \ilObject::_lookupObjId($initial_test_ref_id);
559 
560  if (
561  $initial_test_obj_id &&
562  $this->loc_settings->hasSeparateInitialTests() &&
563  !\ilObjTestAccess::checkCondition($initial_test_obj_id, \ilConditionHandler::OPERATOR_FINISHED, '', $ilUser->getId())
564  ) {
565  $acc_content[] = $this->renderTest(
566  $this->test_assignments->getTestByObjective($a_objective_id, \ilLOSettings::TYPE_TEST_INITIAL),
567  $a_objective_id,
568  true
569  );
570  $initial_shown = true;
571  } elseif ($this->loc_settings->hasSeparateQualifiedTests()) {
572  $acc_content[] = $this->renderTest(
573  $this->test_assignments->getTestByObjective($a_objective_id, \ilLOSettings::TYPE_TEST_QUALIFIED),
574  $a_objective_id,
575  false
576  );
577  }
578 
579  $co_page = null;
580  if (\ilPageUtil::_existsAndNotEmpty("lobj", $objective->getObjectiveId())) {
581  $a_has_lo_page = true;
582 
583  $page_gui = new \ilLOPageGUI($objective->getObjectiveId());
584 
585  $page_gui->setStyleId(
586  $this->content_style_domain->getEffectiveStyleId()
587  );
588  $page_gui->setPresentationTitle("");
589  $page_gui->setTemplateOutput(false);
590  $page_gui->setHeader("");
591 
592  $co_page = "<div class='ilContObjectiveIntro'>" . $page_gui->showPage() . "</div>";
593  }
594 
595  $a_accordion->addItem(
596  $this->buildAccordionTitle($objective, $a_lo_result),
597  $co_page .
598  $this->buildAccordionContent($acc_content),
599  ($this->request->getObjectiveId() == $objective->getObjectiveId())
600  );
601  }
602  return "";
603  }
buildAccordionTitle(\ilCourseObjective $a_objective, array $a_lo_result=null)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupObjId(int $ref_id)
static _lookupTitle(int $a_obj_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) ...
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
check condition
static getItemsByObjective(int $objective_id)
Get objective items.
renderTest(int $a_test_ref_id, ?int $a_objective_id, bool $a_is_initial=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderObjectives()

ILIAS\Containter\Content\ObjectiveRenderer::renderObjectives ( )

Definition at line 86 of file class.ObjectiveRenderer.php.

References ILIAS\Containter\Content\ObjectiveRenderer\$output_html, ilObject\_lookupObjId(), ilObjTestAccess\checkCondition(), ilLOSettings\getInstanceByObjId(), ilLOUserResults\hasResults(), ilConditionHandler\OPERATOR_FINISHED, ILIAS\Containter\Content\ObjectiveRenderer\renderTest(), ILIAS\Containter\Content\ObjectiveRenderer\showButton(), and ILIAS\Containter\Content\ObjectiveRenderer\showObjectives().

86  : string
87  {
88  $mode = $this->domain->content()->mode($this->container);
89  $user = $this->domain->user();
90  $access = $this->domain->access();
91  $lng = $this->domain->lng();
92 
93  $is_manage = $mode->isAdminMode();
94  $is_order = $mode->isOrderingMode();
95 
96  if (!$is_manage) {
97 
98  // render objectives
99  $this->showObjectives($is_order);
100 
101  // check for results
102  $has_results = \ilLOUserResults::hasResults($this->container->getId(), $user->getId());
103 
104  $tst_obj_id = \ilObject::_lookupObjId($this->loc_settings->getInitialTest());
105 
106  // render initial/qualified test
107  if (
108  $this->loc_settings->getInitialTest() &&
109  $this->loc_settings->isGeneralInitialTestVisible() &&
110  !$this->loc_settings->isInitialTestStart() &&
112  $tst_obj_id,
114  '',
115  $user->getId()
116  )
117  ) {
118  $this->output_html .= $this->renderTest($this->loc_settings->getInitialTest(), null, true);
119  } elseif (
120  $this->loc_settings->getQualifiedTest() &&
121  $this->loc_settings->isGeneralQualifiedTestVisible()
122  ) {
123  $this->output_html .= $this->renderTest($this->loc_settings->getQualifiedTest(), null, false);
124  }
125 
126  // render other materials
127  //$this->showMaterials(self::MATERIALS_OTHER, false, !$is_order);
128  } else {
129 
130  // render all materials
131  // not needed anymore
132  //$this->showMaterials(null, true);
133  }
134 
135  // reset results by setting or for admins
136  if (
137  \ilLOSettings::getInstanceByObjId($this->container->getId())->isResetResultsEnabled() or
138  $access->checkAccess('write', '', $this->container->getRefId())
139  ) {
140  if ($has_results) {
141  if (!$is_manage && !$is_order) {
142  $this->showButton('askReset', $lng->txt('crs_reset_results'));
143  }
144  }
145  }
146  return $this->output_html;
147  }
static hasResults(int $a_container_id, int $a_user_id)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupObjId(int $ref_id)
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
check condition
static getInstanceByObjId(int $a_obj_id)
showButton(string $a_cmd, string $a_text, string $a_target='', string $a_id="")
renderTest(int $a_test_ref_id, ?int $a_objective_id, bool $a_is_initial=false)
+ Here is the call graph for this function:

◆ renderProgressMeter()

static ILIAS\Containter\Content\ObjectiveRenderer::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 = '' 
)
static

Render progress meter.

Parameters
int | null$a_perc_result
int | null$a_perc_limit
int | null$a_compare_value
string | null$a_caption
string | null$a_url
string | null$a_tt_id
string | null$a_tt_txt
string | null$a_next_step
bool$a_sub
int$a_sub_style
string$a_main_text
string$a_required_text
Returns
string

Definition at line 660 of file class.ObjectiveRenderer.php.

References $DIC, ilTooltipGUI\addTooltip(), and ilLinkButton\getInstance().

673  : string {
674  global $DIC;
675 
676  $tpl = new \ilTemplate("tpl.objective_progressmeter.html", true, true, "Services/Container");
677 
678  $lng = $DIC->language();
679  $lng->loadLanguageModule('crs');
680 
681 
682 
683  if (is_numeric($a_perc_result)) {
684  $uiFactory = $DIC->ui()->factory();
685  $uiRenderer = $DIC->ui()->renderer();
686 
687  $pMeter = $uiFactory->chart()->progressMeter()->standard(
688  100,
689  (int) $a_perc_result,
690  (int) $a_perc_limit,
691  (int) $a_compare_value
692  );
693  $tpl->setVariable('PROGRESS_METER', $uiRenderer->render($pMeter));
694  }
695 
696  if ($a_caption) {
697  if ($a_url) {
698  $button = \ilLinkButton::getInstance();
699  $button->setCaption($a_caption, false);
700  $button->setUrl($a_url);
701 
702  $tpl->setCurrentBlock("statustxt_bl");
703  $tpl->setVariable("TXT_PROGRESS_STATUS", $button->render());
704  } else {
705  $tpl->setCurrentBlock("statustxt_no_link_bl");
706  $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
707  }
708  $tpl->parseCurrentBlock();
709  }
710 
711  if ($a_next_step) {
712  //$tpl->setCurrentBlock("nstep_bl");
713  $tpl->setVariable("TXT_NEXT_STEP", $a_next_step);
714  //$tpl->parseCurrentBlock();
715  }
716 
717  if ($a_tt_id &&
718  $a_tt_txt) {
719  \ilTooltipGUI::addTooltip($a_tt_id, $a_tt_txt);
720  }
721 
722  if ($a_sub) {
723  $tpl->setVariable("SUB_STYLE", ' style="padding-left: ' . $a_sub_style . 'px;"');
724  $tpl->setVariable("SUB_INIT", $a_sub);
725  }
726 
727  return $tpl->get();
728  }
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: feed.php:28
static addTooltip(string $a_el_id, string $a_text, string $a_container="", string $a_my="bottom center", string $a_at="top center", bool $a_use_htmlspecialchars=true)
+ Here is the call graph for this function:

◆ renderTest()

ILIAS\Containter\Content\ObjectiveRenderer::renderTest ( int  $a_test_ref_id,
?int  $a_objective_id,
bool  $a_is_initial = false 
)
protected

Definition at line 223 of file class.ObjectiveRenderer.php.

References ilObject\_lookupObjId(), ilObject\_lookupTitle(), and ilCourseObjective\lookupObjectiveTitle().

Referenced by ILIAS\Containter\Content\ObjectiveRenderer\renderObjective(), and ILIAS\Containter\Content\ObjectiveRenderer\renderObjectives().

227  : string {
228  $tree = $this->domain->repositoryTree();
229  $lng = $this->domain->lng();
230 
231  $node_data = [];
232  if ($a_test_ref_id) {
233  $node_data = $tree->getNodeData($a_test_ref_id);
234  }
235  if (!isset($node_data['child']) || !$node_data['child']) {
236  return '';
237  }
238 
239  // update ti
240  if ($a_objective_id) {
241  if ($a_is_initial) {
242  $title = sprintf($lng->txt('crs_loc_itst_for_objective'), \ilCourseObjective::lookupObjectiveTitle($a_objective_id));
243  } else {
244  $title = sprintf($lng->txt('crs_loc_qtst_for_objective'), \ilCourseObjective::lookupObjectiveTitle($a_objective_id));
245  }
246  $node_data['objective_id'] = $a_objective_id;
247  $node_data['objective_status'] = false;
248  } else {
249  $obj_id = \ilObject::_lookupObjId($a_test_ref_id);
250  $title = \ilObject::_lookupTitle($obj_id);
251 
252  $title .= (
253  ' (' .
254  (
255  $a_is_initial
256  ? $lng->txt('crs_loc_itest_info')
257  : $lng->txt('crs_loc_qtest_info')
258  ) .
259  ')'
260  );
261  $node_data['objective_id'] = 0;
262  }
263 
264  $node_data['title'] = $title;
265 
266  return "<div class='ilContObjectivesViewTestItem'>" . $this->renderer->getItemRenderer()->renderItem($node_data) . "</div>";
267  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showButton()

ILIAS\Containter\Content\ObjectiveRenderer::showButton ( string  $a_cmd,
string  $a_text,
string  $a_target = '',
string  $a_id = "" 
)
protected

Definition at line 1042 of file class.ObjectiveRenderer.php.

Referenced by ILIAS\Containter\Content\ObjectiveRenderer\renderObjectives(), and ILIAS\Containter\Content\ObjectiveRenderer\showObjectives().

1047  : void {
1048  $ilToolbar = $this->gui->toolbar();
1049  $ilCtrl = $this->gui->ctrl();
1050 
1051  // #11842
1052  $ilToolbar->addButton(
1053  $a_text,
1054  $ilCtrl->getLinkTarget($this->container_gui, $a_cmd),
1055  $a_target,
1056  null,
1057  '',
1058  $a_id
1059  );
1060  }
+ Here is the caller graph for this function:

◆ showObjectives()

ILIAS\Containter\Content\ObjectiveRenderer::showObjectives ( bool  $a_is_order = false)

Definition at line 154 of file class.ObjectiveRenderer.php.

References $ilSetting, ilCourseObjective\_getObjectiveIds(), ilAccordionGUI\FIRST_OPEN, ilLOSettings\getInstanceByObjId(), ilLOUtils\hasActiveRun(), ILIAS\Containter\Content\ObjectiveRenderer\parseLOUserResults(), ILIAS\Containter\Content\ObjectiveRenderer\renderObjective(), ILIAS\Containter\Content\ObjectiveRenderer\showButton(), and ilLOSettings\TYPE_TEST_INITIAL.

Referenced by ILIAS\Containter\Content\ObjectiveRenderer\renderObjectives().

154  : void
155  {
156  $lng = $this->domain->lng();
157  $ilSetting = $this->domain->settings();
158  // All objectives
159  if (!count($objective_ids = \ilCourseObjective::_getObjectiveIds($this->container->getId(), true))) {
160  return;
161  }
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);
166  }
167 
168  $acc = null;
169  if (!$a_is_order) {
170  $acc = new \ilAccordionGUI();
171  $acc->setUseSessionStorage(true);
172  $acc->setAllowMultiOpened(true);
173  $acc->setBehaviour(\ilAccordionGUI::FIRST_OPEN);
174  $acc->setId("crsobjtv_" . $this->container->getId());
175  } else {
176  $this->renderer->addCustomBlock('lobj', $lng->txt('crs_objectives'));
177  }
178 
179  $lur_data = $this->parseLOUserResults();
180  $has_initial = \ilLOSettings::getInstanceByObjId($this->container->getId())->worksWithInitialTest();
181  $has_lo_page = false;
182  $obj_cnt = 0;
183  foreach ($objective_ids as $objective_id) {
184  if (
185  $has_initial &&
186  (
187  !isset($lur_data[$objective_id]) or
189  $this->container->getId(),
190  \ilLOSettings::getInstanceByObjId($this->container->getId())->getInitialTest(),
191  $objective_id
192  )
193  )
194  ) {
195  $lur_data[$objective_id] = array("type" => \ilLOSettings::TYPE_TEST_INITIAL);
196  }
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);
199  }
200  $obj_cnt++;
201  }
202 
203  // buttons for showing/hiding all objectives
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");
209  }
210 
211  // order/block
212  if ($a_is_order) {
213  $this->output_html .= $this->renderer->getHTML();
214 
215  $this->renderer->resetDetails();
216  }
217  // view/accordion
218  else {
219  $this->output_html .= "<div class='ilCrsObjAcc'>" . $acc->getHTML() . "</div>";
220  }
221  }
static hasActiveRun(int $a_container_id, int $a_test_ref_id, int $a_objective_id)
renderObjective(int $a_objective_id, bool &$a_has_lo_page, \ilAccordionGUI $a_accordion=null, array $a_lo_result=null)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
static getInstanceByObjId(int $a_obj_id)
showButton(string $a_cmd, string $a_text, string $a_target='', string $a_id="")
global $ilSetting
Definition: privfeed.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $container

ilContainer ILIAS\Containter\Content\ObjectiveRenderer::$container
protected

Definition at line 48 of file class.ObjectiveRenderer.php.

◆ $container_gui

ilContainerGUI ILIAS\Containter\Content\ObjectiveRenderer::$container_gui
protected

Definition at line 47 of file class.ObjectiveRenderer.php.

◆ $content_style_domain

ILIAS Style Content Object ObjectFacade ILIAS\Containter\Content\ObjectiveRenderer::$content_style_domain
protected

Definition at line 42 of file class.ObjectiveRenderer.php.

◆ $domain

InternalDomainService ILIAS\Containter\Content\ObjectiveRenderer::$domain
protected

Definition at line 51 of file class.ObjectiveRenderer.php.

◆ $gui

InternalGUIService ILIAS\Containter\Content\ObjectiveRenderer::$gui
protected

Definition at line 50 of file class.ObjectiveRenderer.php.

◆ $list_gui

array ILIAS\Containter\Content\ObjectiveRenderer::$list_gui = []
protected

Definition at line 52 of file class.ObjectiveRenderer.php.

◆ $lng

ilLanguage ILIAS\Containter\Content\ObjectiveRenderer::$lng
protected

Definition at line 40 of file class.ObjectiveRenderer.php.

◆ $loc_settings

ilLOSettings ILIAS\Containter\Content\ObjectiveRenderer::$loc_settings
protected

Definition at line 45 of file class.ObjectiveRenderer.php.

◆ $objective_list_gui

ilCourseObjectiveListGUI ILIAS\Containter\Content\ObjectiveRenderer::$objective_list_gui
protected

Definition at line 39 of file class.ObjectiveRenderer.php.

◆ $output_html

string ILIAS\Containter\Content\ObjectiveRenderer::$output_html = ""
protected

◆ $rendered_items

array ILIAS\Containter\Content\ObjectiveRenderer::$rendered_items
protected

Definition at line 38 of file class.ObjectiveRenderer.php.

◆ $renderer

ilContainerRenderer ILIAS\Containter\Content\ObjectiveRenderer::$renderer
protected

Definition at line 44 of file class.ObjectiveRenderer.php.

◆ $request

ILIAS Container StandardGUIRequest ILIAS\Containter\Content\ObjectiveRenderer::$request
protected

Definition at line 41 of file class.ObjectiveRenderer.php.

◆ $test_assignments

ilLOTestAssignments ILIAS\Containter\Content\ObjectiveRenderer::$test_assignments
protected

Definition at line 43 of file class.ObjectiveRenderer.php.

◆ $view_mode

string ILIAS\Containter\Content\ObjectiveRenderer::$view_mode
protected

Definition at line 49 of file class.ObjectiveRenderer.php.

◆ CHECKBOX_ADMIN

const ILIAS\Containter\Content\ObjectiveRenderer::CHECKBOX_ADMIN = 1

Definition at line 36 of file class.ObjectiveRenderer.php.

◆ CHECKBOX_DOWNLOAD

const ILIAS\Containter\Content\ObjectiveRenderer::CHECKBOX_DOWNLOAD = 2

Definition at line 37 of file class.ObjectiveRenderer.php.

◆ CHECKBOX_NONE

const ILIAS\Containter\Content\ObjectiveRenderer::CHECKBOX_NONE = 0

Definition at line 35 of file class.ObjectiveRenderer.php.

◆ MATERIALS_OTHER

const ILIAS\Containter\Content\ObjectiveRenderer::MATERIALS_OTHER = 2

Definition at line 33 of file class.ObjectiveRenderer.php.

◆ MATERIALS_TESTS

const ILIAS\Containter\Content\ObjectiveRenderer::MATERIALS_TESTS = 1

Definition at line 32 of file class.ObjectiveRenderer.php.


The documentation for this class was generated from the following file: