ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilContainerObjectiveGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilContainerObjectiveGUI:
+ Collaboration diagram for ilContainerObjectiveGUI:

Public Member Functions

 __construct (ilContainerGUI $container_gui_obj, \ILIAS\Container\Content\ItemPresentationManager $item_presentation)
 
 getTestAssignments ()
 
 getSettings ()
 
 getMainContent ()
 Get content HTML for main column, this one may be overwritten in derived classes. More...
 
 initRenderer ()
 Init container renderer. More...
 
 renderItemList ()
 
 showObjectives (bool $a_is_order=false)
 
- Public Member Functions inherited from ilContainerContentGUI
 getContainerObject ()
 
 getContainerGUI ()
 
 setOutput ()
 This method sets the output of the right and main column in the global standard template. More...
 
 getMainContent ()
 Get content HTML for main column, this one may be overwritten in derived classes. More...
 
 determinePageEmbeddedBlocks (string $a_container_page_html)
 Determine all blocks that are embedded in the container page. More...
 
 addEmbeddedBlock (string $block_type, $block_parameter)
 Add embedded block. More...
 
 getEmbeddedBlocks ()
 
 renderPageEmbeddedBlocks ()
 
 renderItem (array $a_item_data, int $a_position=0, bool $a_force_icon=false, string $a_pos_prefix="", string $object_group_list_presentation="")
 
 renderCard (array $a_item_data, int $a_position=0, bool $a_force_icon=false, string $a_pos_prefix="")
 
 insertPageEmbeddedBlocks (string $a_output_html)
 Insert blocks into container page. More...
 
 getSingleTypeBlockAsynch (string $type)
 Render single block. More...
 
 getGroupedObjTypes ()
 Get grouped repository object types. More...
 
 getIntroduction ()
 
 getObjectGroupsHTML (int $a_pos=0)
 
 renderObjectGroup (array $a_obgr)
 

Static Public Member Functions

static renderProgressBar (?int $a_perc_result=null, ?int $a_perc_limit=null, ?string $a_css=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)
 Render progress bar(s) More...
 
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 bar(s) 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
 
- Data Fields inherited from ilContainerContentGUI
const DETAILS_DEACTIVATED = 0
 
const DETAILS_TITLE = 1
 
const DETAILS_ALL = 2
 
const VIEW_MODE_LIST = 0
 
const VIEW_MODE_TILE = 1
 
ilContainerGUI $container_gui
 
ilContainer $container_obj
 

Protected Member Functions

 getDetailsLevel (int $a_item_id)
 
 renderTest (int $a_test_ref_id, int $a_objective_id, bool $a_is_initial=false)
 
 showMaterials (?int $a_mode=null, bool $a_is_manage=false, bool $a_as_accordion=false)
 
 buildObjectiveMap ()
 Stays in ContainergGUI, needed for addItemDetails. More...
 
 addItemDetails (ilObjectListGUI $a_item_list_gui, array $a_item)
 Stays in ContainergGUI, inject in renderer. More...
 
 updateResult (array $a_res, int $a_item_ref_id, int $a_objective_id, int $a_user_id)
 
 renderObjective (int $a_objective_id, bool &$a_has_lo_page, ?ilAccordionGUI $a_accordion=null, ?array $a_lo_result=null)
 
 initTestAssignments ()
 
 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 Member Functions inherited from ilContainerContentGUI
 getViewMode ()
 
 getRightColumnHTML ()
 
 getCenterColumnHTML ()
 
 initRenderer ()
 Init container renderer. More...
 
 getItemGUI (array $item_data)
 
 hasForcedOrderByStartDate (string $type)
 
 getUniqueItemId (array $a_item_data)
 

Protected Attributes

ILIAS Container InternalGUIService $gui
 
ilTabsGUI $tabs
 
array $objective_map = []
 
ilToolbarGUI $toolbar
 
int $force_details = 0
 
ilCourseObjectiveListGUI $objective_list_gui
 
array $rendered_items = []
 
ilLOSettings $loc_settings
 
ILIAS Style Content Object ObjectFacade $content_style_domain
 
- Protected Attributes inherited from ilContainerContentGUI
ILIAS Container Content ItemPresentationManager $item_presentation
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilObjUser $user
 
ilLanguage $lng
 
ilAccessHandler $access
 
ilDBInterface $db
 
ilRbacSystem $rbacsystem
 
ilSetting $settings
 
ilObjectDefinition $obj_definition
 
int $details_level = self::DETAILS_DEACTIVATED
 
ilContainerRenderer $renderer
 
ilLogger $log
 
int $view_mode
 
array $embedded_block = []
 
array $items = []
 
array $list_gui = []
 
ClipboardManager $clipboard
 
StandardGUIRequest $request
 
ItemManager $item_manager
 
BlockSessionRepository $block_repo
 
int $block_limit = 0
 
array $type_grps = []
 
int $force_details
 
ilContainerUserFilter $container_user_filter
 

Private Attributes

ilLogger $logger
 
string $output_html = ''
 
