ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjectListGUIPreloader.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Object/classes/class.ilObjectListGUI.php");
5
13{
17 protected $obj_definition;
18
22 protected $tree;
23
27 protected $obj_data_cache;
28
32 protected $user;
33
37 protected $rbacsystem;
38
39 protected $context; // [int]
40 protected $obj_ids; // [array]
41 protected $obj_ids_by_type; // [array]
42 protected $ref_ids; // [array]
43 protected $ref_ids_by_type; // [array]
44 protected $types; // [array]
45
46 public function __construct($a_context)
47 {
48 global $DIC;
49
50 $this->obj_definition = $DIC["objDefinition"];
51 $this->tree = $DIC->repositoryTree();
52 $this->obj_data_cache = $DIC["ilObjDataCache"];
53 $this->user = $DIC->user();
54 $this->rbacsystem = $DIC->rbac()->system();
55 $this->context = $a_context;
56 }
57
58 public function addItem($a_obj_id, $a_type, $a_ref_id = null)
59 {
60 $this->obj_ids[] = $a_obj_id;
61 $this->obj_ids_by_type[$a_type][] = $a_obj_id;
62 $this->types[] = $a_type;
63
64 if ($a_ref_id) {
65 $this->ref_ids[] = $a_ref_id;
66 $this->ref_ids_by_type[$a_type][] = $a_ref_id;
67 }
68 }
69
70 public function preload()
71 {
72 $objDefinition = $this->obj_definition;
74 $ilObjDataCache = $this->obj_data_cache;
77
78 if (!$this->obj_ids) {
79 return;
80 }
81
82 $this->obj_ids = array_unique($this->obj_ids);
83 $this->types = array_unique($this->types);
84 if ($this->ref_ids) {
85 $this->ref_ids = array_unique($this->ref_ids);
86 }
87
88 // type specific preloads
89 include_once("./Services/Conditions/classes/class.ilConditionHandler.php");
90 foreach ($this->types as $type) {
91 $this->obj_ids_by_type[$type] = array_unique($this->obj_ids_by_type[$type]);
92
93 if (is_array($this->ref_ids_by_type[$type])) {
94 $this->ref_ids_by_type[$type] = array_unique($this->ref_ids_by_type[$type]);
95 }
96
97 if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY ||
99 $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
101 $type,
102 $this->obj_ids_by_type[$type]
103 );
104 }
105
106 $class = $objDefinition->getClassName($type);
107 $location = $objDefinition->getLocation($type);
108 if ($class && $location) { // #12775
109 $full_class = "ilObj" . $class . "Access";
110 include_once($location . "/class." . $full_class . ".php");
111 if (class_exists($full_class)) {
112 call_user_func(
113 array($full_class, "_preloadData"),
114 $this->obj_ids_by_type[$type],
115 $this->ref_ids_by_type[$type]
116 );
117 }
118 }
119 }
120
121 if ($this->ref_ids) {
122 $tree->preloadDeleted($this->ref_ids);
123 $tree->preloadDepthParent($this->ref_ids);
124 $ilObjDataCache->preloadReferenceCache($this->ref_ids, false);
125 $rbacsystem->preloadRbacPaCache($this->ref_ids, $ilUser->getId());
126
127 if ($ilUser->getId != ANONYMOUS_USER_ID &&
129 ilObjUser::preloadIsDesktopItem($ilUser->getId(), $this->ref_ids);
130 }
131
132 include_once("./Services/Object/classes/class.ilObjectActivation.php");
133 ilObjectActivation::preloadData($this->ref_ids);
134 }
135
136 include_once("./Services/Object/classes/class.ilObjectListGUI.php");
137 ilObjectListGUI::preloadCommonProperties($this->obj_ids, $this->context);
138
139 if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY) {
140 include_once("./Services/Rating/classes/class.ilRating.php");
141 include_once("./Services/Rating/classes/class.ilRatingGUI.php");
142 ilRating::preloadListGUIData($this->obj_ids);
143
144 include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
146 }
147
148 if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY ||
150 $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
151 include_once("./Services/Tracking/classes/class.ilLPStatus.php");
152 ilLPStatus::preloadListGUIData($this->obj_ids);
153 }
154 }
155}
user()
Definition: user.php:4
$location
Definition: buildRTE.php:44
An exception for terminatinating execution or to throw for unit testing.
static preloadByObjIds(array $a_obj_ids)
Preload list gui data.
static preloadPersistedConditionsForTargetRecords($a_type, $a_obj_ids)
Preload conditions for target records.
static preloadListGUIData($a_obj_ids)
static preloadIsDesktopItem($a_usr_id, $a_item_ids)
Preload desktop item information.
static preloadData(array $a_ref_ids)
Preload data to internal cache.
Preloader for object list GUIs.
addItem($a_obj_id, $a_type, $a_ref_id=null)
static preloadCommonProperties($a_obj_ids, $a_context)
Preload common properties.
static preloadListGUIData(array $a_obj_ids)
Preload rating data for list guis.
$type
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92