ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilRatingDataSet.php
Go to the documentation of this file.
1<?php
2
28{
29 public function getSupportedVersions(): array
30 {
31 return array("4.3.0");
32 }
33
37 protected function getXmlNamespace(string $a_entity, string $a_schema_version): string
38 {
39 return "https://www.ilias.de/xml/Services/Rating/" . $a_entity;
40 }
41
45 protected function getTypes(string $a_entity, string $a_version): array
46 {
47 if ($a_entity == "rating_category") {
48 switch ($a_version) {
49 case "4.3.0":
50 return array(
51 "Id" => "integer",
52 "ParentId" => "integer",
53 "Title" => "text",
54 "Description" => "text",
55 "Pos" => "integer");
56 }
57 }
58 return [];
59 }
60
64 public function readData(string $a_entity, string $a_version, array $a_ids): void
65 {
67
68 if (!is_array($a_ids)) {
69 $a_ids = array($a_ids);
70 }
71
72 if ($a_entity == "rating_category") {
73 switch ($a_version) {
74 case "4.3.0":
75 $this->getDirectDataFromQuery("SELECT id, parent_id, title," .
76 " description, pos" .
77 " FROM il_rating_cat" .
78 " WHERE " . $ilDB->in("parent_id", $a_ids, false, "integer"));
79 break;
80 }
81 }
82 }
83
84 protected function getDependencies(
85 string $a_entity,
86 string $a_version,
87 ?array $a_rec = null,
88 ?array $a_ids = null
89 ): array {
90 return [];
91 }
92
93 public function importRecord(
94 string $a_entity,
95 array $a_types,
96 array $a_rec,
97 ilImportMapping $a_mapping,
98 string $a_schema_version
99 ): void {
100 $a_rec = $this->stripTags($a_rec);
101 switch ($a_entity) {
102 case "rating_category":
103 if ($parent_id = $a_mapping->getMapping('components/ILIAS/Rating', 'rating_category_parent_id', $a_rec['ParentId'])) {
104 $newObj = new ilRatingCategory();
105 $newObj->setParentId($parent_id);
106 $newObj->save();
107
108 $newObj->setTitle($a_rec["Title"]);
109 $newObj->setDescription($a_rec["Description"]);
110 $newObj->setPosition($a_rec["Pos"]);
111 $newObj->update();
112 }
113 break;
114 }
115 }
116}
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
ilDBInterface $db
getMapping(string $a_comp, string $a_entity, string $a_old_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getXmlNamespace(string $a_entity, string $a_schema_version)
@inheritDoc
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
getTypes(string $a_entity, string $a_version)
@inheritDoc
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
Needs to be overwritten for import use case.
readData(string $a_entity, string $a_version, array $a_ids)
@inheritDoc
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...