ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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  {
66  $ilDB = $this->db;
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('Services/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 }
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTypes(string $a_entity, string $a_version)
readData(string $a_entity, string $a_version, array $a_ids)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
ilDBInterface $db
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 ...
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)
stripTags(array $rec, array $omit_keys=[])
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...