19 declare(strict_types=1);
30 private \ILIAS\Cache\Container\Container
$cache;
43 $this->cache = $DIC->globalCache()->get($this);
58 public function init(): void
60 if ($this->cache->has(
'data')) {
70 $this->il_object_def = $data[
'il_object_def'];
71 $this->subobj_for_parent = $data[
'subobj_for_parent'];
72 $this->grouped_rep_obj_types = $data[
'grouped_rep_obj_types'];
73 $this->il_object_group = $data[
'il_object_group'];
74 $this->il_object_sub_type = $data[
'il_object_sub_type'];
90 $this->cache->set(
'data', $this->
getRawData());
102 if (is_array($cached_results)) {
112 $db = $DIC->database();
117 "SELECT id, class_name, component, location, checkbox, inherit, translate, devmode, allow_link," . PHP_EOL
118 .
"allow_copy, rbac, `system`, sideblock, default_pos, grp, default_pres_pos, `export`, repository," . PHP_EOL
119 .
"workspace, administration, amet, orgunit_permissions, lti_provider, offline_handling" . PHP_EOL
120 .
"FROM il_object_def" . PHP_EOL;
121 $set = $db->query($sql);
122 while ($rec = $db->fetchAssoc($set)) {
123 $data[
'il_object_def'][$rec[
'id']] = $rec;
127 "SELECT parent, subobj, mmax" . PHP_EOL
128 .
"FROM il_object_subobj" . PHP_EOL;
129 $set = $db->query($sql);
130 while ($rec = $db->fetchAssoc($set)) {
131 $parent = $rec[
'parent'];
132 $data[
'subobj_for_parent'][$parent][] = $rec;
136 "SELECT DISTINCT(id) AS sid, parent, id, class_name, component, location, checkbox, inherit," . PHP_EOL
137 .
"translate, devmode, allow_link, allow_copy, rbac, `system`, sideblock, default_pos, grp," . PHP_EOL
138 .
"default_pres_pos, `export`, repository, workspace, administration, amet, orgunit_permissions," . PHP_EOL
139 .
"lti_provider, offline_handling" . PHP_EOL
140 .
"FROM il_object_def, il_object_subobj" . PHP_EOL
141 .
"WHERE NOT (" . $db->quoteIdentifier(
'system') .
" = 1)" . PHP_EOL
142 .
"AND NOT (sideblock = 1)" . PHP_EOL
143 .
"AND subobj = id" . PHP_EOL;
144 $set = $db->query($sql);
145 while ($rec = $db->fetchAssoc($set)) {
146 $data[
'grouped_rep_obj_types'][$rec[
'parent']][] = $rec;
150 "SELECT id, name, default_pres_pos" . PHP_EOL
151 .
"FROM il_object_group" . PHP_EOL;
152 $set = $db->query($sql);
153 while ($rec = $db->fetchAssoc($set)) {
154 $data[
'il_object_group'][$rec[
'id']] = $rec;
158 "SELECT obj_type, sub_type, amet" . PHP_EOL
159 .
"FROM il_object_sub_type" . PHP_EOL;
160 $set = $db->query($sql);
161 while ($rec = $db->fetchAssoc($set)) {
162 $data[
'il_object_sub_type'][$rec[
'obj_type']][] = $rec;
184 if (!isset(self::$instance)) {
185 return self::$instance =
new self();
188 return self::$instance;
199 if (is_array($parent)) {
200 $index = md5(serialize($parent));
201 if (isset($this->cached_results[
'subop_par'][$index])) {
202 return $this->cached_results[
'subop_par'][$index];
206 foreach ($parent as $p) {
207 if (isset($this->subobj_for_parent[$p]) && is_array($this->subobj_for_parent[$p])) {
208 foreach ($this->subobj_for_parent[$p] as $rec) {
214 $this->cached_results[
'subop_par'][$index] = $return;
215 $this->changed =
true;
220 return $this->subobj_for_parent[$parent];
225 if ($this->changed) {
226 $this->changed =
false;
227 $this->cache->set(
'data', $this->
getRawData());
238 if (is_array($parent)) {
239 $index = md5(serialize($parent));
240 if (isset($this->cached_results[
'grpd_repo'][$index])) {
241 return $this->cached_results[
'grpd_repo'][$index];
246 foreach ($parent as $p) {
247 $s = $this->grouped_rep_obj_types[$p];
248 foreach ($s as $child) {
249 if (!in_array($child[
'sid'], $sids)) {
250 $sids[] = $child[
'sid'];
255 $this->changed =
true;
256 $this->cached_results[
'grpd_repo'][$index] = $return;
260 return $this->grouped_rep_obj_types[$parent] ??
null;
Cache for object definitions, based on ilGlobalCache.
static ilCachedObjectDefinition $instance
loadFromRawData(array $data)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
array $il_object_sub_type
lookupSubObjForParent($parent)
lookupGroupedRepObj($parent)
ILIAS Cache Container Container $cache
array $grouped_rep_obj_types