ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 Render an item. More...
 
 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 30 of file class.ItemRenderer.php.

Member Function Documentation

◆ getItemGUI()

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

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

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

References ilObjectListGUIFactory\_getListGUIByType().

Referenced by ILIAS\Containter\Content\ItemRenderer\renderItem().

+ Here is the call graph for this function:
+ Here is the caller 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 249 of file class.ItemRenderer.php.

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

Referenced by ILIAS\Containter\Content\ItemRenderer\renderItem().

+ Here is the caller graph for this function:

◆ 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 
)

Render an item.

Returns
\ILIAS\UI\Component\Card\RepositoryObject|string|null

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

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

+ Here is the call graph for this function:

◆ setItemModifierClosure()

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

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

244 : void
245 {
246 $this->item_modifier_closure = $f;
247 }

References Vendor\Package\$f.

Field Documentation

◆ $container

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

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

◆ $container_gui

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

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

◆ $domain

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

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

◆ $gui

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

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

◆ $item_modifier_closure

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

◆ $list_gui

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

Definition at line 42 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 33 of file class.ItemRenderer.php.

◆ CHECKBOX_DOWNLOAD

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

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

◆ CHECKBOX_NONE

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

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


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