ILIAS  release_8 Revision v8.24
class.ilContainerContentGUI.php
Go to the documentation of this file.
1<?php
2
23
33{
34 public const DETAILS_DEACTIVATED = 0;
35 public const DETAILS_TITLE = 1;
36 public const DETAILS_ALL = 2;
37
38 public const VIEW_MODE_LIST = 0;
39 public const VIEW_MODE_TILE = 1;
40
42 protected ilCtrl $ctrl;
43 protected ilObjUser $user;
44 protected ilLanguage $lng;
46 protected ilDBInterface $db;
54 public bool $adminCommands = false;
55 protected ilLogger $log;
56 protected int $view_mode;
57 protected array $embedded_block = [];
58 protected array $items = [];
60 protected array $list_gui = [];
65
66 public function __construct(ilContainerGUI $container_gui_obj)
67 {
69 global $DIC;
70
71 $this->tpl = $DIC["tpl"];
72 $this->ctrl = $DIC->ctrl();
73 $this->user = $DIC->user();
74 $this->lng = $DIC->language();
75 $this->access = $DIC->access();
76 $this->db = $DIC->database();
77 $this->rbacsystem = $DIC->rbac()->system();
78 $this->settings = $DIC->settings();
79 $this->obj_definition = $DIC["objDefinition"];
80 $tpl = $DIC["tpl"];
81
82 $this->container_gui = $container_gui_obj;
84 $obj = $this->container_gui->getObject();
85 $this->container_obj = $obj;
86
87 $tpl->addJavaScript("./Services/Container/js/Container.js");
88
89 $this->log = ilLoggerFactory::getLogger('cont');
90
91 $this->view_mode = (ilContainer::_lookupContainerSetting($this->container_obj->getId(), "list_presentation") === "tile" && !$this->container_gui->isActiveAdministrationPanel() && !$this->container_gui->isActiveOrdering())
92 ? self::VIEW_MODE_TILE
93 : self::VIEW_MODE_LIST;
94
95 $this->clipboard = $DIC
96 ->repository()
97 ->internal()
98 ->domain()
99 ->clipboard();
100 $this->request = $DIC
101 ->container()
102 ->internal()
103 ->gui()
104 ->standardRequest();
105 $this->item_manager = $DIC
106 ->container()
107 ->internal()
108 ->domain()
109 ->content()
110 ->items($this->container_obj);
111 $this->block_repo = $DIC
112 ->container()
113 ->internal()
114 ->repo()
115 ->content()
116 ->block();
117 }
118
119 protected function getViewMode(): int
120 {
121 return $this->view_mode;
122 }
123
124 protected function getDetailsLevel(int $a_item_id): int
125 {
127 }
128
130 {
132 }
133
135 {
137 }
138
143 public function setOutput(): void
144 {
146 $ilCtrl = $this->ctrl;
147
148 // note: we do not want to get the center html in case of
149 // asynchronous calls to blocks in the right column (e.g. news)
150 // see #13012
151 if ($ilCtrl->getNextClass() === "ilcolumngui" &&
152 $ilCtrl->isAsynch()) {
154 }
155
156 // BEGIN ChangeEvent: record read event.
158
159 $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
161 $this->getContainerObject()->getType(),
162 $this->getContainerObject()->getRefId(),
163 $obj_id,
164 $ilUser->getId()
165 );
166 // END ChangeEvent: record read event.
167
168 $html = $this->getCenterColumnHTML();
169 if ($html !== '') {
170 $tpl->setContent($html);
171 }
172
173 // see above, all other cases (this was the old position of setRightContent,
174 // maybe the position above is ok and all ifs can be removed)
175 if ($ilCtrl->getNextClass() !== "ilcolumngui" ||
176 !$ilCtrl->isAsynch()) {
178 }
179 }
180
181 protected function getRightColumnHTML(): string
182 {
183 $ilCtrl = $this->ctrl;
184 $html = "";
185
186 $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
187
188 $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
189 $obj_type = ilObject::_lookupType($obj_id);
190
191 $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
192
193 if ($column_gui::getScreenMode() === IL_SCREEN_FULL) {
194 return "";
195 }
196
197 $this->getContainerGUI()->setColumnSettings($column_gui);
198
199 if ($ilCtrl->getNextClass() === "ilcolumngui" &&
200 $column_gui::getCmdSide() === IL_COL_RIGHT &&
201 $column_gui::getScreenMode() === IL_SCREEN_SIDE) {
202 $html = $ilCtrl->forwardCommand($column_gui);
203 } else {
204 if (!$ilCtrl->isAsynch()) {
205 $html = "";
206
207 // user interface plugin slot + default rendering
208 $uip = new ilUIHookProcessor(
209 "Services/Container",
210 "right_column",
211 ["container_content_gui" => $this]
212 );
213 if (!$uip->replaced()) {
214 $html = $ilCtrl->getHTML($column_gui);
215 }
216 $html = $uip->getHTML($html);
217 }
218 }
219
220 return $html;
221 }
222
223 protected function getCenterColumnHTML(): string
224 {
225 $ilCtrl = $this->ctrl;
228
229 $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
230
231 $tpl->addOnLoadCode("il.Object.setRedrawListItemUrl('" .
232 $ilCtrl->getLinkTarget($this->container_gui, "redrawListItem", "", true) . "');");
233
234 $tpl->addOnLoadCode("il.Object.setRatingUrl('" .
235 $ilCtrl->getLinkTargetByClass(
236 [get_class($this->container_gui), "ilcommonactiondispatchergui", "ilratinggui"],
237 "saveRating",
238 "",
239 true,
240 false
241 ) . "');");
242
243 switch ($ilCtrl->getNextClass()) {
244 case "ilcolumngui":
245 $this->container_gui->setSideColumnReturn();
246 $html = $this->forwardToColumnGUI();
247 break;
248
249 default:
250 $ilDB->useSlave(true);
251 $html = $this->getMainContent();
252 $ilDB->useSlave(false);
253 break;
254 }
255
256 return $html;
257 }
258
263 abstract public function getMainContent(): string;
264
268 protected function initRenderer(): void
269 {
271
272 $this->renderer = new ilContainerRenderer(
273 ($this->getContainerGUI()->isActiveAdministrationPanel() && !$this->clipboard->hasEntries()),
274 $this->getContainerGUI()->isMultiDownloadEnabled(),
275 $this->getContainerGUI()->isActiveOrdering() && (get_class($this) !== "ilContainerObjectiveGUI") // no block sorting in objective view
276 ,
277 $sorting->getBlockPositions(),
278 $this->container_gui,
279 $this->getViewMode(),
280 $this->getContainerGUI()->isActiveAdministrationPanel()
281 );
282
283 // all event items are included per session rendering
284 // and should return true for hasItem
285 $event_items = ilEventItems::_getItemsOfContainer($this->container_obj->getRefId());
286 foreach ($event_items as $ev) {
287 $this->renderer->addItemId($ev);
288 }
289 }
290
294 private function forwardToColumnGUI(): string
295 {
296 $ilCtrl = $this->ctrl;
297 $html = "";
298
299 // this gets us the subitems we need in setColumnSettings()
300 // todo: this should be done in ilCourseGUI->getSubItems
301
302 $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
303 $obj_type = ilObject::_lookupType($obj_id);
304
305 if (!$ilCtrl->isAsynch()) {
307 // right column wants center
309 $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
310 $this->getContainerGUI()->setColumnSettings($column_gui);
311 $html = $ilCtrl->forwardCommand($column_gui);
312 }
313 // left column wants center
315 $column_gui = new ilColumnGUI($obj_type, IL_COL_LEFT);
316 $this->getContainerGUI()->setColumnSettings($column_gui);
317 $html = $ilCtrl->forwardCommand($column_gui);
318 }
319 } else {
320 $html = $this->getMainContent();
321 }
322 }
323
324 return $html;
325 }
326
327 protected function clearAdminCommandsDetermination(): void
328 {
329 $this->adminCommands = false;
330 }
331
332 protected function determineAdminCommands(
333 int $a_ref_id,
334 bool $a_admin_com_included_in_list = false
335 ): void {
336 $rbacsystem = $this->rbacsystem;
337
338 if (!$this->adminCommands) {
339 if (!$this->getContainerGUI()->isActiveAdministrationPanel()) {
340 if ($rbacsystem->checkAccess("delete", $a_ref_id)) {
341 $this->adminCommands = true;
342 }
343 } else {
344 $this->adminCommands = $a_admin_com_included_in_list;
345 }
346 }
347 }
348
349 protected function getItemGUI(array $item_data): ilObjectListGUI
350 {
351 // get item list gui object
352 if (!isset($this->list_gui[$item_data["type"]])) {
353 $item_list_gui = ilObjectListGUIFactory::_getListGUIByType($item_data["type"]);
354 $item_list_gui->setContainerObject($this->getContainerGUI());
355 $this->list_gui[$item_data["type"]] = &$item_list_gui;
356 } else {
357 $item_list_gui = &$this->list_gui[$item_data["type"]];
358 }
359
360 // unique js-ids
361 $item_list_gui->setParentRefId((int) ($item_data["parent"] ?? 0));
362
363 $item_list_gui->setDefaultCommandParameters([]);
364 $item_list_gui->disableTitleLink(false);
365 $item_list_gui->resetConditionTarget();
366
367 if ($this->container_obj->isClassificationFilterActive()) {
368 $item_list_gui->enablePath(
369 true,
370 $this->container_obj->getRefId(),
372 );
373 }
374
375 // activate common social commands
376 $item_list_gui->enableComments(true);
377 $item_list_gui->enableNotes(true);
378 $item_list_gui->enableTags(true);
379 $item_list_gui->enableRating(true);
380
381 // reset
382 $item_list_gui->forceVisibleOnly(false);
383
384 // container specific modifications
385 $this->getContainerGUI()->modifyItemGUI($item_list_gui, $item_data);
386
387 return $item_list_gui;
388 }
389
394 string $a_container_page_html
395 ): void {
396 $type_grps = $this->getGroupedObjTypes();
397
398 // iterate all types
399 foreach ($type_grps as $type => $v) {
400 // set template (overall or type specific)
401 if (is_int(strpos($a_container_page_html, "[list-" . $type . "]"))) {
402 $this->addEmbeddedBlock("type", $type);
403 }
404 }
405
406 // determine item groups
407 while (preg_match('~\[(item-group-([0-9]*))\]~i', $a_container_page_html, $found)) {
408 $this->addEmbeddedBlock("itgr", (int) $found[2]);
409
410 $html = ''; // This was never defined before
411 $a_container_page_html = preg_replace('~\[' . $found[1] . '\]~i', $html, $a_container_page_html);
412 }
413 }
414
420 public function addEmbeddedBlock(
421 string $block_type,
422 $block_parameter
423 ): void {
424 $this->embedded_block[$block_type][] = $block_parameter;
425 }
426
427 public function getEmbeddedBlocks(): array
428 {
429 return $this->embedded_block;
430 }
431
432 public function renderPageEmbeddedBlocks(): void
433 {
434 // item groups
435 if (isset($this->embedded_block["itgr"]) && is_array($this->embedded_block["itgr"])) {
436 $item_groups = [];
437 if (isset($this->items["itgr"]) && is_array($this->items["itgr"])) {
438 foreach ($this->items["itgr"] as $ig) {
439 $item_groups[$ig["ref_id"]] = $ig;
440 }
441 }
442
443 foreach ($this->embedded_block["itgr"] as $ref_id) {
444 if (isset($item_groups[$ref_id])) {
445 $this->renderItemGroup($item_groups[$ref_id]);
446 }
447 }
448 }
449
450 // type specific blocks
451 if (isset($this->embedded_block["type"]) && is_array($this->embedded_block["type"])) {
452 foreach ($this->embedded_block["type"] as $type) {
453 if (isset($this->items[$type]) && is_array($this->items[$type]) && $this->renderer->addTypeBlock($type)) {
454 if ($this->hasForcedOrderByStartDate($type)) {
455 $this->items['sess'] = ilArrayUtil::sortArray($this->items['sess'], 'start', 'ASC', true, true);
456 }
457
458 $position = 1;
459
460 foreach ($this->items[$type] as $item_data) {
461 if (!$this->renderer->hasItem($item_data["child"])) {
462 $html = $this->renderItem($item_data, $position++);
463 if ($html != "") {
464 $this->renderer->addItemToBlock($type, $item_data["type"], $item_data["child"], $html);
465 }
466 }
467 }
468 }
469 }
470 }
471 }
472
473 protected function hasForcedOrderByStartDate(string $type): bool
474 {
475 return $type === 'sess' && get_class($this) === ilContainerSessionsContentGUI::class;
476 }
477
482 public function renderItem(
483 array $a_item_data,
484 int $a_position = 0,
485 bool $a_force_icon = false,
486 string $a_pos_prefix = "",
487 string $item_group_list_presentation = ""
488 ) {
490 $ilAccess = $this->access;
491 $ilCtrl = $this->ctrl;
492
493 // Pass type, obj_id and tree to checkAccess method to improve performance
494 if (!$ilAccess->checkAccess('visible', '', $a_item_data['ref_id'], $a_item_data['type'], $a_item_data['obj_id'], $a_item_data['tree'])) {
495 return '';
496 }
497
498 $view_mode = $this->getViewMode();
499 if ($item_group_list_presentation != "") {
500 $view_mode = ($item_group_list_presentation === "tile")
501 ? self::VIEW_MODE_TILE
502 : self::VIEW_MODE_LIST;
503 }
504
505 if ($view_mode === self::VIEW_MODE_TILE) {
506 return $this->renderCard($a_item_data, $a_position, $a_force_icon, $a_pos_prefix);
507 }
508
509 $item_list_gui = $this->getItemGUI($a_item_data);
510 if ($a_item_data["type"] === "sess" ||
511 $a_force_icon ||
512 $ilSetting->get("icon_position_in_lists") === "item_rows") {
513 $item_list_gui->enableIcon(true);
514 }
515
516 if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$this->clipboard->hasEntries()) {
517 $item_list_gui->enableCheckbox(true);
518 } elseif ($this->getContainerGUI()->isMultiDownloadEnabled()) {
519 // display multi download checkboxes
520 $item_list_gui->enableDownloadCheckbox((int) $a_item_data["ref_id"]);
521 }
522
523 if ($this->getContainerGUI()->isActiveItemOrdering() && !$this->hasForcedOrderByStartDate($a_item_data['type'])) {
524 $item_list_gui->setPositionInputField(
525 $a_pos_prefix . "[" . $a_item_data["ref_id"] . "]",
526 sprintf('%d', $a_position * 10)
527 );
528 }
529
530 if ($a_item_data['type'] === 'sess' && get_class($this) !== 'ilContainerObjectiveGUI') {
531 switch ($this->getDetailsLevel($a_item_data['obj_id'])) {
532 case self::DETAILS_TITLE:
533 $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_MINIMAL);
534 $item_list_gui->enableExpand(true);
535 $item_list_gui->setExpanded(false);
536 $item_list_gui->enableDescription(false);
537 $item_list_gui->enableProperties(true);
538 break;
539
540 case self::DETAILS_ALL:
541 $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
542 $item_list_gui->enableExpand(true);
543 $item_list_gui->setExpanded(true);
544 $item_list_gui->enableDescription(true);
545 $item_list_gui->enableProperties(true);
546 break;
547
548 default:
549 $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
550 $item_list_gui->enableExpand(true);
551 $item_list_gui->enableDescription(true);
552 $item_list_gui->enableProperties(true);
553 break;
554 }
555 }
556
557 if (method_exists($this, "addItemDetails")) {
558 $this->addItemDetails($item_list_gui, $a_item_data);
559 }
560
561 // show subitems
562 if ($a_item_data['type'] === 'sess' && (
563 $this->getDetailsLevel($a_item_data['obj_id']) !== self::DETAILS_TITLE ||
564 $this->getContainerGUI()->isActiveAdministrationPanel() ||
565 $this->getContainerGUI()->isActiveItemOrdering()
566 )) {
567 $pos = 1;
568
569 $items = ilObjectActivation::getItemsByEvent($a_item_data['obj_id']);
570 $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('sess', $a_item_data['obj_id'], $items);
572
573 $item_readable = $ilAccess->checkAccess('read', '', $a_item_data['ref_id']);
574
575 foreach ($items as $item) {
576 // TODO: this should be removed and be handled by if(strlen($sub_item_html))
577 // see mantis: 0003944
578 if (!$ilAccess->checkAccess('visible', '', $item['ref_id'])) {
579 continue;
580 }
581
582 $item_list_gui2 = $this->getItemGUI($item);
583 $item_list_gui2->enableIcon(true);
584 $item_list_gui2->enableItemDetailLinks(false);
585
586 // unique js-ids
587 $item_list_gui2->setParentRefId((int) ($a_item_data['ref_id'] ?? 0));
588
589 // @see mantis 10488
590 if (!$item_readable && !$ilAccess->checkAccess('write', '', $item['ref_id'])) {
591 $item_list_gui2->forceVisibleOnly(true);
592 }
593
594 if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$this->clipboard->hasEntries()) {
595 $item_list_gui2->enableCheckbox(true);
596 } elseif ($this->getContainerGUI()->isMultiDownloadEnabled()) {
597 // display multi download checkbox
598 $item_list_gui2->enableDownloadCheckbox((int) $item['ref_id']);
599 }
600
601 if ($this->getContainerGUI()->isActiveItemOrdering()) {
602 $item_list_gui2->setPositionInputField(
603 "[sess][" . $a_item_data['obj_id'] . "][" . $item["ref_id"] . "]",
604 sprintf('%d', $pos * 10)
605 );
606 $pos++;
607 }
608
609 // #10611
611
612 $sub_item_html = $item_list_gui2->getListItemHTML(
613 $item['ref_id'],
614 $item['obj_id'],
615 $item['title'],
616 $item['description']
617 );
618
619 $this->determineAdminCommands($item["ref_id"], $item_list_gui2->adminCommandsIncluded());
620 if ($sub_item_html !== '') {
621 $item_list_gui->addSubItemHTML($sub_item_html);
622 }
623 }
624 }
625
626 $asynch = false;
627 $asynch_url = '';
628 if ($ilSetting->get("item_cmd_asynch")) {
629 $asynch = true;
630 $ilCtrl->setParameter($this->container_gui, "cmdrefid", $a_item_data['ref_id']);
631 $asynch_url = $ilCtrl->getLinkTarget(
632 $this->container_gui,
633 "getAsynchItemList",
634 "",
635 true,
636 false
637 );
638 $ilCtrl->setParameter($this->container_gui, "cmdrefid", "");
639 }
640
641 ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_item_data);
642
643 $html = $item_list_gui->getListItemHTML(
644 (int) $a_item_data['ref_id'],
645 (int) $a_item_data['obj_id'],
646 (string) $a_item_data['title'],
647 (string) $a_item_data['description'],
648 $asynch,
649 false,
650 $asynch_url
651 );
652 $this->determineAdminCommands(
653 $a_item_data["ref_id"],
654 $item_list_gui->adminCommandsIncluded()
655 );
656
657
658 return $html;
659 }
660
661 public function renderCard(
662 array $a_item_data,
663 int $a_position = 0,
664 bool $a_force_icon = false,
665 string $a_pos_prefix = ""
666 ): ?\ILIAS\UI\Component\Card\RepositoryObject {
667 $item_list_gui = $this->getItemGUI($a_item_data);
668 $item_list_gui->setAjaxHash(ilCommonActionDispatcherGUI::buildAjaxHash(
670 $a_item_data['ref_id'],
671 $a_item_data['type'],
672 (int) $a_item_data['obj_id']
673 ));
674 $item_list_gui->initItem(
675 (int) $a_item_data['ref_id'],
676 (int) $a_item_data['obj_id'],
677 (string) $a_item_data['type'],
678 (string) $a_item_data['title'],
679 (string) $a_item_data['description']
680 );
681
682 // actions
683 $item_list_gui->insertCommands();
684 return $item_list_gui->getAsCard(
685 $a_item_data['ref_id'],
686 (int) $a_item_data['obj_id'],
687 (string) $a_item_data['type'],
688 (string) $a_item_data['title'],
689 (string) $a_item_data['description']
690 );
691 }
692
696 public function insertPageEmbeddedBlocks(string $a_output_html): string
697 {
698 $this->determinePageEmbeddedBlocks($a_output_html);
699 $this->renderPageEmbeddedBlocks();
700
701 // iterate all types
702 foreach ($this->getGroupedObjTypes() as $type => $v) {
703 // set template (overall or type specific)
704 if (is_int(strpos($a_output_html, "[list-" . $type . "]"))) {
705 $a_output_html = preg_replace(
706 '~\[list-' . $type . '\]~i',
707 $this->renderer->renderSingleTypeBlock($type),
708 $a_output_html
709 );
710 }
711 }
712
713 // insert all item groups
714 while (preg_match('~\[(item-group-([0-9]*))\]~i', $a_output_html, $found)) {
715 $itgr_ref_id = (int) $found[2];
716
717 $a_output_html = preg_replace(
718 '~\[' . $found[1] . '\]~i',
719 $this->renderer->renderSingleCustomBlock($itgr_ref_id),
720 $a_output_html
721 );
722 }
723
724 return $a_output_html;
725 }
726
731 string $type
732 ): string {
733 $this->initRenderer();
734 // get all sub items
735 $this->items = $this->getContainerObject()->getSubItems(
736 $this->getContainerGUI()->isActiveAdministrationPanel()
737 );
738
739
740 $ref_ids = $this->request->getAlreadyRenderedRefIds();
741
742 // iterate all types
743 if (is_array($this->items[$type]) &&
744 $this->renderer->addTypeBlock($type)) {
745 //$this->renderer->setBlockPosition($type, ++$pos);
746
747 $position = 1;
748 $counter = 1;
749 foreach ($this->items[$type] as $item_data) {
750 $item_ref_id = $item_data["child"];
751
752 if (in_array($item_ref_id, $ref_ids)) {
753 continue;
754 }
755
756 if ($this->block_limit > 0 && $counter == $this->block_limit + 1) {
757 if ($counter == $this->block_limit + 1) {
758 // render more button
759 $this->renderer->addShowMoreButton($type);
760 }
761 continue;
762 }
763
764 if (!$this->renderer->hasItem($item_ref_id)) {
765 $html = $this->renderItem($item_data, $position++);
766 if ($html != "") {
767 $counter++;
768 $this->renderer->addItemToBlock($type, $item_data["type"], $item_ref_id, $html);
769 }
770 }
771 }
772 }
773
774 return $this->renderer->renderSingleTypeBlock($type);
775 }
776
780 public function getGroupedObjTypes(): array
781 {
782 $objDefinition = $this->obj_definition;
783
784 if (empty($this->type_grps)) {
785 $this->type_grps =
786 $objDefinition::getGroupedRepositoryObjectTypes($this->getContainerObject()->getType());
787 }
788 return $this->type_grps;
789 }
790
791 public function getIntroduction(): string
792 {
794
795 $lng->loadLanguageModule("rep");
796
797 $tpl = new ilTemplate("tpl.rep_intro.html", true, true, "Services/Repository");
798 $tpl->setVariable("IMG_REP_LARGE", ilObject::_getIcon(0, "big", "root"));
799 $tpl->setVariable("TXT_WELCOME", $lng->txt("rep_intro"));
800 $tpl->setVariable("TXT_INTRO_1", $lng->txt("rep_intro1"));
801 $tpl->setVariable("TXT_INTRO_2", $lng->txt("rep_intro2"));
802 $tpl->setVariable("TXT_INTRO_3", sprintf($lng->txt("rep_intro3"), $lng->txt("add")));
803 $tpl->setVariable("TXT_INTRO_4", sprintf($lng->txt("rep_intro4"), $lng->txt("cat_add")));
804 $tpl->setVariable("TXT_INTRO_5", $lng->txt("rep_intro5"));
805 $tpl->setVariable("TXT_INTRO_6", $lng->txt("rep_intro6"));
806
807 return $tpl->get();
808 }
809
810 public function getItemGroupsHTML(int $a_pos = 0): int
811 {
812 if (isset($this->items["itgr"]) && is_array($this->items["itgr"])) {
813 foreach ($this->items["itgr"] as $itgr) {
814 if (!$this->renderer->hasCustomBlock($itgr["child"])) {
815 $this->renderItemGroup($itgr);
816
817 $this->renderer->setBlockPosition($itgr["ref_id"], ++$a_pos);
818 }
819 }
820 }
821 return $a_pos;
822 }
823
824 public function renderItemGroup(array $a_itgr): void
825 {
826 $ilAccess = $this->access;
827 $ilUser = $this->user;
828
829 // #16493
830 $perm_ok = ($ilAccess->checkAccess("visible", "", $a_itgr['ref_id']) &&
831 $ilAccess->checkAccess("read", "", $a_itgr['ref_id']));
832
833 $items = ilObjectActivation::getItemsByItemGroup($a_itgr['ref_id']);
834
835 // get all valid ids (this is filtered)
836 $all_ids = array_map(static function (array $i): int {
837 return (int) $i["child"];
838 }, $this->items["_all"]);
839
840 // remove filtered items
841 $items = array_filter($items, static function (array $i) use ($all_ids): bool {
842 return in_array($i["ref_id"], $all_ids);
843 });
844
845 // if no permission is given, set the items to "rendered" but
846 // do not display the whole block
847 if (!$perm_ok) {
848 foreach ($items as $item) {
849 $this->renderer->hideItem($item["child"]);
850 }
851 return;
852 }
853
854 $item_list_gui = $this->getItemGUI($a_itgr);
855 $item_list_gui->enableNotes(false);
856 $item_list_gui->enableTags(false);
857 $item_list_gui->enableComments(false);
858 $item_list_gui->enableTimings(false);
859 $item_list_gui->getListItemHTML(
860 $a_itgr["ref_id"],
861 $a_itgr["obj_id"],
862 $a_itgr["title"],
863 $a_itgr["description"]
864 );
865 $commands_html = $item_list_gui->getCommandsHTML();
866
867 // determine behaviour
868 $item_group = new ilObjItemGroup($a_itgr["ref_id"]);
869 $beh = $item_group->getBehaviour();
870 $stored_val = $this->block_repo->getProperty(
871 "itgr_" . $a_itgr["ref_id"],
872 $ilUser->getId(),
873 "opened"
874 );
875 if ($stored_val !== "" && $beh !== ilItemGroupBehaviour::ALWAYS_OPEN) {
876 $beh = ($stored_val === "1")
879 }
880
881 $data = [
882 "behaviour" => $beh,
883 "store-url" => "./ilias.php?baseClass=ilcontainerblockpropertiesstoragegui&cmd=store" .
884 "&cont_block_id=itgr_" . $a_itgr['ref_id']
885 ];
886 if (ilObjItemGroup::lookupHideTitle($a_itgr["obj_id"]) &&
887 !$this->getContainerGUI()->isActiveAdministrationPanel()) {
888 $this->renderer->addCustomBlock($a_itgr["ref_id"], "", $commands_html, $data);
889 } else {
890 $this->renderer->addCustomBlock($a_itgr["ref_id"], $a_itgr["title"], $commands_html, $data);
891 }
892
893
894 // render item group sub items
895
897 $this->getContainerObject()->getId()
898 )->sortSubItems('itgr', $a_itgr['obj_id'], $items);
899
900 // #18285
902
903 $position = 1;
904 foreach ($items as $item) {
905 // we are NOT using hasItem() here, because item might be in multiple item groups
906
907 $it_pres = $item_group->getListPresentation();
908 if ($this->getContainerGUI()->isActiveOrdering() ||
909 $this->getContainerGUI()->isActiveAdministrationPanel()) {
910 $it_pres = "list";
911 }
912
913 $html2 = $this->renderItem($item, $position++, false, "[itgr][" . $a_itgr['obj_id'] . "]", $it_pres);
914 if ($html2 != "") {
915 // :TODO: show it multiple times?
916 $this->renderer->addItemToBlock($a_itgr["ref_id"], $item["type"], $item["child"], $html2, true);
917 }
918 }
919 }
920
921 protected function handleSessionExpand(): void
922 {
923 $expand = $this->request->getExpand();
924 if ($expand > 0) {
925 $this->item_manager->setExpanded(abs($expand), self::DETAILS_ALL);
926 } elseif ($expand < 0) {
927 $this->item_manager->setExpanded(abs($expand), self::DETAILS_TITLE);
928 }
929 }
930}
Manages items in repository clipboard.
const IL_SCREEN_SIDE
const IL_COL_RIGHT
const IL_SCREEN_FULL
const IL_COL_LEFT
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
Column user interface class.
static getScreenMode()
static getCmdSide()
Get Column Side of Current Command.
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, string $sub_type=null, int $sub_id=null, int $news_id=0)
Build ajax hash.
Parent class of all container content GUIs.
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.
initRenderer()
Init container renderer.
determineAdminCommands(int $a_ref_id, bool $a_admin_com_included_in_list=false)
insertPageEmbeddedBlocks(string $a_output_html)
Insert blocks into container page.
addEmbeddedBlock(string $block_type, $block_parameter)
Add embedded block.
determinePageEmbeddedBlocks(string $a_container_page_html)
Determine all blocks that are embedded in the container page.
setOutput()
This method sets the output of the right and main column in the global standard template.
forwardToColumnGUI()
Get columngui output.
getGroupedObjTypes()
Get grouped repository object types.
BlockSessionRepository $block_repo
getMainContent()
Get content HTML for main column, this one must be overwritten in derived classes.
getSingleTypeBlockAsynch(string $type)
Render single block.
renderCard(array $a_item_data, int $a_position=0, bool $a_force_icon=false, string $a_pos_prefix="")
ilGlobalTemplateInterface $tpl
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder,...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstance(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getCompleteDescriptions(array $objects)
overwrites description fields to long or short description in an assoc array keys needed (obj_id and ...
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
Class ilCtrl provides processing control methods.
saveParameterByClass(string $a_class, $a_parameter)
@inheritDoc
static _getItemsOfContainer(int $a_ref_id)
language handling
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupHideTitle(int $a_id)
User class.
static getItemsByEvent(int $event_id)
Get session material / event items.
static getItemsByItemGroup(int $item_group_ref_id)
Get materials of item group.
static addListGUIActivationProperty(ilObjectListGUI $list_gui, array &$item)
Get timing details for list gui.
parses the objects.xml it handles the xml-description of all ilias objects
static _getListGUIByType(string $type, int $context=ilObjectListGUI::CONTEXT_REPOSITORY)
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
setContent(string $a_html)
Sets content for standard template.
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
setRightContent(string $a_html)
Sets content of right column.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$ref_id
Definition: ltiauth.php:67
$i
Definition: metadata.php:41
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
global $ilSetting
Definition: privfeed.php:17
$type
$lng