ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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...
 
 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
 
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 274 of file class.ItemRenderer.php.

References ilObjectListGUIFactory\_getListGUIByType().

Referenced by ILIAS\Containter\Content\ItemRenderer\renderCard(), and ILIAS\Containter\Content\ItemRenderer\renderItem().

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

References ilCommonActionDispatcherGUI\buildAjaxHash(), ILIAS\Containter\Content\ItemRenderer\getItemGUI(), and ilCommonActionDispatcherGUI\TYPE_REPOSITORY.

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

248  $item_list_gui = $this->getItemGUI($a_item_data);
249  $item_list_gui->setAjaxHash(\ilCommonActionDispatcherGUI::buildAjaxHash(
251  (int) $a_item_data['ref_id'],
252  $a_item_data['type'],
253  (int) $a_item_data['obj_id']
254  ));
255  $item_list_gui->initItem(
256  (int) $a_item_data['ref_id'],
257  (int) $a_item_data['obj_id'],
258  $a_item_data['type'],
259  $a_item_data['title'],
260  $a_item_data['description']
261  );
262 
263  // actions
264  $item_list_gui->insertCommands();
265  return $item_list_gui->getAsCard(
266  (int) $a_item_data['ref_id'],
267  (int) $a_item_data['obj_id'],
268  (string) $a_item_data['type'],
269  (string) $a_item_data['title'],
270  (string) $a_item_data['description']
271  );
272  }
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.
+ Here is the call graph for this function:
+ 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
|string|null

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

References $ilSetting, 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.

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

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.

◆ $list_gui

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

Definition at line 41 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.

Referenced by ilContainerRenderer\renderItemBlockSequence().

◆ CHECKBOX_DOWNLOAD

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

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

Referenced by ilContainerRenderer\renderItemBlockSequence().

◆ CHECKBOX_NONE

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

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

Referenced by ilContainerRenderer\renderItemBlockSequence().


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