ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSurveyDataSet.php
Go to the documentation of this file.
1<?php
2
32{
33 public function getSupportedVersions(): array
34 {
35 return array("5.1.0");
36 }
37
38 protected function getXmlNamespace(string $a_entity, string $a_schema_version): string
39 {
40 return "https://www.ilias.de/xml/Modules/Survey/" . $a_entity;
41 }
42
46 protected function getTypes(string $a_entity, string $a_version): array
47 {
48 if ($a_entity === "svy_quest_skill") {
49 switch ($a_version) {
50 case "5.1.0":
51 return array(
52 "QId" => "integer",
53 "SurveyId" => "integer",
54 "BaseSkillId" => "integer",
55 "TrefId" => "integer"
56 );
57 }
58 }
59 if ($a_entity === "svy_skill_threshold") {
60 switch ($a_version) {
61 case "5.1.0":
62 return array(
63 "SurveyId" => "integer",
64 "BaseSkillId" => "integer",
65 "TrefId" => "integer",
66 "LevelId" => "integer",
67 "Treshold" => "integer"
68 );
69 }
70 }
71 return array();
72 }
73
74 public function readData(string $a_entity, string $a_version, array $a_ids): void
75 {
77
78 $this->data = array();
79
80 if ($a_entity === "svy_quest_skill") {
81 switch ($a_version) {
82 case "5.1.0":
83 $this->getDirectDataFromQuery("SELECT * " .
84 " FROM svy_quest_skill WHERE " .
85 $ilDB->in("survey_id", $a_ids, false, "integer"));
86 break;
87 }
88 }
89
90 if ($a_entity === "svy_skill_threshold") {
91 switch ($a_version) {
92 case "5.1.0":
93 $this->getDirectDataFromQuery("SELECT * " .
94 " FROM svy_skill_threshold WHERE " .
95 $ilDB->in("survey_id", $a_ids, false, "integer"));
96 break;
97 }
98 }
99 }
100
104 protected function getDependencies(
105 string $a_entity,
106 string $a_version,
107 ?array $a_rec = null,
108 ?array $a_ids = null
109 ): array {
110 $ilDB = $this->db;
111
112 /*switch ($a_entity)
113 {
114 case "svy_quest_skill":
115 $deps["svy_skill_treshold"]["ids"][] = $a_ids;
116 return $deps;
117 }*/
118
119 return [];
120 }
121
122 public function importRecord(
123 string $a_entity,
124 array $a_types,
125 array $a_rec,
126 ilImportMapping $a_mapping,
127 string $a_schema_version
128 ): void {
129 $a_rec = $this->stripTags($a_rec);
130 switch ($a_entity) {
131 case "svy_quest_skill":
132 $skill_data = ilBasicSkill::getCommonSkillIdForImportId($this->getCurrentInstallationId(), $a_rec["BaseSkillId"], $a_rec["TrefId"]);
133 $q_id = $a_mapping->getMapping("components/ILIAS/Survey", "svy_q", $a_rec["QId"]);
134 if ($q_id > 0 && count($skill_data) > 0) {
135 $skill_survey = new ilSurveySkill($this->getImport()->getSurvey());
136 $skill_survey->addQuestionSkillAssignment($q_id, $skill_data[0]["skill_id"], $skill_data[0]["tref_id"]);
137 }
138 break;
139
140 case "svy_skill_threshold":
141 $l = ilBasicSkill::getLevelIdForImportIdMatchSkill($this->getCurrentInstallationId(), $a_rec["LevelId"], $a_rec["BaseSkillId"], $a_rec["TrefId"]);
142 if (count($l) > 0) {
143 $skill_thres = new ilSurveySkillThresholds($this->getImport()->getSurvey());
144 $skill_thres->writeThreshold($l[0]["skill_id"], $l[0]["tref_id"], $l[0]["level_id"], $a_rec["Threshold"]);
145 }
146 break;
147 }
148 }
149}
static getLevelIdForImportIdMatchSkill(int $a_source_inst_id, int $a_level_import_id, int $a_skill_import_id, int $a_tref_import_id=0)
static getCommonSkillIdForImportId(int $a_source_inst_id, int $a_skill_import_id, int $a_tref_import_id=0)
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
ilDBInterface $db
getMapping(string $a_comp, string $a_entity, string $a_old_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getXmlNamespace(string $a_entity, string $a_schema_version)
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
Determine the dependent sets of data.
readData(string $a_entity, string $a_version, array $a_ids)
Read data from DB.
getTypes(string $a_entity, string $a_version)
Get field types for entity.
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
Needs to be overwritten for import use case.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...