ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 public 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 switch ($a_version) {
54 case "5.1.0":
55 return array(
56 "QId" => "integer",
57 "SurveyId" => "integer",
58 "BaseSkillId" => "integer",
59 "TrefId" => "integer"
60 );
61 }
62 }
63 if ($a_entity == "svy_skill_threshold") {
64 switch ($a_version) {
65 case "5.1.0":
66 return array(
67 "SurveyId" => "integer",
68 "BaseSkillId" => "integer",
69 "TrefId" => "integer",
70 "LevelId" => "integer",
71 "Treshold" => "integer"
72 );
73 }
74 }
75 return array();
76 }
77
86 public function readData($a_entity, $a_version, $a_ids, $a_field = "")
87 {
89
90 $this->data = array();
91
92 if (!is_array($a_ids)) {
93 $a_ids = array($a_ids);
94 }
95
96 if ($a_entity == "svy_quest_skill") {
97 switch ($a_version) {
98 case "5.1.0":
99 $this->getDirectDataFromQuery("SELECT * " .
100 " FROM svy_quest_skill WHERE " .
101 $ilDB->in("survey_id", $a_ids, false, "integer"));
102 break;
103
104 }
105 }
106
107 if ($a_entity == "svy_skill_threshold") {
108 switch ($a_version) {
109 case "5.1.0":
110 $this->getDirectDataFromQuery("SELECT * " .
111 " FROM svy_skill_threshold WHERE " .
112 $ilDB->in("survey_id", $a_ids, false, "integer"));
113 break;
114
115 }
116 }
117 }
118
122 protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids)
123 {
125
126 /*switch ($a_entity)
127 {
128 case "svy_quest_skill":
129 $deps["svy_skill_treshold"]["ids"][] = $a_ids;
130 return $deps;
131 }*/
132
133 return false;
134 }
135
136
143 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
144 {
145 switch ($a_entity) {
146 case "svy_quest_skill":
147 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
148 $skill_data = ilBasicSkill::getCommonSkillIdForImportId($this->getCurrentInstallationId(), $a_rec["BaseSkillId"], $a_rec["TrefId"]);
149 $q_id = $a_mapping->getMapping("Modules/Survey", "svy_q", $a_rec["QId"]);
150 if ($q_id > 0 && count($skill_data) > 0) {
151 include_once("./Modules/Survey/classes/class.ilSurveySkill.php");
152 $skill_survey = new ilSurveySkill($this->getImport()->getSurvey());
153 $skill_survey->addQuestionSkillAssignment($q_id, $skill_data[0]["skill_id"], $skill_data[0]["tref_id"]);
154 }
155 break;
156
157 case "svy_skill_threshold":
158 $l = ilBasicSkill::getLevelIdForImportIdMatchSkill($this->getCurrentInstallationId(), $a_rec["LevelId"], $a_rec["BaseSkillId"], $a_rec["TrefId"]);
159 if (count($l) > 0) {
160 include_once("./Modules/Survey/classes/class.ilSurveySkillThresholds.php");
161 $skill_thres = new ilSurveySkillThresholds($this->getImport()->getSurvey());
162 //echo "<br>".$l[0]["skill_id"]."-".$l[0]["tref_id"]."-".$l[0]["level_id"]."-".$a_rec["Threshold"]."-".$sid."-"; exit;
163 $skill_thres->writeThreshold($l[0]["skill_id"], $l[0]["tref_id"], $l[0]["level_id"], $a_rec["Threshold"]);
164 }
165 break;
166 }
167 }
168}
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
$this data['403_header']