ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 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 $item_group_list_presentation="")
 Render an item. More...
 
 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 ()
 
 getItemGroupsHTML (int $a_pos=0)
 
 renderItemGroup (array $a_itgr)
 

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 
49  $this->tabs = $DIC->tabs();
50  $this->toolbar = $DIC->toolbar();
51  $this->logger = $DIC->logger()->crs();
52  parent::__construct($container_gui_obj, $item_presentation);
53  $this->initTestAssignments();
54 
55  // ak: note, also in ILIAS <= 7 this page did not
56  // use the container style, it could however, but this would be a conceptual change
57  $this->content_style_domain = $DIC
58  ->contentStyle()
59  ->domain()
60  ->styleForObjId(0);
61  $this->gui = $DIC->container()->internal()->gui();
62  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
ILIAS Container Content ItemPresentationManager $item_presentation

Member Function Documentation

◆ addItemDetails()

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

Stays in ContainergGUI, inject in renderer.

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

466  : void
467  {
468  $lng = $this->lng;
469  $ilCtrl = $this->ctrl;
470  $ilUser = $this->user;
471 
472  $item_ref_id = $a_item["ref_id"];
473 
474  if (is_array($this->objective_map)) {
475  $details = [];
476  if (isset($this->objective_map["material"][$item_ref_id])) {
477  // #12965
478  foreach ($this->objective_map["material"][$item_ref_id] as $objective_id) {
479  $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $objective_id);
480  $url = $ilCtrl->getLinkTargetByClass(['illoeditorgui', 'ilcourseobjectivesgui'], 'edit');
481  $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', '');
482 
483  $details[] = [
484  'desc' => $lng->txt('crs_loc_tab_materials') . ': ',
485  'target' => '_top',
486  'link' => $url,
487  'name' => $this->objective_map["names"][$objective_id]
488  ];
489  }
490  }
491  if (($this->objective_map["test_i"] ?? 0) == $item_ref_id) {
492  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1);
493  $details[] = [
494  'desc' => '',
495  'target' => '_top',
496  'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'),
497  'name' => $lng->txt('crs_loc_tab_itest')
498  ];
499  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
500  }
501  if (($this->objective_map["test_q"] ?? 0) == $item_ref_id) {
502  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2);
503  $details[] = [
504  'desc' => '',
505  'target' => '_top',
506  'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'),
507  'name' => $lng->txt('crs_loc_tab_qtest')
508  ];
509  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
510  }
511 
512  // #15367
513  if (is_array($this->objective_map["test_ass"][$item_ref_id] ?? false)) {
514  foreach ($this->objective_map["test_ass"][$item_ref_id] as $type => $items) {
515  if ($type == ilLOSettings::TYPE_TEST_INITIAL) {
516  $caption = $lng->txt('crs_loc_tab_itest');
517  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1);
518  } else {
519  $caption = $lng->txt('crs_loc_tab_qtest');
520  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2);
521  }
522  foreach ($items as $objtv_title) {
523  $details[] = [
524  'desc' => '',
525  'target' => '_top',
526  'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testsOverview'),
527  'name' => $caption . " (" . $this->lng->txt("crs_loc_learning_objective") . ": " . $objtv_title . ")"
528  ];
529  }
530  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
531  }
532  }
533 
534  if (count($details)) {
535  $a_item_list_gui->enableItemDetailLinks(true);
536  $a_item_list_gui->setItemDetailLinks($details, $lng->txt('crs_loc_settings_tbl') . ': ');
537  } else {
538  $a_item_list_gui->enableItemDetailLinks(false);
539  }
540  }
541 
542  // order
543  if ($this->getContainerGUI()->isActiveOrdering()) {
544  $a_item_list_gui->enableCommands(true, true);
545  $a_item_list_gui->enableProperties(false);
546  }
547  // view
548  elseif (!$this->getContainerGUI()->isActiveAdministrationPanel()) {
549  $a_item_list_gui->enableCommands(true, true);
550  $a_item_list_gui->enableProperties(false);
551  }
552 
553  if ($a_item['objective_id'] ?? false) {
554  $a_item_list_gui->setDefaultCommandParameters(['objective_id' => $a_item['objective_id']]);
555 
556 
557  if ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) {
558  $a_item_list_gui->setConditionTarget($this->getContainerObject()->getRefId(), (int) $a_item['objective_id'], 'lobj');
559  // check conditions of target
560  $fullfilled = ilConditionHandler::_checkAllConditionsOfTarget($this->getContainerObject()->getRefId(), (int) $a_item['objective_id'], 'lobj');
561  if (!$fullfilled || $a_item['objective_status']) {
562  $a_item_list_gui->disableTitleLink(true);
563  }
564  }
566  $this->getContainerObject()->getId(),
567  $ilUser->getId(),
568  $a_item['objective_id'],
570  );
571 
572  $res = $this->updateResult($res, $a_item['ref_id'], $a_item['objective_id'], $ilUser->getId());
573 
574  if ($res['is_final'] ?? false) {
575  $a_item_list_gui->disableTitleLink(true);
576  $a_item_list_gui->enableProperties(true);
577  $a_item_list_gui->addCustomProperty(
578  $this->lng->txt('crs_loc_passes_reached'),
579  '',
580  true
581  );
582  } elseif ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) {
583  $poss_pass = ilCourseObjective::lookupMaxPasses($a_item['objective_id']);
584 
585  if ($poss_pass) {
586  $a_item_list_gui->enableProperties(true);
587  $a_item_list_gui->addCustomProperty(
588  $this->lng->txt('crs_loc_passes_left'),
589  (($poss_pass - $res['tries']) > 0) ? ($poss_pass - $res['tries']) : 1,
590  false
591  );
592  }
593  }
594  }
595  }
$res
Definition: ltiservices.php:69
setConditionTarget(int $ref_id, int $obj_id, string $target_type)
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...
enableCommands(bool $status, bool $std_only=false)
static lookupResult(int $a_course_obj_id, int $a_user_id, int $a_objective_id, int $a_tst_type)
enableProperties(bool $status)
array $details
Details for error message relating to last request processed.
Definition: System.php:109
updateResult(array $a_res, int $a_item_ref_id, int $a_objective_id, int $a_user_id)
setDefaultCommandParameters(array $params)
static lookupMaxPasses(int $a_objective_id)
$url
Definition: ltiregstart.php:35
disableTitleLink(bool $status)
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
setItemDetailLinks(array $detail_links, string $intro_txt='')
set items detail links
enableItemDetailLinks(bool $status)
enable item detail links E.g Direct links to chapters or pages
addCustomProperty(string $property='', string $value='', bool $alert=false, bool $newline=false)

◆ buildAccordionContent()

ilContainerObjectiveGUI::buildAccordionContent ( array  $a_items)
protected

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

1324  : string
1325  {
1326  $tpl = new ilTemplate("tpl.objective_accordion_content.html", true, true, "Services/Container");
1327  foreach ($a_items as $item) {
1328  $tpl->setCurrentBlock("items_bl");
1329  $tpl->setVariable("ITEM", $item);
1331  }
1332  return $tpl->get();
1333  }
ilGlobalTemplateInterface $tpl
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.

◆ buildAccordionTitle()

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

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

1196  : string {
1197  global $DIC;
1198 
1199  $renderer = $DIC->ui()->renderer();
1200  $ui_factory = $DIC->ui()->factory();
1201 
1202  $tpl = new ilTemplate("tpl.objective_accordion_title.html", true, true, "Services/Container");
1203 
1204  if ($a_lo_result) {
1205  $tpl->setVariable(
1206  "PROGRESS_BAR",
1207  self::buildObjectiveProgressBar(
1208  $this->loc_settings->worksWithInitialTest(),
1209  $a_objective->getObjectiveId(),
1210  $a_lo_result
1211  )
1212  );
1213  }
1214 
1215  $tpl->setVariable("TITLE", $this->lng->txt("crs_loc_learning_objective") . ": " . trim($a_objective->getTitle()));
1216  $tpl->setVariable("DESCRIPTION", nl2br(trim($a_objective->getDescription())));
1217 
1218  $initial_res = null;
1219  $initial_lim = null;
1220  if ($this->loc_settings->worksWithInitialTest()) {
1221  if (array_key_exists('initial', $a_lo_result)) {
1222  $initial_res = (int) ($a_lo_result['initial']['result_perc'] ?? 0);
1223  $initial_lim = (int) ($a_lo_result['initial']['limit_perc'] ?? 0);
1224  }
1225  if (
1226  $a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
1227  isset($a_lo_result['result_perc'])
1228  ) {
1229  $initial_res = (int) ($a_lo_result['result_perc'] ?? 0);
1230  $initial_lim = (int) ($a_lo_result['limit_perc'] ?? 0);
1231  }
1232  }
1233 
1234  if ($initial_res !== null) {
1236  $a_lo_result["itest"],
1237  $a_lo_result["user_id"]
1238  );
1239 
1240  if ($link !== '') {
1241  $tpl->setCurrentBlock('i_with_link');
1242  $tpl->setVariable(
1243  'IBTN',
1244  $renderer->render(
1245  $ui_factory->button()->shy(
1246  $this->lng->txt('crs_objective_result_details'),
1247  $link
1248  )
1249  )
1250  );
1252  }
1253 
1254  $tpl->setCurrentBlock('res_initial');
1255  $tpl->setVariable(
1256  'IRESULT',
1257  sprintf(
1258  $this->lng->txt('crs_objective_result_summary_initial'),
1259  $initial_res . '%',
1260  (int) $initial_lim . '%'
1261  )
1262  );
1264  }
1265 
1266  $qual_res = null;
1267  $qual_lim = null;
1268 
1269  if (($a_lo_result['type'] ?? null) == ilLOUserResults::TYPE_QUALIFIED) {
1270  $qual_res = (int) $a_lo_result['result_perc'];
1271  $qual_lim = (int) $a_lo_result['limit_perc'];
1272  }
1273 
1274  if ($qual_res !== null) {
1276  $a_lo_result["qtest"],
1277  $a_lo_result["user_id"]
1278  );
1279 
1280  if ($link !== '') {
1281  $tpl->setCurrentBlock('q_with_link');
1282  $tpl->setVariable(
1283  'QBTN',
1284  $renderer->render(
1285  $ui_factory->button()->shy(
1286  $this->lng->txt('crs_objective_result_details'),
1287  $link
1288  )
1289  )
1290  );
1292  }
1293  $tpl->setCurrentBlock('res_qualifying');
1294  $tpl->setVariable(
1295  'QRESULT',
1296  sprintf(
1297  $this->lng->txt('crs_objective_result_summary_qualifying'),
1298  $qual_res . '%',
1299  (int) $qual_lim . '%'
1300  )
1301  );
1303  }
1304 
1305  $this->logger->dump($a_lo_result);
1306 
1307  $summary = self::getObjectiveResultSummary(
1308  $this->loc_settings->worksWithInitialTest(),
1309  $a_objective->getObjectiveId(),
1310  $a_lo_result
1311  );
1312  if ($summary !== '') {
1313  $tpl->setCurrentBlock('objective_summary');
1314  $tpl->setVariable('SUMMARY_TXT', $summary);
1316  }
1317 
1318  // #15510
1319  $tpl->setVariable("ANCHOR_ID", "objtv_acc_" . $a_objective->getObjectiveId());
1320 
1321  return $tpl->get();
1322  }
ilGlobalTemplateInterface $tpl
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
global $DIC
Definition: feed.php:28
static getTestResultLinkForUser(int $a_test_ref_id, int $a_user_id)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.

