ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjIndividualAssessment.php
Go to the documentation of this file.
1 <?php
11 require_once 'Services/Object/classes/class.ilObject.php';
12 require_once 'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentSettings.php';
13 require_once 'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentSettingsStorageDB.php';
14 require_once 'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMembersStorageDB.php';
15 require_once 'Modules/IndividualAssessment/classes/AccessControl/class.ilIndividualAssessmentAccessHandler.php';
17 
18  protected $lp_active = null;
19 
20  public function __construct($a_id = 0, $a_call_by_reference = true) {
21  global $DIC;
22  $this->type = 'iass';
23  parent::__construct($a_id, $a_call_by_reference);
24  $this->settings_storage = new ilIndividualAssessmentSettingsStorageDB($DIC['ilDB']);
25  $this->members_storage = new ilIndividualAssessmentMembersStorageDB($DIC['ilDB']);
26  $this->access_handler = new ilIndividualAssessmentAccessHandler(
27  $DIC['ilAccess']
28  ,$DIC['rbacadmin']
29  ,$DIC['rbacreview']
30  ,$DIC['ilUser']);
31 
32  }
33 
37  public function create() {
38  parent::create();
39  $this->settings = new ilIndividualAssessmentSettings($this);
40  $this->settings_storage->createSettings($this->settings);
41  }
42 
46  public function read() {
47  parent::read();
48  global $DIC;
49  $settings_storage = new ilIndividualAssessmentSettingsStorageDB($DIC['ilDB']);
50  $this->settings = $settings_storage->loadSettings($this);
51  $this->info_settings = $settings_storage->loadInfoSettings($this);
52  }
53 
57  public function getSettings() {
58  if(!$this->settings) {
59  $this->settings = $this->settings_storage->loadSettings($this);
60  }
61  return $this->settings;
62  }
63 
64  public function getInfoSettings() {
65  if(!$this->info_settings) {
66  $this->info_settings = $this->settings_storage->loadInfoSettings($this);
67  }
68  return $this->info_settings;
69  }
70 
76  public function loadMembers() {
77  return $this->members_storage->loadMembers($this);
78  }
79 
85  public function updateMembers(ilIndividualAssessmentMembers $members) {
86  $members->updateStorageAndRBAC($this->members_storage, $this->access_handler);
87  }
88 
92  public function delete() {
93  $this->settings_storage->deleteSettings($this);
94  $this->members_storage->deleteMembers($this);
95  parent::delete();
96  }
97 
101  public function update() {
102  parent::update();
103  $this->settings_storage->updateSettings($this->settings);
104  }
105 
106  public function updateInfo() {
107  $this->settings_storage->updateInfoSettings($this->info_settings);
108  }
109 
115  public function membersStorage() {
116  return $this->members_storage;
117  }
118 
122  public function initDefaultRoles() {
123  $this->access_handler->initDefaultRolesForObject($this);
124  }
125 
131  public function accessHandler() {
132  return $this->access_handler;
133  }
134 
138  public function cloneObject($a_target_id,$a_copy_id = 0, $a_omit_tree = false) {
139  $new_obj = parent::cloneObject($a_target_id,$a_copy_id, $a_omit_tree);
140  $settings = $this->getSettings();
141  $info_settings = $this->getInfoSettings();
142  $new_settings = new ilIndividualAssessmentSettings($new_obj,
143  $settings->content()
144  ,$settings->recordTemplate());
145  $new_obj->settings = $new_settings;
146 
147  $new_info_settings = new ilIndividualAssessmentInfoSettings($new_obj,
148  $info_settings->contact()
149  ,$info_settings->responsibility()
150  ,$info_settings->phone()
151  ,$info_settings->mails()
152  ,$info_settings->consultationHours());
153  $new_obj->settings = $new_settings;
154  $new_obj->info_settings = $new_info_settings;
155  $new_obj->settings_storage->updateSettings($new_settings);
156  $new_obj->settings_storage->updateInfoSettings($new_info_settings);
157  return $new_obj;
158  }
159 
165  public function isActiveLP() {
166  if($this->lp_active === null) {
167  require_once 'Modules/IndividualAssessment/classes/LearningProgress/class.ilIndividualAssessmentLPInterface.php';
168  $this->lp_active = ilIndividualAssessmentLPInterface::isActiveLP($this->getId());
169  }
170  return $this->lp_active;
171  }
172 
184  public function getParentContainerIdByType($id, array $types) {
185  global $DIC;
186 
187  $tree = $DIC['tree'];
188  $node = $tree->getParentNodeData($id);
189 
190  while($node['type'] !== "root") {
191  if(in_array($node['type'], $types)) {
192  return $node['ref_id'];
193  }
194  $node = $tree->getParentNodeData($node['ref_id']);
195  }
196  return 0;
197  }
198 }
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.
Class ilObject Basic functions for all objects.
membersStorage()
Get the member storage object used by this.
isActiveLP()
Check wether the LP is activated for current object.
getId()
get object id public
__construct($a_id=0, $a_call_by_reference=true)
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
loadMembers()
Get the members object associated with this.
updateStorageAndRBAC(ilIndividualAssessmentMembersStorage $storage, IndividualAssessmentAccessHandler $access_handler)
Store the data to a persistent medium.
global $DIC
accessHandler()
Get the access handler of this.
getParentContainerIdByType($id, array $types)
Bubbles up the tree.
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)