ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Settings.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 protected const string STORAGE_IDENTIFIER = 'meta_oer';
26 protected const array ELIGIBLE_TYPES = [
27 'blog',
28 'copa',
29 'dcl',
30 'exc',
31 'file',
32 'glo',
33 'lm',
34 'htlm',
35 'sahs',
36 'mcst',
37 'mep',
38 'qpl',
39 'spl',
40 'webr',
41 'wiki'
42 ];
43
44 protected \ilSetting $settings;
45
49 protected array $selected_obj_types;
50
54 protected array $selected_cp_entry_ids;
57
58 public function __construct()
59 {
60 $this->settings = new \ilSetting(self::STORAGE_IDENTIFIER);
61 }
62
66 public function getObjectTypesEligibleForHarvesting(): array
67 {
69 }
70
74 public function getObjectTypesSelectedForHarvesting(): array
75 {
76 if (isset($this->selected_obj_types)) {
78 }
79 $types_from_storage = unserialize(
80 $this->settings->get(
81 'collected_types',
82 serialize($this->getObjectTypesEligibleForHarvesting()),
83 ),
84 ['allowed_classes' => false]
85 );
86 return $this->selected_obj_types = array_intersect(
87 $types_from_storage,
89 );
90 }
91
92 public function isObjectTypeSelectedForHarvesting(string $type): bool
93 {
95 return in_array($type, $types);
96 }
97
98 public function saveObjectTypesSelectedForHarvesting(string ...$types): void
99 {
100 $this->selected_obj_types = $types;
101 $this->settings->set('collected_types', serialize($types));
102 }
103
108 {
109 if (isset($this->selected_cp_entry_ids)) {
111 }
112 $ids_from_storage = unserialize(
113 $this->settings->get('templates', serialize([])),
114 ['allowed_classes' => false]
115 );
116 $this->selected_cp_entry_ids = [];
117 foreach ($ids_from_storage as $id) {
118 $this->selected_cp_entry_ids[] = (int) $id;
119 }
121 }
122
124 {
125 $entry_ids = $this->getCopyrightEntryIDsSelectedForHarvesting();
126 return in_array($id, $entry_ids);
127 }
128
129 public function saveCopyrightEntryIDsSelectedForHarvesting(int ...$ids): void
130 {
131 $this->selected_cp_entry_ids = $ids;
132 $this->settings->set('templates', serialize($ids));
133 }
134
136 {
137 if (isset($this->target_for_harvesting_ref_id)) {
139 }
140 return $this->target_for_harvesting_ref_id = (int) $this->settings->get(
141 'target',
142 '0'
143 );
144 }
145
146 public function saveContainerRefIDForHarvesting(int $ref_id): void
147 {
148 $this->target_for_harvesting_ref_id = $ref_id;
149 $this->settings->set('target', (string) $ref_id);
150 }
151
153 {
154 if (isset($this->source_for_exposing_ref_id)) {
156 }
157 return $this->source_for_exposing_ref_id = (int) $this->settings->get(
158 'exposed_container',
159 '0'
160 );
161 }
162
163 public function saveContainerRefIDForExposing(int $ref_id): void
164 {
165 $this->source_for_exposing_ref_id = $ref_id;
166 $this->settings->set('exposed_container', (string) $ref_id);
167 }
168}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
saveObjectTypesSelectedForHarvesting(string ... $types)
Definition: Settings.php:98
$ref_id
Definition: ltiauth.php:66