ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\UI\Component\Legacy\Content\ItemSetManager Class Reference

Manages container subitems set. More...

+ Collaboration diagram for ILIAS\UI\Component\Legacy\Content\ItemSetManager:

Public Member Functions

 __construct (InternalDomainService $domain, int $mode, int $parent_ref_id, ?\ilContainerUserFilter $user_filter=null, int $single_ref_id=0, bool $admin_mode=false, bool $force_session_order_by_date=true)
 
 setHiddenFilesFound (bool $a_hiddenfilesfound)
 
 getHiddenFilesFound ()
 
 hasItems ()
 
 getRefIdsOfType (string $type)
 
 getAllRefIds ()
 
 getRawDataByRefId (int $ref_id)
 
 isSideBlockItem (int $ref_id)
 
 isClassificationFilterActive ()
 

Data Fields

const FLAT = 0
 
const TREE = 1
 
const SINGLE = 2
 

Protected Member Functions

 init ()
 
 applySorting ()
 
 groupItems ()
 Internally group all items. More...
 
 sortSessions ()
 
 getAdditionalSubItemInformation ()
 
 addAdditionalSubItemInformationToObject (array &$object)
 
 applyUserFilter ()
 Apply container user filter on objects. More...
 
 getCompleteDescriptions ()
 From ilContainer. More...
 
 applyClassificationFilter ()
 From ilContainer. More...
 
 preloadAdvancedMDValues ()
 

Protected Attributes

bool $force_session_order_by_date
 
bool $admin_mode
 
bool $hiddenfilesfound = false
 
string $parent_type
 
int $parent_obj_id
 
int $parent_ref_id = 0
 
int $single_ref_id = 0
 
InternalDomainService $domain
 
array $raw = []
 
array $raw_by_type = []
 
array $rendered = []
 
int $mode = self::FLAT
 
ilContainerUserFilter $user_filter = null
 
bool $initialised = false
 

Detailed Description

Manages container subitems set.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 29 of file class.ItemSetManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::__construct ( InternalDomainService  $domain,
int  $mode,
int  $parent_ref_id,
?\ilContainerUserFilter  $user_filter = null,
int  $single_ref_id = 0,
bool  $admin_mode = false,
bool  $force_session_order_by_date = true 
)
Parameters
int$modeself::TREE|self::FLAT|self::SINGLE

Definition at line 54 of file class.ItemSetManager.php.

References ILIAS\UI\Component\Legacy\Content\ItemSetManager\$admin_mode, ILIAS\UI\Component\Legacy\Content\ItemSetManager\$domain, ILIAS\UI\Component\Legacy\Content\ItemSetManager\$force_session_order_by_date, ILIAS\UI\Component\Legacy\Content\ItemSetManager\$mode, ILIAS\UI\Component\Legacy\Content\ItemSetManager\$parent_ref_id, ILIAS\UI\Component\Legacy\Content\ItemSetManager\$single_ref_id, ILIAS\UI\Component\Legacy\Content\ItemSetManager\$user_filter, ilObject\_lookupObjId(), ilObject\_lookupType(), and ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

62  {
63  $this->parent_ref_id = $parent_ref_id;
64  $this->parent_obj_id = \ilObject::_lookupObjId($this->parent_ref_id);
65  $this->parent_type = \ilObject::_lookupType($this->parent_obj_id);
66  $this->user_filter = $user_filter;
67  $this->force_session_order_by_date = $force_session_order_by_date;
68 
69  $this->single_ref_id = $single_ref_id;
70  $this->domain = $domain;
71  $this->mode = $mode; // might be refactored as subclasses
72  $this->admin_mode = $admin_mode;
73  $this->init();
74  }
static _lookupObjId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

Member Function Documentation

◆ addAdditionalSubItemInformationToObject()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::addAdditionalSubItemInformationToObject ( array &  $object)
protected

Definition at line 227 of file class.ItemSetManager.php.

References ilObjectActivation\addAdditionalSubItemInformation().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\getAdditionalSubItemInformation().

