ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMediaCastDataSet.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 
14 {
21  public function getSupportedVersions($a_entity)
22  {
23  switch ($a_entity)
24  {
25  case "mcst":
26  return array("4.1.0");
27  }
28  }
29 
36  function getXmlNamespace($a_entity, $a_target_release)
37  {
38  return "http://www.ilias.de/xml/Modules/MediaCast/".$a_entity;
39  }
40 
47  protected function getTypes($a_entity, $a_version)
48  {
49  if ($a_entity == "mcst")
50  {
51  switch ($a_version)
52  {
53  case "4.1.0":
54  return array(
55  "Id" => "integer",
56  "Title" => "text",
57  "Description" => "text",
58  "PublicFiles" => "integer",
59  "Downloadable" => "integer",
60  "DefaultAccess" => "integer");
61  }
62  }
63 
64  }
65 
72  function readData($a_entity, $a_version, $a_ids, $a_field = "")
73  {
74  global $ilDB;
75 
76  if (!is_array($a_ids))
77  {
78  $a_ids = array($a_ids);
79  }
80 
81  if ($a_entity == "mcst")
82  {
83  switch ($a_version)
84  {
85  case "4.1.0":
86  $this->getDirectDataFromQuery("SELECT id, title, description, ".
87  " public_files, downloadable, def_access default_access".
88  " FROM il_media_cast_data JOIN object_data ON (il_media_cast_data.id = object_data.obj_id) ".
89  "WHERE ".
90  $ilDB->in("id", $a_ids, false, "integer"));
91  break;
92  }
93  }
94 
95  }
96 
100  protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids)
101  {
102  return false;
103  }
104 
105 
112  function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
113  {
114 //echo $a_entity;
115 //var_dump($a_rec);
116 
117  switch ($a_entity)
118  {
119  case "mcst":
120  include_once("./Modules/MediaCast/classes/class.ilObjMediaCast.php");
121 
122  if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id']))
123  {
124  $newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
125  }
126  else
127  {
128  $newObj = new ilObjMediaCast();
129  $newObj->setType("mcst");
130  $newObj->create(true);
131  }
132 
133  $newObj->setTitle($a_rec["Title"]);
134  $newObj->setDescription($a_rec["Description"]);
135  $newObj->setDefaultAccess($a_rec["DefaultAccess"]);
136  $newObj->setDownloadable($a_rec["Downloadable"]);
137  $newObj->setPublicFiles($a_rec["PublicFiles"]);
138  $newObj->update(true);
139  $this->current_obj = $newObj;
140  $a_mapping->addMapping("Modules/MediaCast", "mcst", $a_rec["Id"], $newObj->getId());
141  $a_mapping->addMapping("Services/News", "news_context",
142  $a_rec["Id"].":mcst:0:",
143  $newObj->getId().":mcst:0:");
144 //var_dump($a_mapping->mappings["Services/News"]["news_context"]);
145  break;
146  }
147  }
148 }
149 ?>