ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
4 include_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  {
88  $ilDB = $this->db;
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  {
124  $ilDB = $this->db;
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 }
Add some data
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 ...
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
getImport()
Get import object.
Skill/Competence handling in surveys.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
Skill tresholds for 360 surveys.
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.
Survey Data set class.
getCurrentInstallationId()
Get current installation id.
Create styles array
The data for the language used.
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
getSupportedVersions()
Get supported versions.
global $l
Definition: afr.php:30
getTypes($a_entity, $a_version)
Get field types for entity.
global $ilDB
A dataset contains in data in a common structure that can be shared and transformed for different pur...
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
static getCommonSkillIdForImportId($a_source_inst_id, $a_skill_import_id, $a_tref_import_id=0)
Get common skill ids for import IDs (newest first)