◆ buildObjectiveMap()

ilContainerObjectiveGUI::buildObjectiveMap ( )
protected

Stays in ContainergGUI, needed for addItemDetails.

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

421  : array
422  {
423  $objective_map = [];
424  // begin-patch lok
425  if (count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) {
426  // end-patch lok
427  foreach ($objective_ids as $objective_id) {
428  foreach (ilCourseObjectiveMaterials::_getAssignedMaterials($objective_id) as $mat_ref_id) {
429  $objective_map["material"][$mat_ref_id][] = $objective_id;
430 
431  if (!isset($objective_map["names"][$objective_id])) {
432  $objective = new ilCourseObjective($this->getContainerObject(), $objective_id);
433  $objective_map["names"][$objective_id] = $objective->getTitle();
434  }
435  }
436  }
437 
438  // initial/qualifying test
439  $tst = $this->loc_settings->getInitialTest();
440  if ($tst) {
441  $objective_map["test_i"] = $tst;
442  }
443  $tst = $this->loc_settings->getQualifiedTest();
444  if ($tst) {
445  $objective_map["test_q"] = $tst;
446  }
447 
448  // objective test assignments
449  $ass_test = new ilLOTestAssignments($this->getContainerObject()->getId());
450  foreach ($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_INITIAL) as $ass) {
451  $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
452  $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
453  }
454  foreach ($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_QUALIFIED) as $ass) {
455  $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
456  $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
457  }
458  }
459 
460  return $objective_map;
461  }
static _getAssignedMaterials(int $a_objective_id)
Settings for LO courses.
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)

◆ 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 1083 of file class.ilContainerObjectiveGUI.php.

Referenced by ilPortfolioPageGUI\renderMyCourses().

1090  : string {
1091  global $DIC;
1092 
1093  $lng = $DIC->language();
1094  $lng->loadLanguageModule('crs');
1095 
1096  // tooltip (has to be unique!)
1097 
1098  $tooltip_id = "crsobjtvusr_" . $a_objective_id . "_" . $a_lo_result["type"] . "_" . ((int) $a_sub);
1099  if ($a_tt_suffix !== null) {
1100  $tooltip_id .= "_" . $a_tt_suffix;
1101  }
1102 
1103  $tt_txt = sprintf(
1104  $lng->txt("crs_loc_tt_info"),
1105  $a_lo_result["result_perc"] ?? '0',
1106  $a_lo_result["limit_perc"] ?? '0'
1107  );
1108 
1109 
1110  $is_qualified = ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED);
1111  $is_qualified_initial = ($a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
1112  ilLOSettings::getInstanceByObjId($a_lo_result['course_id'] ?? 0)->isInitialTestQualifying());
1113  $has_completed = (($a_lo_result["status"] ?? 0) == ilLOUserResults::STATUS_COMPLETED);
1114 
1115  $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null;
1116  $compare_value = null;
1117 
1118  if ($is_qualified ||
1119  $is_qualified_initial) {
1120  $progress_txt = $lng->txt("crs_loc_progress_result_qtest");
1121  $tt_txt = $lng->txt("crs_loc_tab_qtest") . ": " . $tt_txt;
1122 
1123  if ($has_completed) {
1124  $next_step = $lng->txt("crs_loc_progress_objective_complete");
1125  $bar_color = "ilCourseObjectiveProgressBarCompleted";
1126 
1127  // render 2nd progressbar if there is also an initial test
1128  if ($is_qualified &&
1129  $a_has_initial_test &&
1130  is_array($a_lo_result["initial"])) {
1131  $a_lo_result["initial"]["itest"] = $a_lo_result["itest"];
1132 
1133  // force list mode to get rid of next step
1134  #$initial_sub = self::buildObjectiveProgressBar(true, $a_objective_id, $a_lo_result["initial"], true, true, $a_tt_suffix);
1135  $compare_value = $a_lo_result['initial']['result_perc'];
1136  }
1137  } else {
1138  $next_step = $lng->txt("crs_loc_progress_do_qualifying_again");
1139  $bar_color = "ilCourseObjectiveProgressBarFailed";
1140  }
1141  }
1142  // initial test
1143  elseif ($a_lo_result["status"] ?? false) {
1144  $progress_txt = $lng->txt("crs_loc_progress_result_itest");
1145  $tt_txt = $lng->txt("crs_loc_tab_itest") . ": " . $tt_txt;
1146 
1147  $bar_color = "ilCourseObjectiveProgressBarNeutral";
1148  $next_step = $has_completed
1149  ? $lng->txt("crs_loc_progress_do_qualifying")
1150  : $lng->txt("crs_loc_suggested");
1151  }
1152  // not attempted: no progress bar
1153  else {
1154  $next_step = $a_has_initial_test
1155  ? $lng->txt("crs_loc_progress_no_result_do_initial")
1156  : $lng->txt("crs_loc_progress_no_result_no_initial");
1157  }
1158 
1159  // link to test statistics
1160  $relevant_test_id = ($a_lo_result["qtest"] ?? 0)
1161  ?: ($a_lo_result["itest"] ?? 0);
1162  if ($relevant_test_id) {
1163  $test_url = ilLOUtils::getTestResultLinkForUser($relevant_test_id, $a_lo_result["user_id"] ?? 0);
1164  }
1165 
1166  $main_text = $lng->txt('crs_loc_itest_info');
1167  if ($a_lo_result['type'] == ilLOSettings::TYPE_TEST_QUALIFIED) {
1168  $main_text = $lng->txt('crs_loc_qtest_info');
1169  }
1170 
1171 
1172 
1173  return self::renderProgressMeter(
1174  $a_lo_result["result_perc"] ?? null,
1175  $a_lo_result["limit_perc"] ?? null,
1176  $compare_value,
1177  $progress_txt,
1178  $test_url,
1179  $tooltip_id,
1180  $tt_txt,
1181  $a_list_mode
1182  ? null
1183  : $next_step,
1184  (bool) $initial_sub,
1185  $a_list_mode
1186  ? 30
1187  : 10,
1188  $main_text,
1189  $lng->txt('crs_lobj_pm_min_goal')
1190  );
1191  }
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 caller graph for this function:

