ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilSurveyDataSet.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/DataSet/classes/class.ilDataSet.php");
5
21{
27 public function getSupportedVersions()
28 {
29 return array("5.1.0");
30 }
31
38 function getXmlNamespace($a_entity, $a_schema_version)
39 {
40 return "http://www.ilias.de/xml/Modules/Survey/".$a_entity;
41 }
42
50 protected function getTypes($a_entity, $a_version)
51 {
52 if ($a_entity == "svy_quest_skill")
53 {
54 switch ($a_version)
55 {
56 case "5.1.0":
57 return array(
58 "QId" => "integer",
59 "SurveyId" => "integer",
60 "BaseSkillId" => "integer",
61 "TrefId" => "integer"
62 );
63 }
64 }
65 if ($a_entity == "svy_skill_threshold")
66 {
67 switch ($a_version)
68 {
69 case "5.1.0":
70 return array(
71 "SurveyId" => "integer",
72 "BaseSkillId" => "integer",
73 "TrefId" => "integer",
74 "LevelId" => "integer",
75 "Treshold" => "integer"
76 );
77 }
78 }
79 return array();
80 }
81
90 function readData($a_entity, $a_version, $a_ids, $a_field = "")
91 {
92 global $ilDB;
93
94 $this->data = array();
95
96 if (!is_array($a_ids))
97 {
98 $a_ids = array($a_ids);
99 }
100
101 if ($a_entity == "svy_quest_skill")
102 {
103 switch ($a_version)
104 {
105 case "5.1.0":
106 $this->getDirectDataFromQuery("SELECT * ".
107 " FROM svy_quest_skill WHERE ".
108 $ilDB->in("survey_id", $a_ids, false, "integer"));
109 break;
110
111 }
112 }
113
114 if ($a_entity == "svy_skill_threshold")
115 {
116 switch ($a_version)
117 {
118 case "5.1.0":
119 $this->getDirectDataFromQuery("SELECT * ".
120 " FROM svy_skill_threshold WHERE ".
121 $ilDB->in("survey_id", $a_ids, false, "integer"));
122 break;
123
124 }
125 }
126
127 }
128
132 protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids)
133 {
134 global $ilDB;
135
136 /*switch ($a_entity)
137 {
138 case "svy_quest_skill":
139 $deps["svy_skill_treshold"]["ids"][] = $a_ids;
140 return $deps;
141 }*/
142
143 return false;
144 }
145
146
153 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
154 {
155 switch ($a_entity)
156 {
157 case "svy_quest_skill":
158 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
159 $skill_data = ilBasicSkill::getCommonSkillIdForImportId($this->getCurrentInstallationId(), $a_rec["BaseSkillId"], $a_rec["TrefId"]);
160 $q_id = $a_mapping->getMapping("Modules/Survey", "svy_q", $a_rec["QId"]);
161 if ($q_id > 0 && count($skill_data) > 0)
162 {
163 include_once("./Modules/Survey/classes/class.ilSurveySkill.php");
164 $skill_survey = new ilSurveySkill($this->getImport()->getSurvey());
165 $skill_survey->addQuestionSkillAssignment($q_id, $skill_data[0]["skill_id"], $skill_data[0]["tref_id"]);
166 }
167 break;
168
169 case "svy_skill_threshold":
170 $l = ilBasicSkill::getLevelIdForImportIdMatchSkill($this->getCurrentInstallationId(), $a_rec["LevelId"], $a_rec["BaseSkillId"], $a_rec["TrefId"]);
171 if (count($l) > 0)
172 {
173 include_once("./Modules/Survey/classes/class.ilSurveySkillThresholds.php");
174 $skill_thres = new ilSurveySkillThresholds($this->getImport()->getSurvey());
175 //echo "<br>".$l[0]["skill_id"]."-".$l[0]["tref_id"]."-".$l[0]["level_id"]."-".$a_rec["Threshold"]."-".$sid."-"; exit;
176 $skill_thres->writeThreshold($l[0]["skill_id"], $l[0]["tref_id"], $l[0]["level_id"], $a_rec["Threshold"]);
177 }
178 break;
179 }
180 }
181}
182?>
global $l
Definition: afr.php:30
An exception for terminatinating execution or to throw for unit testing.
static getCommonSkillIdForImportId($a_source_inst_id, $a_skill_import_id, $a_tref_import_id=0)
Get common skill ids for import IDs (newest first)
static getLevelIdForImportIdMatchSkill($a_source_inst_id, $a_level_import_id, $a_skill_import_id, $a_tref_import_id=0)
Get level ids for import Ids matching common skills.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getImport()
Get import object.
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
getCurrentInstallationId()
Get current installation id.
Survey Data set class.
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
getTypes($a_entity, $a_version)
Get field types for entity.
getSupportedVersions()
Get supported versions.
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
Skill tresholds for 360 surveys.
Skill/Competence handling in surveys.
global $ilDB