ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSurveyDataSet Class Reference

Survey Data set class. More...

+ Inheritance diagram for ilSurveyDataSet:
+ Collaboration diagram for ilSurveyDataSet:

Public Member Functions

 getSupportedVersions ()
 Get supported versions. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data. More...
 
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 Import record. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 Constructor. More...
 
 init ($a_entity, $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 Get supported version. More...
 
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB. More...
 
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix. More...
 
 getDSPrefix ()
 Get XML dataset namespace prefix. More...
 
 getDSPrefixString ()
 
 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 fields. More...
 
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getJsonRepresentation ()
 Get json representation. More...
 
 getXmlRepresentation ($a_entity, $a_schema_version, $a_ids, $a_field="", $a_omit_header=false, $a_omit_types=false)
 Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" version="4.0.1"> <ftype name="field_1" type="text"> <ftype name="field_2" type="date"> <ftype name="field_3" type="integer"> </types> <types ...> ... More...
 
 addRecordsXml ($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
 Add records xml. More...
 
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record. More...
 
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version. More...
 
 getJsonRecord ($a_set)
 Get json record for version. More...
 
 getXmlTypes ($a_entity, $a_version)
 Get xml types. More...
 
 getJsonTypes ($a_entity, $a_version)
 Get json types. More...
 
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag ($a_entity, $a_schema_version)
 Get entity tag. More...
 
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten) More...
 
 setImport ($a_val)
 Set import object. More...
 
 getImport ()
 Get import object. More...
 
 setCurrentInstallationId ($a_val)
 Set current installation id. More...
 
 getCurrentInstallationId ()
 Get current installation id. More...
 

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity. More...
 
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Determine the dependent sets of data. More...
 
- Protected Member Functions inherited from ilDataSet
 getTypes ($a_entity, $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 createObjectExportId ($a_type, $a_id)
 Build ilias export id. More...
 
 parseObjectExportId ($a_id, $a_fallback_id=NULL)
 Parse export id. More...
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
 $dircnt
 
const EXPORT_NO_INST_ID = 1
 
const EXPORT_ID_ILIAS_LOCAL = 2
 
const EXPORT_ID_ILIAS_LOCAL_INVALID = 3
 
const EXPORT_ID_ILIAS_REMOTE = 4
 
const EXPORT_ID_ILIAS_REMOTE_INVALID = 5
 
const EXPORT_ID = 6
 
const EXPORT_ID_INVALID = 7
 
- Protected Attributes inherited from ilDataSet
 $current_installation_id = ""
 

Detailed Description

Survey Data set class.

Currently most of the survey export is still done "old school".

The dataset part implements mostly the 360 extension:

  • svy_quest_skill: question to skill assignment
  • svy_skill_threshold: skill threshold values
Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 20 of file class.ilSurveyDataSet.php.

Member Function Documentation

◆ getDependencies()

ilSurveyDataSet::getDependencies (   $a_entity,
  $a_version,
  $a_rec,
  $a_ids 
)
protected

Determine the dependent sets of data.

Definition at line 132 of file class.ilSurveyDataSet.php.

References $ilDB.

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  }
global $ilDB

◆ getSupportedVersions()

ilSurveyDataSet::getSupportedVersions ( )

Get supported versions.

Returns
array of version strings

Definition at line 27 of file class.ilSurveyDataSet.php.

References array.

28  {
29  return array("5.1.0");
30  }
Create styles array
The data for the language used.

◆ getTypes()

ilSurveyDataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters
string$a_entityentity
string$a_versionversion
Returns
array

Definition at line 50 of file class.ilSurveyDataSet.php.

References array.

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  }
Create styles array
The data for the language used.

◆ getXmlNamespace()

ilSurveyDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

Definition at line 38 of file class.ilSurveyDataSet.php.

39  {
40  return "http://www.ilias.de/xml/Modules/Survey/".$a_entity;
41  }

◆ importRecord()

ilSurveyDataSet::importRecord (   $a_entity,
  $a_types,
  $a_rec,
  $a_mapping,
  $a_schema_version 
)

Import record.

Parameters

Definition at line 153 of file class.ilSurveyDataSet.php.

References $l, ilBasicSkill\getCommonSkillIdForImportId(), ilDataSet\getCurrentInstallationId(), ilDataSet\getImport(), and ilBasicSkill\getLevelIdForImportIdMatchSkill().

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  }
getImport()
Get import object.
Skill/Competence handling in surveys.
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.
getCurrentInstallationId()
Get current installation id.
global $l
Definition: afr.php:30
static getCommonSkillIdForImportId($a_source_inst_id, $a_skill_import_id, $a_tref_import_id=0)
Get common skill ids for import IDs (newest first)
+ Here is the call graph for this function:

◆ readData()

ilSurveyDataSet::readData (   $a_entity,
  $a_version,
  $a_ids,
  $a_field = "" 
)

Read data.

Parameters
string$a_entityentity
string$a_versionversion
array$a_idsids
string$a_fieldfield

Definition at line 90 of file class.ilSurveyDataSet.php.

References $ilDB, array, data, and ilDataSet\getDirectDataFromQuery().

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  }
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 ...
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: