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

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

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

1322 : string
1323 {
1324 $tpl = new ilTemplate("tpl.objective_accordion_content.html", true, true, "components/ILIAS/Container");
1325 foreach ($a_items as $item) {
1326 $tpl->setCurrentBlock("items_bl");
1327 $tpl->setVariable("ITEM", $item);
1329 }
1330 return $tpl->get();
1331 }
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.

◆ buildAccordionTitle()

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

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

1194 : string {
1195 global $DIC;
1196
1197 $renderer = $DIC->ui()->renderer();
1198 $ui_factory = $DIC->ui()->factory();
1199
1200 $tpl = new ilTemplate("tpl.objective_accordion_title.html", true, true, "components/ILIAS/Container");
1201
1202 if ($a_lo_result) {
1204 "PROGRESS_BAR",
1205 self::buildObjectiveProgressBar(
1206 $this->loc_settings->worksWithInitialTest(),
1207 $a_objective->getObjectiveId(),
1208 $a_lo_result
1209 )
1210 );
1211 }
1212
1213 $tpl->setVariable("TITLE", $this->lng->txt("crs_loc_learning_objective") . ": " . trim($a_objective->getTitle()));
1214 $tpl->setVariable("DESCRIPTION", nl2br(trim($a_objective->getDescription())));
1215
1216 $initial_res = null;
1217 $initial_lim = null;
1218 if ($this->loc_settings->worksWithInitialTest()) {
1219 if (array_key_exists('initial', $a_lo_result)) {
1220 $initial_res = (int) ($a_lo_result['initial']['result_perc'] ?? 0);
1221 $initial_lim = (int) ($a_lo_result['initial']['limit_perc'] ?? 0);
1222 }
1223 if (
1224 $a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
1225 isset($a_lo_result['result_perc'])
1226 ) {
1227 $initial_res = (int) ($a_lo_result['result_perc'] ?? 0);
1228 $initial_lim = (int) ($a_lo_result['limit_perc'] ?? 0);
1229 }
1230 }
1231
1232 if ($initial_res !== null) {
1234 $a_lo_result["itest"],
1235 $a_lo_result["user_id"]
1236 );
1237
1238 if ($link !== '') {
1239 $tpl->setCurrentBlock('i_with_link');
1241 'IBTN',
1242 $renderer->render(
1243 $ui_factory->button()->shy(
1244 $this->lng->txt('crs_objective_result_details'),
1245 $link
1246 )
1247 )
1248 );
1250 }
1251
1252 $tpl->setCurrentBlock('res_initial');
1254 'IRESULT',
1255 sprintf(
1256 $this->lng->txt('crs_objective_result_summary_initial'),
1257 $initial_res . '%',
1258 (int) $initial_lim . '%'
1259 )
1260 );
1262 }
1263
1264 $qual_res = null;
1265 $qual_lim = null;
1266
1267 if (($a_lo_result['type'] ?? null) == ilLOUserResults::TYPE_QUALIFIED) {
1268 $qual_res = (int) $a_lo_result['result_perc'];
1269 $qual_lim = (int) $a_lo_result['limit_perc'];
1270 }
1271
1272 if ($qual_res !== null) {
1274 $a_lo_result["qtest"],
1275 $a_lo_result["user_id"]
1276 );
1277
1278 if ($link !== '') {
1279 $tpl->setCurrentBlock('q_with_link');
1281 'QBTN',
1282 $renderer->render(
1283 $ui_factory->button()->shy(
1284 $this->lng->txt('crs_objective_result_details'),
1285 $link
1286 )
1287 )
1288 );
1290 }
1291 $tpl->setCurrentBlock('res_qualifying');
1293 'QRESULT',
1294 sprintf(
1295 $this->lng->txt('crs_objective_result_summary_qualifying'),
1296 $qual_res . '%',
1297 (int) $qual_lim . '%'
1298 )
1299 );
1301 }
1302
1303 $this->logger->dump($a_lo_result);
1304
1306 $this->loc_settings->worksWithInitialTest(),
1307 $a_objective->getObjectiveId(),
1308 $a_lo_result
1309 );
1310 if ($summary !== '') {
1311 $tpl->setCurrentBlock('objective_summary');
1312 $tpl->setVariable('SUMMARY_TXT', $summary);
1314 }
1315
1316 // #15510
1317 $tpl->setVariable("ANCHOR_ID", "objtv_acc_" . $a_objective->getObjectiveId());
1318
1319 return $tpl->get();
1320 }
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 1081 of file class.ilContainerObjectiveGUI.php.

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

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

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

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

822 : void
823 {
824 $this->test_assignments = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
825 }
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 828 of file class.ilContainerObjectiveGUI.php.

828 : array
829 {
830 $ilUser = $this->user;
831 $initial_status = null;
832
833 $res = [];
834
836
837 $lur = new ilLOUserResults($this->getContainerObject()->getId(), $ilUser->getId());
838 foreach ($lur->getCourseResultsForUserPresentation() as $objective_id => $types) {
839 // show either initial or qualified for objective
840 if (isset($types[ilLOUserResults::TYPE_INITIAL])) {
841 $initial_status = $types[ilLOUserResults::TYPE_INITIAL]["status"];
842 }
843
844 // qualified test has priority
845 if (isset($types[ilLOUserResults::TYPE_QUALIFIED])) {
846 $result = $types[ilLOUserResults::TYPE_QUALIFIED];
847 $result["type"] = ilLOUserResults::TYPE_QUALIFIED;
848 $result["initial"] = $types[ilLOUserResults::TYPE_INITIAL] ?? null;
849 } else {
850 $result = $types[ilLOUserResults::TYPE_INITIAL];
851 $result["type"] = ilLOUserResults::TYPE_INITIAL;
852 }
853
854 $result["initial_status"] = $initial_status;
855
856 $result["itest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL);
857 $result["qtest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
858
859 $res[$objective_id] = $result;
860 }
861
862 return $res;
863 }

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

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

891 : string {
892 global $DIC;
893
894 $gui = $DIC->container()->internal()->gui();
895
896 $tpl = new ilTemplate("tpl.objective_progressbar.html", true, true, "components/ILIAS/Container");
897
898 if ($a_perc_result !== null) {
899 $tpl->setCurrentBlock("statusbar_bl");
900 $tpl->setVariable("PERC_STATUS", $a_perc_result);
901 $tpl->setVariable("PERC_WIDTH", $a_perc_result);
902 $tpl->setVariable("PERC_COLOR", $a_css);
903 if ($a_perc_limit) {
904 // :TODO: magic?
905 $limit_pos = (99 - $a_perc_limit) * -1;
906 $tpl->setVariable("LIMIT_POS", $limit_pos);
907 }
908 if ($a_tt_txt &&
909 $a_tt_id) {
910 $tpl->setVariable("TT_ID", $a_tt_id);
911 }
913 }
914
915 if ($a_caption) {
916 if ($a_url) {
917 $button = $gui->link(
918 $a_caption,
919 $a_url
920 );
921
922 $tpl->setCurrentBlock("statustxt_bl");
923 $tpl->setVariable("TXT_PROGRESS_STATUS", $button->render());
924 } else {
925 $tpl->setCurrentBlock("statustxt_no_link_bl");
926 $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
927 }
929 }
930
931 if ($a_next_step) {
932 #$tpl->setCurrentBlock("nstep_bl");
933 $tpl->setVariable("TXT_NEXT_STEP", $a_next_step);
934 #$tpl->parseCurrentBlock();
935 }
936
937 if ($a_sub) {
938 $tpl->setVariable("SUB_STYLE", ' style="padding-left: ' . $a_sub_style . 'px;"');
939 $tpl->setVariable("SUB_INIT", $a_sub);
940 }
941
942 return $tpl->get();
943 }
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 961 of file class.ilContainerObjectiveGUI.php.

974 : string {
975 global $DIC;
976
977 $tpl = new ilTemplate("tpl.objective_progressmeter.html", true, true, "components/ILIAS/Container");
978
979 $lng = $DIC->language();
980 $lng->loadLanguageModule('crs');
981 $gui = $DIC->container()->internal()->gui();
982
983
984 if (is_numeric($a_perc_result)) {
985 $uiFactory = $DIC->ui()->factory();
986 $uiRenderer = $DIC->ui()->renderer();
987
988 $pMeter = $uiFactory->chart()->progressMeter()->standard(
989 100,
990 (int) $a_perc_result,
991 (int) $a_perc_limit,
992 (int) $a_compare_value
993 );
994 $tpl->setVariable('PROGRESS_METER', $uiRenderer->render($pMeter));
995 }
996
997 if ($a_caption) {
998 if ($a_url) {
999 $button = $gui->link(
1000 $a_caption,
1001 $a_url
1002 );
1003
1004 $tpl->setCurrentBlock("statustxt_bl");
1005 $tpl->setVariable("TXT_PROGRESS_STATUS", $button->render());
1006 } else {
1007 $tpl->setCurrentBlock("statustxt_no_link_bl");
1008 $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
1009 }
1011 }
1012
1013 if ($a_next_step) {
1014 //$tpl->setCurrentBlock("nstep_bl");
1015 $tpl->setVariable("TXT_NEXT_STEP", $a_next_step);
1016 //$tpl->parseCurrentBlock();
1017 }
1018
1019 if ($a_sub) {
1020 $tpl->setVariable("SUB_STYLE", ' style="padding-left: ' . $a_sub_style . 'px;"');
1021 $tpl->setVariable("SUB_INIT", $a_sub);
1022 }
1023
1024 return $tpl->get();
1025 }

◆ 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 $item_group_list_presentation="")
Render an item.
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 1333 of file class.ilContainerObjectiveGUI.php.

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

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'] === 'itgr') {
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->getItemGroupsHTML();
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...
$txt
Definition: error.php:31

References $lng, $txt, 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:31

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

609 : array {
610 if ($this->loc_settings->getQualifiedTest() === $a_item_ref_id) {
611 // Check for existing test run, and decrease tries, reset final if run exists
613 $a_item_ref_id,
614 $a_user_id
615 );
616
618 ilObject::_lookupObjId($a_item_ref_id),
619 $a_objective_id,
620 $a_user_id
621 )) {
622 if ($a_res['tries'] > 0) {
623 --$a_res['tries'];
624 }
625 $a_res['is_final'] = 0;
626 }
627 }
628 return $a_res;
629 }
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: