ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjIndividualAssessment.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
30{
31 use ilIndividualAssessmentDIC;
32
33 protected ?bool $lp_active = null;
39 protected ?Pimple\Container $dic = null;
40
43
44
45
46 public function __construct(int $id = 0, bool $call_by_reference = true)
47 {
48 global $DIC;
49 $this->type = 'iass';
50 $this->il_access_handler = $DIC["ilAccess"];
51
53
54 $this->settings_storage = new ilIndividualAssessmentSettingsStorageDB($DIC['ilDB']);
55
56 $dic = $this->getDic();
57
58 $this->members_storage = $dic['iass.member.storage'];
59 $this->access_handler = $dic['iass.accesshandler'];
60 }
61
65 public function create(): int
66 {
67 $id = parent::create();
68 $this->createMetaData();
69
71 $this->getId(),
72 '',
73 '',
74 '',
75 '',
76 false,
77 false
78 );
79 $this->settings_storage->createSettings($this->settings);
80 return $id;
81 }
82
86 public function read(): void
87 {
88 parent::read();
89 global $DIC;
91 $this->settings = $settings_storage->loadSettings($this);
92 $this->info_settings = $settings_storage->loadInfoSettings($this);
93 }
94
96 {
97 if (!$this->settings) {
98 $this->settings = $this->settings_storage->loadSettings($this);
99 }
100 return $this->settings;
101 }
102
107 {
108 $this->settings = $settings;
109 $this->setTitle($settings->getTitle());
110 $this->setDescription($settings->getDescription());
111 }
112
114 {
115 if (!$this->info_settings) {
116 $this->info_settings = $this->settings_storage->loadInfoSettings($this);
117 }
119 }
120
125 {
126 $this->info_settings = $info;
127 }
128
133 {
134 return $this->members_storage->loadMembers($this);
135 }
136
142 public function loadMembersAsSingleObjects(?string $filter = null, ?string $sort = null): array
143 {
144 return $this->members_storage->loadMembersAsSingleObjects($this, $filter, $sort);
145 }
146
151 {
152 return $this->members_storage->loadMembers($this)
153 ->withAccessHandling($this->il_access_handler);
154 }
155
159 public function updateMembers(ilIndividualAssessmentMembers $members): void
160 {
161 $members->updateStorageAndRBAC($this->members_storage, $this->access_handler);
162 }
163
167 public function delete(): bool
168 {
169 $this->deleteMetaData();
170 $this->settings_storage->deleteSettings($this);
171 $this->members_storage->deleteMembers($this);
172 return parent::delete();
173 }
174
178 public function update(): bool
179 {
180 parent::update();
181 $this->updateMetaData();
182
183 $this->settings_storage->updateSettings($this->settings);
184 return true;
185 }
186
187 public function updateInfo(): void
188 {
189 $this->settings_storage->updateInfoSettings($this->getInfoSettings());
190 }
191
196 {
198 }
199
203 public function initDefaultRoles(): void
204 {
205 $this->access_handler->initDefaultRolesForObject($this);
206 }
207
212 {
214 }
215
219 public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree = false): ?ilObject
220 {
221 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
222 $settings = $this->getSettings();
223 $info_settings = $this->getInfoSettings();
224 $new_settings = new ilIndividualAssessmentSettings(
225 $new_obj->getId(),
226 $new_obj->getTitle(),
227 $new_obj->getDescription(),
232 );
233 $new_obj->settings = $new_settings;
234
235 $new_info_settings = new ilIndividualAssessmentInfoSettings(
236 $new_obj->getId(),
242 );
243 $new_obj->settings = $new_settings;
244 $new_obj->info_settings = $new_info_settings;
245 $new_obj->settings_storage->updateSettings($new_settings);
246 $new_obj->settings_storage->updateInfoSettings($new_info_settings);
247
248 return $new_obj;
249 }
250
254 public function isActiveLP(): bool
255 {
256 if ($this->lp_active === null) {
257 $this->lp_active = ilIndividualAssessmentLPInterface::isActiveLP($this->getId());
258 }
259 return $this->lp_active;
260 }
261
273 public function getParentContainerIdByType(int $id, array $types): int
274 {
275 global $DIC;
276
277 $tree = $DIC['tree'];
278 $node = $tree->getParentNodeData($id);
279
280 while ($node['type'] !== "root") {
281 if (in_array($node['type'], $types)) {
282 return (int) $node['ref_id'];
283 }
284 $node = $tree->getParentNodeData((int) $node['ref_id']);
285 }
286 return 0;
287 }
288
289 protected function getDic(): Pimple\Container
290 {
291 if (is_null($this->dic)) {
292 global $DIC;
293 $this->dic = $this->getObjectDIC(
294 $this,
295 $DIC
296 );
297 }
298 return $this->dic;
299 }
300
302 {
303 return $this->getDic()['ilIndividualAssessmentMembersGUI'];
304 }
305
307 {
308 return $this->getDic()['ilIndividualAssessmentSettingsGUI'];
309 }
310}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
Member administration related logic, add and remove members, get the list of all members,...
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
A settings storage handler to write iass settings to db.
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.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
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.
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.
loadMembersAsSingleObjects(?string $filter=null, ?string $sort=null)
Get the members as single object associated with this.
setSettings(ilIndividualAssessmentSettings $settings)
Set the settings.
loadMembers()
Get the members object associated with this.
ilIndividualAssessmentInfoSettings $info_settings
Class ilObject Basic functions for all objects.
ilTree $tree
bool $call_by_reference
setTitle(string $title)
setDescription(string $description)
getParentNodeData(int $a_node_id)
get data of parent node from tree and object_data
$info
Definition: entry_point.php:21
Mechanic regarding the access control and roles of an objet goes here.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26