ilLOTestAssignments $test_assignments = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning /** GUI class for course objective view

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 25 of file class.ilContainerObjectiveGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerObjectiveGUI::__construct ( ilContainerGUI  $container_gui_obj,
\ILIAS\Container\Content\ItemPresentationManager  $item_presentation 
)

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

46 {
47 global $DIC;
48 $this->tabs = $DIC->tabs();
49 $this->toolbar = $DIC->toolbar();
50 $this->logger = $DIC->logger()->crs();
51 parent::__construct($container_gui_obj, $item_presentation);
52 $this->initTestAssignments();
53
54 // ak: note, also in ILIAS <= 7 this page did not
55 // use the container style, it could however, but this would be a conceptual change
56 $this->content_style_domain = $DIC
57 ->contentStyle()
58 ->domain()
59 ->styleForObjId(0);
60 $this->gui = $DIC->container()->internal()->gui();
61 }
ILIAS Container Content ItemPresentationManager $item_presentation
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ilContainerContentGUI\$item_presentation, ILIAS\GlobalScreen\Provider\__construct(), initTestAssignments(), ILIAS\Repository\logger(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ addItemDetails()

ilContainerObjectiveGUI::addItemDetails ( ilObjectListGUI  $a_item_list_gui,
array  $a_item 
)
protected

Stays in ContainergGUI, inject in renderer.

Definition at line 475 of file class.ilContainerObjectiveGUI.php.

475 : void
476 {
477 $ilUser = $this->user;
478
479 // order
480 if ($this->getContainerGUI()->isActiveOrdering()) {
481 $a_item_list_gui->enableCommands(true, true);
482 $a_item_list_gui->enableProperties(false);
483 }
484 // view
485 elseif (!$this->getContainerGUI()->isActiveAdministrationPanel()) {
486 $a_item_list_gui->enableCommands(true, true);
487 $a_item_list_gui->enableProperties(false);
488 }
489
490 if ($a_item['objective_id'] ?? false) {
491 $a_item_list_gui->setDefaultCommandParameters(['objective_id' => $a_item['objective_id']]);
492
493
494 if ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) {
495 $a_item_list_gui->setConditionTarget($this->getContainerObject()->getRefId(), (int) $a_item['objective_id'], 'lobj');
496 // check conditions of target
497 $fullfilled = ilConditionHandler::_checkAllConditionsOfTarget($this->getContainerObject()->getRefId(), (int) $a_item['objective_id'], 'lobj');
498 if (!$fullfilled || $a_item['objective_status']) {
499 $a_item_list_gui->disableTitleLink(true);
500 }
501 }
503 $this->getContainerObject()->getId(),
504 $ilUser->getId(),
505 $a_item['objective_id'],
507 );
508
509 $res = $this->updateResult($res, $a_item['ref_id'], $a_item['objective_id'], $ilUser->getId());
510
511 if ($res['is_final'] ?? false) {
512 $a_item_list_gui->disableTitleLink(true);
513 $a_item_list_gui->enableProperties(true);
514 $a_item_list_gui->addCustomProperty(
515 $this->lng->txt('crs_loc_passes_reached'),
516 '',
517 true
518 );
519 } elseif ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) {
520 $poss_pass = ilCourseObjective::lookupMaxPasses($a_item['objective_id']);
521
522 if ($poss_pass) {
523 $a_item_list_gui->enableProperties(true);
524 $a_item_list_gui->addCustomProperty(
525 $this->lng->txt('crs_loc_passes_left'),
526 (($poss_pass - $res['tries']) > 0) ? ($poss_pass - $res['tries']) : 1,
527 false
528 );
529 }
530 }
531 }
532 }
static _checkAllConditionsOfTarget(int $a_target_ref_id, int $a_target_id, string $a_target_type="", int $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
updateResult(array $a_res, int $a_item_ref_id, int $a_objective_id, int $a_user_id)
static lookupMaxPasses(int $a_objective_id)
static lookupResult(int $a_course_obj_id, int $a_user_id, int $a_objective_id, int $a_tst_type)
setDefaultCommandParameters(array $params)
setConditionTarget(int $ref_id, int $obj_id, string $target_type)
disableTitleLink(bool $status)
addCustomProperty(string $property='', string $value='', bool $alert=false, bool $newline=false)
enableCommands(bool $status, bool $std_only=false)
enableProperties(bool $status)
foreach($_POST as $key=> $value) $res

References $res, ilConditionHandler\_checkAllConditionsOfTarget(), ilObjectListGUI\addCustomProperty(), ilObjectListGUI\disableTitleLink(), ilObjectListGUI\enableCommands(), ilObjectListGUI\enableProperties(), ILIAS\Survey\Mode\getId(), ILIAS\Repository\lng(), ilCourseObjective\lookupMaxPasses(), ilLOUserResults\lookupResult(), ilObjectListGUI\setConditionTarget(), ilObjectListGUI\setDefaultCommandParameters(), and ilLOUserResults\TYPE_QUALIFIED.

Referenced by initRenderer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildAccordionContent()

ilContainerObjectiveGUI::buildAccordionContent ( array  $a_items)
protected

Definition at line 1252 of file class.ilContainerObjectiveGUI.php.

1252 : string
1253 {
1254 $tpl = new ilTemplate("tpl.objective_accordion_content.html", true, true, "components/ILIAS/Container");
1255 foreach ($a_items as $item) {
1256 $tpl->setCurrentBlock("items_bl");
1257 $tpl->setVariable("ITEM", $item);
1259 }
1260 return $tpl->get();
1261 }
ilGlobalTemplateInterface $tpl
special template class to simplify handling of ITX/PEAR
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References ILIAS\News\Common\Table\$tpl, ILIAS\UICore\GlobalTemplate\get(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), and ILIAS\UICore\GlobalTemplate\setVariable().

+ Here is the call graph for this function:

◆ buildAccordionTitle()

ilContainerObjectiveGUI::buildAccordionTitle ( ilCourseObjective  $a_objective,
?array  $a_lo_result = null 
)
protected

Definition at line 1121 of file class.ilContainerObjectiveGUI.php.

1124 : string {
1125 global $DIC;
1126
1127 $renderer = $DIC->ui()->renderer();
1128 $ui_factory = $DIC->ui()->factory();
1129
1130 $tpl = new ilTemplate("tpl.objective_accordion_title.html", true, true, "components/ILIAS/Container");
1131
1132 if ($a_lo_result) {
1134 "PROGRESS_BAR",
1135 self::buildObjectiveProgressBar(
1136 $this->loc_settings->worksWithInitialTest(),
1137 $a_objective->getObjectiveId(),
1138 $a_lo_result
1139 )
1140 );
1141 }
1142
1143 $tpl->setVariable("TITLE", $this->lng->txt("crs_loc_learning_objective") . ": " . trim($a_objective->getTitle()));
1144 $tpl->setVariable("DESCRIPTION", nl2br(trim($a_objective->getDescription())));
1145
1146 $initial_res = null;
1147 $initial_lim = null;
1148 if ($this->loc_settings->worksWithInitialTest()) {
1149 if (array_key_exists('initial', $a_lo_result)) {
1150 $initial_res = (int) ($a_lo_result['initial']['result_perc'] ?? 0);
1151 $initial_lim = (int) ($a_lo_result['initial']['limit_perc'] ?? 0);
1152 }
1153 if (
1154 $a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
1155 isset($a_lo_result['result_perc'])
1156 ) {
1157 $initial_res = (int) ($a_lo_result['result_perc'] ?? 0);
1158 $initial_lim = (int) ($a_lo_result['limit_perc'] ?? 0);
1159 }
1160 }
1161
1162 if ($initial_res !== null) {
1164 $a_lo_result["itest"],
1165 $a_lo_result["user_id"]
1166 );
1167
1168 if ($link !== '') {
1169 $tpl->setCurrentBlock('i_with_link');
1171 'IBTN',
1172 $renderer->render(
1173 $ui_factory->button()->shy(
1174 $this->lng->txt('crs_objective_result_details'),
1175 $link
1176 )
1177 )
1178 );
1180 }
1181
1182 $tpl->setCurrentBlock('res_initial');
1184 'IRESULT',
1185 sprintf(
1186 $this->lng->txt('crs_objective_result_summary_initial'),
1187 $initial_res . '%',
1188 (int) $initial_lim . '%'
1189 )
1190 );
1192 }
1193
1194 $qual_res = null;
1195 $qual_lim = null;
1196
1197 if (($a_lo_result['type'] ?? null) == ilLOUserResults::TYPE_QUALIFIED) {
1198 $qual_res = (int) $a_lo_result['result_perc'];
1199 $qual_lim = (int) $a_lo_result['limit_perc'];
1200 }
1201
1202 if ($qual_res !== null) {
1204 $a_lo_result["qtest"],
1205 $a_lo_result["user_id"]
1206 );
1207
1208 if ($link !== '') {
1209 $tpl->setCurrentBlock('q_with_link');
1211 'QBTN',
1212 $renderer->render(
1213 $ui_factory->button()->shy(
1214 $this->lng->txt('crs_objective_result_details'),
1215 $link
1216 )
1217 )
1218 );
1220 }
1221 $tpl->setCurrentBlock('res_qualifying');
1223 'QRESULT',
1224 sprintf(
1225 $this->lng->txt('crs_objective_result_summary_qualifying'),
1226 $qual_res . '%',
1227 (int) $qual_lim . '%'
1228 )
1229 );
1231 }
1232
1233 $this->logger->dump($a_lo_result);
1234
1236 $this->loc_settings->worksWithInitialTest(),
1237 $a_objective->getObjectiveId(),
1238 $a_lo_result
1239 );
1240 if ($summary !== '') {
1241 $tpl->setCurrentBlock('objective_summary');
1242 $tpl->setVariable('SUMMARY_TXT', $summary);
1244 }
1245
1246 // #15510
1247 $tpl->setVariable("ANCHOR_ID", "objtv_acc_" . $a_objective->getObjectiveId());
1248
1249 return $tpl->get();
1250 }
static getObjectiveResultSummary(bool $a_has_initial_test, int $a_objective_id, ?array $a_lo_result)
Get objective result summary.
static getTestResultLinkForUser(int $a_test_ref_id, int $a_user_id)

◆ buildObjectiveMap()

ilContainerObjectiveGUI::buildObjectiveMap ( )
protected

Stays in ContainergGUI, needed for addItemDetails.

Definition at line 430 of file class.ilContainerObjectiveGUI.php.

430 : array
431 {
432 $objective_map = [];
433 // begin-patch lok
434 if (count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) {
435 // end-patch lok
436 foreach ($objective_ids as $objective_id) {
437 foreach (ilCourseObjectiveMaterials::_getAssignedMaterials($objective_id) as $mat_ref_id) {
438 $objective_map["material"][$mat_ref_id][] = $objective_id;
439
440 if (!isset($objective_map["names"][$objective_id])) {
441 $objective = new ilCourseObjective($this->getContainerObject(), $objective_id);
442 $objective_map["names"][$objective_id] = $objective->getTitle();
443 }
444 }
445 }
446
447 // initial/qualifying test
448 $tst = $this->loc_settings->getInitialTest();
449 if ($tst) {
450 $objective_map["test_i"] = $tst;
451 }
452 $tst = $this->loc_settings->getQualifiedTest();
453 if ($tst) {
454 $objective_map["test_q"] = $tst;
455 }
456
457 // objective test assignments
458 $ass_test = new ilLOTestAssignments($this->getContainerObject()->getId());
459 foreach ($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_INITIAL) as $ass) {
460 $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
461 $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
462 }
463 foreach ($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_QUALIFIED) as $ass) {
464 $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
465 $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
466 }
467 }
468
469 return $objective_map;
470 }
static _getAssignedMaterials(int $a_objective_id)
class ilcourseobjective
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
Settings for LO courses.

References ilCourseObjectiveMaterials\_getAssignedMaterials(), ilCourseObjective\_getObjectiveIds(), ILIAS\Survey\Mode\getId(), ilCourseObjective\lookupObjectiveTitle(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

Referenced by initRenderer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildObjectiveProgressBar()

static ilContainerObjectiveGUI::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 1011 of file class.ilContainerObjectiveGUI.php.

1018 : string {
1019 global $DIC;
1020
1021 $lng = $DIC->language();
1022 $lng->loadLanguageModule('crs');
1023
1024 // tooltip (has to be unique!)
1025
1026 $tooltip_id = "crsobjtvusr_" . $a_objective_id . "_" . $a_lo_result["type"] . "_" . ((int) $a_sub);
1027 if ($a_tt_suffix !== null) {
1028 $tooltip_id .= "_" . $a_tt_suffix;
1029 }
1030
1031 $tt_txt = sprintf(
1032 $lng->txt("crs_loc_tt_info"),
1033 $a_lo_result["result_perc"] ?? '0',
1034 $a_lo_result["limit_perc"] ?? '0'
1035 );
1036
1037
1038 $is_qualified = ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED);
1039 $is_qualified_initial = ($a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
1040 ilLOSettings::getInstanceByObjId($a_lo_result['course_id'] ?? 0)->isInitialTestQualifying());
1041 $has_completed = (($a_lo_result["status"] ?? 0) == ilLOUserResults::STATUS_COMPLETED);
1042
1043 $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null;
1044 $compare_value = null;
1045
1046 if ($is_qualified ||
1047 $is_qualified_initial) {
1048 $progress_txt = $lng->txt("crs_loc_progress_result_qtest");
1049 $tt_txt = $lng->txt("crs_loc_tab_qtest") . ": " . $tt_txt;
1050
1051 if ($has_completed) {
1052 $next_step = $lng->txt("crs_loc_progress_objective_complete");
1053 $bar_color = "ilCourseObjectiveProgressBarCompleted";
1054
1055 // render 2nd progressbar if there is also an initial test
1056 if ($is_qualified &&
1057 $a_has_initial_test &&
1058 is_array($a_lo_result["initial"])) {
1059 $a_lo_result["initial"]["itest"] = $a_lo_result["itest"];
1060
1061 // force list mode to get rid of next step
1062 #$initial_sub = self::buildObjectiveProgressBar(true, $a_objective_id, $a_lo_result["initial"], true, true, $a_tt_suffix);
1063 $compare_value = $a_lo_result['initial']['result_perc'];
1064 }
1065 } else {
1066 $next_step = $lng->txt("crs_loc_progress_do_qualifying_again");
1067 $bar_color = "ilCourseObjectiveProgressBarFailed";
1068 }
1069 }
1070 // initial test
1071 elseif ($a_lo_result["status"] ?? false) {
1072 $progress_txt = $lng->txt("crs_loc_progress_result_itest");
1073 $tt_txt = $lng->txt("crs_loc_tab_itest") . ": " . $tt_txt;
1074
1075 $bar_color = "ilCourseObjectiveProgressBarNeutral";
1076 $next_step = $has_completed
1077 ? $lng->txt("crs_loc_progress_do_qualifying")
1078 : $lng->txt("crs_loc_suggested");
1079 }
1080 // not attempted: no progress bar
1081 else {
1082 $next_step = $a_has_initial_test
1083 ? $lng->txt("crs_loc_progress_no_result_do_initial")
1084 : $lng->txt("crs_loc_progress_no_result_no_initial");
1085 }
1086
1087 // link to test statistics
1088 $relevant_test_id = ($a_lo_result["qtest"] ?? 0)
1089 ?: ($a_lo_result["itest"] ?? 0);
1090 if ($relevant_test_id) {
1091 $test_url = ilLOUtils::getTestResultLinkForUser($relevant_test_id, $a_lo_result["user_id"] ?? 0);
1092 }
1093
1094 $main_text = $lng->txt('crs_loc_itest_info');
1095 if ($a_lo_result['type'] == ilLOSettings::TYPE_TEST_QUALIFIED) {
1096 $main_text = $lng->txt('crs_loc_qtest_info');
1097 }
1098
1099
1100
1102 $a_lo_result["result_perc"] ?? null,
1103 $a_lo_result["limit_perc"] ?? null,
1104 $compare_value,
1105 $progress_txt,
1106 $test_url,
1107 $tooltip_id,
1108 $tt_txt,
1109 $a_list_mode
1110 ? null
1111 : $next_step,
1112 (bool) $initial_sub,
1113 $a_list_mode
1114 ? 30
1115 : 10,
1116 $main_text,
1117 $lng->txt('crs_lobj_pm_min_goal')
1118 );
1119 }
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 bar(s)
static getInstanceByObjId(int $a_obj_id)
loadLanguageModule(string $a_module)
Load language module.
txt(string|LanguageIdentifier $a_topic, ?int $n=null)
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

◆ getDetailsLevel()

ilContainerObjectiveGUI::getDetailsLevel ( int  $a_item_id)
protected

Definition at line 73 of file class.ilContainerObjectiveGUI.php.

73 : int
74 {
75 // no details anymore
76 return self::DETAILS_ALL;
77 }

References ilContainerContentGUI\DETAILS_ALL.

◆ getMainContent()

ilContainerObjectiveGUI::getMainContent ( )

Get content HTML for main column, this one may be overwritten in derived classes.

Reimplemented from ilContainerContentGUI.

Definition at line 79 of file class.ilContainerObjectiveGUI.php.

79 : string
80 {
82 $ilAccess = $this->access;
83 $ilUser = $this->user;
84 $ilCtrl = $this->ctrl;
85 $has_results = false;
86
87 //$tpl = new ilTemplate("tpl.container_page.html", true, true, "components/ILIAS/Container");
88
89 if ($ilAccess->checkAccess('write', '', $this->getContainerObject()->getRefId())) {
90 // check for results
91 if (ilLOUserResults::hasResults($this->getContainerObject()->getId(), $ilUser->getId())) {
92 $ilToolbar = new ilToolbarGUI();
93 $ilToolbar->addButton(
94 $lng->txt('crs_reset_results'),
95 $ilCtrl->getLinkTargetByClass(get_class($this->getContainerGUI()), 'reset')
96 );
97 }
98 }
99
100 return parent::getMainContent();
101
102 // Feedback
103 // @todo
104 // $this->__showFeedBack();
105
106 $this->items = $this->getContainerObject()->getSubItems($this->getContainerGUI()->isActiveAdministrationPanel());
107
108 $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
109 $is_order = $this->getContainerGUI()->isActiveOrdering();
110
111 $this->loc_settings = ilLOSettings::getInstanceByObjId($this->getContainerObject()->getId());
112
113 $this->initRenderer();
114
115 if (!$is_manage) {
116
117 // render objectives
118 $this->showObjectives($is_order);
119
120 // check for results
121 $has_results = ilLOUserResults::hasResults($this->getContainerObject()->getId(), $ilUser->getId());
122
123 $tst_obj_id = ilObject::_lookupObjId($this->loc_settings->getInitialTest());
124
125 // render initial/qualified test
126 if (
127 $this->loc_settings->getInitialTest() &&
128 $this->loc_settings->isGeneralInitialTestVisible() &&
129 !$this->loc_settings->isInitialTestStart() &&
131 ) {
132 $this->output_html .= $this->renderTest($this->loc_settings->getInitialTest(), 0, true);
133 } elseif (
134 $this->loc_settings->getQualifiedTest() &&
135 $this->loc_settings->isGeneralQualifiedTestVisible()
136 ) {
137 $this->output_html .= $this->renderTest($this->loc_settings->getQualifiedTest(), 0, false);
138 }
139
140 // render other materials
141 $this->showMaterials(self::MATERIALS_OTHER, false, !$is_order);
142 } else {
143
144 // render all materials
145 $this->showMaterials(null, true);
146 }
147
148 // reset results by setting or for admins
149 if (
150 ilLOSettings::getInstanceByObjId($this->getContainerObject()->getId())->isResetResultsEnabled() ||
151 $ilAccess->checkAccess('write', '', $this->getContainerObject()->getRefId())
152 ) {
153 if ($has_results && !$is_manage && !$is_order) {
154 $this->showButton('askReset', $lng->txt('crs_reset_results'));
155 }
156 }
157
158 $tpl->setVariable('CONTAINER_PAGE_CONTENT', $this->output_html);
159
160 return $tpl->get();
161 }
showMaterials(?int $a_mode=null, bool $a_is_manage=false, bool $a_as_accordion=false)
initRenderer()
Init container renderer.
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)
showObjectives(bool $a_is_order=false)
static hasResults(int $a_container_id, int $a_user_id)
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
check condition for a specific user and object

References ilContainerContentGUI\$access, ilContainerContentGUI\$ctrl, ilContainerContentGUI\$lng, ilContainerContentGUI\$tpl, ilContainerContentGUI\$user, ilObject\_lookupObjId(), ilConditionHandling\checkCondition(), ILIAS\UICore\GlobalTemplate\get(), ilContainerContentGUI\getContainerGUI(), ilContainerContentGUI\getContainerObject(), ILIAS\Survey\Mode\getId(), ilLOSettings\getInstanceByObjId(), ilLOUserResults\hasResults(), initRenderer(), ilConditionHandler\OPERATOR_FINISHED, renderTest(), ILIAS\UICore\GlobalTemplate\setVariable(), showButton(), showMaterials(), showObjectives(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getObjectiveResultSummary()

static ilContainerObjectiveGUI::getObjectiveResultSummary ( bool  $a_has_initial_test,
int  $a_objective_id,
?array  $a_lo_result 
)
static

Get objective result summary.

Definition at line 960 of file class.ilContainerObjectiveGUI.php.

964 : string {
965 global $DIC;
966
967 if ($a_lo_result === null) {
968 $a_lo_result["type"] = null;
969 }
970
971 $lng = $DIC->language();
972 $lng->loadLanguageModule('crs');
973
974 $is_qualified =
975 ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED);
976 $is_qualified_initial =
977 (
978 $a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
979 ilLOSettings::getInstanceByObjId($a_lo_result['course_id'] ?? 0)->isInitialTestQualifying()
980 );
981 $has_completed =
982 (($a_lo_result["status"] ?? 0) == ilLOUserResults::STATUS_COMPLETED);
983
984 $next_step = '';
985
986 if (
987 $is_qualified ||
988 $is_qualified_initial) {
989 if ($has_completed) {
990 $next_step = $lng->txt("crs_loc_progress_objective_complete");
991 } else {
992 $next_step = $lng->txt("crs_loc_progress_do_qualifying_again");
993 }
994 } // initial test
995 elseif ($a_lo_result["status"] ?? false) {
996 $next_step =
997 $has_completed ?
998 $lng->txt("crs_loc_progress_do_qualifying") :
999 $lng->txt("crs_loc_suggested");
1000 } else {
1001 $next_step = $a_has_initial_test ?
1002 $lng->txt("crs_loc_progress_no_result_do_initial") :
1003 $lng->txt("crs_loc_progress_no_result_no_initial");
1004 }
1005 return $next_step;
1006 }

◆ getSettings()

ilContainerObjectiveGUI::getSettings ( )

Definition at line 68 of file class.ilContainerObjectiveGUI.php.

69 {
71 }
Settings for LO courses.

References $loc_settings.

◆ getTestAssignments()

ilContainerObjectiveGUI::getTestAssignments ( )

Definition at line 63 of file class.ilContainerObjectiveGUI.php.

References $test_assignments.

◆ initRenderer()

ilContainerObjectiveGUI::initRenderer ( )

Init container renderer.

Reimplemented from ilContainerContentGUI.

Definition at line 163 of file class.ilContainerObjectiveGUI.php.

163 : void
164 {
165 parent::initRenderer();
166 $this->loc_settings = ilLOSettings::getInstanceByObjId($this->getContainerObject()->getId());
167 $this->objective_map = $this->buildObjectiveMap();
168 $this->renderer->setItemModifierClosure(function (ilObjectListGUI $a_item_list_gui, array $a_item) {
169 $this->addItemDetails($a_item_list_gui, $a_item);
170 });
171 }
renderer()
buildObjectiveMap()
Stays in ContainergGUI, needed for addItemDetails.
addItemDetails(ilObjectListGUI $a_item_list_gui, array $a_item)
Stays in ContainergGUI, inject in renderer.

References addItemDetails(), buildObjectiveMap(), ilContainerContentGUI\getContainerObject(), ILIAS\Survey\Mode\getId(), ilLOSettings\getInstanceByObjId(), and renderer().

Referenced by getMainContent(), and renderItemList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTestAssignments()

ilContainerObjectiveGUI::initTestAssignments ( )
protected

Definition at line 752 of file class.ilContainerObjectiveGUI.php.

752 : void
753 {
754 $this->test_assignments = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
755 }
static getInstance(int $a_container_id)

References ILIAS\Survey\Mode\getId(), and ilLOTestAssignments\getInstance().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseLOUserResults()

ilContainerObjectiveGUI::parseLOUserResults ( )
protected

Definition at line 758 of file class.ilContainerObjectiveGUI.php.

758 : array
759 {
760 $ilUser = $this->user;
761 $initial_status = null;
762
763 $res = [];
764
766
767 $lur = new ilLOUserResults($this->getContainerObject()->getId(), $ilUser->getId());
768 foreach ($lur->getCourseResultsForUserPresentation() as $objective_id => $types) {
769 // show either initial or qualified for objective
770 if (isset($types[ilLOUserResults::TYPE_INITIAL])) {
771 $initial_status = $types[ilLOUserResults::TYPE_INITIAL]["status"];
772 }
773
774 // qualified test has priority
775 if (isset($types[ilLOUserResults::TYPE_QUALIFIED])) {
776 $result = $types[ilLOUserResults::TYPE_QUALIFIED];
777 $result["type"] = ilLOUserResults::TYPE_QUALIFIED;
778 $result["initial"] = $types[ilLOUserResults::TYPE_INITIAL] ?? null;
779 } else {
780 $result = $types[ilLOUserResults::TYPE_INITIAL];
781 $result["type"] = ilLOUserResults::TYPE_INITIAL;
782 }
783
784 $result["initial_status"] = $initial_status;
785
786 $result["itest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL);
787 $result["qtest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
788
789 $res[$objective_id] = $result;
790 }
791
792 return $res;
793 }

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

Referenced by showObjectives().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderItemList()

ilContainerObjectiveGUI::renderItemList ( )

Definition at line 173 of file class.ilContainerObjectiveGUI.php.

173 : string
174 {
175 $this->initRenderer();
176 return $this->renderer->renderItemBlockSequence($this->item_presentation->getItemBlockSequence());
177 }

References initRenderer(), and renderer().

+ Here is the call graph for this function:

◆ renderObjective()

ilContainerObjectiveGUI::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
ilTemplateException

Definition at line 569 of file class.ilContainerObjectiveGUI.php.

574 : string {
575 $ilUser = $this->user;
577
578 $objective = new ilCourseObjective($this->getContainerObject(), $a_objective_id);
579
581
582 // sorting is handled by ilCourseObjectiveMaterials
583 // $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj',$a_objective_id,$items);
584
585 $objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
586
587 // #13381 - map material assignment to position
588 $sort_map = [];
589 foreach ($objectives_lm_obj->getMaterials() as $item) {
590 $sort_map[$item["lm_ass_id"]] = $item["position"];
591 }
592
593 $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
594 $is_order = $this->getContainerGUI()->isActiveOrdering();
595
596 $sort_content = [];
597
598 foreach ($items as $item) {
599 if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) {
600 continue;
601 }
602
603 $item_list_gui2 = $this->getItemGUI($item);
604 $item_list_gui2->enableIcon(true);
605
606 if ($is_order || $a_accordion) {
607 $item_list_gui2->enableCommands(true, true);
608 $item_list_gui2->enableProperties(false);
609 }
610
611 $chapters = $objectives_lm_obj->getChapters();
612 if (count($chapters)) {
613 $has_sections = false;
614 foreach ($chapters as $chapter) {
615 if ($chapter['ref_id'] != $item['child']) {
616 continue;
617 }
618 $has_sections = true;
619
620 $title = $item['title'] .
621 " › " . ilLMObject::_lookupTitle($chapter['obj_id']) .
622 " (" . $lng->txt('obj_' . $chapter['type']) . ")";
623
624 $item_list_gui2->setDefaultCommandParameters([
625 "obj_id" => $chapter['obj_id'],
626 "focus_id" => $chapter['obj_id'],
627 "focus_return" => $this->container_obj->getRefId()
628 ]);
629
630 if ($is_order) {
631 $item_list_gui2->setPositionInputField(
632 "[lobj][" . $a_objective_id . "][" . $chapter['lm_ass_id'] . "]",
633 sprintf('%d', $chapter['position'] * 10)
634 );
635 }
636
637 $sub_item_html = $item_list_gui2->getListItemHTML(
638 $item['ref_id'],
639 $item['obj_id'],
640 $title,
641 $item['description']
642 );
643
644 // #13381 - use materials order
645 $sort_key = str_pad($chapter['position'], 5, '0', STR_PAD_LEFT) . "_" . strtolower($title) . "_" . $chapter['lm_ass_id'];
646 $sort_content[$sort_key] = $sub_item_html;
647 }
648 }
649
650 $this->rendered_items[$item['child']] = true;
651
652 if ($lm_ass_id = $objectives_lm_obj->isAssigned($item['ref_id'], true)) {
653 if ($is_order) {
654 $item_list_gui2->setPositionInputField(
655 "[lobj][" . $a_objective_id . "][" . $lm_ass_id . "]",
656 sprintf('%d', $sort_map[$lm_ass_id] * 10)
657 );
658 }
659
660 $sub_item_html = $item_list_gui2->getListItemHTML(
661 $item['ref_id'],
662 $item['obj_id'],
663 $item['title'],
664 $item['description'] ?? ''
665 );
666
667 // #13381 - use materials order
668 $sort_key = str_pad($sort_map[$lm_ass_id], 5, '0', STR_PAD_LEFT) . "_" . strtolower($item['title']) . "_" . $lm_ass_id;
669 $sort_content[$sort_key] = $sub_item_html;
670 }
671 }
672
673 if ($this->getDetailsLevel($a_objective_id) === self::DETAILS_ALL) {
674 $this->objective_list_gui->enableCommands(false);
675 } else {
676 $this->objective_list_gui->enableCommands(true);
677 }
678
679 if ($is_order) {
680 $this->objective_list_gui->setPositionInputField(
681 "[lobj][" . $a_objective_id . "][0]",
682 (string) ($objective->__getPosition() * 10)
683 );
684 }
685
686 ksort($sort_content);
687
688 if (!$a_accordion) {
689 foreach ($sort_content as $sub_item_html) {
690 $this->objective_list_gui->addSubItemHTML($sub_item_html);
691 }
692
693 return $this->objective_list_gui->getObjectiveListItemHTML(
694 0,
695 $a_objective_id,
696 $objective->getTitle(),
697 $objective->getDescription(),
698 ($is_manage || $is_order)
699 );
700 }
701
702 $acc_content = $sort_content;
703
704 $initial_shown = false;
705 $initial_test_ref_id = $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL);
706 $initial_test_obj_id = ilObject::_lookupObjId($initial_test_ref_id);
707
708 if (
709 $initial_test_obj_id &&
710 $this->getSettings()->hasSeparateInitialTests() &&
711 !ilObjTestAccess::checkCondition($initial_test_obj_id, ilConditionHandler::OPERATOR_FINISHED, '', $ilUser->getId())
712 ) {
713 $acc_content[] = $this->renderTest(
714 $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL),
715 $a_objective_id,
716 true
717 );
718 $initial_shown = true;
719 } elseif ($this->getSettings()->hasSeparateQualifiedTests()) {
720 $acc_content[] = $this->renderTest(
721 $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_QUALIFIED),
722 $a_objective_id,
723 false
724 );
725 }
726
727 $co_page = null;
728 if (ilPageUtil::_existsAndNotEmpty("lobj", $objective->getObjectiveId())) {
729 $a_has_lo_page = true;
730
731 $page_gui = new ilLOPageGUI($objective->getObjectiveId());
732
733 $page_gui->setStyleId(
734 $this->content_style_domain->getEffectiveStyleId()
735 );
736 $page_gui->setPresentationTitle("");
737 $page_gui->setTemplateOutput(false);
738 $page_gui->setHeader("");
739
740 $co_page = "<div class='ilContObjectiveIntro'>" . $page_gui->showPage() . "</div>";
741 }
742
743 $a_accordion->addItem(
744 $this->buildAccordionTitle($objective, $a_lo_result),
745 $co_page . $this->buildAccordionContent($acc_content),
746 ($this->request->getObjectiveId() === $objective->getObjectiveId())
747 );
748
749 return "";
750 }
buildAccordionTitle(ilCourseObjective $a_objective, ?array $a_lo_result=null)
class ilCourseObjectiveMaterials
static _lookupTitle(int $a_obj_id)
(Course) learning objective page GUI class
static getItemsByObjective(int $objective_id)
Get objective items.
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)

Referenced by showObjectives().

+ Here is the caller graph for this function:

◆ renderProgressBar()

static ilContainerObjectiveGUI::renderProgressBar ( ?int  $a_perc_result = null,
?int  $a_perc_limit = null,
?string  $a_css = 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 
)
static

Render progress bar(s)

Parameters
int | null$a_perc_result
int | null$a_perc_limit
string | null$a_css
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
Returns
string
Deprecated:
use ks progress or ks progress bar meter instead

Definition at line 810 of file class.ilContainerObjectiveGUI.php.

821 : string {
822 global $DIC;
823
824 $gui = $DIC->container()->internal()->gui();
825
826 $tpl = new ilTemplate("tpl.objective_progressbar.html", true, true, "components/ILIAS/Container");
827
828 if ($a_perc_result !== null) {
829 $tpl->setCurrentBlock("statusbar_bl");
830 $tpl->setVariable("PERC_STATUS", $a_perc_result);
831 $tpl->setVariable("PERC_WIDTH", $a_perc_result);
832 $tpl->setVariable("PERC_COLOR", $a_css);
833 if ($a_perc_limit) {
834 // :TODO: magic?
835 $limit_pos = (99 - $a_perc_limit) * -1;
836 $tpl->setVariable("LIMIT_POS", $limit_pos);
837 }
838 if ($a_tt_txt &&
839 $a_tt_id) {
840 $tpl->setVariable("TT_ID", $a_tt_id);
841 }
843 }
844
845 if ($a_caption) {
846 if ($a_url) {
847 $button = $gui->link(
848 $a_caption,
849 $a_url
850 );
851
852 $tpl->setCurrentBlock("statustxt_bl");
853 $tpl->setVariable("TXT_PROGRESS_STATUS", $button->render());
854 } else {
855 $tpl->setCurrentBlock("statustxt_no_link_bl");
856 $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
857 }
859 }
860
861 if ($a_next_step) {
862 #$tpl->setCurrentBlock("nstep_bl");
863 $tpl->setVariable("TXT_NEXT_STEP", $a_next_step);
864 #$tpl->parseCurrentBlock();
865 }
866
867 if ($a_sub) {
868 $tpl->setVariable("SUB_STYLE", ' style="padding-left: ' . $a_sub_style . 'px;"');
869 $tpl->setVariable("SUB_INIT", $a_sub);
870 }
871
872 return $tpl->get();
873 }
ILIAS Container InternalGUIService $gui

Referenced by ilStudyProgrammeProgressListGUI\buildProgressBar().

+ Here is the caller graph for this function:

◆ renderProgressMeter()

static ilContainerObjectiveGUI::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 bar(s)

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(deprecated, does not seem to be used)
string | null$a_tt_txt(deprecated, does not seem to be used)
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 891 of file class.ilContainerObjectiveGUI.php.

904 : string {
905 global $DIC;
906
907 $tpl = new ilTemplate("tpl.objective_progressmeter.html", true, true, "components/ILIAS/Container");
908
909 $lng = $DIC->language();
910 $lng->loadLanguageModule('crs');
911 $gui = $DIC->container()->internal()->gui();
912
913
914 if (is_numeric($a_perc_result)) {
915 $uiFactory = $DIC->ui()->factory();
916 $uiRenderer = $DIC->ui()->renderer();
917
918 $pMeter = $uiFactory->chart()->progressMeter()->standard(
919 100,
920 (int) $a_perc_result,
921 (int) $a_perc_limit,
922 (int) $a_compare_value
923 );
924 $tpl->setVariable('PROGRESS_METER', $uiRenderer->render($pMeter));
925 }
926
927 if ($a_caption) {
928 if ($a_url) {
929 $button = $gui->link(
930 $a_caption,
931 $a_url
932 );
933
934 $tpl->setCurrentBlock("statustxt_bl");
935 $tpl->setVariable("TXT_PROGRESS_STATUS", $button->render());
936 } else {
937 $tpl->setCurrentBlock("statustxt_no_link_bl");
938 $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
939 }
941 }
942
943 if ($a_next_step) {
944 //$tpl->setCurrentBlock("nstep_bl");
945 $tpl->setVariable("TXT_NEXT_STEP", $a_next_step);
946 //$tpl->parseCurrentBlock();
947 }
948
949 if ($a_sub) {
950 $tpl->setVariable("SUB_STYLE", ' style="padding-left: ' . $a_sub_style . 'px;"');
951 $tpl->setVariable("SUB_INIT", $a_sub);
952 }
953
954 return $tpl->get();
955 }

◆ renderTest()

ilContainerObjectiveGUI::renderTest ( int  $a_test_ref_id,
int  $a_objective_id,
bool  $a_is_initial = false 
)
protected

Definition at line 278 of file class.ilContainerObjectiveGUI.php.

282 : string {
283 global $DIC;
284
285 $tree = $DIC->repositoryTree();
286
287 $node_data = [];
288 if ($a_test_ref_id) {
289 $node_data = $tree->getNodeData($a_test_ref_id);
290 }
291 if (!($node_data['child'] ?? false)) {
292 return '';
293 }
294
295 // update ti
296 if ($a_objective_id) {
297 if ($a_is_initial) {
298 $title = sprintf($this->lng->txt('crs_loc_itst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
299 } else {
300 $title = sprintf($this->lng->txt('crs_loc_qtst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
301 }
302 $node_data['objective_id'] = $a_objective_id;
303 $node_data['objective_status'] = false;
304 } else {
305 $obj_id = ilObject::_lookupObjId($a_test_ref_id);
306 $title = ilObject::_lookupTitle($obj_id);
307
308 $title .= (
309 ' (' .
310 (
311 $a_is_initial
312 ? $this->lng->txt('crs_loc_itest_info')
313 : $this->lng->txt('crs_loc_qtest_info')
314 ) .
315 ')'
316 );
317 $node_data['objective_id'] = 0;
318 }
319
320 $node_data['title'] = $title;
321
322 return "<div class='ilContObjectivesViewTestItem'>" . $this->renderItem($node_data) . "</div>";
323 }
renderItem(array $a_item_data, int $a_position=0, bool $a_force_icon=false, string $a_pos_prefix="", string $object_group_list_presentation="")
static _lookupTitle(int $obj_id)

Referenced by getMainContent().

+ Here is the caller graph for this function:

◆ showButton()

ilContainerObjectiveGUI::showButton ( string  $a_cmd,
string  $a_text,
string  $a_target = '',
string  $a_id = "" 
)
protected

Definition at line 1263 of file class.ilContainerObjectiveGUI.php.

1268 : void {
1269 $ilToolbar = $this->toolbar;
1270 $ilCtrl = $this->ctrl;
1271
1272 // #11842
1273 $ilToolbar->addButton(
1274 $a_text,
1275 $ilCtrl->getLinkTarget($this->getContainerGUI(), $a_cmd),
1276 $a_target,
1277 null,
1278 '',
1279 $a_id
1280 );
1281 }

Referenced by getMainContent(), and showObjectives().

+ Here is the caller graph for this function:

◆ showMaterials()

ilContainerObjectiveGUI::showMaterials ( ?int  $a_mode = null,
bool  $a_is_manage = false,
bool  $a_as_accordion = false 
)
protected

Definition at line 326 of file class.ilContainerObjectiveGUI.php.

330 : void {
332
333 if (is_array($this->items["_all"])) {
334 $this->objective_map = $this->buildObjectiveMap();
335 // all rows
336 $item_r = [];
337 $position = 1;
338 foreach ($this->items["_all"] as $k => $item_data) {
339 if ($a_mode === self::MATERIALS_TESTS && $item_data['type'] !== 'tst') {
340 continue;
341 }
342 if ($item_data['type'] === 'obgr') {
343 continue;
344 }
345 if (!$a_is_manage) {
346 // if test object is qualified or initial do not show here
348 if ($assignments->getTypeByTest($item_data['child']) !== ilLOSettings::TYPE_TEST_UNDEFINED) {
349 continue;
350 }
351 }
352
353 if (($this->rendered_items[$item_data["child"]] ?? false) !== true &&
354 !$this->renderer->hasItem($item_data["child"] ?? 0)) {
355 $this->rendered_items[$item_data['child']] = true;
356
357 // TODO: Position (DONE ?)
358 $html = $this->renderItem($item_data, $position++, !($a_mode === self::MATERIALS_TESTS));
359 if ($html != "") {
360 $item_r[] = ["html" => $html, "id" => $item_data["child"], "type" => $item_data["type"]];
361 }
362 }
363 }
364
365 // if we have at least one item, output the block
366 if (count($item_r) > 0) {
367 if (!$a_as_accordion) {
368 $pos = 0;
369
370 switch ($a_mode) {
372 $block_id = "tst";
373 $this->renderer->addTypeBlock($block_id);
374 break;
375
377 $block_id = "oth";
378 $this->renderer->addCustomBlock($block_id, $lng->txt('crs_other_resources'));
379 break;
380
381 // manage
382 default:
383 $block_id = "all";
384 $this->renderer->addCustomBlock($block_id, $lng->txt('content'));
385 break;
386 }
387
388 // :TODO:
389 if ($a_mode !== self::MATERIALS_TESTS) {
390 $pos = $this->getObjectGroupsHTML();
391 }
392
393 foreach ($item_r as $h) {
394 if (!$this->renderer->hasItem($h["id"])) {
395 $this->renderer->addItemToBlock($block_id, $h["type"], $h["id"], $h["html"]);
396 }
397 }
398
399 $this->output_html .= $this->renderer->getHTML();
400 } else {
401 $txt = "";
402 switch ($a_mode) {
404 $txt = $lng->txt('objs_tst');
405 break;
406
408 $txt = $lng->txt('crs_other_resources');
409 break;
410 }
411
412 $acc = new ilAccordionGUI();
413 $acc->setId("crsobjtvmat" . $a_mode . "_" . $this->container_obj->getId());
414
415 $acc_content = [];
416 foreach ($item_r as $h) {
417 $acc_content[] = $h["html"];
418 }
419 $acc->addItem($txt, $this->buildAccordionContent($acc_content));
420
421 $this->output_html .= $acc->getHTML();
422 }
423 }
424 }
425 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $lng, ILIAS\Survey\Mode\getId(), ilLOTestAssignments\getInstance(), renderer(), and ilLOSettings\TYPE_TEST_UNDEFINED.

Referenced by getMainContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showObjectives()

ilContainerObjectiveGUI::showObjectives ( bool  $a_is_order = false)

Definition at line 179 of file class.ilContainerObjectiveGUI.php.

179 : void
180 {
184 // get embedded blocks
185 $has_container_page = false;
186 if (!$a_is_order) {
187 $output_html = $this->getContainerGUI()->getContainerPageHTML();
188 if ($output_html !== "") {
189 $has_container_page = true;
190 $this->output_html .= $this->insertPageEmbeddedBlocks($output_html);
191 }
192 unset($output_html);
193 }
194
195 // All objectives
196 if (!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) {
197 return;
198 }
199
200 $this->objective_list_gui = new ilCourseObjectiveListGUI();
201 $this->objective_list_gui->setContainerObject($this->getContainerGUI());
202 if ($ilSetting->get("icon_position_in_lists") === "item_rows") {
203 $this->objective_list_gui->enableIcon(true);
204 }
205
206 $acc = null;
207 if (!$a_is_order) {
208 $acc = new ilAccordionGUI();
209 $acc->setUseSessionStorage(true);
210 $acc->setAllowMultiOpened(true);
211 $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
212 $acc->setId("crsobjtv_" . $this->container_obj->getId());
213 } else {
214 $this->renderer->addCustomBlock('lobj', $lng->txt('crs_objectives'));
215 }
216
217 $lur_data = $this->parseLOUserResults();
218
219 $has_initial = ilLOSettings::getInstanceByObjId($this->container_obj->getId())->worksWithInitialTest();
220
221 $has_lo_page = false;
222 $obj_cnt = 0;
223 foreach ($objective_ids as $objective_id) {
224 if (
225 $has_initial &&
226 (
227 !isset($lur_data[$objective_id]) ||
229 $this->container_obj->getId(),
230 ilLOSettings::getInstanceByObjId($this->container_obj->getId())->getInitialTest(),
231 $objective_id
232 )
233 )
234 ) {
235 $lur_data[$objective_id] = ["type" => ilLOSettings::TYPE_TEST_INITIAL];
236 }
237
238 if ($html = $this->renderObjective($objective_id, $has_lo_page, $acc, $lur_data[$objective_id] ?? null)) {
239 $this->renderer->addItemToBlock('lobj', 'lobj', $objective_id, $html);
240 }
241 $obj_cnt++;
242 }
243
244 // buttons for showing/hiding all objectives
245 if (!$a_is_order && $obj_cnt > 1) {
246 $this->showButton("", $lng->txt("crs_show_all_obj"), "", "crs_show_all_obj_btn");
247 $this->showButton("", $lng->txt("crs_hide_all_obj"), "", "crs_hide_all_obj_btn");
248 $acc->setShowAllElement("crs_show_all_obj_btn");
249 $acc->setHideAllElement("crs_hide_all_obj_btn");
250 }
251
252 if (!$has_container_page && $has_lo_page) {
253 // add core co page css
255 "LOCATION_CONTENT_STYLESHEET",
257 );
258 $tpl->setCurrentBlock("SyntaxStyle");
260 "LOCATION_SYNTAX_STYLESHEET",
262 );
264 }
265
266 // order/block
267 if ($a_is_order) {
268 $this->output_html .= $this->renderer->getHTML();
269
270 $this->renderer->resetDetails();
271 }
272 // view/accordion
273 else {
274 $this->output_html .= "<div class='ilCrsObjAcc'>" . $acc->getHTML() . "</div>";
275 }
276 }
insertPageEmbeddedBlocks(string $a_output_html)
Insert blocks into container page.
renderObjective(int $a_objective_id, bool &$a_has_lo_page, ?ilAccordionGUI $a_accordion=null, ?array $a_lo_result=null)
List gui for course objectives.
static hasActiveRun(int $a_container_id, int $a_test_ref_id, int $a_objective_id)
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
global $ilSetting
Definition: privfeed.php:26

References $ilSetting, ilContainerContentGUI\$lng, $output_html, ilContainerContentGUI\$settings, ilContainerContentGUI\$tpl, ilCourseObjective\_getObjectiveIds(), ilAccordionGUI\FIRST_OPEN, ilContainerContentGUI\getContainerGUI(), ilContainerContentGUI\getContainerObject(), ilObjStyleSheet\getContentStylePath(), ILIAS\Survey\Mode\getId(), ilLOSettings\getInstanceByObjId(), ilObjStyleSheet\getSyntaxStylePath(), ilLOUtils\hasActiveRun(), ilContainerContentGUI\insertPageEmbeddedBlocks(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), parseLOUserResults(), renderer(), renderObjective(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), ILIAS\UICore\GlobalTemplate\setVariable(), showButton(), ilLanguage\txt(), and ilLOSettings\TYPE_TEST_INITIAL.

Referenced by getMainContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateResult()

ilContainerObjectiveGUI::updateResult ( array  $a_res,
int  $a_item_ref_id,
int  $a_objective_id,
int  $a_user_id 
)
protected

Definition at line 534 of file class.ilContainerObjectiveGUI.php.

539 : array {
540 if ($this->loc_settings->getQualifiedTest() === $a_item_ref_id) {
541 // Check for existing test run, and decrease tries, reset final if run exists
543 $a_item_ref_id,
544 $a_user_id
545 );
546
548 ilObject::_lookupObjId($a_item_ref_id),
549 $a_objective_id,
550 $a_user_id
551 )) {
552 if ($a_res['tries'] > 0) {
553 --$a_res['tries'];
554 }
555 $a_res['is_final'] = 0;
556 }
557 }
558 return $a_res;
559 }
static lookupRunExistsForObjective(int $a_test_id, int $a_objective_id, int $a_user_id)
static isParticipantsLastPassActive(int $test_ref_id, int $user_id)

References ilObject\_lookupObjId(), ilObjTest\isParticipantsLastPassActive(), and ilLOTestRun\lookupRunExistsForObjective().

+ Here is the call graph for this function:

Field Documentation

◆ $content_style_domain

ILIAS Style Content Object ObjectFacade ilContainerObjectiveGUI::$content_style_domain
protected

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

◆ $force_details

int ilContainerObjectiveGUI::$force_details = 0
protected

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

◆ $gui

ILIAS Container InternalGUIService ilContainerObjectiveGUI::$gui
protected

Definition at line 31 of file class.ilContainerObjectiveGUI.php.

◆ $loc_settings

ilLOSettings ilContainerObjectiveGUI::$loc_settings
protected

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

Referenced by getSettings().

◆ $logger

ilLogger ilContainerObjectiveGUI::$logger
private

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

◆ $objective_list_gui

ilCourseObjectiveListGUI ilContainerObjectiveGUI::$objective_list_gui
protected

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

◆ $objective_map

array ilContainerObjectiveGUI::$objective_map = []
protected

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

◆ $output_html

string ilContainerObjectiveGUI::$output_html = ''
private

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

Referenced by showObjectives().

◆ $rendered_items

array ilContainerObjectiveGUI::$rendered_items = []
protected

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

◆ $tabs

ilTabsGUI ilContainerObjectiveGUI::$tabs
protected

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

◆ $test_assignments

ilLOTestAssignments ilContainerObjectiveGUI::$test_assignments = null
private

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

Referenced by getTestAssignments().

◆ $toolbar

ilToolbarGUI ilContainerObjectiveGUI::$toolbar
protected

Definition at line 34 of file class.ilContainerObjectiveGUI.php.

◆ MATERIALS_OTHER

const ilContainerObjectiveGUI::MATERIALS_OTHER = 2

Definition at line 28 of file class.ilContainerObjectiveGUI.php.

◆ MATERIALS_TESTS

const ilContainerObjectiveGUI::MATERIALS_TESTS = 1

Definition at line 27 of file class.ilContainerObjectiveGUI.php.


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