◆ getDetailsLevel()

ilContainerObjectiveGUI::getDetailsLevel ( int  $a_item_id)
protected

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

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

◆ getMainContent()

ilContainerObjectiveGUI::getMainContent ( )

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

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

◆ 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 1032 of file class.ilContainerObjectiveGUI.php.

1036  : string {
1037  global $DIC;
1038 
1039  if ($a_lo_result === null) {
1040  $a_lo_result["type"] = null;
1041  }
1042 
1043  $lng = $DIC->language();
1044  $lng->loadLanguageModule('crs');
1045 
1046  $is_qualified =
1047  ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED);
1048  $is_qualified_initial =
1049  (
1050  $a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
1051  ilLOSettings::getInstanceByObjId($a_lo_result['course_id'] ?? 0)->isInitialTestQualifying()
1052  );
1053  $has_completed =
1054  (($a_lo_result["status"] ?? 0) == ilLOUserResults::STATUS_COMPLETED);
1055 
1056  $next_step = '';
1057 
1058  if (
1059  $is_qualified ||
1060  $is_qualified_initial) {
1061  if ($has_completed) {
1062  $next_step = $lng->txt("crs_loc_progress_objective_complete");
1063  } else {
1064  $next_step = $lng->txt("crs_loc_progress_do_qualifying_again");
1065  }
1066  } // initial test
1067  elseif ($a_lo_result["status"] ?? false) {
1068  $next_step =
1069  $has_completed ?
1070  $lng->txt("crs_loc_progress_do_qualifying") :
1071  $lng->txt("crs_loc_suggested");
1072  } else {
1073  $next_step = $a_has_initial_test ?
1074  $lng->txt("crs_loc_progress_no_result_do_initial") :
1075  $lng->txt("crs_loc_progress_no_result_no_initial");
1076  }
1077  return $next_step;
1078  }
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)

◆ getSettings()

ilContainerObjectiveGUI::getSettings ( )

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

69  : ilLOSettings
70  {
71  return $this->loc_settings;
72  }
Settings for LO courses.

◆ getTestAssignments()

ilContainerObjectiveGUI::getTestAssignments ( )

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

65  {
67  }
Settings for LO courses.

◆ initTestAssignments()

ilContainerObjectiveGUI::initTestAssignments ( )
protected

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

815  : void
816  {
817  $this->test_assignments = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
818  }
static getInstance(int $a_container_id)

◆ parseLOUserResults()

ilContainerObjectiveGUI::parseLOUserResults ( )
protected

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

