ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjectListGUIPreloader Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilObjectListGUIPreloader:

Public Member Functions

 __construct (int $context)
 
 addItem (int $obj_id, string $type, ?int $ref_id=null)
 
 preload ()
 

Protected Attributes

ilObjectDefinition $obj_definition
 
ilTree $tree
 
ilObjectDataCache $obj_data_cache
 
ilObjUser $user
 
ilRbacSystem $rbacsystem
 
ilFavouritesManager $fav_manager
 
int $context
 
array $obj_ids = []
 
array $obj_ids_by_type = []
 
array $ref_ids = []
 
array $ref_ids_by_type = []
 
array $types = []
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Preloader for object list GUIs

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 26 of file class.ilObjectListGUIPreloader.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectListGUIPreloader::__construct ( int  $context)

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

References $context, $DIC, and ILIAS\Repository\user().

44  {
45  global $DIC;
46 
47  $this->obj_definition = $DIC["objDefinition"];
48  $this->tree = $DIC->repositoryTree();
49  $this->obj_data_cache = $DIC["ilObjDataCache"];
50  $this->user = $DIC->user();
51  $this->rbacsystem = $DIC->rbac()->system();
52  $this->fav_manager = new ilFavouritesManager();
53  $this->context = $context;
54  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ addItem()

ilObjectListGUIPreloader::addItem ( int  $obj_id,
string  $type,
?int  $ref_id = null 
)

Definition at line 56 of file class.ilObjectListGUIPreloader.php.

References $ref_id, and $type.

56  : void
57  {
58  $this->obj_ids[] = $obj_id;
59  $this->obj_ids_by_type[$type][] = $obj_id;
60  $this->types[] = $type;
61 
62  if ($ref_id) {
63  $this->ref_ids[] = $ref_id;
64  $this->ref_ids_by_type[$type][] = $ref_id;
65  }
66  }
$type
$ref_id
Definition: ltiauth.php:67

◆ preload()

ilObjectListGUIPreloader::preload ( )

Definition at line 68 of file class.ilObjectListGUIPreloader.php.

References $location, $ref_ids, $type, ANONYMOUS_USER_ID, ilObjectListGUI\CONTEXT_PERSONAL_DESKTOP, ilObjectListGUI\CONTEXT_REPOSITORY, ilObjectListGUI\CONTEXT_SEARCH, ilAdvancedMDValues\preloadByObjIds(), ilObjectListGUI\preloadCommonProperties(), ilObjectActivation\preloadData(), ilRating\preloadListGUIData(), ilLPStatus\preloadListGUIData(), ilConditionHandler\preloadPersistedConditionsForTargetRecords(), and ILIAS\Repository\user().

68  : void
69  {
70  if (!$this->obj_ids) {
71  return;
72  }
73 
74  $this->obj_ids = array_unique($this->obj_ids);
75  $this->types = array_unique($this->types);
76  if ($this->ref_ids) {
77  $this->ref_ids = array_unique($this->ref_ids);
78  }
79 
80  // type specific preloads
81  foreach ($this->types as $type) {
82  $this->obj_ids_by_type[$type] = array_unique($this->obj_ids_by_type[$type]);
83 
84  if (isset($this->ref_ids_by_type[$type])) {
85  $this->ref_ids_by_type[$type] = array_unique($this->ref_ids_by_type[$type]);
86  }
87 
88  if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY ||
90  $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
92  $type,
93  $this->obj_ids_by_type[$type]
94  );
95  }
96 
97  $class = $this->obj_definition->getClassName($type);
98  $location = $this->obj_definition->getLocation($type);
99  if ($class && $location) { // #12775
100  $full_class = "ilObj" . $class . "Access";
101  if (is_file($location . "/class." . $full_class . ".php")) {
102  include_once($location . "/class." . $full_class . ".php");
103  }
104  if (class_exists($full_class)) {
105  call_user_func(
106  array($full_class, "_preloadData"),
107  $this->obj_ids_by_type[$type] ?? [],
108  $this->ref_ids_by_type[$type] ?? []
109  );
110  }
111  }
112  }
113 
114  if ($this->ref_ids) {
115  $this->tree->preloadDeleted($this->ref_ids);
116  $this->tree->preloadDepthParent($this->ref_ids);
117  $this->obj_data_cache->preloadReferenceCache($this->ref_ids, false);
118  $this->rbacsystem->preloadRbacPaCache($this->ref_ids, $this->user->getId());
119 
120  if ($this->user->getId() != ANONYMOUS_USER_ID &&
121  $this->context != ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP) {
122  $this->fav_manager->loadData($this->user->getId(), $this->ref_ids);
123  }
124 
125  ilObjectActivation::preloadData($this->ref_ids);
126  }
127 
128  ilObjectListGUI::preloadCommonProperties($this->obj_ids, $this->context);
129 
130  if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY) {
131  ilRating::preloadListGUIData($this->obj_ids);
132 
133  ilAdvancedMDValues::preloadByObjIds($this->obj_ids);
134  }
135 
136  if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY ||
137  $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP ||
138  $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
139  ilLPStatus::preloadListGUIData($this->obj_ids);
140  }
141  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
$type
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static preloadByObjIds(array $a_obj_ids)
Preload list gui data.
static preloadListGUIData(array $a_obj_ids)
static preloadCommonProperties(array $obj_ids, int $context)
static preloadData(array $ref_ids)
Preload data to internal cache.
static preloadPersistedConditionsForTargetRecords(string $a_type, array $a_obj_ids)
static preloadListGUIData(array $a_obj_ids)
Preload rating data for list guis.
+ Here is the call graph for this function:

Field Documentation

◆ $context

int ilObjectListGUIPreloader::$context
protected

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

Referenced by __construct().

◆ $fav_manager

ilFavouritesManager ilObjectListGUIPreloader::$fav_manager
protected

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

◆ $obj_data_cache

ilObjectDataCache ilObjectListGUIPreloader::$obj_data_cache
protected

Definition at line 30 of file class.ilObjectListGUIPreloader.php.

◆ $obj_definition

ilObjectDefinition ilObjectListGUIPreloader::$obj_definition
protected

Definition at line 28 of file class.ilObjectListGUIPreloader.php.

◆ $obj_ids

array ilObjectListGUIPreloader::$obj_ids = []
protected

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

◆ $obj_ids_by_type

array ilObjectListGUIPreloader::$obj_ids_by_type = []
protected

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

◆ $rbacsystem

ilRbacSystem ilObjectListGUIPreloader::$rbacsystem
protected

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

◆ $ref_ids

array ilObjectListGUIPreloader::$ref_ids = []
protected

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

Referenced by preload().

◆ $ref_ids_by_type

array ilObjectListGUIPreloader::$ref_ids_by_type = []
protected

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

◆ $tree

ilTree ilObjectListGUIPreloader::$tree
protected

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

◆ $types

array ilObjectListGUIPreloader::$types = []
protected

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

◆ $user

ilObjUser ilObjectListGUIPreloader::$user
protected

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


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