ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilRatingDataSet.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
17{
24 public function getSupportedVersions()
25 {
26 return array("4.3.0");
27 }
28
35 public function getXmlNamespace($a_entity, $a_schema_version)
36 {
37 return "http://www.ilias.de/xml/Services/Rating/" . $a_entity;
38 }
39
46 protected function getTypes($a_entity, $a_version)
47 {
48 if ($a_entity == "rating_category") {
49 switch ($a_version) {
50 case "4.3.0":
51 return array(
52 "Id" => "integer",
53 "ParentId" => "integer",
54 "Title" => "text",
55 "Description" => "text",
56 "Pos" => "integer");
57 }
58 }
59 }
60
67 public function readData($a_entity, $a_version, $a_ids, $a_field = "")
68 {
70
71 if (!is_array($a_ids)) {
72 $a_ids = array($a_ids);
73 }
74
75 if ($a_entity == "rating_category") {
76 switch ($a_version) {
77 case "4.3.0":
78 $this->getDirectDataFromQuery("SELECT id, parent_id, title," .
79 " description, pos" .
80 " FROM il_rating_cat" .
81 " WHERE " . $ilDB->in("parent_id", $a_ids, false, "integer"));
82 break;
83 }
84 }
85 }
86
90 protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids)
91 {
92 return false;
93 }
94
101 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
102 {
103 //echo $a_entity;
104 //var_dump($a_rec);
105
106 switch ($a_entity) {
107 case "rating_category":
108 if ($parent_id = $a_mapping->getMapping('Services/Rating', 'rating_category_parent_id', $a_rec['ParentId'])) {
109 include_once("./Services/Rating/classes/class.ilRatingCategory.php");
110 $newObj = new ilRatingCategory();
111 $newObj->setParentId($parent_id);
112 $newObj->save();
113
114 $newObj->setTitle($a_rec["Title"]);
115 $newObj->setDescription($a_rec["Description"]);
116 $newObj->setPosition($a_rec["Pos"]);
117 $newObj->update();
118 }
119 break;
120 }
121 }
122}
An exception for terminatinating execution or to throw for unit testing.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
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 ...
Class ilRatingCategory.
Rating Data set class.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
getSupportedVersions()
Get supported versions.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
getTypes($a_entity, $a_version)
Get field types for entity.
global $ilDB