ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjIndividualAssessment.php
Go to the documentation of this file.
1<?php
11require_once 'Services/Object/classes/class.ilObject.php';
12require_once 'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentSettings.php';
13require_once 'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentSettingsStorageDB.php';
14require_once 'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMembersStorageDB.php';
15require_once 'Modules/IndividualAssessment/classes/AccessControl/class.ilIndividualAssessmentAccessHandler.php';
16require_once 'Modules/IndividualAssessment/classes/FileStorage/class.ilIndividualAssessmentFileStorage.php';
18{
19 protected $lp_active = null;
20
21 public function __construct($a_id = 0, $a_call_by_reference = true)
22 {
23 global $DIC;
24 $this->type = 'iass';
25 $this->il_access_handler = $DIC["ilAccess"];
26 parent::__construct($a_id, $a_call_by_reference);
27 $this->settings_storage = new ilIndividualAssessmentSettingsStorageDB($DIC['ilDB']);
28 $this->members_storage = new ilIndividualAssessmentMembersStorageDB($DIC['ilDB']);
29 $this->access_handler = new ilIndividualAssessmentAccessHandler(
30 $this,
31 $DIC['ilAccess'],
32 $DIC['rbacadmin'],
33 $DIC['rbacreview'],
34 $DIC['ilUser']
35 );
36 }
37
41 public function create()
42 {
43 parent::create();
44 $this->settings = new ilIndividualAssessmentSettings($this);
45 $this->settings_storage->createSettings($this->settings);
46 }
47
51 public function read()
52 {
53 parent::read();
54 global $DIC;
55 $settings_storage = new ilIndividualAssessmentSettingsStorageDB($DIC['ilDB']);
56 $this->settings = $settings_storage->loadSettings($this);
57 $this->info_settings = $settings_storage->loadInfoSettings($this);
58 }
59
63 public function getSettings()
64 {
65 if (!$this->settings) {
66 $this->settings = $this->settings_storage->loadSettings($this);
67 }
68 return $this->settings;
69 }
70
75 {
76 $this->settings = $settings;
77 }
78
79 public function getInfoSettings()
80 {
81 if (!$this->info_settings) {
82 $this->info_settings = $this->settings_storage->loadInfoSettings($this);
83 }
84 return $this->info_settings;
85 }
86
91 {
92 $this->info_settings = $info;
93 }
94
100 public function loadMembers()
101 {
102 return $this->members_storage->loadMembers($this);
103 }
104
110 public function loadVisibleMembers()
111 {
112 return $this->members_storage->loadMembers($this)
113 ->withAccessHandling($this->il_access_handler);
114 }
115
122 {
123 $members->updateStorageAndRBAC($this->members_storage, $this->access_handler);
124 }
125
129 public function delete()
130 {
131 $this->settings_storage->deleteSettings($this);
132 $this->members_storage->deleteMembers($this);
133 parent::delete();
134 }
135
139 public function update()
140 {
142 $this->settings_storage->updateSettings($this->settings);
143 }
144
145 public function updateInfo()
146 {
147 $this->settings_storage->updateInfoSettings($this->info_settings);
148 }
149
155 public function membersStorage()
156 {
157 return $this->members_storage;
158 }
159
163 public function initDefaultRoles()
164 {
165 $this->access_handler->initDefaultRolesForObject($this);
166 }
167
173 public function accessHandler()
174 {
175 return $this->access_handler;
176 }
177
181 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
182 {
183 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
184 $settings = $this->getSettings();
185 $info_settings = $this->getInfoSettings();
186 $new_settings = new ilIndividualAssessmentSettings(
187 $new_obj,
188 $settings->content(),
189 $settings->recordTemplate()
190 );
191 $new_obj->settings = $new_settings;
192
193 $new_info_settings = new ilIndividualAssessmentInfoSettings(
194 $new_obj,
195 $info_settings->contact(),
196 $info_settings->responsibility(),
197 $info_settings->phone(),
198 $info_settings->mails(),
199 $info_settings->consultationHours()
200 );
201 $new_obj->settings = $new_settings;
202 $new_obj->info_settings = $new_info_settings;
203 $new_obj->settings_storage->updateSettings($new_settings);
204 $new_obj->settings_storage->updateInfoSettings($new_info_settings);
205
206 $fstorage = $this->getFileStorage();
207 if (count($fstorage->readDir()) > 0) {
208 $n_fstorage = $new_obj->getFileStorage();
209 $n_fstorage->create();
210 $fstorage->_copyDirectory($fstorage->getAbsolutePath(), $n_fstorage->getAbsolutePath());
211 }
212 return $new_obj;
213 }
214
220 public function getFileStorage()
221 {
222 if ($this->file_storage === null) {
223 $this->file_storage = ilIndividualAssessmentFileStorage::getInstance($this->getId());
224 }
225 return $this->file_storage;
226 }
227
233 public function isActiveLP()
234 {
235 if ($this->lp_active === null) {
236 require_once 'Modules/IndividualAssessment/classes/LearningProgress/class.ilIndividualAssessmentLPInterface.php';
237 $this->lp_active = ilIndividualAssessmentLPInterface::isActiveLP($this->getId());
238 }
239 return $this->lp_active;
240 }
241
253 public function getParentContainerIdByType($id, array $types)
254 {
255 global $DIC;
256
257 $tree = $DIC['tree'];
258 $node = $tree->getParentNodeData($id);
259
260 while ($node['type'] !== "root") {
261 if (in_array($node['type'], $types)) {
262 return $node['ref_id'];
263 }
264 $node = $tree->getParentNodeData($node['ref_id']);
265 }
266 return 0;
267 }
268}
An exception for terminatinating execution or to throw for unit testing.
Member administration related logic, add and remove members, get the list of all members,...
updateStorageAndRBAC(ilIndividualAssessmentMembersStorage $storage, IndividualAssessmentAccessHandler $access_handler)
Store the data to a persistent medium.
A settings storage handler to write iass settings to db.
An object carrying settings of an Individual Assessment obj beyond the standart information.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
setInfoSettings(ilIndividualAssessmentInfoSettings $info)
Set info settings.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
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 wether the LP is activated for current object.
accessHandler()
Get the access handler of this.
read()
read object data from db into object
updateMembers(ilIndividualAssessmentMembers $members)
Update the members object associated with this.
create()
createnote: title, description and type should be set when this function is called@access public inte...
getParentContainerIdByType($id, array $types)
Bubbles up the tree.
membersStorage()
Get the member storage object used by this.
update()
update object in db@access public boolean true on success
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
setSettings(ilIndividualAssessmentSettings $settings)
Set the settings.
loadMembers()
Get the members object associated with this.
getFileStorage()
Get the file storage system.
Class ilObject Basic functions for all objects.
getId()
get object id @access public
$info
Definition: index.php:5
update($pash, $contents, Config $config)
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2