821  : array
822  {
823  $ilUser = $this->user;
824  $initial_status = null;
825 
826  $res = [];
827 
829 
830  $lur = new ilLOUserResults($this->getContainerObject()->getId(), $ilUser->getId());
831  foreach ($lur->getCourseResultsForUserPresentation() as $objective_id => $types) {
832  // show either initial or qualified for objective
833  if (isset($types[ilLOUserResults::TYPE_INITIAL])) {
834  $initial_status = $types[ilLOUserResults::TYPE_INITIAL]["status"];
835  }
836 
837  // qualified test has priority
838  if (isset($types[ilLOUserResults::TYPE_QUALIFIED])) {
839  $result = $types[ilLOUserResults::TYPE_QUALIFIED];
840  $result["type"] = ilLOUserResults::TYPE_QUALIFIED;
841  $result["initial"] = $types[ilLOUserResults::TYPE_INITIAL] ?? null;
842  } else {
843  $result = $types[ilLOUserResults::TYPE_INITIAL];
844  $result["type"] = ilLOUserResults::TYPE_INITIAL;
845  }
846 
847  $result["initial_status"] = $initial_status;
848 
849  $result["itest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL);
850  $result["qtest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
851 
852  $res[$objective_id] = $result;
853  }
854 
855  return $res;
856  }
$res
Definition: ltiservices.php:69
static getInstance(int $a_container_id)

◆ renderItemList()

ilContainerObjectiveGUI::renderItemList ( )

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

164  : string
165  {
166  $this->initRenderer();
167  return $this->renderer->renderItemBlockSequence($this->item_presentation->getItemBlockSequence());
168  }
initRenderer()
Init container renderer.

◆ 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 632 of file class.ilContainerObjectiveGUI.php.

637  : string {
638  $ilUser = $this->user;
639  $lng = $this->lng;
640 
641  $objective = new ilCourseObjective($this->getContainerObject(), $a_objective_id);
642 
644 
645  // sorting is handled by ilCourseObjectiveMaterials
646  // $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj',$a_objective_id,$items);
647 
648  $objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
649 
650  // #13381 - map material assignment to position
651  $sort_map = [];
652  foreach ($objectives_lm_obj->getMaterials() as $item) {
653  $sort_map[$item["lm_ass_id"]] = $item["position"];
654  }
655 
656  $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
657  $is_order = $this->getContainerGUI()->isActiveOrdering();
658 
659  $sort_content = [];
660 
661  foreach ($items as $item) {
662  if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) {
663  continue;
664  }
665 
666  $item_list_gui2 = $this->getItemGUI($item);
667  $item_list_gui2->enableIcon(true);
668 
669  if ($is_order || $a_accordion) {
670  $item_list_gui2->enableCommands(true, true);
671  $item_list_gui2->enableProperties(false);
672  }
673 
674  $chapters = $objectives_lm_obj->getChapters();
675  if (count($chapters)) {
676  $has_sections = false;
677  foreach ($chapters as $chapter) {
678  if ($chapter['ref_id'] != $item['child']) {
679  continue;
680  }
681  $has_sections = true;
682 
683  $title = $item['title'] .
684  " &rsaquo; " . ilLMObject::_lookupTitle($chapter['obj_id']) .
685  " (" . $lng->txt('obj_' . $chapter['type']) . ")";
686 
687  $item_list_gui2->setDefaultCommandParameters([
688  "obj_id" => $chapter['obj_id'],
689  "focus_id" => $chapter['obj_id'],
690  "focus_return" => $this->container_obj->getRefId()
691  ]);
692 
693  if ($is_order) {
694  $item_list_gui2->setPositionInputField(
695  "[lobj][" . $a_objective_id . "][" . $chapter['lm_ass_id'] . "]",
696  sprintf('%d', $chapter['position'] * 10)
697  );
698  }
699 
700  $sub_item_html = $item_list_gui2->getListItemHTML(
701  $item['ref_id'],
702  $item['obj_id'],
703  $title,
704  $item['description']
705  );
706 
707  // #13381 - use materials order
708  $sort_key = str_pad($chapter['position'], 5, '0', STR_PAD_LEFT) . "_" . strtolower($title) . "_" . $chapter['lm_ass_id'];
709  $sort_content[$sort_key] = $sub_item_html;
710  }
711  }
712 
713  $this->rendered_items[$item['child']] = true;
714 
715  if ($lm_ass_id = $objectives_lm_obj->isAssigned($item['ref_id'], true)) {
716  if ($is_order) {
717  $item_list_gui2->setPositionInputField(
718  "[lobj][" . $a_objective_id . "][" . $lm_ass_id . "]",
719  sprintf('%d', $sort_map[$lm_ass_id] * 10)
720  );
721  }
722 
723  $sub_item_html = $item_list_gui2->getListItemHTML(
724  $item['ref_id'],
725  $item['obj_id'],
726  $item['title'],
727  $item['description'] ?? ''
728  );
729 
730  // #13381 - use materials order
731  $sort_key = str_pad($sort_map[$lm_ass_id], 5, '0', STR_PAD_LEFT) . "_" . strtolower($item['title']) . "_" . $lm_ass_id;
732  $sort_content[$sort_key] = $sub_item_html;
733  }
734  }
735 
736  if ($this->getDetailsLevel($a_objective_id) === self::DETAILS_ALL) {
737  $this->objective_list_gui->enableCommands(false);
738  } else {
739  $this->objective_list_gui->enableCommands(true);
740  }
741 
742  if ($is_order) {
743  $this->objective_list_gui->setPositionInputField(
744  "[lobj][" . $a_objective_id . "][0]",
745  (string) ($objective->__getPosition() * 10)
746  );
747  }
748 
749  ksort($sort_content);
750 
751  if (!$a_accordion) {
752  foreach ($sort_content as $sub_item_html) {
753  $this->objective_list_gui->addSubItemHTML($sub_item_html);
754  }
755 
756  return $this->objective_list_gui->getObjectiveListItemHTML(
757  0,
758  $a_objective_id,
759  $objective->getTitle(),
760  $objective->getDescription(),
761  ($is_manage || $is_order)
762  );
763  }
764 
765  $acc_content = $sort_content;
766 
767  $initial_shown = false;
768  $initial_test_ref_id = $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL);
769  $initial_test_obj_id = ilObject::_lookupObjId($initial_test_ref_id);
770 
771  if (
772  $initial_test_obj_id &&
773  $this->getSettings()->hasSeparateInitialTests() &&
774  !ilObjTestAccess::checkCondition($initial_test_obj_id, ilConditionHandler::OPERATOR_FINISHED, '', $ilUser->getId())
775  ) {
776  $acc_content[] = $this->renderTest(
777  $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL),
778  $a_objective_id,
779  true
780  );
781  $initial_shown = true;
782  } elseif ($this->getSettings()->hasSeparateQualifiedTests()) {
783  $acc_content[] = $this->renderTest(
784  $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_QUALIFIED),
785  $a_objective_id,
786  false
787  );
788  }
789 
790  $co_page = null;
791  if (ilPageUtil::_existsAndNotEmpty("lobj", $objective->getObjectiveId())) {
792  $a_has_lo_page = true;
793 
794  $page_gui = new ilLOPageGUI($objective->getObjectiveId());
795 
796  $page_gui->setStyleId(
797  $this->content_style_domain->getEffectiveStyleId()
798  );
799  $page_gui->setPresentationTitle("");
800  $page_gui->setTemplateOutput(false);
801  $page_gui->setHeader("");
802 
803  $co_page = "<div class='ilContObjectiveIntro'>" . $page_gui->showPage() . "</div>";
804  }
805 
806  $a_accordion->addItem(
807  $this->buildAccordionTitle($objective, $a_lo_result),
808  $co_page . $this->buildAccordionContent($acc_content),
809  ($this->request->getObjectiveId() === $objective->getObjectiveId())
810  );
811 
812  return "";
813  }
addItem(string $a_header, string $a_content, bool $a_force_open=false)
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...
setStyleId(int $a_styleid)
buildAccordionTitle(ilCourseObjective $a_objective, array $a_lo_result=null)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $a_obj_id)
class ilCourseObjectiveMaterials
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) ...
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getItemsByObjective(int $objective_id)
Get objective items.
renderTest(int $a_test_ref_id, int $a_objective_id, bool $a_is_initial=false)

