ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\Containter\Content\ItemRenderer Class Reference
+ Collaboration diagram for ILIAS\Containter\Content\ItemRenderer:

Public Member Functions

 renderItem (array $a_item_data, int $a_position=0, bool $a_force_icon=false, string $a_pos_prefix="", string $item_group_list_presentation="", int $checkbox=self::CHECKBOX_NONE, bool $item_ordering=false, int $details_level=\ilObjectListGUI::DETAILS_ALL)
 
 setItemModifierClosure (\Closure $f)
 
 renderCard (array $a_item_data, int $a_position=0, bool $a_force_icon=false, string $a_pos_prefix="")
 
 getItemGUI (array $item_data)
 

Data Fields

const CHECKBOX_NONE = 0
 
const CHECKBOX_ADMIN = 1
 
const CHECKBOX_DOWNLOAD = 2
 

Protected Attributes

ilContainerGUI $container_gui
 
ilContainer $container
 
string $view_mode
 
InternalGUIService $gui
 
InternalDomainService $domain
 
Closure $item_modifier_closure = null
 
array $list_gui = []
 

Detailed Description

Todo:
currently too fat for a renderer, more a GUI class
Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 31 of file class.ItemRenderer.php.

Member Function Documentation

◆ getItemGUI()

ILIAS\Containter\Content\ItemRenderer::getItemGUI ( array  $item_data)

Definition at line 276 of file class.ItemRenderer.php.

277 {
278 // get item list gui object
279 if (!isset($this->list_gui[$item_data["type"]])) {
280 $item_list_gui = \ilObjectListGUIFactory::_getListGUIByType($item_data["type"]);
281 $item_list_gui->setContainerObject($this->container_gui);
282 $this->list_gui[$item_data["type"]] = $item_list_gui;
283 } else {
284 $item_list_gui = $this->list_gui[$item_data["type"]];
285 }
286
287 // unique js-ids
288 $item_list_gui->setParentRefId((int) ($item_data["parent"] ?? 0));
289
290 $item_list_gui->setDefaultCommandParameters(array());
291 $item_list_gui->disableTitleLink(false);
292 $item_list_gui->resetConditionTarget();
293
294 if ($this->container->isClassificationFilterActive()) {
295 $item_list_gui->enablePath(
296 true,
297 $this->container->getRefId(),
299 );
300 }
301
302 // show administration command buttons (or not)
303 /*
304 if (!$this->container_gui->isActiveAdministrationPanel()) {
305 // $item_list_gui->enableDelete(false);
306// $item_list_gui->enableLink(false);
307// $item_list_gui->enableCut(false);
308 }*/
309
310 // activate common social commands
311 $item_list_gui->enableComments(true);
312 $item_list_gui->enableNotes(true);
313 $item_list_gui->enableTags(true);
314 $item_list_gui->enableRating(true);
315
316 // reset
317 $item_list_gui->forceVisibleOnly(false);
318
319 // container specific modifications
320 $this->container_gui->modifyItemGUI($item_list_gui, $item_data);
321
322 return $item_list_gui;
323 }
static _getListGUIByType(string $type, int $context=ilObjectListGUI::CONTEXT_REPOSITORY)
PathGUI which handles materials assigned to sessions.

References ilObjectListGUIFactory\_getListGUIByType().

+ Here is the call graph for this function:

◆ renderCard()

ILIAS\Containter\Content\ItemRenderer::renderCard ( array  $a_item_data,
int  $a_position = 0,
bool  $a_force_icon = false,
string  $a_pos_prefix = "" 
)

Definition at line 246 of file class.ItemRenderer.php.

251 : ?RepositoryObject {
252 $item_list_gui = $this->getItemGUI($a_item_data);
253 $item_list_gui->setAjaxHash(\ilCommonActionDispatcherGUI::buildAjaxHash(
255 (int) $a_item_data['ref_id'],
256 $a_item_data['type'],
257 (int) $a_item_data['obj_id']
258 ));
259 $item_list_gui->initItem(
260 (int) $a_item_data['ref_id'],
261 (int) $a_item_data['obj_id'],
262 $a_item_data['type'],
263 $a_item_data['title'],
264 $a_item_data['description']
265 );
266
267 return $item_list_gui->getAsCard(
268 (int) $a_item_data['ref_id'],
269 (int) $a_item_data['obj_id'],
270 (string) $a_item_data['type'],
271 (string) $a_item_data['title'],
272 (string) $a_item_data['description']
273 );
274 }
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.

◆ renderItem()

ILIAS\Containter\Content\ItemRenderer::renderItem ( array  $a_item_data,
int  $a_position = 0,
bool  $a_force_icon = false,
string  $a_pos_prefix = "",
string  $item_group_list_presentation = "",
int  $checkbox = self::CHECKBOX_NONE,
bool  $item_ordering = false,
int  $details_level = \ilObjectListGUI::DETAILS_ALL 
)

