ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSurveyDataSet.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
19{
25 public function getSupportedVersions()
26 {
27 return array("5.1.0");
28 }
29
36 public function getXmlNamespace($a_entity, $a_schema_version)
37 {
38 return "http://www.ilias.de/xml/Modules/Survey/" . $a_entity;
39 }
40
48 protected function getTypes($a_entity, $a_version)
49 {
50 if ($a_entity == "svy_quest_skill") {
51 switch ($a_version) {
52 case "5.1.0":
53 return array(
54 "QId" => "integer",
55 "SurveyId" => "integer",
56 "BaseSkillId" => "integer",
57 "TrefId" => "integer"
58 );
59 }
60 }
61 if ($a_entity == "svy_skill_threshold") {
62 switch ($a_version) {
63 case "5.1.0":
64 return array(
65 "SurveyId" => "integer",
66 "BaseSkillId" => "integer",
67 "TrefId" => "integer",
68 "LevelId" => "integer",
69 "Treshold" => "integer"
70 );
71 }
72 }
73 return array();
74 }
75
84 public function readData($a_entity, $a_version, $a_ids, $a_field = "")
85 {
87
88 $this->data = array();
89
90 if (!is_array($a_ids)) {
91 $a_ids = array($a_ids);
92 }
93
94 if ($a_entity == "svy_quest_skill") {
95 switch ($a_version) {
96 case "5.1.0":
97 $this->getDirectDataFromQuery("SELECT * " .
98 " FROM svy_quest_skill WHERE " .
99 $ilDB->in("survey_id", $a_ids, false, "integer"));
100 break;
101
102 }
103 }
104
105 if ($a_entity == "svy_skill_threshold") {
106 switch ($a_version) {
107 case "5.1.0":
108 $this->getDirectDataFromQuery("SELECT * " .
109 " FROM svy_skill_threshold WHERE " .
110 $ilDB->in("survey_id", $a_ids, false, "integer"));
111 break;
112
113 }
114 }
115 }
116
120 protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids)
121 {
123
124 /*switch ($a_entity)
125 {
126 case "svy_quest_skill":
127 $deps["svy_skill_treshold"]["ids"][] = $a_ids;
128 return $deps;
129 }*/
130
131 return false;
132 }
133
134
141 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
142 {
143 $a_rec = $this->stripTags($a_rec);
144 switch ($a_entity) {
145 case "svy_quest_skill":
146 $skill_data = ilBasicSkill::getCommonSkillIdForImportId($this->getCurrentInstallationId(), $a_rec["BaseSkillId"], $a_rec["TrefId"]);
147 $q_id = $a_mapping->getMapping("Modules/Survey", "svy_q", $a_rec["QId"]);
148 if ($q_id > 0 && count($skill_data) > 0) {
149 $skill_survey = new ilSurveySkill($this->getImport()->getSurvey());
150 $skill_survey->addQuestionSkillAssignment($q_id, $skill_data[0]["skill_id"], $skill_data[0]["tref_id"]);
151 }
152 break;
153
154 case "svy_skill_threshold":
155 $l = ilBasicSkill::getLevelIdForImportIdMatchSkill($this->getCurrentInstallationId(), $a_rec["LevelId"], $a_rec["BaseSkillId"], $a_rec["TrefId"]);
156 if (count($l) > 0) {
157 $skill_thres = new ilSurveySkillThresholds($this->getImport()->getSurvey());
158 $skill_thres->writeThreshold($l[0]["skill_id"], $l[0]["tref_id"], $l[0]["level_id"], $a_rec["Threshold"]);
159 }
160 break;
161 }
162 }
163}
An exception for terminatinating execution or to throw for unit testing.
static getLevelIdForImportIdMatchSkill(int $a_source_inst_id, int $a_level_import_id, int $a_skill_import_id, int $a_tref_import_id=0)
Get level ids for import Ids matching common skills.
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...
stripTags(array $rec, array $omit_keys=[])
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