ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjIndividualAssessment.php
Go to the documentation of this file.
1 <?php
11 {
13 
17  protected $lp_active = null;
18 
22  protected $settings;
23 
27  protected $settings_storage;
28 
32  protected $members_storage;
33 
37  protected $access_handler;
38 
42  protected $il_access_handler;
43 
47  protected $dic;
48 
49  public function __construct($a_id = 0, $a_call_by_reference = true)
50  {
51  global $DIC;
52  $this->type = 'iass';
53  $this->il_access_handler = $DIC["ilAccess"];
54  parent::__construct($a_id, $a_call_by_reference);
55  $this->settings_storage = new ilIndividualAssessmentSettingsStorageDB($DIC['ilDB']);
56  $this->members_storage = new ilIndividualAssessmentMembersStorageDB($DIC['ilDB']);
57  $this->access_handler = new ilIndividualAssessmentAccessHandler(
58  $this,
59  $DIC['ilAccess'],
60  $DIC['rbacadmin'],
61  $DIC['rbacreview'],
62  $DIC['ilUser']
63  );
64  }
65 
69  public function create()
70  {
71  parent::create();
72  $this->createMetaData();
73 
75  (int) $this->getId(),
76  '',
77  '',
78  '',
79  '',
80  false,
81  false
82  );
83  $this->settings_storage->createSettings($this->settings);
84  }
85 
89  public function read()
90  {
91  parent::read();
92  global $DIC;
94  $this->settings = $settings_storage->loadSettings($this);
95  $this->info_settings = $settings_storage->loadInfoSettings($this);
96  }
97 
99  {
100  if (!$this->settings) {
101  $this->settings = $this->settings_storage->loadSettings($this);
102  }
103  return $this->settings;
104  }
105 
110  {
111  $this->settings = $settings;
112  $this->setTitle($settings->getTitle());
113  $this->setDescription($settings->getDescription());
114  }
115 
117  {
118  if (!$this->info_settings) {
119  $this->info_settings = $this->settings_storage->loadInfoSettings($this);
120  }
121  return $this->info_settings;
122  }
123 
128  {
129  $this->info_settings = $info;
130  }
131 
137  public function loadMembers()
138  {
139  return $this->members_storage->loadMembers($this);
140  }
141 
147  public function loadMembersAsSingleObjects(string $filter = null, string $sort = null)
148  {
149  return $this->members_storage->loadMembersAsSingleObjects($this, $filter, $sort);
150  }
151 
157  public function loadVisibleMembers()
158  {
159  return $this->members_storage->loadMembers($this)
160  ->withAccessHandling($this->il_access_handler);
161  }
162 
169  {
170  $members->updateStorageAndRBAC($this->members_storage, $this->access_handler);
171  }
172 
176  public function delete()
177  {
178  $this->deleteMetaData();
179  $this->settings_storage->deleteSettings($this);
180  $this->members_storage->deleteMembers($this);
181  parent::delete();
182  }
183 
187  public function update()
188  {
189  parent::update();
190  $this->updateMetaData();
191 
192  $this->settings_storage->updateSettings($this->settings);
193  }
194 
195  public function updateInfo()
196  {
197  $this->settings_storage->updateInfoSettings($this->info_settings);
198  }
199 
205  public function membersStorage()
206  {
207  return $this->members_storage;
208  }
209 
213  public function initDefaultRoles()
214  {
215  $this->access_handler->initDefaultRolesForObject($this);
216  }
217 
223  public function accessHandler()
224  {
225  return $this->access_handler;
226  }
227 
231  public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
232  {
233  $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
234  $settings = $this->getSettings();
235  $info_settings = $this->getInfoSettings();
236  $new_settings = new ilIndividualAssessmentSettings(
237  (int) $new_obj->getId(),
238  (int) $new_obj->getTitle(),
239  (int) $new_obj->getDescription(),
240  $settings->getContent(),
241  $settings->getRecordTemplate(),
242  $settings->isEventTimePlaceRequired(),
243  $settings->isFileRequired()
244  );
245  $new_obj->settings = $new_settings;
246 
247  $new_info_settings = new ilIndividualAssessmentInfoSettings(
248  (int) $new_obj->getId(),
249  $info_settings->getContact(),
250  $info_settings->getResponsibility(),
251  $info_settings->getPhone(),
252  $info_settings->getMails(),
253  $info_settings->getConsultationHours()
254  );
255  $new_obj->settings = $new_settings;
256  $new_obj->info_settings = $new_info_settings;
257  $new_obj->settings_storage->updateSettings($new_settings);
258  $new_obj->settings_storage->updateInfoSettings($new_info_settings);
259 
260  $fstorage = $this->getFileStorage();
261  if (count($fstorage->readDir()) > 0) {
262  $n_fstorage = $new_obj->getFileStorage();
263  $n_fstorage->create();
264  $fstorage->_copyDirectory($fstorage->getAbsolutePath(), $n_fstorage->getAbsolutePath());
265  }
266  return $new_obj;
267  }
268 
274  public function getFileStorage()
275  {
276  if ($this->file_storage === null) {
277  $this->file_storage = ilIndividualAssessmentFileStorage::getInstance($this->getId());
278  }
279  return $this->file_storage;
280  }
281 
287  public function isActiveLP()
288  {
289  if ($this->lp_active === null) {
290  require_once 'Modules/IndividualAssessment/classes/LearningProgress/class.ilIndividualAssessmentLPInterface.php';
291  $this->lp_active = ilIndividualAssessmentLPInterface::isActiveLP($this->getId());
292  }
293  return $this->lp_active;
294  }
295 
307  public function getParentContainerIdByType($id, array $types)
308  {
309  global $DIC;
310 
311  $tree = $DIC['tree'];
312  $node = $tree->getParentNodeData($id);
313 
314  while ($node['type'] !== "root") {
315  if (in_array($node['type'], $types)) {
316  return $node['ref_id'];
317  }
318  $node = $tree->getParentNodeData($node['ref_id']);
319  }
320  return 0;
321  }
322 
323  protected function getDic() : Pimple\Container
324  {
325  if (is_null($this->dic)) {
326  global $DIC;
327  $this->dic = $this->getObjectDIC(
328  $this,
329  $DIC
330  );
331  }
332  return $this->dic;
333  }
334 
336  {
337  return $this->getDic()['ilIndividualAssessmentMembersGUI'];
338  }
339 
341  {
342  return $this->getDic()['ilIndividualAssessmentSettingsGUI'];
343  }
344 }
settings()
Definition: settings.php:2
For the purpose of streamlining the grading and learning-process status definition outside of tests...
A settings storage handler to write iass settings to db.
updateMetaData()
update meta data entry
An object carrying settings of an Individual Assessment obj beyond the standart information.
membersStorage()
Get the member storage object used by this.
createMetaData()
create meta data entry
getTitle()
Get the content of this assessment, e.g.
setInfoSettings(ilIndividualAssessmentInfoSettings $info)
Set info settings.
loadVisibleMembers()
Get the members object associated with this and visible by the current user.
getFileStorage()
Get the file storage system.
setTitle($a_title)
set object title
getDescription()
Get the content of this assessment, e.g.
isActiveLP()
Check wether the LP is activated for current object.
getId()
get object id public
global $DIC
Definition: goto.php:24
setSettings(ilIndividualAssessmentSettings $settings)
Set the settings.
__construct($a_id=0, $a_call_by_reference=true)
loadMembersAsSingleObjects(string $filter=null, string $sort=null)
Get the members as single object associated with this.
loadMembers()
Get the members object associated with this.
updateStorageAndRBAC(ilIndividualAssessmentMembersStorage $storage, IndividualAssessmentAccessHandler $access_handler)
Store the data to a persistent medium.
__construct(Container $dic, ilPlugin $plugin)
deleteMetaData()
delete meta data entry
setDescription($a_desc)
set object description
ilIndividualAssessmentSettingsGUI: ilIndividualAssessmentCommonSettingsGUI
accessHandler()
Get the access handler of this.
getParentContainerIdByType($id, array $types)
Bubbles up the tree.
For the purpose of streamlining the grading and learning-process status definition outside of tests...
updateMembers(ilIndividualAssessmentMembers $members)
Update the members object associated with this.
Member administration related logic, add and remove members, get the list of all members, etc.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)