ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 = ""
 
 $db
 
 $ds_log
 

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

References ilDataSet\$db, and $ilDB.

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  }
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  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  }
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 143 of file class.ilSurveyDataSet.php.

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

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  }
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 86 of file class.ilSurveyDataSet.php.

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

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  }
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: