ILIAS  release_8 Revision v8.24
class.ilObjIndividualAssessment.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
27{
28 use ilIndividualAssessmentDIC;
29
30 protected ?bool $lp_active = null;
36 protected ?Pimple\Container $dic = null;
37
40
41 public function __construct(int $id = 0, bool $call_by_reference = true)
42 {
43 global $DIC;
44 $this->type = 'iass';
45 $this->il_access_handler = $DIC["ilAccess"];
46
48
49 $this->settings_storage = new ilIndividualAssessmentSettingsStorageDB($DIC['ilDB']);
50 $this->members_storage = new ilIndividualAssessmentMembersStorageDB($DIC['ilDB']);
51 $this->access_handler = new ilIndividualAssessmentAccessHandler(
52 $this,
53 $DIC['ilAccess'],
54 $DIC['rbacadmin'],
55 $DIC['rbacreview'],
56 $DIC['ilUser']
57 );
58 }
59
63 public function create(): int
64 {
65 $id = parent::create();
66 $this->createMetaData();
67
69 $this->getId(),
70 '',
71 '',
72 '',
73 '',
74 false,
75 false
76 );
77 $this->settings_storage->createSettings($this->settings);
78 return $id;
79 }
80
84 public function read(): void
85 {
86 parent::read();
87 global $DIC;
89 $this->settings = $settings_storage->loadSettings($this);
90 $this->info_settings = $settings_storage->loadInfoSettings($this);
91 }
92
94 {
95 if (!$this->settings) {
96 $this->settings = $this->settings_storage->loadSettings($this);
97 }
98 return $this->settings;
99 }
100
105 {
106 $this->settings = $settings;
107 $this->setTitle($settings->getTitle());
108 $this->setDescription($settings->getDescription());
109 }
110
112 {
113 if (!$this->info_settings) {
114 $this->info_settings = $this->settings_storage->loadInfoSettings($this);
115 }
117 }
118
123 {
124 $this->info_settings = $info;
125 }
126
131 {
132 return $this->members_storage->loadMembers($this);
133 }
134
140 public function loadMembersAsSingleObjects(string $filter = null, string $sort = null): array
141 {
142 return $this->members_storage->loadMembersAsSingleObjects($this, $filter, $sort);
143 }
144
149 {
150 return $this->members_storage->loadMembers($this)
151 ->withAccessHandling($this->il_access_handler);
152 }
153
157 public function updateMembers(ilIndividualAssessmentMembers $members): void
158 {
159 $members->updateStorageAndRBAC($this->members_storage, $this->access_handler);
160 }
161
165 public function delete(): bool
166 {
167 $this->deleteMetaData();
168 $this->settings_storage->deleteSettings($this);
169 $this->members_storage->deleteMembers($this);
170 return parent::delete();
171 }
172
176 public function update(): bool
177 {
178 parent::update();
179 $this->updateMetaData();
180
181 $this->settings_storage->updateSettings($this->settings);
182 return true;
183 }
184
185 public function updateInfo(): void
186 {
187 $this->settings_storage->updateInfoSettings($this->getInfoSettings());
188 }
189
194 {
196 }
197
201 public function initDefaultRoles(): void
202 {
203 $this->access_handler->initDefaultRolesForObject($this);
204 }
205
210 {
212 }
213
217 public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree = false): ?ilObject
218 {
219 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
220 $settings = $this->getSettings();
221 $info_settings = $this->getInfoSettings();
222 $new_settings = new ilIndividualAssessmentSettings(
223 $new_obj->getId(),
224 $new_obj->getTitle(),
225 $new_obj->getDescription(),
230 );
231 $new_obj->settings = $new_settings;
232
233 $new_info_settings = new ilIndividualAssessmentInfoSettings(
234 $new_obj->getId(),
240 );
241 $new_obj->settings = $new_settings;
242 $new_obj->info_settings = $new_info_settings;
243 $new_obj->settings_storage->updateSettings($new_settings);
244 $new_obj->settings_storage->updateInfoSettings($new_info_settings);
245
246 $fstorage = $this->getFileStorage();
247 if (count($fstorage->readDir()) > 0) {
248 $n_fstorage = $new_obj->getFileStorage();
249 $n_fstorage->create();
250 $fstorage->_copyDirectory($fstorage->getAbsolutePath(), $n_fstorage->getAbsolutePath());
251 }
252 return $new_obj;
253 }
254
259 {
260 if ($this->file_storage === null) {
261 $this->file_storage = ilIndividualAssessmentFileStorage::getInstance($this->getId());
262 }
263 return $this->file_storage;
264 }
265
269 public function isActiveLP(): bool
270 {
271 if ($this->lp_active === null) {
272 $this->lp_active = ilIndividualAssessmentLPInterface::isActiveLP($this->getId());
273 }
274 return $this->lp_active;
275 }
276
288 public function getParentContainerIdByType(int $id, array $types): int
289 {
290 global $DIC;
291
292 $tree = $DIC['tree'];
293 $node = $tree->getParentNodeData($id);
294
295 while ($node['type'] !== "root") {
296 if (in_array($node['type'], $types)) {
297 return (int) $node['ref_id'];
298 }
299 $node = $tree->getParentNodeData((int) $node['ref_id']);
300 }
301 return 0;
302 }
303
304 protected function getDic(): Pimple\Container
305 {
306 if (is_null($this->dic)) {
307 global $DIC;
308 $this->dic = $this->getObjectDIC(
309 $this,
310 $DIC
311 );
312 }
313 return $this->dic;
314 }
315
317 {
318 return $this->getDic()['ilIndividualAssessmentMembersGUI'];
319 }
320
322 {
323 return $this->getDic()['ilIndividualAssessmentSettingsGUI'];
324 }
325}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Handles the file upload and folder creation for files uploaded in grading form.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
withAccessHandling(ilOrgUnitPositionAndRBACAccessHandler $access_handler)
Get a collection like this, but only including users that are visible according to the supplied acces...
updateStorageAndRBAC(ilIndividualAssessmentMembersStorage $storage, IndividualAssessmentAccessHandler $access_handler)
Store the data to a persistent medium.
@ilCtrl_Calls ilIndividualAssessmentSettingsGUI: ilIndividualAssessmentCommonSettingsGUI
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
loadSettings(ilObjIndividualAssessment $obj)
Load settings corresponding to obj.
loadInfoSettings(ilObjIndividualAssessment $obj)
Load info-screen settings corresponding to obj.
An object carrying settings of an Individual Assessment obj beyond the standard information.
isEventTimePlaceRequired()
Get the value of the checkbox event_time_place_require.
isFileRequired()
Get the value of the checkbox file_required.
getTitle()
Get the content of this assessment, e.g.
getDescription()
Get the content of this assessment, e.g.
getRecordTemplate()
Get the record template to be used as default record with corresponding object.
getContent()
Get the content of this assessment, e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setInfoSettings(ilIndividualAssessmentInfoSettings $info)
Set info settings.
ilIndividualAssessmentMembersStorageDB $members_storage
getParentContainerIdByType(int $id, array $types)
Bubbles up the tree.
ilIndividualAssessmentAccessHandler $access_handler
loadVisibleMembers()
Get the members object associated with this and visible by the current user.
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...
isActiveLP()
Check whether the LP is activated for current object.
ilIndividualAssessmentSettings $settings
accessHandler()
Get the access handler of this.
loadMembersAsSingleObjects(string $filter=null, string $sort=null)
Get the members as single object associated with this.
cloneObject(int $target_id, int $copy_id=0, bool $omit_tree=false)
__construct(int $id=0, bool $call_by_reference=true)
updateMembers(ilIndividualAssessmentMembers $members)
Update the members object associated with this.
create()
note: title, description and type should be set when this function is called
ilIndividualAssessmentSettingsStorageDB $settings_storage
ilIndividualAssessmentFileStorage $file_storage
membersStorage()
Get the member storage object used by this.
setSettings(ilIndividualAssessmentSettings $settings)
Set the settings.
loadMembers()
Get the members object associated with this.
ilIndividualAssessmentInfoSettings $info_settings
getFileStorage()
Get the file storage system.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilTree $tree
bool $call_by_reference
setTitle(string $title)
setDescription(string $desc)
getParentNodeData(int $a_node_id)
get data of parent node from tree and object_data
global $DIC
Definition: feed.php:28
$target_id
Definition: goto.php:52
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc