ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilIndividualAssessmentDataSet.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3 require_once("./Services/DataSet/classes/class.ilDataSet.php");
4 
11 {
12 
16  public function getSupportedVersions()
17  {
18  return array('5.2.0', '5.3.0');
19  }
20 
21 
28  public function getXmlNamespace($entity, $schema_version)
29  {
30  return 'http://www.ilias.de/xml/Modules/IndividualAssessment/' . $entity;
31  }
32 
41  protected function getTypes($entity, $version)
42  {
43  switch ($entity) {
44  case 'iass':
45  return array(
46  "id" => "integer",
47  "title" => "text",
48  "description" => "text",
49  "content" => "text",
50  "recordTemplate" => "text",
51  "eventTimePlaceRequired" => "integer",
52  "file_required" => "integer",
53  "contact" => "text",
54  "responsibility" => "text",
55  "phone" => "text",
56  "mails" => "text",
57  "consultation_hours" => "text"
58  );
59  default:
60  return array();
61  }
62  }
63 
74  protected function getDependencies($entity, $version, $rec, $ids)
75  {
76  return false;
77  }
78 
86  public function readData($entity, $version, $ids)
87  {
88  $this->data = array();
89  if (!is_array($ids)) {
90  $ids = array($ids);
91  }
92  $this->_readData($entity, $ids);
93  }
94 
101  protected function _readData($entity, $ids)
102  {
103  switch ($entity) {
104  case 'iass':
105  foreach ($ids as $iass_id) {
106  if (ilObject::_lookupType($iass_id) == 'iass') {
107  $obj = new ilObjIndividualAssessment($iass_id, false);
108  $settings = $obj->getSettings();
109  $info = $obj->getInfoSettings();
110  $data = array(
111  'id' => $iass_id,
112  'title' => $obj->getTitle(),
113  'description' => $obj->getDescription(),
114  'content' => $settings->content(),
115  'recordTemplate' => $settings->recordTemplate(),
116  'eventTimePlaceRequired' => (int) $settings->eventTimePlaceRequired(),
117  'file_required' => (int) $settings->fileRequired(),
118  "contact" => $info->contact(),
119  "responsibility" => $info->responsibility(),
120  "phone" => $info->phone(),
121  "mails" => $info->mails(),
122  "consultation_hours" => $info->consultationHours()
123  );
124  $this->data[] = $data;
125  }
126  }
127  break;
128  default:
129  }
130  }
131 
142  public function importRecord($entity, $types, array $rec, ilImportMapping $mapping, $schema_version)
143  {
144  assert(is_string($entity));
145  assert(is_object($types) || is_null($types));
146  assert(is_string($schema_version));
147 
148  switch ($entity) {
149  case "iass":
150  if ($new_id = $mapping->getMapping('Services/Container', 'objs', $rec['id'])) {
151  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
152  } else {
153  $newObj = new ilObjIndividualAssessment();
154  $newObj->create();
155  }
156  $settings = new ilIndividualAssessmentSettings(
157  $newObj,
158  $rec["content"],
159  $rec["recordTemplate"],
160  $rec['file_required'],
161  $rec['eventTimePlaceRequired']
162  );
163 
165  $newObj,
166  $rec['contact'],
167  $rec['responsibility'],
168  $rec['phone'],
169  $rec['mails'],
170  $rec['consultation_hours']
171  );
172 
173  $newObj->setTitle($rec["title"]);
174  $newObj->setDescription($rec["description"]);
175  $newObj->setSettings($settings);
176  $newObj->setInfoSettings($info);
177  $newObj->update();
178  $newObj->updateInfo();
179  $mapping->addMapping("Modules/IndividualAssessment", "iass", $rec["id"], $newObj->getId());
180  break;
181  }
182  }
183 }
getMapping($a_comp, $a_entity, $a_old_id)
Get a mapping.
_readData($entity, $ids)
Build data array, data is read from cache except iass object itself.
For the purpose of streamlining the grading and learning-process status definition outside of tests...
Individual Assessment dataset class.
An object carrying settings of an Individual Assessment obj beyond the standart information.
importRecord($entity, $types, array $rec, ilImportMapping $mapping, $schema_version)
Import record.
addMapping($a_comp, $a_entity, $a_old_id, $a_new_id)
Add mapping.
$version
Definition: build.php:27
readData($entity, $version, $ids)
Read data from Cache for a given entity and ID(s)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType($a_id, $a_reference=false)
lookup object type
getDependencies($entity, $version, $rec, $ids)
Return dependencies form entities to other entities (in our case these are all the DB relations) ...
getTypes($entity, $version)
Map XML attributes of entities to datatypes (text, integer...)
$this data['403_header']
$info
Definition: index.php:5
A dataset contains in data in a common structure that can be shared and transformed for different pur...
$data
Definition: bench.php:6