◆ 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

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

Referenced by ilStudyProgrammeProgressListGUI\buildProgressBar().

883  : string {
884  global $DIC;
885 
886  $gui = $DIC->container()->internal()->gui();
887 
888  $tpl = new ilTemplate("tpl.objective_progressbar.html", true, true, "Services/Container");
889 
890  if ($a_perc_result !== null) {
891  $tpl->setCurrentBlock("statusbar_bl");
892  $tpl->setVariable("PERC_STATUS", $a_perc_result);
893  $tpl->setVariable("PERC_WIDTH", $a_perc_result);
894  $tpl->setVariable("PERC_COLOR", $a_css);
895  if ($a_perc_limit) {
896  // :TODO: magic?
897  $limit_pos = (99 - $a_perc_limit) * -1;
898  $tpl->setVariable("LIMIT_POS", $limit_pos);
899  }
900  if ($a_tt_txt &&
901  $a_tt_id) {
902  $tpl->setVariable("TT_ID", $a_tt_id);
903  }
905  }
906 
907  if ($a_caption) {
908  if ($a_url) {
909  $button = $gui->link(
910  $a_caption,
911  $a_url
912  );
913 
914  $tpl->setCurrentBlock("statustxt_bl");
915  $tpl->setVariable("TXT_PROGRESS_STATUS", $button->render());
916  } else {
917  $tpl->setCurrentBlock("statustxt_no_link_bl");
918  $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
919  }
921  }
922 
923  if ($a_next_step) {
924  #$tpl->setCurrentBlock("nstep_bl");
925  $tpl->setVariable("TXT_NEXT_STEP", $a_next_step);
926  #$tpl->parseCurrentBlock();
927  }
928 
929  if ($a_tt_id &&
930  $a_tt_txt) {
931  ilTooltipGUI::addTooltip($a_tt_id, $a_tt_txt);
932  }
933 
934  if ($a_sub) {
935  $tpl->setVariable("SUB_STYLE", ' style="padding-left: ' . $a_sub_style . 'px;"');
936  $tpl->setVariable("SUB_INIT", $a_sub);
937  }
938 
939  return $tpl->get();
940  }
ilGlobalTemplateInterface $tpl
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
global $DIC
Definition: feed.php:28
ILIAS Container InternalGUIService $gui
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)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
+ 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
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 958 of file class.ilContainerObjectiveGUI.php.

971  : string {
972  global $DIC;
973 
974  $tpl = new ilTemplate("tpl.objective_progressmeter.html", true, true, "Services/Container");
975 
976  $lng = $DIC->language();
977  $lng->loadLanguageModule('crs');
978  $gui = $DIC->container()->internal()->gui();
979 
980 
981  if (is_numeric($a_perc_result)) {
982  $uiFactory = $DIC->ui()->factory();
983  $uiRenderer = $DIC->ui()->renderer();
984 
985  $pMeter = $uiFactory->chart()->progressMeter()->standard(
986  100,
987  (int) $a_perc_result,
988  (int) $a_perc_limit,
989  (int) $a_compare_value
990  );
991  $tpl->setVariable('PROGRESS_METER', $uiRenderer->render($pMeter));
992  }
993 
994  if ($a_caption) {
995  if ($a_url) {
996  $button = $gui->link(
997  $a_caption,
998  $a_url
999  );
1000 
1001  $tpl->setCurrentBlock("statustxt_bl");
1002  $tpl->setVariable("TXT_PROGRESS_STATUS", $button->render());
1003  } else {
1004  $tpl->setCurrentBlock("statustxt_no_link_bl");
1005  $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
1006  }
1008  }
1009 
1010  if ($a_next_step) {
1011  //$tpl->setCurrentBlock("nstep_bl");
1012  $tpl->setVariable("TXT_NEXT_STEP", $a_next_step);
1013  //$tpl->parseCurrentBlock();
1014  }
1015 
1016  if ($a_tt_id &&
1017  $a_tt_txt) {
1018  ilTooltipGUI::addTooltip($a_tt_id, $a_tt_txt);
1019  }
1020 
1021  if ($a_sub) {
1022  $tpl->setVariable("SUB_STYLE", ' style="padding-left: ' . $a_sub_style . 'px;"');
1023  $tpl->setVariable("SUB_INIT", $a_sub);
1024  }
1025 
1026  return $tpl->get();
1027  }
ilGlobalTemplateInterface $tpl
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
loadLanguageModule(string $a_module)
Load language module.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
global $DIC
Definition: feed.php:28
ILIAS Container InternalGUIService $gui
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)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.

