ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
4 include_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 ?>