ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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;
56 protected int $editorial_ref_id;
60
61 public function __construct()
62 {
63 $this->settings = new \ilSetting(self::STORAGE_IDENTIFIER);
64 }
65
69 public function getObjectTypesEligibleForPublishing(): array
70 {
72 }
73
77 public function getObjectTypesSelectedForPublishing(): array
78 {
79 if (isset($this->selected_obj_types)) {
81 }
82 $types_from_storage = unserialize(
83 $this->settings->get(
84 'collected_types',
85 serialize($this->getObjectTypesEligibleForPublishing()),
86 ),
87 ['allowed_classes' => false]
88 );
89 return $this->selected_obj_types = array_intersect(
90 $types_from_storage,
92 );
93 }
94
95 public function isObjectTypeSelectedForPublishing(string $type): bool
96 {
98 return in_array($type, $types);
99 }
100
101 public function saveObjectTypesSelectedForPublishing(string ...$types): void
102 {
103 $this->selected_obj_types = $types;
104 $this->settings->set('collected_types', serialize($types));
105 }
106
111 {
112 if (isset($this->selected_cp_entry_ids)) {
114 }
115 $ids_from_storage = unserialize(
116 $this->settings->get('templates', serialize([])),
117 ['allowed_classes' => false]
118 );
119 $this->selected_cp_entry_ids = [];
120 foreach ($ids_from_storage as $id) {
121 $this->selected_cp_entry_ids[] = (int) $id;
122 }
124 }
125
127 {
128 $entry_ids = $this->getCopyrightEntryIDsSelectedForPublishing();
129 return in_array($id, $entry_ids);
130 }
131
132 public function saveCopyrightEntryIDsSelectedForPublishing(int ...$ids): void
133 {
134 $this->selected_cp_entry_ids = $ids;
135 $this->settings->set('templates', serialize($ids));
136 }
137
138 public function isEditorialStepEnabled(): bool
139 {
140 if (isset($this->editorial_step_enabled)) {
142 }
143 return $this->editorial_step_enabled = (bool) $this->settings->get(
144 'editorial_step',
145 '0'
146 );
147 }
148
149 public function saveEditorialStepEnabled(bool $enabled): void
150 {
151 $this->editorial_step_enabled = $enabled;
152 $this->settings->set('editorial_step', $enabled ? '1' : '0');
153 }
154
156 {
157 if (isset($this->editorial_ref_id)) {
159 }
160 return $this->editorial_ref_id = (int) $this->settings->get(
161 'target',
162 '0'
163 );
164 }
165
167 {
168 $this->editorial_ref_id = $ref_id;
169 $this->settings->set('target', (string) $ref_id);
170 }
171
173 {
174 if (isset($this->source_for_exposing_ref_id)) {
176 }
177 return $this->source_for_exposing_ref_id = (int) $this->settings->get(
178 'exposed_container',
179 '0'
180 );
181 }
182
183 public function saveContainerRefIDForPublishing(int $ref_id): void
184 {
185 $this->source_for_exposing_ref_id = $ref_id;
186 $this->settings->set('exposed_container', (string) $ref_id);
187 }
188
189
190
191 public function isManualPublishingEnabled(): bool
192 {
193 if (isset($this->manual_publishing_enabled)) {
195 }
196 return $this->manual_publishing_enabled = (bool) $this->settings->get(
197 'manual_publishing',
198 '0'
199 );
200 }
201
202 public function saveManualPublishingEnabled(bool $enabled): void
203 {
204 $this->editorial_step_enabled = $enabled;
205 $this->settings->set('manual_publishing', $enabled ? '1' : '0');
206 }
207
208 public function isAutomaticPublishingEnabled(): bool
209 {
210 if (isset($this->automatic_publishing_enabled)) {
212 }
213 return $this->automatic_publishing_enabled = (bool) $this->settings->get(
214 'automatic_publishing',
215 '0'
216 );
217 }
218
219 public function saveAutomaticPublishingEnabled(bool $enabled): void
220 {
221 $this->editorial_step_enabled = $enabled;
222 $this->settings->set('automatic_publishing', $enabled ? '1' : '0');
223 }
224}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
saveObjectTypesSelectedForPublishing(string ... $types)
Definition: Settings.php:101
$ref_id
Definition: ltiauth.php:66