ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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();
73  (int) $this->getId(),
74  '',
75  '',
76  '',
77  '',
78  false,
79  false
80  );
81  $this->settings_storage->createSettings($this->settings);
82  }
83 
87  public function read()
88  {
89  parent::read();
90  global $DIC;
92  $this->settings = $settings_storage->loadSettings($this);
93  $this->info_settings = $settings_storage->loadInfoSettings($this);
94  }
95 
97  {
98  if (!$this->settings) {
99  $this->settings = $this->settings_storage->loadSettings($this);
100  }
101  return $this->settings;
102  }
103 
108  {
109  $this->settings = $settings;
110  $this->setTitle($settings->getTitle());
111  $this->setDescription($settings->getDescription());
112  }
113 
115  {
116  if (!$this->info_settings) {
117  $this->info_settings = $this->settings_storage->loadInfoSettings($this);
118  }
119  return $this->info_settings;
120  }
121 
126  {
127  $this->info_settings = $info;
128  }
129 
135  public function loadMembers()
136  {
137  return $this->members_storage->loadMembers($this);
138  }
139 
145  public function loadMembersAsSingleObjects(string $filter = null, string $sort = null)
146  {
147  return $this->members_storage->loadMembersAsSingleObjects($this, $filter, $sort);
148  }
149 
155  public function loadVisibleMembers()
156  {
157  return $this->members_storage->loadMembers($this)
158  ->withAccessHandling($this->il_access_handler);
159  }
160 
167  {
168  $members->updateStorageAndRBAC($this->members_storage, $this->access_handler);
169  }
170 
174  public function delete()
175  {
176  $this->settings_storage->deleteSettings($this);
177  $this->members_storage->deleteMembers($this);
178  parent::delete();
179  }
180 
184  public function update()
185  {
186  parent::update();
187  $this->settings_storage->updateSettings($this->settings);
188  }
189 
190  public function updateInfo()
191  {
192  $this->settings_storage->updateInfoSettings($this->info_settings);
193  }
194 
200  public function membersStorage()
201  {
202  return $this->members_storage;
203  }
204 
208  public function initDefaultRoles()
209  {
210  $this->access_handler->initDefaultRolesForObject($this);
211  }
212 
218  public function accessHandler()
219  {
220  return $this->access_handler;
221  }
222 
226  public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
227  {
228  $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
229  $settings = $this->getSettings();
230  $info_settings = $this->getInfoSettings();
231  $new_settings = new ilIndividualAssessmentSettings(
232  (int) $new_obj->getId(),
233  (int) $new_obj->getTitle(),
234  (int) $new_obj->getDescription(),
235  $settings->getContent(),
236  $settings->getRecordTemplate(),
237  $settings->isEventTimePlaceRequired(),
238  $settings->isFileRequired()
239  );
240  $new_obj->settings = $new_settings;
241 
242  $new_info_settings = new ilIndividualAssessmentInfoSettings(
243  (int) $new_obj->getId(),
244  $info_settings->getContact(),
245  $info_settings->getResponsibility(),
246  $info_settings->getPhone(),
247  $info_settings->getMails(),
248  $info_settings->getConsultationHours()
249  );
250  $new_obj->settings = $new_settings;
251  $new_obj->info_settings = $new_info_settings;
252  $new_obj->settings_storage->updateSettings($new_settings);
253  $new_obj->settings_storage->updateInfoSettings($new_info_settings);
254 
255  $fstorage = $this->getFileStorage();
256  if (count($fstorage->readDir()) > 0) {
257  $n_fstorage = $new_obj->getFileStorage();
258  $n_fstorage->create();
259  $fstorage->_copyDirectory($fstorage->getAbsolutePath(), $n_fstorage->getAbsolutePath());
260  }
261  return $new_obj;
262  }
263 
269  public function getFileStorage()
270  {
271  if ($this->file_storage === null) {
272  $this->file_storage = ilIndividualAssessmentFileStorage::getInstance($this->getId());
273  }
274  return $this->file_storage;
275  }
276 
282  public function isActiveLP()
283  {
284  if ($this->lp_active === null) {
285  require_once 'Modules/IndividualAssessment/classes/LearningProgress/class.ilIndividualAssessmentLPInterface.php';
286  $this->lp_active = ilIndividualAssessmentLPInterface::isActiveLP($this->getId());
287  }
288  return $this->lp_active;
289  }
290 
302  public function getParentContainerIdByType($id, array $types)
303  {
304  global $DIC;
305 
306  $tree = $DIC['tree'];
307  $node = $tree->getParentNodeData($id);
308 
309  while ($node['type'] !== "root") {
310  if (in_array($node['type'], $types)) {
311  return $node['ref_id'];
312  }
313  $node = $tree->getParentNodeData($node['ref_id']);
314  }
315  return 0;
316  }
317 
318  protected function getDic() : Pimple\Container
319  {
320  if (is_null($this->dic)) {
321  global $DIC;
322  $this->dic = $this->getObjectDIC(
323  $this,
324  $DIC
325  );
326  }
327  return $this->dic;
328  }
329 
331  {
332  return $this->getDic()['ilIndividualAssessmentMembersGUI'];
333  }
334 
336  {
337  return $this->getDic()['ilIndividualAssessmentSettingsGUI'];
338  }
339 }
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.
An object carrying settings of an Individual Assessment obj beyond the standart information.
membersStorage()
Get the member storage object used by this.
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
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)
$DIC
Definition: xapitoken.php:46
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)