227  : void
228  {
230  }
static addAdditionalSubItemInformation(array &$item)
Parse item data for list entries.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyClassificationFilter()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::applyClassificationFilter ( )
protected

From ilContainer.

Todo:
remove there

Definition at line 327 of file class.ItemSetManager.php.

References $classification, $id, ilClassificationProvider\getValidProviders(), and ILIAS\Repository\raw().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

327  : void
328  {
329  // apply container classification filters
330  $classification = $this->domain->classification($this->parent_ref_id);
332  $this->parent_ref_id,
333  $this->parent_obj_id,
334  $this->parent_type
335  ) as $class_provider) {
336  $id = get_class($class_provider);
337  $current = $classification->getSelectionOfProvider($id);
338  if ($current) {
339  $class_provider->setSelection($current);
340  $filtered = $class_provider->getFilteredObjects();
341  $this->raw = array_filter($this->raw, static function ($i) use ($filtered) {
342  return (is_array($filtered) && in_array($i["obj_id"], $filtered));
343  });
344  }
345  }
346  }
$classification
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getValidProviders(int $a_parent_ref_id, int $a_parent_obj_id, string $a_parent_obj_type)
Get all valid providers (for parent container)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applySorting()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::applySorting ( )
protected

Definition at line 153 of file class.ItemSetManager.php.

References ilContainerSorting\_getInstance(), and ILIAS\Repository\raw().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

153  : void
154  {
155  $sort = \ilContainerSorting::_getInstance($this->parent_obj_id);
156  $all = $sort->sortItems(["all" => $this->raw]);
157  $this->raw = $all["all"];
158  //$this->raw_by_type = $sort->sortItems($this->raw_by_type);
159  }
static _getInstance(int $a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyUserFilter()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::applyUserFilter ( )
protected

Apply container user filter on objects.

Exceptions

Definition at line 258 of file class.ItemSetManager.php.

References ilContainer\_lookupContainerSetting(), and ILIAS\Repository\raw().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

258  : void
259  {
260  if (is_null($this->user_filter)) {
261  return;
262  }
263  $filter = $this->domain->content()->filter(
264  $this->raw,
265  $this->user_filter,
267  $this->parent_obj_id,
268  "filter_show_empty",
269  "0"
270  )
271  );
272  $this->raw = $filter->apply();
273  }
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdditionalSubItemInformation()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::getAdditionalSubItemInformation ( )
protected

Definition at line 220 of file class.ItemSetManager.php.

References ILIAS\UI\Component\Legacy\Content\ItemSetManager\addAdditionalSubItemInformationToObject(), and ILIAS\Repository\raw().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

220  : void
221  {
222  foreach ($this->raw as $key => $object) {
223  $this->addAdditionalSubItemInformationToObject($this->raw[$key]);
224  }
225  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllRefIds()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::getAllRefIds ( )

Definition at line 133 of file class.ItemSetManager.php.

References ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

133  : array
134  {
135  $this->init();
136  return array_keys($this->raw_by_type["_all"]);
137  }
+ Here is the call graph for this function:

◆ getCompleteDescriptions()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::getCompleteDescriptions ( )
protected

From ilContainer.

Todo:
remove there

Definition at line 278 of file class.ItemSetManager.php.

References $ilSetting, ilObject\DESC_LENGTH, ilObject\getLongDescriptions(), ILIAS\Repository\int(), ILIAS\Repository\raw(), and ilStr\shortenTextExtended().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

278  : void
279  {
280  $ilSetting = $this->domain->settings();
281  $ilObjDataCache = $this->domain->objectDataCache();
282 
283  // using long descriptions?
284  $short_desc = $ilSetting->get("rep_shorten_description");
285  $short_desc_max_length = (int) $ilSetting->get("rep_shorten_description_length");
286  if (!$short_desc || $short_desc_max_length != \ilObject::DESC_LENGTH) {
287  // using (part of) shortened description
288  if ($short_desc && $short_desc_max_length && $short_desc_max_length < \ilObject::DESC_LENGTH) {
289  foreach ($this->raw as $key => $object) {
290  $this->raw[$key]["description"] = \ilStr::shortenTextExtended(
291  $object["description"],
292  $short_desc_max_length,
293  true
294  );
295  }
296  }
297  // using (part of) long description
298  else {
299  $obj_ids = array();
300  foreach ($this->raw as $key => $object) {
301  $obj_ids[] = $object["obj_id"];
302  }
303  if (count($obj_ids) > 0) {
304  $long_desc = \ilObject::getLongDescriptions($obj_ids);
305  foreach ($this->raw as $key => $object) {
306  // #12166 - keep translation, ignore long description
307  if ($ilObjDataCache->isTranslatedDescription((int) $object["obj_id"])) {
308  $long_desc[$object["obj_id"]] = $object["description"];
309  }
310  if ($short_desc && $short_desc_max_length) {
311  $long_desc[$object["obj_id"]] = \ilStr::shortenTextExtended(
312  (string) ($long_desc[$object["obj_id"]] ?? ""),
313  $short_desc_max_length,
314  true
315  );
316  }
317  $this->raw[$key]["description"] = $long_desc[$object["obj_id"]] ?? '';
318  }
319  }
320  }
321  }
322  }
const DESC_LENGTH
static getLongDescriptions(array $obj_ids)
global $ilSetting
Definition: privfeed.php:31
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHiddenFilesFound()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::getHiddenFilesFound ( )

◆ getRawDataByRefId()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::getRawDataByRefId ( int  $ref_id)

Definition at line 139 of file class.ItemSetManager.php.

References $ref_id, ILIAS\UI\Component\Legacy\Content\ItemSetManager\init(), and null.

139  : ?array
140  {
141  $this->init();
142  return $this->raw_by_type["_all"][$ref_id] ?? null;
143  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ getRefIdsOfType()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::getRefIdsOfType ( string  $type)

Definition at line 122 of file class.ItemSetManager.php.

References ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

122  : array
123  {
124  $this->init();
125  if (isset($this->raw_by_type[$type])) {
126  return array_map(static function ($item) {
127  return (int) $item["child"];
128  }, $this->raw_by_type[$type]);
129  }
130  return [];
131  }
+ Here is the call graph for this function:

◆ groupItems()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::groupItems ( )
protected

Internally group all items.

Definition at line 164 of file class.ItemSetManager.php.

References ilObjFileAccess\_isFileHidden(), ILIAS\Repository\int(), ILIAS\UI\Component\Legacy\Content\ItemSetManager\isClassificationFilterActive(), ILIAS\Repository\raw(), and ILIAS\UI\Component\Legacy\Content\ItemSetManager\setHiddenFilesFound().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

164  : void
165  {
166  $obj_definition = $this->domain->objectDefinition();
167  $classification_filter_active = $this->isClassificationFilterActive();
168  $this->raw_by_type["_all"] = [];
169  foreach ($this->raw as $key => $object) {
170 
171  // hide object types in devmode
172  if ($object["type"] === "adm" || $object["type"] === "rolf" ||
173  $obj_definition->getDevMode($object["type"])) {
174  continue;
175  }
176 
177  // remove inactive plugins
178  if ($obj_definition->isInactivePlugin($object["type"])) {
179  continue;
180  }
181 
182  // BEGIN WebDAV: Don't display hidden Files, Folders and Categories
183  if (in_array($object['type'], array('file','fold','cat'))) {
184  if (\ilObjFileAccess::_isFileHidden($object['title'])) {
185  $this->setHiddenFilesFound(true);
186  if (!$this->admin_mode) {
187  continue;
188  }
189  }
190  }
191  // END WebDAV: Don't display hidden Files, Folders and Categories
192 
193  // group object type groups together (e.g. learning resources)
194  $type = $obj_definition->getGroupOfObj($object["type"]);
195  if ($type == "") {
196  $type = $object["type"];
197  }
198 
199  $new_key = (int) $object["child"];
200  $this->rendered[$new_key] = false;
201  $this->raw_by_type[$type][$new_key] = $object;
202 
203  $this->raw_by_type["_all"][$new_key] = $object;
204  if ($object["type"] !== "sess") {
205  $this->raw_by_type["_non_sess"][$new_key] = $object;
206  }
207  }
208  }
static _isFileHidden(string $a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user. ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasItems()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::hasItems ( )
Todo:
from ilContainer, should be removed there

Definition at line 116 of file class.ItemSetManager.php.

References ILIAS\UI\Component\Legacy\Content\ItemSetManager\init(), and ILIAS\Repository\raw().

116  : bool
117  {
118  $this->init();
119  return count($this->raw) > 0;
120  }
+ Here is the call graph for this function:

◆ init()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::init ( )
protected
Todo:
from ilContainer, should be removed there

Definition at line 89 of file class.ItemSetManager.php.

References ILIAS\UI\Component\Legacy\Content\ItemSetManager\applyClassificationFilter(), ILIAS\UI\Component\Legacy\Content\ItemSetManager\applySorting(), ILIAS\UI\Component\Legacy\Content\ItemSetManager\applyUserFilter(), ILIAS\UI\Component\Legacy\Content\ItemSetManager\getAdditionalSubItemInformation(), ILIAS\UI\Component\Legacy\Content\ItemSetManager\getCompleteDescriptions(), ILIAS\UI\Component\Legacy\Content\ItemSetManager\groupItems(), ILIAS\UI\Component\Legacy\Content\ItemSetManager\preloadAdvancedMDValues(), ILIAS\Repository\raw(), and ILIAS\UI\Component\Legacy\Content\ItemSetManager\sortSessions().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\__construct(), ILIAS\UI\Component\Legacy\Content\ItemSetManager\getAllRefIds(), ILIAS\UI\Component\Legacy\Content\ItemSetManager\getRawDataByRefId(), ILIAS\UI\Component\Legacy\Content\ItemSetManager\getRefIdsOfType(), ILIAS\UI\Component\Legacy\Content\ItemSetManager\hasItems(), and ILIAS\UI\Component\Legacy\Content\ItemSetManager\isSideBlockItem().

89  : void
90  {
91  if ($this->initialised) {
92  return;
93  }
94  $tree = $this->domain->repositoryTree();
95  if ($this->mode === self::TREE) {
96  $this->raw = $tree->getSubTree($tree->getNodeData($this->parent_ref_id));
97  } elseif ($this->mode === self::FLAT) {
98  $this->raw = $tree->getChilds($this->parent_ref_id, "title");
99  } else {
100  $this->raw[] = $tree->getNodeData($this->single_ref_id);
101  }
102  $this->applyUserFilter();
103  $this->getCompleteDescriptions();
104  $this->applyClassificationFilter();
106  $this->applySorting();
107  $this->groupItems();
108  $this->sortSessions();
109  $this->preloadAdvancedMDValues();
110  $this->initialised = true;
111  }
applyUserFilter()
Apply container user filter on objects.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isClassificationFilterActive()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::isClassificationFilterActive ( )
Todo:
from ilContainer, remove there

Definition at line 235 of file class.ItemSetManager.php.

References $classification, $id, and ilClassificationProvider\getValidProviders().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\groupItems().

235  : bool
236  {
237  // apply container classification filters
238  $classification = $this->domain->classification($this->parent_ref_id);
240  $this->parent_ref_id,
241  $this->parent_obj_id,
242  $this->parent_type
243  ) as $class_provider) {
244  $id = get_class($class_provider);
245  $current = $classification->getSelectionOfProvider($id);
246  if ($current) {
247  return true;
248  }
249  }
250  return false;
251  }
$classification
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getValidProviders(int $a_parent_ref_id, int $a_parent_obj_id, string $a_parent_obj_type)
Get all valid providers (for parent container)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSideBlockItem()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::isSideBlockItem ( int  $ref_id)

Definition at line 145 of file class.ItemSetManager.php.

References $ref_id, and ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

145  : bool
146  {
147  $this->init();
148  $type = $this->raw_by_type["_all"][$ref_id]["type"] ?? "";
149  $obj_definition = $this->domain->objectDefinition();
150  return $obj_definition->isSideBlock($type);
151  }
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ preloadAdvancedMDValues()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::preloadAdvancedMDValues ( )
protected

Definition at line 348 of file class.ItemSetManager.php.

References ilAdvancedMDValues\preloadByObjIds().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

348  : void
349  {
350  $obj_ids = [];
351  foreach ($this->raw_by_type["_all"] as $object) {
352  $obj_ids[] = $object["obj_id"];
353  }
355  }
static preloadByObjIds(array $a_obj_ids)
Preload list gui data.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHiddenFilesFound()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::setHiddenFilesFound ( bool  $a_hiddenfilesfound)

Definition at line 76 of file class.ItemSetManager.php.

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\groupItems().

76  : void
77  {
78  $this->hiddenfilesfound = $a_hiddenfilesfound;
79  }
+ Here is the caller graph for this function:

◆ sortSessions()

ILIAS\UI\Component\Legacy\Content\ItemSetManager::sortSessions ( )
protected

Definition at line 210 of file class.ItemSetManager.php.

References ilArrayUtil\sortArray().

Referenced by ILIAS\UI\Component\Legacy\Content\ItemSetManager\init().

210  : void
211  {
212  if (!$this->force_session_order_by_date) {
213  return;
214  }
215  if (isset($this->raw_by_type["sess"]) && count($this->raw_by_type["sess"]) > 0) {
216  $this->raw_by_type["sess"] = \ilArrayUtil::sortArray($this->raw_by_type["sess"], 'start', 'ASC', true, true);
217  }
218  }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $admin_mode

bool ILIAS\UI\Component\Legacy\Content\ItemSetManager::$admin_mode
protected

◆ $domain

InternalDomainService ILIAS\UI\Component\Legacy\Content\ItemSetManager::$domain
protected

◆ $force_session_order_by_date

bool ILIAS\UI\Component\Legacy\Content\ItemSetManager::$force_session_order_by_date
protected

◆ $hiddenfilesfound

bool ILIAS\UI\Component\Legacy\Content\ItemSetManager::$hiddenfilesfound = false
protected

◆ $initialised

bool ILIAS\UI\Component\Legacy\Content\ItemSetManager::$initialised = false
protected

Definition at line 49 of file class.ItemSetManager.php.

◆ $mode

int ILIAS\UI\Component\Legacy\Content\ItemSetManager::$mode = self::FLAT
protected

◆ $parent_obj_id

int ILIAS\UI\Component\Legacy\Content\ItemSetManager::$parent_obj_id
protected

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

◆ $parent_ref_id

int ILIAS\UI\Component\Legacy\Content\ItemSetManager::$parent_ref_id = 0
protected

◆ $parent_type

string ILIAS\UI\Component\Legacy\Content\ItemSetManager::$parent_type
protected

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

◆ $raw

array ILIAS\UI\Component\Legacy\Content\ItemSetManager::$raw = []
protected

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

◆ $raw_by_type

array ILIAS\UI\Component\Legacy\Content\ItemSetManager::$raw_by_type = []
protected

Definition at line 44 of file class.ItemSetManager.php.

◆ $rendered

array ILIAS\UI\Component\Legacy\Content\ItemSetManager::$rendered = []
protected

Definition at line 46 of file class.ItemSetManager.php.

◆ $single_ref_id

int ILIAS\UI\Component\Legacy\Content\ItemSetManager::$single_ref_id = 0
protected

◆ $user_filter

ilContainerUserFilter ILIAS\UI\Component\Legacy\Content\ItemSetManager::$user_filter = null
protected

◆ FLAT

const ILIAS\UI\Component\Legacy\Content\ItemSetManager::FLAT = 0

◆ SINGLE

const ILIAS\UI\Component\Legacy\Content\ItemSetManager::SINGLE = 2

◆ TREE

const ILIAS\UI\Component\Legacy\Content\ItemSetManager::TREE = 1

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