ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilPDObjectsListRenderer.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
12 public function render(array $groupedItems, bool $showHeader) : string
13 {
14 $itemRendered = false;
15
16 foreach ($groupedItems as $group) {
17 $itemHtml = [];
18
19 foreach ($group->getItems() as $item) {
20 $itemListGUI = $this->listItemFactory->byType($item['type']);
22
23 // #15232
24 $itemListGUI->enableCheckbox(false);
25 if ($this->blockView->isInManageMode() && $this->blockView->mayRemoveItem((int) $item['ref_id'])) {
26 $itemListGUI->enableCheckbox(true);
27 }
28
29 $html = $itemListGUI->getListItemHTML(
30 $item['ref_id'],
31 $item['obj_id'],
32 $item['title'],
33 $item['description']
34 );
35
36 if ($html !== '') {
37 $itemHtml[] = [
38 'html' => $html,
39 'item_ref_id' => $item['ref_id'],
40 'item_obj_id' => $item['obj_id'],
41 'parent_ref' => $item['parent_ref'],
42 'type' => $item['type'],
43 'item_icon_image_type' => $itemListGUI->getIconImageType()
44 ];
45 }
46 }
47
48 if (0 == count($itemHtml)) {
49 continue;
50 }
51 if ($showHeader) {
52 $this->addSectionHeader($group);
53 $this->resetRowType();
54 }
55
56 foreach ($itemHtml as $item) {
57 $this->addStandardRow(
58 $item['html'],
59 (int) $item['item_ref_id'],
60 (int) $item['item_obj_id'],
61 $item['item_icon_image_type'],
62 'th_' . md5($group->getLabel())
63 );
64
65 $itemRendered = true;
66 }
67 }
68
69 if (!$itemRendered) {
70 return '';
71 }
72
73 if ($this->blockView->isInManageMode() && $this->blockView->supportsSelectAll()) {
74 // #11355 - see ContainerContentGUI::renderSelectAllBlock()
75 $this->tpl->setCurrentBlock('select_all_row');
76 $this->tpl->setVariable('CHECKBOXNAME', 'ilToolbarSelectAll');
77 $this->tpl->setVariable('SEL_ALL_PARENT', 'ilToolbar');
78 $this->tpl->setVariable('SEL_ALL_CB_NAME', 'id');
79 $this->tpl->setVariable('TXT_SELECT_ALL', $this->lng->txt('select_all'));
80 $this->tpl->parseCurrentBlock();
81 }
82
83 return $this->tpl->get();
84 }
85}
An exception for terminatinating execution or to throw for unit testing.
static addListGUIActivationProperty(ilObjectListGUI $a_list_gui, array &$a_item)
Get timing details for list gui.
Class ilPDBaseObjectsRenderer.
Class ilPDSelectedItemsListRenderer.
render(array $groupedItems, bool $showHeader)
@inheritDoc
Interface ilPDObjectsRenderer.