ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
 stripTags (array $rec, array $omit_keys=[])
 

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 = ""
 
 $db
 
 $ds_log
 
 $ds_namespace = 'ds'
 

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

Definition at line 18 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 120 of file class.ilSurveyDataSet.php.

References ilDataSet\$db, and $ilDB.

121  {
122  $ilDB = $this->db;
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  }
global $ilDB

◆ getSupportedVersions()

ilSurveyDataSet::getSupportedVersions ( )

Get supported versions.

Returns
array of version strings

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

26  {
27  return array("5.1.0");
28  }

◆ 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 48 of file class.ilSurveyDataSet.php.

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  }

◆ getXmlNamespace()

ilSurveyDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

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

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

◆ importRecord()

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

Import record.

Parameters

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

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

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  }
static getCommonSkillIdForImportId(int $a_source_inst_id, int $a_skill_import_id, int $a_tref_import_id=0)
getImport()
Get import object.
Skill/Competence handling in surveys.
Skill tresholds for 360 surveys.
getCurrentInstallationId()
Get current installation id.
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.
stripTags(array $rec, array $omit_keys=[])
+ 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 84 of file class.ilSurveyDataSet.php.

References ilDataSet\$db, $ilDB, and ilDataSet\getDirectDataFromQuery().

85  {
86  $ilDB = $this->db;
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  }
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 ...
global $ilDB
+ Here is the call graph for this function:

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