ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilContainerContentGUI.php
Go to the documentation of this file.
1<?php
2
24
34{
35 public const DETAILS_DEACTIVATED = 0;
36 public const DETAILS_TITLE = 1;
37 public const DETAILS_ALL = 2;
38
39 public const VIEW_MODE_LIST = 0;
40 public const VIEW_MODE_TILE = 1;
41 protected \ILIAS\Container\Content\ItemPresentationManager $item_presentation;
42
44 protected ilCtrl $ctrl;
45 protected ilObjUser $user;
46 protected ilLanguage $lng;
48 protected ilDBInterface $db;
56 protected ilLogger $log;
57 protected int $view_mode;
58 protected array $embedded_block = [];
59 protected array $items = [];
61 protected array $list_gui = [];
66 protected int $block_limit = 0;
67 protected array $type_grps = [];
68 protected int $force_details;
70
71 public function __construct(
72 ilContainerGUI $container_gui_obj,
73 \ILIAS\Container\Content\ItemPresentationManager $item_presentation
74 ) {
75 global $DIC;
76
77 $this->tpl = $DIC["tpl"];
78 $this->ctrl = $DIC->ctrl();
79 $this->user = $DIC->user();
80 $this->lng = $DIC->language();
81 $this->access = $DIC->access();
82 $this->db = $DIC->database();
83 $this->rbacsystem = $DIC->rbac()->system();
84 $this->settings = $DIC->settings();
85 $this->obj_definition = $DIC["objDefinition"];
86 $tpl = $DIC["tpl"];
87
88 $this->container_gui = $container_gui_obj;
90 $obj = $this->container_gui->getObject();
91 $this->container_obj = $obj;
92
93 $tpl->addJavaScript("assets/js/Container.js");
94 $tpl->addJavaScript("assets/js/repository.js");
95
96 $this->log = ilLoggerFactory::getLogger('cont');
97
98 $this->view_mode = (ilContainer::_lookupContainerSetting($this->container_obj->getId(), "list_presentation") === "tile" && !$this->container_gui->isActiveAdministrationPanel() && !$this->container_gui->isActiveOrdering())
99 ? self::VIEW_MODE_TILE
100 : self::VIEW_MODE_LIST;
101
102 $this->clipboard = $DIC
103 ->repository()
104 ->internal()
105 ->domain()
106 ->clipboard();
107 $this->request = $DIC
108 ->container()
109 ->internal()
110 ->gui()
111 ->standardRequest();
112 $this->item_manager = $DIC
113 ->container()
114 ->internal()
115 ->domain()
116 ->content()
117 ->items($this->container_obj);
118 $this->block_repo = $DIC
119 ->container()
120 ->internal()
121 ->repo()
122 ->content()
123 ->block();
124 $this->item_presentation = $item_presentation;
125 $this->block_limit = (int) ilContainer::_lookupContainerSetting($container_gui_obj->getObject()->getId(), "block_limit");
126 }
127
128 protected function getViewMode(): int
129 {
130 return $this->view_mode;
131 }
132
133
135 {
137 }
138
140 {
142 }
143
148 public function setOutput(): void
149 {
151 $ilCtrl = $this->ctrl;
152
153 // note: we do not want to get the center html in case of
154 // asynchronous calls to blocks in the right column (e.g. news)
155 // see #13012
156 if ($ilCtrl->getNextClass() === "ilcolumngui" &&
157 $ilCtrl->isAsynch()) {
159 }
160
161 // BEGIN ChangeEvent: record read event.
162 $ilUser = $this->user;
163
164 $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
166 $this->getContainerObject()->getType(),
167 $this->getContainerObject()->getRefId(),
168 $obj_id,
169 $ilUser->getId()
170 );
171 // END ChangeEvent: record read event.
172
173 $html = $this->getCenterColumnHTML();
174 if ($html !== '') {
175 $tpl->setContent($html);
176 }
177
178 // see above, all other cases (this was the old position of setRightContent,
179 // maybe the position above is ok and all ifs can be removed)
180 if ($ilCtrl->getNextClass() !== "ilcolumngui" ||
181 !$ilCtrl->isAsynch()) {
183 }
184 }
185
186 protected function getRightColumnHTML(): string
187 {
188 $ilCtrl = $this->ctrl;
189 $html = "";
190
191 $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
192
193 $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
194 $obj_type = ilObject::_lookupType($obj_id);
195
196 $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
197
198 if ($column_gui::getScreenMode() === IL_SCREEN_FULL) {
199 return "";
200 }
201
202 $this->getContainerGUI()->setColumnSettings($column_gui);
203
204 if ($ilCtrl->getNextClass() === "ilcolumngui" &&
205 $column_gui::getCmdSide() === IL_COL_RIGHT &&
206 $column_gui::getScreenMode() === IL_SCREEN_SIDE) {
207 $html = $ilCtrl->forwardCommand($column_gui);
208 } else {
209 if (!$ilCtrl->isAsynch()) {
210 $html = "";
211
212 // user interface plugin slot + default rendering
213 $uip = new ilUIHookProcessor(
214 "components/ILIAS/Container",
215 "right_column",
216 ["container_content_gui" => $this]
217 );
218 if (!$uip->replaced()) {
219 $html = $ilCtrl->getHTML($column_gui);
220 }
221 $html = $uip->getHTML($html);
222 }
223 }
224
225 return $html;
226 }
227
228 protected function getCenterColumnHTML(): string
229 {
230 $ilCtrl = $this->ctrl;
233
234 $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
235
236 $tpl->addOnLoadCode("il.Object.setRedrawListItemUrl('" .
237 $ilCtrl->getLinkTarget($this->container_gui, "redrawListItem", "", true) . "');");
238
239 $tpl->addOnLoadCode("il.Object.setRatingUrl('" .
240 $ilCtrl->getLinkTargetByClass(
241 [get_class($this->container_gui), "ilcommonactiondispatchergui", "ilratinggui"],
242 "saveRating",
243 "",
244 true,
245 false
246 ) . "');");
247
248 switch ($ilCtrl->getNextClass()) {
249 case "ilcolumngui":
250 $this->container_gui->setSideColumnReturn();
251 $html = $this->forwardToColumnGUI();
252 break;
253
254 default:
255 $ilDB->useSlave(true);
256 $html = $this->getMainContent();
257 $ilDB->useSlave(false);
258 break;
259 }
260
261 return $html;
262 }
263
268 public function getMainContent(): string
269 {
270 $ilAccess = $this->access;
271
272 $tpl = new ilTemplate(
273 "tpl.container_page.html",
274 true,
275 true,
276 "components/ILIAS/Container"
277 );
278 // Show introduction, if repository is empty
279 if (!$this->item_presentation->hasItems() &&
280 $this->getContainerObject()->getRefId() == ROOT_FOLDER_ID &&
281 $ilAccess->checkAccess("write", "", $this->getContainerObject()->getRefId())) {
282 $html = $this->getIntroduction();
283 } else { // show item list otherwise
284 $html = $this->renderItemList();
285 }
286 $tpl->setVariable("CONTAINER_PAGE_CONTENT", $html);
287
288 return $tpl->get();
289 }
290
294 protected function initRenderer(): void
295 {
297
298 $this->renderer = new ilContainerRenderer(
299 $this->item_presentation,
300 ($this->getContainerGUI()->isActiveAdministrationPanel() && !$this->clipboard->hasEntries()),
301 $this->getContainerGUI()->isMultiDownloadEnabled(),
302 $this->getContainerGUI()->isActiveOrdering() && (get_class($this) !== "ilContainerObjectiveGUI") // no block sorting in objective view
303 ,
304 $sorting->getBlockPositions(),
305 $this->container_gui,
306 $this->getViewMode(),
307 $this->getContainerGUI()->isActiveAdministrationPanel()
308 );
309
310 // all event items are included per session rendering
311 // and should return true for hasItem
312 $event_items = ilEventItems::_getItemsOfContainer($this->container_obj->getRefId());
313 foreach ($event_items as $ev) {
314 $this->renderer->addItemId($ev);
315 }
316 }
317
321 private function forwardToColumnGUI(): string
322 {
323 $ilCtrl = $this->ctrl;
324 $html = "";
325
326 // this gets us the subitems we need in setColumnSettings()
327 // todo: this should be done in ilCourseGUI->getSubItems
328
329 $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
330 $obj_type = ilObject::_lookupType($obj_id);
331
332 if (!$ilCtrl->isAsynch()) {
334 // right column wants center
336 $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
337 $this->getContainerGUI()->setColumnSettings($column_gui);
338 $html = $ilCtrl->forwardCommand($column_gui);
339 }
340 // left column wants center
342 $column_gui = new ilColumnGUI($obj_type, IL_COL_LEFT);
343 $this->getContainerGUI()->setColumnSettings($column_gui);
344 $html = $ilCtrl->forwardCommand($column_gui);
345 }
346 } else {
347 $html = $this->getMainContent();
348 }
349 }
350
351 return $html;
352 }
353
354 protected function getItemGUI(array $item_data): ilObjectListGUI
355 {
356 // get item list gui object
357 if (!isset($this->list_gui[$item_data["type"]])) {
358 $item_list_gui = ilObjectListGUIFactory::_getListGUIByType($item_data["type"]);
359 $item_list_gui->setContainerObject($this->getContainerGUI());
360 $this->list_gui[$item_data["type"]] = &$item_list_gui;
361 } else {
362 $item_list_gui = &$this->list_gui[$item_data["type"]];
363 }
364
365 // unique js-ids
366 $item_list_gui->setParentRefId((int) ($item_data["parent"] ?? 0));
367
368 $item_list_gui->setDefaultCommandParameters([]);
369 $item_list_gui->disableTitleLink(false);
370 $item_list_gui->resetConditionTarget();
371
372 if ($this->container_obj->isClassificationFilterActive()) {
373 $item_list_gui->enablePath(
374 true,
375 $this->container_obj->getRefId(),
377 );
378 }
379
380 // activate common social commands
381 $item_list_gui->enableComments(true);
382 $item_list_gui->enableNotes(true);
383 $item_list_gui->enableTags(true);
384 $item_list_gui->enableRating(true);
385
386 // reset
387 $item_list_gui->forceVisibleOnly(false);
388
389 // container specific modifications
390 $this->getContainerGUI()->modifyItemGUI($item_list_gui, $item_data);
391
392 return $item_list_gui;
393 }
394
399 string $a_container_page_html
400 ): void {
402
403 // iterate all types
404 foreach ($type_grps as $type => $v) {
405 // set template (overall or type specific)
406 if (is_int(strpos($a_container_page_html, "[list-" . $type . "]"))) {
407 $this->addEmbeddedBlock("type", $type);
408 }
409 }
410
411 // determine item groups
412 while (preg_match('~\[(item-group-([0-9]*))\]~i', $a_container_page_html, $found)) {
413 $this->addEmbeddedBlock("itgr", (int) $found[2]);
414
415 $html = ''; // This was never defined before
416 $a_container_page_html = preg_replace('~\[' . $found[1] . '\]~i', $html, $a_container_page_html);
417 }
418 }
419
425 public function addEmbeddedBlock(
426 string $block_type,
427 $block_parameter
428 ): void {
429 $this->embedded_block[$block_type][] = $block_parameter;
430 }
431
432 public function getEmbeddedBlocks(): array
433 {
434 return $this->embedded_block;
435 }
436
437 public function renderPageEmbeddedBlocks(): void
438 {
439 // item groups
440 if (isset($this->embedded_block["itgr"]) && is_array($this->embedded_block["itgr"])) {
441 $item_groups = [];
442 if (isset($this->items["itgr"]) && is_array($this->items["itgr"])) {
443 foreach ($this->items["itgr"] as $ig) {
444 $item_groups[$ig["ref_id"]] = $ig;
445 }
446 }
447
448 foreach ($this->embedded_block["itgr"] as $ref_id) {
449 if (isset($item_groups[$ref_id])) {
450 $this->renderItemGroup($item_groups[$ref_id]);
451 }
452 }
453 }
454
455 // type specific blocks
456 if (isset($this->embedded_block["type"]) && is_array($this->embedded_block["type"])) {
457 foreach ($this->embedded_block["type"] as $type) {
458 if (isset($this->items[$type]) && is_array($this->items[$type]) && $this->renderer->addTypeBlock($type)) {
459 if ($this->hasForcedOrderByStartDate($type)) {
460 $this->items['sess'] = ilArrayUtil::sortArray($this->items['sess'], 'start', 'ASC', true, true);
461 }
462
463 $position = 1;
464
465 foreach ($this->items[$type] as $item_data) {
466 if (!$this->renderer->hasItem($item_data["child"])) {
467 $html = $this->renderItem($item_data, $position++);
468 if ($html != "") {
469 $this->renderer->addItemToBlock($type, $item_data["type"], $item_data["child"], $html);
470 }
471 }
472 }
473 }
474 }
475 }
476 }
477
478 protected function hasForcedOrderByStartDate(string $type): bool
479 {
480 return $type === 'sess' && get_class($this) === ilContainerSessionsContentGUI::class;
481 }
482
483 protected function getUniqueItemId(array $a_item_data): string
484 {
485 $item_list_gui = $this->getItemGUI($a_item_data);
486 return $item_list_gui->getUniqueItemId();
487 }
488
489 public function renderItem(
490 array $a_item_data,
491 int $a_position = 0,
492 bool $a_force_icon = false,
493 string $a_pos_prefix = "",
494 string $item_group_list_presentation = ""
495 ): RepositoryObject|string|null {
496 $ilSetting = $this->settings;
497 $ilAccess = $this->access;
498 $ilCtrl = $this->ctrl;
499 // Pass type, obj_id and tree to checkAccess method to improve performance
500 if (!$ilAccess->checkAccess('visible', '', $a_item_data['ref_id'], $a_item_data['type'], $a_item_data['obj_id'], $a_item_data['tree'])) {
501 return '';
502 }
503
504 $view_mode = $this->getViewMode();
505 if ($item_group_list_presentation != "") {
506 $view_mode = ($item_group_list_presentation === "tile")
507 ? self::VIEW_MODE_TILE
508 : self::VIEW_MODE_LIST;
509 }
510 if ($view_mode === self::VIEW_MODE_TILE) {
511 return $this->renderCard($a_item_data, $a_position, $a_force_icon, $a_pos_prefix);
512 }
513
514 $item_list_gui = $this->getItemGUI($a_item_data);
515 if ($a_item_data["type"] === "sess" ||
516 $a_force_icon ||
517 $ilSetting->get("icon_position_in_lists") === "item_rows") {
518 $item_list_gui->enableIcon(true);
519 }
520
521 if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$this->clipboard->hasEntries()) {
522 $item_list_gui->enableCheckbox(true);
523 } elseif ($this->getContainerGUI()->isMultiDownloadEnabled()) {
524 // display multi download checkboxes
525 $item_list_gui->enableDownloadCheckbox((int) $a_item_data["ref_id"]);
526 }
527
528 if ($this->getContainerGUI()->isActiveItemOrdering() && !$this->hasForcedOrderByStartDate($a_item_data['type'])) {
529 $item_list_gui->setPositionInputField(
530 $a_pos_prefix . "[" . $a_item_data["ref_id"] . "]",
531 sprintf('%d', $a_position * 10)
532 );
533 }
534
535 if ($a_item_data['type'] === 'sess' && get_class($this) !== 'ilContainerObjectiveGUI') {
536 switch ($this->getDetailsLevel($a_item_data['obj_id'])) {
537 case self::DETAILS_TITLE:
538 $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_MINIMAL);
539 $item_list_gui->enableExpand(true);
540 $item_list_gui->setExpanded(false);
541 $item_list_gui->enableDescription(false);
542 $item_list_gui->enableProperties(true);
543 break;
544
545 case self::DETAILS_ALL:
546 $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
547 $item_list_gui->enableExpand(true);
548 $item_list_gui->setExpanded(true);
549 $item_list_gui->enableDescription(true);
550 $item_list_gui->enableProperties(true);
551 break;
552
553 default:
554 $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
555 $item_list_gui->enableExpand(true);
556 $item_list_gui->enableDescription(true);
557 $item_list_gui->enableProperties(true);
558 break;
559 }
560 }
561
562 if (method_exists($this, "addItemDetails")) {
563 $this->addItemDetails($item_list_gui, $a_item_data);
564 }
565
566 // show subitems
567 if ($a_item_data['type'] === 'sess' && (
568 $this->getDetailsLevel($a_item_data['obj_id']) !== self::DETAILS_TITLE ||
569 $this->getContainerGUI()->isActiveAdministrationPanel() ||
570 $this->getContainerGUI()->isActiveItemOrdering()
571 )) {
572 $pos = 1;
573 $items = ilObjectActivation::getItemsByEvent($a_item_data['obj_id']);
574 $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('sess', $a_item_data['obj_id'], $items);
576
577 $item_readable = $ilAccess->checkAccess('read', '', $a_item_data['ref_id']);
578
579 foreach ($items as $item) {
580 // TODO: this should be removed and be handled by if(strlen($sub_item_html))
581 // see mantis: 0003944
582 if (!$ilAccess->checkAccess('visible', '', $item['ref_id'])) {
583 continue;
584 }
585
586 $item_list_gui2 = $this->getItemGUI($item);
587 $item_list_gui2->enableIcon(true);
588 $item_list_gui2->enableItemDetailLinks(false);
589
590 // unique js-ids
591 $item_list_gui2->setParentRefId((int) ($a_item_data['ref_id'] ?? 0));
592
593 // @see mantis 10488
594 if (!$item_readable && !$ilAccess->checkAccess('write', '', $item['ref_id'])) {
595 $item_list_gui2->forceVisibleOnly(true);
596 }
597
598 if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$this->clipboard->hasEntries()) {
599 $item_list_gui2->enableCheckbox(true);
600 } elseif ($this->getContainerGUI()->isMultiDownloadEnabled()) {
601 // display multi download checkbox
602 $item_list_gui2->enableDownloadCheckbox((int) $item['ref_id']);
603 }
604
605 if ($this->getContainerGUI()->isActiveItemOrdering()) {
606 $item_list_gui2->setPositionInputField(
607 "[sess][" . $a_item_data['obj_id'] . "][" . $item["ref_id"] . "]",
608 sprintf('%d', $pos * 10)
609 );
610 $pos++;
611 }
612
613 // #10611
615
616 $sub_item_html = $item_list_gui2->getListItemHTML(
617 $item['ref_id'],
618 $item['obj_id'],
619 $item['title'],
620 $item['description']
621 );
622
623 $this->determineAdminCommands($item["ref_id"], $item_list_gui2->adminCommandsIncluded());
624 if ($sub_item_html !== '') {
625 $item_list_gui->addSubItemHTML($sub_item_html);
626 }
627 }
628 }
629
630 ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_item_data);
631
632 $html = $item_list_gui->getListItemHTML(
633 (int) $a_item_data['ref_id'],
634 (int) $a_item_data['obj_id'],
635 (string) $a_item_data['title'],
636 (string) $a_item_data['description'],
637 );
638 return $html;
639 }
640
641 public function renderCard(
642 array $a_item_data,
643 int $a_position = 0,
644 bool $a_force_icon = false,
645 string $a_pos_prefix = ""
646 ): ?RepositoryObject {
647 $item_list_gui = $this->getItemGUI($a_item_data);
648 $item_list_gui->setAjaxHash(ilCommonActionDispatcherGUI::buildAjaxHash(
650 $a_item_data['ref_id'],
651 $a_item_data['type'],
652 (int) $a_item_data['obj_id']
653 ));
654 $item_list_gui->initItem(
655 (int) $a_item_data['ref_id'],
656 (int) $a_item_data['obj_id'],
657 (string) $a_item_data['type'],
658 (string) $a_item_data['title'],
659 (string) $a_item_data['description']
660 );
661
662 return $item_list_gui->getAsCard(
663 $a_item_data['ref_id'],
664 (int) $a_item_data['obj_id'],
665 (string) $a_item_data['type'],
666 (string) $a_item_data['title'],
667 (string) $a_item_data['description']
668 );
669 }
670
674 public function insertPageEmbeddedBlocks(string $a_output_html): string
675 {
676 $this->determinePageEmbeddedBlocks($a_output_html);
677 $this->renderPageEmbeddedBlocks();
678
679 // iterate all types
680 foreach ($this->getGroupedObjTypes() as $type => $v) {
681 // set template (overall or type specific)
682 if (is_int(strpos($a_output_html, "[list-" . $type . "]"))) {
683 $a_output_html = preg_replace(
684 '~\[list-' . $type . '\]~i',
685 $this->renderer->renderSingleTypeBlock($type),
686 $a_output_html
687 );
688 }
689 }
690
691 // insert all item groups
692 while (preg_match('~\[(item-group-([0-9]*))\]~i', $a_output_html, $found)) {
693 $itgr_ref_id = (int) $found[2];
694
695 $a_output_html = preg_replace(
696 '~\[' . $found[1] . '\]~i',
697 $this->renderer->renderSingleCustomBlock($itgr_ref_id),
698 $a_output_html
699 );
700 }
701
702 return $a_output_html;
703 }
704
709 string $type
710 ): string {
711 $this->initRenderer();
712 $ref_ids = $this->request->getAlreadyRenderedRefIds();
713
714 return $this->renderer->renderSingleTypeBlockAsynch(
715 $this->item_presentation->getItemBlockSequence($ref_ids),
716 $type,
717 $ref_ids,
718 $this->block_limit
719 );
720 }
721
725 public function getGroupedObjTypes(): array
726 {
727 $objDefinition = $this->obj_definition;
728
729 if (empty($this->type_grps)) {
730 $this->type_grps =
731 $objDefinition::getGroupedRepositoryObjectTypes($this->getContainerObject()->getType());
732 }
733 return $this->type_grps;
734 }
735
736 public function getIntroduction(): string
737 {
739
740 $lng->loadLanguageModule("rep");
741
742 $tpl = new ilTemplate("tpl.rep_intro.html", true, true, "components/ILIAS/Repository");
743 $tpl->setVariable("IMG_REP_LARGE", ilObject::_getIcon(0, "big", "root"));
744 $tpl->setVariable("TXT_WELCOME", $lng->txt("rep_intro"));
745 $tpl->setVariable("TXT_INTRO_1", $lng->txt("rep_intro1"));
746 $tpl->setVariable("TXT_INTRO_2", $lng->txt("rep_intro2"));
747 $tpl->setVariable("TXT_INTRO_3", sprintf($lng->txt("rep_intro3"), $lng->txt("add")));
748 $tpl->setVariable("TXT_INTRO_4", sprintf($lng->txt("rep_intro4"), $lng->txt("cat_add")));
749 $tpl->setVariable("TXT_INTRO_5", $lng->txt("rep_intro5"));
750 $tpl->setVariable("TXT_INTRO_6", $lng->txt("rep_intro6"));
751
752 return $tpl->get();
753 }
754
755 public function getItemGroupsHTML(int $a_pos = 0): int
756 {
757 if (isset($this->items["itgr"]) && is_array($this->items["itgr"])) {
758 foreach ($this->items["itgr"] as $itgr) {
759 if (!$this->renderer->hasCustomBlock($itgr["child"])) {
760 $this->renderItemGroup($itgr);
761
762 $this->renderer->setBlockPosition($itgr["ref_id"], ++$a_pos);
763 }
764 }
765 }
766 return $a_pos;
767 }
768
769 public function renderItemGroup(array $a_itgr): void
770 {
771 $ilAccess = $this->access;
772 $ilUser = $this->user;
773 // #16493
774 $perm_ok = ($ilAccess->checkAccess("visible", "", $a_itgr['ref_id']) &&
775 $ilAccess->checkAccess("read", "", $a_itgr['ref_id']));
776
777 $items = ilObjectActivation::getItemsByItemGroup($a_itgr['ref_id']);
778
779 // get all valid ids (this is filtered)
780 $all_ids = array_map(static function (array $i): int {
781 return (int) $i["child"];
782 }, $this->items["_all"]);
783
784 // remove filtered items
785 $items = array_filter($items, static function (array $i) use ($all_ids): bool {
786 return in_array($i["ref_id"], $all_ids);
787 });
788
789 // if no permission is given, set the items to "rendered" but
790 // do not display the whole block
791 if (!$perm_ok) {
792 foreach ($items as $item) {
793 $this->renderer->hideItem($item["child"]);
794 }
795 return;
796 }
797
798 $item_list_gui = $this->getItemGUI($a_itgr);
799 $item_list_gui->enableNotes(false);
800 $item_list_gui->enableTags(false);
801 $item_list_gui->enableComments(false);
802 $item_list_gui->enableTimings(false);
803 $item_list_gui->getListItemHTML(
804 $a_itgr["ref_id"],
805 $a_itgr["obj_id"],
806 $a_itgr["title"],
807 $a_itgr["description"]
808 );
809 $commands_html = $item_list_gui->getCommandsHTML($a_itgr["title"], false);
810
811 // determine behaviour
812 $item_group = new ilObjItemGroup($a_itgr["ref_id"]);
813 $beh = $item_group->getBehaviour();
814 $stored_val = $this->block_repo->getProperty(
815 "itgr_" . $a_itgr["ref_id"],
816 $ilUser->getId(),
817 "opened"
818 );
819 if ($stored_val !== "" && $beh !== ilItemGroupBehaviour::ALWAYS_OPEN) {
820 $beh = ($stored_val === "1")
823 }
824
825 $data = [
826 "behaviour" => $beh,
827 "store-url" => "./ilias.php?baseClass=ilcontainerblockpropertiesstoragegui&cmd=store" .
828 "&cont_block_id=itgr_" . $a_itgr['ref_id']
829 ];
830 if (ilObjItemGroup::lookupHideTitle($a_itgr["obj_id"]) &&
831 !$this->getContainerGUI()->isActiveAdministrationPanel()) {
832 $this->renderer->addCustomBlock($a_itgr["ref_id"], "", $commands_html, $data);
833 } else {
834 $this->renderer->addCustomBlock($a_itgr["ref_id"], $a_itgr["title"], $commands_html, $data);
835 }
836
837
838 // render item group sub items
839
841 $this->getContainerObject()->getId()
842 )->sortSubItems('itgr', $a_itgr['obj_id'], $items);
843
844 // #18285
846
847 $position = 1;
848 foreach ($items as $item) {
849 // we are NOT using hasItem() here, because item might be in multiple item groups
850
851 $it_pres = $item_group->getListPresentation();
852 if ($this->getContainerGUI()->isActiveOrdering() ||
853 $this->getContainerGUI()->isActiveAdministrationPanel()) {
854 $it_pres = "list";
855 }
856
857 $html2 = $this->renderItem($item, $position++, false, "[itgr][" . $a_itgr['obj_id'] . "]", $it_pres);
858 if ($html2 != "") {
859 // :TODO: show it multiple times?
860 $this->renderer->addItemToBlock($a_itgr["ref_id"], $item["type"], $item["child"], $html2, true);
861 }
862 }
863 }
864}
renderer()
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, $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="")
initRenderer()
Init container renderer.
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 may be overwritten in derived classes.
ILIAS Container Content ItemPresentationManager $item_presentation
ilContainerUserFilter $container_user_filter
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,...
Class ilContainerRenderer.
static _getInstance(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilContainer.
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.
Class ilObjItemGroup.
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...
PathGUI which handles materials assigned to sessions.
ILIAS Setting Class.
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...
const ROOT_FOLDER_ID
Definition: constants.php:32
setVariable(string $variable, $value='')
Sets the given variable to the given value.
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.
setRightContent(string $a_html)
Sets content of right column.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setContent(string $a_html)
Sets content for standard template.
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
Interface ilDBInterface.
$ref_id
Definition: ltiauth.php:66
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:31
global $ilSetting
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26