ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjectListGUIPreloader Class Reference

Preloader for object list GUIs. 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

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.

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 }
Manages favourites, currently the interface for other components, needs discussion.
global $DIC
Definition: shib_login.php:26

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

+ 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.

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 }
$ref_id
Definition: ltiauth.php:66

References $ref_id.

◆ preload()

ilObjectListGUIPreloader::preload ( )

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

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 (class_exists($full_class)) {
102 call_user_func(
103 [$full_class, "_preloadData"],
104 $this->obj_ids_by_type[$type] ?? [],
105 $this->ref_ids_by_type[$type] ?? []
106 );
107 }
108 }
109 }
110
111 if ($this->ref_ids) {
112 $this->tree->preloadDeleted($this->ref_ids);
113 $this->tree->preloadDepthParent($this->ref_ids);
114 $this->obj_data_cache->preloadReferenceCache($this->ref_ids, false);
115 $this->rbacsystem->preloadRbacPaCache($this->ref_ids, $this->user->getId());
116
117 if ($this->user->getId() != ANONYMOUS_USER_ID &&
119 $this->fav_manager->loadData($this->user->getId(), $this->ref_ids);
120 }
121
122 ilObjectActivation::preloadData($this->ref_ids);
123 }
124
125 ilObjectListGUI::preloadCommonProperties($this->obj_ids, $this->context);
126
127 if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY) {
128 ilRating::preloadListGUIData($this->obj_ids);
129
131 }
132
133 if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY ||
135 $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
136 ilLPStatus::preloadListGUIData($this->obj_ids);
137 }
138 }
$location
Definition: buildRTE.php:22
static preloadByObjIds(array $a_obj_ids)
Preload list gui data.
static preloadPersistedConditionsForTargetRecords(string $a_type, array $a_obj_ids)
static preloadListGUIData(array $a_obj_ids)
static preloadData(array $ref_ids)
Preload data to internal cache.
static preloadCommonProperties(array $obj_ids, int $context)
static preloadListGUIData(array $a_obj_ids)
Preload rating data for list guis.
const ANONYMOUS_USER_ID
Definition: constants.php:27

References $location, 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().

+ 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.

◆ $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: