ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 */
3require_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->getContent(),
115 'recordTemplate' => $settings->getRecordTemplate(),
116 'eventTimePlaceRequired' => (int) $settings->isEventTimePlaceRequired(),
117 'file_required' => (int) $settings->isFileRequired(),
118 "contact" => $info->getContact(),
119 "responsibility" => $info->getResponsibility(),
120 "phone" => $info->getPhone(),
121 "mails" => $info->getMails(),
122 "consultation_hours" => $info->getConsultationHours()
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
157 $newObj->setTitle($rec["title"]);
158 $newObj->setDescription($rec["description"]);
159
160 $settings = new ilIndividualAssessmentSettings(
161 (int) $newObj->getId(),
162 $newObj->getTitle(),
163 $newObj->getDescription(),
164 $rec["content"],
165 $rec["recordTemplate"],
166 $rec['eventTimePlaceRequired'],
167 $rec['file_required']
168 );
169
171 (int) $newObj->getId(),
172 $rec['contact'],
173 $rec['responsibility'],
174 $rec['phone'],
175 $rec['mails'],
176 $rec['consultation_hours']
177 );
178
179 $newObj->setSettings($settings);
180 $newObj->setInfoSettings($info);
181 $newObj->update();
182 $newObj->updateInfo();
183 $mapping->addMapping("Modules/IndividualAssessment", "iass", $rec["id"], $newObj->getId());
184 break;
185 }
186 }
187}
An exception for terminatinating execution or to throw for unit testing.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getMapping($a_comp, $a_entity, $a_old_id)
Get a mapping.
addMapping($a_comp, $a_entity, $a_old_id, $a_new_id)
Add mapping.
Individual Assessment dataset class.
readData($entity, $version, $ids)
Read data from Cache for a given entity and ID(s)
importRecord($entity, $types, array $rec, ilImportMapping $mapping, $schema_version)
Import record.
_readData($entity, $ids)
Build data array, data is read from cache except iass object itself.
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...)
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,...
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
$data
Definition: storeScorm.php:23