ILIAS  Release_4_4_x_branch Revision 61816
 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()
22  {
23  return array("4.1.0");
24  }
25 
32  function getXmlNamespace($a_entity, $a_schema_version)
33  {
34  return "http://www.ilias.de/xml/Modules/MediaCast/".$a_entity;
35  }
36 
43  protected function getTypes($a_entity, $a_version)
44  {
45  if ($a_entity == "mcst")
46  {
47  switch ($a_version)
48  {
49  case "4.1.0":
50  return array(
51  "Id" => "integer",
52  "Title" => "text",
53  "Description" => "text",
54  "PublicFiles" => "integer",
55  "Downloadable" => "integer",
56  "DefaultAccess" => "integer");
57  }
58  }
59 
60  }
61 
68  function readData($a_entity, $a_version, $a_ids, $a_field = "")
69  {
70  global $ilDB;
71 
72  if (!is_array($a_ids))
73  {
74  $a_ids = array($a_ids);
75  }
76 
77  if ($a_entity == "mcst")
78  {
79  switch ($a_version)
80  {
81  case "4.1.0":
82  $this->getDirectDataFromQuery("SELECT id, title, description, ".
83  " public_files, downloadable, def_access default_access".
84  " FROM il_media_cast_data JOIN object_data ON (il_media_cast_data.id = object_data.obj_id) ".
85  "WHERE ".
86  $ilDB->in("id", $a_ids, false, "integer"));
87  break;
88  }
89  }
90 
91  }
92 
96  protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids)
97  {
98  return false;
99  }
100 
101 
108  function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
109  {
110 //echo $a_entity;
111 //var_dump($a_rec);
112 
113  switch ($a_entity)
114  {
115  case "mcst":
116  include_once("./Modules/MediaCast/classes/class.ilObjMediaCast.php");
117 
118  if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id']))
119  {
120  $newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
121  }
122  else
123  {
124  $newObj = new ilObjMediaCast();
125  $newObj->setType("mcst");
126  $newObj->create(true);
127  }
128 
129  $newObj->setTitle($a_rec["Title"]);
130  $newObj->setDescription($a_rec["Description"]);
131  $newObj->setDefaultAccess($a_rec["DefaultAccess"]);
132  $newObj->setDownloadable($a_rec["Downloadable"]);
133  $newObj->setPublicFiles($a_rec["PublicFiles"]);
134  $newObj->update(true);
135  $this->current_obj = $newObj;
136  $a_mapping->addMapping("Modules/MediaCast", "mcst", $a_rec["Id"], $newObj->getId());
137  $a_mapping->addMapping("Services/News", "news_context",
138  $a_rec["Id"].":mcst:0:",
139  $newObj->getId().":mcst:0:");
140 //var_dump($a_mapping->mappings["Services/News"]["news_context"]);
141  break;
142  }
143  }
144 }
145 ?>