ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilIndividualAssessmentDataSet.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
26 public function getSupportedVersions(): array
27 {
28 return ['5.2.0', '5.3.0', '9.0.0'];
29 }
30
31 protected function getXmlNamespace(string $a_entity, string $a_schema_version): string
32 {
33 return 'http://www.ilias.de/xml/Modules/IndividualAssessment/' . $a_entity;
34 }
35
39 protected function getTypes(string $a_entity, string $a_version): array
40 {
41 switch ($a_entity) {
42 case 'iass':
43 return array(
44 "id" => "integer",
45 "title" => "text",
46 "description" => "text",
47 "content" => "text",
48 "recordTemplate" => "text",
49 "eventTimePlaceRequired" => "integer",
50 "file_required" => "integer",
51 "contact" => "text",
52 "responsibility" => "text",
53 "phone" => "text",
54 "mails" => "text",
55 "consultation_hours" => "text"
56 );
57 default:
58 return array();
59 }
60 }
61
65 protected function getDependencies(
66 string $a_entity,
67 string $a_version,
68 ?array $a_rec = null,
69 ?array $a_ids = null
70 ): array {
71 return [];
72 }
73
77 public function readData(string $a_entity, string $a_version, array $a_ids): void
78 {
79 $this->data = array();
80 $this->_readData($a_entity, $a_ids);
81 }
82
86 protected function _readData(string $entity, array $ids): void
87 {
88 switch ($entity) {
89 case 'iass':
90 foreach ($ids as $iass_id) {
91 $iass_id = (int) $iass_id;
92 if (ilObject::_lookupType($iass_id) == 'iass') {
93 $obj = new ilObjIndividualAssessment($iass_id, false);
94 $settings = $obj->getSettings();
95 $info = $obj->getInfoSettings();
96 $data = array(
97 'id' => $iass_id,
98 'title' => $obj->getTitle(),
99 'description' => $obj->getDescription(),
100 'content' => $settings->getContent(),
101 'recordTemplate' => $settings->getRecordTemplate(),
102 'eventTimePlaceRequired' => (int) $settings->isEventTimePlaceRequired(),
103 'file_required' => (int) $settings->isFileRequired(),
104 "contact" => $info->getContact(),
105 "responsibility" => $info->getResponsibility(),
106 "phone" => $info->getPhone(),
107 "mails" => $info->getMails(),
108 "consultation_hours" => $info->getConsultationHours()
109 );
110 $this->data[] = $data;
111 }
112 }
113 break;
114 default:
115 }
116 }
117
121 public function importRecord(
122 string $a_entity,
123 array $a_types,
124 array $a_rec,
125 ilImportMapping $a_mapping,
126 string $a_schema_version
127 ): void {
128 if ($a_entity == "iass") {
129 if ($new_id = $a_mapping->getMapping('components/ILIAS/Container', 'objs', $a_rec['id'])) {
130 $newObj = ilObjectFactory::getInstanceByObjId((int) $new_id, false);
131 } else {
132 $newObj = new ilObjIndividualAssessment();
133 $newObj->create();
134 }
135
136 $newObj->setTitle($a_rec["title"]);
137 $newObj->setDescription($a_rec["description"]);
138
139 $settings = new ilIndividualAssessmentSettings(
140 $newObj->getId(),
141 $newObj->getTitle(),
142 $newObj->getDescription(),
143 $a_rec["content"],
144 $a_rec["recordTemplate"],
145 $a_rec['eventTimePlaceRequired'] == 1,
146 $a_rec['file_required'] == 1
147 );
148
150 $newObj->getId(),
151 $a_rec['contact'],
152 $a_rec['responsibility'],
153 $a_rec['phone'],
154 $a_rec['mails'],
155 $a_rec['consultation_hours']
156 );
157
158 $newObj->setSettings($settings);
159 $newObj->setInfoSettings($info);
160 $newObj->update();
161 $newObj->updateInfo();
162 $a_mapping->addMapping("components/ILIAS/IndividualAssessment", "iass", $a_rec["id"], (string) $newObj->getId());
163 }
164 }
165}
A dataset contains in data in a common structure that can be shared and transformed for different pur...
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
Individual Assessment dataset class.
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
Return dependencies form entities to other entities (in our case these are all the DB relations)
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
Import record.
getTypes(string $a_entity, string $a_version)
Map XML attributes of entities to data types (text, integer...)
_readData(string $entity, array $ids)
Build data array, data is read from cache except iass object itself.
readData(string $a_entity, string $a_version, array $a_ids)
Read data from Cache for a given entity and ID(s)
getXmlNamespace(string $a_entity, string $a_schema_version)
An object carrying settings of an Individual Assessment obj beyond the standard information.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType(int $id, bool $reference=false)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$info
Definition: entry_point.php:21
if(!file_exists('../ilias.ini.php'))