Definition at line 62 of file class.ItemRenderer.php.

71 : RepositoryObject|string|null {
72 $ilSetting = $this->domain->settings();
73 $ilAccess = $this->domain->access();
74 $ilCtrl = $this->gui->ctrl();
75
76 // Pass type, obj_id and tree to checkAccess method to improve performance
77 /* deactivated, this should have been checked before
78 if (!$ilAccess->checkAccess('visible', '', $a_item_data['ref_id'], $a_item_data['type'], $a_item_data['obj_id'], $a_item_data['tree'])) {
79 return '';
80 }*/
82 if ($item_group_list_presentation != "") {
83 $view_mode = ($item_group_list_presentation === "tile")
86 }
87
89 return $this->renderCard($a_item_data, $a_position, $a_force_icon, $a_pos_prefix);
90 }
91
92 $item_list_gui = $this->getItemGUI($a_item_data);
93 if ($ilSetting->get("icon_position_in_lists") === "item_rows" ||
94 $a_item_data["type"] === "sess" || $a_force_icon) {
95 $item_list_gui->enableIcon(true);
96 }
97 if ($checkbox === self::CHECKBOX_ADMIN) {
98 $item_list_gui->enableCheckbox(true);
99 } elseif ($checkbox === self::CHECKBOX_DOWNLOAD) {
100 // display multi download checkboxes
101 $item_list_gui->enableDownloadCheckbox((int) $a_item_data["ref_id"]);
102 }
103
104 if ($item_ordering) {
105 $item_list_gui->setPositionInputField(
106 $a_pos_prefix . "[" . $a_item_data["ref_id"] . "]",
107 sprintf('%d', $a_position * 10)
108 );
109 }
110
111 if ($a_item_data['type'] === 'sess') {
112 switch ($details_level) {
113 case \ilContainerContentGUI::DETAILS_TITLE:
114 $item_list_gui->setDetailsLevel(\ilObjectListGUI::DETAILS_MINIMAL);
115 $item_list_gui->enableExpand(true);
116 $item_list_gui->setExpanded(false);
117 $item_list_gui->enableDescription(false);
118 $item_list_gui->enableProperties(true);
119 break;
120
121 case \ilContainerContentGUI::DETAILS_ALL:
122 $item_list_gui->setDetailsLevel(\ilObjectListGUI::DETAILS_ALL);
123 $item_list_gui->enableExpand(true);
124 $item_list_gui->setExpanded(true);
125 $item_list_gui->enableDescription(true);
126 $item_list_gui->enableProperties(true);
127 break;
128
129 case \ilContainerContentGUI::DETAILS_DEACTIVATED:
130 break;
131
132 default:
133 $item_list_gui->setDetailsLevel(\ilObjectListGUI::DETAILS_ALL);
134 $item_list_gui->enableExpand(true);
135 $item_list_gui->enableDescription(true);
136 $item_list_gui->enableProperties(true);
137 break;
138 }
139 }
140
141 if ($this->item_modifier_closure instanceof \Closure) {
143 $c($item_list_gui, $a_item_data);
144 }
145
146 // show subitems of sessions
147 if ($a_item_data['type'] === 'sess' and (
148 $details_level !== \ilContainerContentGUI::DETAILS_TITLE or
149 $this->container_gui->isActiveAdministrationPanel() or
150 $this->container_gui->isActiveItemOrdering()
151 )
152 ) {
153 $pos = 1;
154
155 $items = \ilObjectActivation::getItemsByEvent((int) $a_item_data['obj_id']);
156 $items = \ilContainerSorting::_getInstance($this->container->getId())->sortSubItems('sess', (int) $a_item_data['obj_id'], $items);
158
159 $item_readable = $ilAccess->checkAccess('read', '', (int) $a_item_data['ref_id']);
160
161 foreach ($items as $item) {
162 // TODO: this should be removed and be handled by if(strlen($sub_item_html))
163 // see mantis: 0003944
164 if (!$ilAccess->checkAccess('visible', '', (int) $item['ref_id'])) {
165 continue;
166 }
167
168 $item_list_gui2 = $this->getItemGUI($item);
169 $item_list_gui2->enableIcon(true);
170 $item_list_gui2->enableItemDetailLinks(false);
171
172 // unique js-ids
173 $item_list_gui2->setParentRefId((int) ($a_item_data['ref_id'] ?? 0));
174
175 // @see mantis 10488
176 if (!$item_readable and !$ilAccess->checkAccess('write', '', $item['ref_id'])) {
177 $item_list_gui2->forceVisibleOnly(true);
178 }
179
180 if ($checkbox === self::CHECKBOX_ADMIN) {
181 $item_list_gui2->enableCheckbox(true);
182 } elseif ($checkbox === self::CHECKBOX_DOWNLOAD) {
183 // display multi download checkbox
184 $item_list_gui2->enableDownloadCheckbox((int) $item['ref_id']);
185 }
186
187 if ($this->container_gui->isActiveItemOrdering()) {
188 $item_list_gui2->setPositionInputField(
189 "[sess][" . $a_item_data['obj_id'] . "][" . $item["ref_id"] . "]",
190 sprintf('%d', $pos * 10)
191 );
192 $pos++;
193 }
194
195 // #10611
197
198 $sub_item_html = $item_list_gui2->getListItemHTML(
199 (int) $item['ref_id'],
200 (int) $item['obj_id'],
201 $item['title'],
202 $item['description']
203 );
204
205 if (strlen($sub_item_html)) {
206 $item_list_gui->addSubItemHTML($sub_item_html);
207 }
208 }
209 }
210
211 $asynch = false;
212 $asynch_url = '';
213 if ($ilSetting->get("item_cmd_asynch")) {
214 $asynch = true;
215 $ilCtrl->setParameter($this->container_gui, "cmdrefid", $a_item_data['ref_id']);
216 $asynch_url = $ilCtrl->getLinkTarget(
217 $this->container_gui,
218 "getAsynchItemList",
219 "",
220 true,
221 false
222 );
223 $ilCtrl->setParameter($this->container_gui, "cmdrefid", "");
224 }
225
226 \ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_item_data);
227
228 $html = $item_list_gui->getListItemHTML(
229 (int) $a_item_data['ref_id'],
230 (int) $a_item_data['obj_id'],
231 (string) $a_item_data['title'],
232 (string) $a_item_data['description'],
233 $asynch,
234 false,
235 $asynch_url
236 );
237
238 return $html;
239 }
renderCard(array $a_item_data, int $a_position=0, bool $a_force_icon=false, string $a_pos_prefix="")
static _getInstance(int $a_obj_id)
static getCompleteDescriptions(array $objects)
overwrites description fields to long or short description in an assoc array keys needed (obj_id and ...
static getItemsByEvent(int $event_id)
Get session material / event items.
static addListGUIActivationProperty(ilObjectListGUI $list_gui, array &$item)
Get timing details for list gui.
$c
Definition: deliver.php:25
global $ilSetting
Definition: privfeed.php:31

References ILIAS\Containter\Content\ItemRenderer\$view_mode, ilContainerContentGUI\VIEW_MODE_LIST, and ilContainerContentGUI\VIEW_MODE_TILE.

◆ setItemModifierClosure()

ILIAS\Containter\Content\ItemRenderer::setItemModifierClosure ( \Closure  $f)

Definition at line 241 of file class.ItemRenderer.php.

241 : void
242 {
243 $this->item_modifier_closure = $f;
244 }

References Vendor\Package\$f.

Field Documentation

◆ $container

ilContainer ILIAS\Containter\Content\ItemRenderer::$container
protected

Definition at line 38 of file class.ItemRenderer.php.

◆ $container_gui

ilContainerGUI ILIAS\Containter\Content\ItemRenderer::$container_gui
protected

Definition at line 37 of file class.ItemRenderer.php.

◆ $domain

InternalDomainService ILIAS\Containter\Content\ItemRenderer::$domain
protected

Definition at line 41 of file class.ItemRenderer.php.

◆ $gui

InternalGUIService ILIAS\Containter\Content\ItemRenderer::$gui
protected

Definition at line 40 of file class.ItemRenderer.php.

◆ $item_modifier_closure

Closure ILIAS\Containter\Content\ItemRenderer::$item_modifier_closure = null
protected

Definition at line 42 of file class.ItemRenderer.php.

◆ $list_gui

array ILIAS\Containter\Content\ItemRenderer::$list_gui = []
protected

Definition at line 43 of file class.ItemRenderer.php.

◆ $view_mode

string ILIAS\Containter\Content\ItemRenderer::$view_mode
protected

◆ CHECKBOX_ADMIN

const ILIAS\Containter\Content\ItemRenderer::CHECKBOX_ADMIN = 1

Definition at line 34 of file class.ItemRenderer.php.

◆ CHECKBOX_DOWNLOAD

const ILIAS\Containter\Content\ItemRenderer::CHECKBOX_DOWNLOAD = 2

Definition at line 35 of file class.ItemRenderer.php.

◆ CHECKBOX_NONE

const ILIAS\Containter\Content\ItemRenderer::CHECKBOX_NONE = 0

Definition at line 33 of file class.ItemRenderer.php.


The documentation for this class was generated from the following file: