ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
14 protected $context; // [int]
15 protected $obj_ids; // [array]
16 protected $obj_ids_by_type; // [array]
17 protected $ref_ids; // [array]
18 protected $ref_ids_by_type; // [array]
19 protected $types; // [array]
20
21 public function __construct($a_context)
22 {
23 $this->context = $a_context;
24 }
25
26 public function addItem($a_obj_id, $a_type, $a_ref_id = null)
27 {
28 $this->obj_ids[] = $a_obj_id;
29 $this->obj_ids_by_type[$a_type][] = $a_obj_id;
30 $this->types[] = $a_type;
31
32 if($a_ref_id)
33 {
34 $this->ref_ids[] = $a_ref_id;
35 $this->ref_ids_by_type[$a_type][] = $a_ref_id;
36 }
37 }
38
39 public function preload()
40 {
41 global $objDefinition, $tree, $ilObjDataCache, $ilUser, $rbacsystem;
42
43 if(!$this->obj_ids)
44 {
45 return;
46 }
47
48 $this->obj_ids = array_unique($this->obj_ids);
49 $this->types = array_unique($this->types);
50 if($this->ref_ids)
51 {
52 $this->ref_ids = array_unique($this->ref_ids);
53 }
54
55 // type specific preloads
56 include_once("./Services/AccessControl/classes/class.ilConditionHandler.php");
57 foreach ($this->types as $type)
58 {
59 $this->obj_ids_by_type[$type] = array_unique($this->obj_ids_by_type[$type]);
60
61 if(is_array($this->ref_ids_by_type[$type]))
62 {
63 $this->ref_ids_by_type[$type] = array_unique($this->ref_ids_by_type[$type]);
64 }
65
66 if($this->context == ilObjectListGUI::CONTEXT_REPOSITORY ||
68 $this->context == ilObjectListGUI::CONTEXT_SEARCH)
69 {
71 $this->obj_ids_by_type[$type]);
72 }
73
74 $class = $objDefinition->getClassName($type);
75 $location = $objDefinition->getLocation($type);
76 if($class && $location) // #12775
77 {
78 $full_class = "ilObj".$class."Access";
79 include_once($location."/class.".$full_class.".php");
80 if(class_exists($full_class))
81 {
82 call_user_func(array($full_class, "_preloadData"),
83 $this->obj_ids_by_type[$type], $this->ref_ids_by_type[$type]);
84 }
85 }
86 }
87
88 if($this->ref_ids)
89 {
90 $tree->preloadDeleted($this->ref_ids);
91 $tree->preloadDepthParent($this->ref_ids);
92 $ilObjDataCache->preloadReferenceCache($this->ref_ids, false);
93 $rbacsystem->preloadRbacPaCache($this->ref_ids, $ilUser->getId());
94
95 if($ilUser->getId != ANONYMOUS_USER_ID &&
97 {
98 ilObjUser::preloadIsDesktopItem($ilUser->getId(), $this->ref_ids);
99 }
100
101 include_once("./Services/Object/classes/class.ilObjectActivation.php");
102 ilObjectActivation::preloadData($this->ref_ids);
103 }
104
105 include_once("./Services/Object/classes/class.ilObjectListGUI.php");
106 ilObjectListGUI::preloadCommonProperties($this->obj_ids, $this->context);
107
108 if($this->context == ilObjectListGUI::CONTEXT_REPOSITORY)
109 {
110 include_once("./Services/Rating/classes/class.ilRating.php");
111 include_once("./Services/Rating/classes/class.ilRatingGUI.php");
112 ilRating::preloadListGUIData($this->obj_ids);
113
114 include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
116 }
117
118 if($this->context == ilObjectListGUI::CONTEXT_REPOSITORY ||
120 $this->context == ilObjectListGUI::CONTEXT_SEARCH)
121 {
122 include_once("./Services/Tracking/classes/class.ilLPStatus.php");
123 ilLPStatus::preloadListGUIData($this->obj_ids);
124 }
125 }
126}
127
128?>
$location
Definition: buildRTE.php:44
static preloadByObjIds(array $a_obj_ids)
Preload list gui data.
preloadConditionsForTargetRecords($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.
global $ilUser
Definition: imgupload.php:15