◆ renderTest()

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

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

273  : string {
274  global $DIC;
275 
276  $tree = $DIC->repositoryTree();
277 
278  $node_data = [];
279  if ($a_test_ref_id) {
280  $node_data = $tree->getNodeData($a_test_ref_id);
281  }
282  if (!($node_data['child'] ?? false)) {
283  return '';
284  }
285 
286  // update ti
287  if ($a_objective_id) {
288  if ($a_is_initial) {
289  $title = sprintf($this->lng->txt('crs_loc_itst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
290  } else {
291  $title = sprintf($this->lng->txt('crs_loc_qtst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
292  }
293  $node_data['objective_id'] = $a_objective_id;
294  $node_data['objective_status'] = false;
295  } else {
296  $obj_id = ilObject::_lookupObjId($a_test_ref_id);
297  $title = ilObject::_lookupTitle($obj_id);
298 
299  $title .= (
300  ' (' .
301  (
302  $a_is_initial
303  ? $this->lng->txt('crs_loc_itest_info')
304  : $this->lng->txt('crs_loc_qtest_info')
305  ) .
306  ')'
307  );
308  $node_data['objective_id'] = 0;
309  }
310 
311  $node_data['title'] = $title;
312 
313  return "<div class='ilContObjectivesViewTestItem'>" . $this->renderItem($node_data) . "</div>";
314  }
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
renderItem(array $a_item_data, int $a_position=0, bool $a_force_icon=false, string $a_pos_prefix="", string $item_group_list_presentation="")
Render an item.
static _lookupTitle(int $obj_id)
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)

◆ showButton()

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

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

1340  : void {
1341  $ilToolbar = $this->toolbar;
1342  $ilCtrl = $this->ctrl;
1343 
1344  // #11842
1345  $ilToolbar->addButton(
1346  $a_text,
1347  $ilCtrl->getLinkTarget($this->getContainerGUI(), $a_cmd),
1348  $a_target,
1349  null,
1350  '',
1351  $a_id
1352  );
1353  }

◆ showMaterials()

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

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

321  : void {
322  $lng = $this->lng;
323 
324  if (is_array($this->items["_all"])) {
325  $this->objective_map = $this->buildObjectiveMap();
326  // all rows
327  $item_r = [];
328  $position = 1;
329  foreach ($this->items["_all"] as $k => $item_data) {
330  if ($a_mode === self::MATERIALS_TESTS && $item_data['type'] !== 'tst') {
331  continue;
332  }
333  if ($item_data['type'] === 'itgr') {
334  continue;
335  }
336  if (!$a_is_manage) {
337  // if test object is qualified or initial do not show here
338  $assignments = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
339  if ($assignments->getTypeByTest($item_data['child']) !== ilLOSettings::TYPE_TEST_UNDEFINED) {
340  continue;
341  }
342  }
343 
344  if (($this->rendered_items[$item_data["child"]] ?? false) !== true &&
345  !$this->renderer->hasItem($item_data["child"] ?? 0)) {
346  $this->rendered_items[$item_data['child']] = true;
347 
348  // TODO: Position (DONE ?)
349  $html = $this->renderItem($item_data, $position++, !($a_mode === self::MATERIALS_TESTS));
350  if ($html != "") {
351  $item_r[] = ["html" => $html, "id" => $item_data["child"], "type" => $item_data["type"]];
352  }
353  }
354  }
355 
356  // if we have at least one item, output the block
357  if (count($item_r) > 0) {
358  if (!$a_as_accordion) {
359  $pos = 0;
360 
361  switch ($a_mode) {
362  case self::MATERIALS_TESTS:
363  $block_id = "tst";
364  $this->renderer->addTypeBlock($block_id);
365  break;
366 
367  case self::MATERIALS_OTHER:
368  $block_id = "oth";
369  $this->renderer->addCustomBlock($block_id, $lng->txt('crs_other_resources'));
370  break;
371 
372  // manage
373  default:
374  $block_id = "all";
375  $this->renderer->addCustomBlock($block_id, $lng->txt('content'));
376  break;
377  }
378 
379  // :TODO:
380  if ($a_mode !== self::MATERIALS_TESTS) {
381  $pos = $this->getItemGroupsHTML();
382  }
383 
384  foreach ($item_r as $h) {
385  if (!$this->renderer->hasItem($h["id"])) {
386  $this->renderer->addItemToBlock($block_id, $h["type"], $h["id"], $h["html"]);
387  }
388  }
389 
390  $this->output_html .= $this->renderer->getHTML();
391  } else {
392  $txt = "";
393  switch ($a_mode) {
394  case self::MATERIALS_TESTS:
395  $txt = $lng->txt('objs_tst');
396  break;
397 
398  case self::MATERIALS_OTHER:
399  $txt = $lng->txt('crs_other_resources');
400  break;
401  }
402 
403  $acc = new ilAccordionGUI();
404  $acc->setId("crsobjtvmat" . $a_mode . "_" . $this->container_obj->getId());
405 
406  $acc_content = [];
407  foreach ($item_r as $h) {
408  $acc_content[] = $h["html"];
409  }
410  $acc->addItem($txt, $this->buildAccordionContent($acc_content));
411 
412  $this->output_html .= $acc->getHTML();
413  }
414  }
415  }
416  }
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...
buildObjectiveMap()
Stays in ContainergGUI, needed for addItemDetails.
renderItem(array $a_item_data, int $a_position=0, bool $a_force_icon=false, string $a_pos_prefix="", string $item_group_list_presentation="")
Render an item.
$txt
Definition: error.php:14
static getInstance(int $a_container_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ showObjectives()

ilContainerObjectiveGUI::showObjectives ( bool  $a_is_order = false)

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

170  : void
171  {
172  $lng = $this->lng;
174  $tpl = $this->tpl;
175  // get embedded blocks
176  $has_container_page = false;
177  if (!$a_is_order) {
178  $output_html = $this->getContainerGUI()->getContainerPageHTML();
179  if ($output_html !== "") {
180  $has_container_page = true;
181  $this->output_html .= $this->insertPageEmbeddedBlocks($output_html);
182  }
183  unset($output_html);
184  }
185 
186  // All objectives
187  if (!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) {
188  return;
189  }
190 
191  $this->objective_list_gui = new ilCourseObjectiveListGUI();
192  $this->objective_list_gui->setContainerObject($this->getContainerGUI());
193  if ($ilSetting->get("icon_position_in_lists") === "item_rows") {
194  $this->objective_list_gui->enableIcon(true);
195  }
196 
197  $acc = null;
198  if (!$a_is_order) {
199  $acc = new ilAccordionGUI();
200  $acc->setUseSessionStorage(true);
201  $acc->setAllowMultiOpened(true);
202  $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
203  $acc->setId("crsobjtv_" . $this->container_obj->getId());
204  } else {
205  $this->renderer->addCustomBlock('lobj', $lng->txt('crs_objectives'));
206  }
207 
208  $lur_data = $this->parseLOUserResults();
209 
210  $has_initial = ilLOSettings::getInstanceByObjId($this->container_obj->getId())->worksWithInitialTest();
211 
212  $has_lo_page = false;
213  $obj_cnt = 0;
214  foreach ($objective_ids as $objective_id) {
215  if (
216  $has_initial &&
217  (
218  !isset($lur_data[$objective_id]) ||
220  $this->container_obj->getId(),
221  ilLOSettings::getInstanceByObjId($this->container_obj->getId())->getInitialTest(),
222  $objective_id
223  )
224  )
225  ) {
226  $lur_data[$objective_id] = ["type" => ilLOSettings::TYPE_TEST_INITIAL];
227  }
228 
229  if ($html = $this->renderObjective($objective_id, $has_lo_page, $acc, $lur_data[$objective_id] ?? null)) {
230  $this->renderer->addItemToBlock('lobj', 'lobj', $objective_id, $html);
231  }
232  $obj_cnt++;
233  }
234 
235  // buttons for showing/hiding all objectives
236  if (!$a_is_order && $obj_cnt > 1) {
237  $this->showButton("", $lng->txt("crs_show_all_obj"), "", "crs_show_all_obj_btn");
238  $this->showButton("", $lng->txt("crs_hide_all_obj"), "", "crs_hide_all_obj_btn");
239  $acc->setShowAllElement("crs_show_all_obj_btn");
240  $acc->setHideAllElement("crs_hide_all_obj_btn");
241  }
242 
243  if (!$has_container_page && $has_lo_page) {
244  // add core co page css
245  $tpl->setVariable(
246  "LOCATION_CONTENT_STYLESHEET",
248  );
249  $tpl->setCurrentBlock("SyntaxStyle");
250  $tpl->setVariable(
251  "LOCATION_SYNTAX_STYLESHEET",
253  );
255  }
256 
257  // order/block
258  if ($a_is_order) {
259  $this->output_html .= $this->renderer->getHTML();
260 
261  $this->renderer->resetDetails();
262  }
263  // view/accordion
264  else {
265  $this->output_html .= "<div class='ilCrsObjAcc'>" . $acc->getHTML() . "</div>";
266  }
267  }
static hasActiveRun(int $a_container_id, int $a_test_ref_id, int $a_objective_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...
ilGlobalTemplateInterface $tpl
renderObjective(int $a_objective_id, bool &$a_has_lo_page, ilAccordionGUI $a_accordion=null, array $a_lo_result=null)
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
showButton(string $a_cmd, string $a_text, string $a_target='', string $a_id="")
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static getInstanceByObjId(int $a_obj_id)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
global $ilSetting
Definition: privfeed.php:18
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
insertPageEmbeddedBlocks(string $a_output_html)
Insert blocks into container page.

◆ updateResult()

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

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

602  : array {
603  if ($this->loc_settings->getQualifiedTest() === $a_item_ref_id) {
604  // Check for existing test run, and decrease tries, reset final if run exists
606  $a_item_ref_id,
607  $a_user_id
608  );
609 
611  ilObject::_lookupObjId($a_item_ref_id),
612  $a_objective_id,
613  $a_user_id
614  )) {
615  if ($a_res['tries'] > 0) {
616  --$a_res['tries'];
617  }
618  $a_res['is_final'] = 0;
619  }
620  }
621  return $a_res;
622  }
static isParticipantsLastPassActive(int $test_ref_id, int $user_id)
static _lookupObjId(int $ref_id)
static lookupRunExistsForObjective(int $a_test_id, int $a_objective_id, int $a_user_id)

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.

◆ $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.

◆ $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.

◆ $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: