ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 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 {
50 switch ($a_version)
51 {
52 case "4.3.0":
53 return array(
54 "Id" => "integer",
55 "ParentId" => "integer",
56 "Title" => "text",
57 "Description" => "text",
58 "Pos" => "integer");
59 }
60 }
61 }
62
69 function readData($a_entity, $a_version, $a_ids, $a_field = "")
70 {
71 global $ilDB;
72
73 if (!is_array($a_ids))
74 {
75 $a_ids = array($a_ids);
76 }
77
78 if ($a_entity == "rating_category")
79 {
80 switch ($a_version)
81 {
82 case "4.3.0":
83 $this->getDirectDataFromQuery("SELECT id, parent_id, title,".
84 " description, pos".
85 " FROM il_rating_cat".
86 " WHERE ".$ilDB->in("parent_id", $a_ids, false, "integer"));
87 break;
88 }
89 }
90 }
91
95 protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids)
96 {
97 return false;
98 }
99
106 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
107 {
108//echo $a_entity;
109//var_dump($a_rec);
110
111 switch ($a_entity)
112 {
113 case "rating_category":
114 if($parent_id = $a_mapping->getMapping('Services/Rating', 'rating_category_parent_id', $a_rec['ParentId']))
115 {
116 include_once("./Services/Rating/classes/class.ilRatingCategory.php");
117 $newObj = new ilRatingCategory();
118 $newObj->setParentId($parent_id);
119 $newObj->save();
120
121 $newObj->setTitle($a_rec["Title"]);
122 $newObj->setDescription($a_rec["Description"]);
123 $newObj->setPosition($a_rec["Pos"]);
124 $newObj->update();
125 }
126 break;
127 }
128 }
129}
130?>
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)
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