ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilExternalFeedDataSet.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_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/ExternalFeed/".$a_entity;
35 }
36
43 protected function getTypes($a_entity, $a_version)
44 {
45 if ($a_entity == "feed")
46 {
47 switch ($a_version)
48 {
49 case "4.1.0":
50 return array(
51 "Id" => "integer",
52 "Title" => "text",
53 "Url" => "text");
54 }
55 }
56
57 }
58
65 function readData($a_entity, $a_version, $a_ids, $a_field = "")
66 {
67 global $ilDB;
68
69 if (!is_array($a_ids))
70 {
71 $a_ids = array($a_ids);
72 }
73
74 if ($a_entity == "feed")
75 {
76 switch ($a_version)
77 {
78 case "4.1.0":
79 $this->getDirectDataFromQuery("SELECT obj_id id, title, description url ".
80 " FROM object_data ".
81 "WHERE ".
82 $ilDB->in("obj_id", $a_ids, false, "integer"));
83 break;
84 }
85 }
86
87 }
88
92 protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids)
93 {
94 return false;
95 }
96
97
104 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
105 {
106//echo $a_entity;
107//var_dump($a_rec);
108
109 switch ($a_entity)
110 {
111 case "feed":
112
113 include_once("./Modules/ExternalFeed/classes/class.ilObjExternalFeed.php");
114
115 if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id']))
116 {
117 $newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
118 }
119 else
120 {
121 $newObj = new ilObjExternalFeed();
122 $newObj->setType("feed");
123 $newObj->create(true);
124 }
125
126 $newObj->setTitle($a_rec["Title"]);
127 $newObj->setDescription($a_rec["Url"]);
128 $newObj->update();
129 $this->current_obj = $newObj;
130 $a_mapping->addMapping("Modules/ExternalFeed", "feed", $a_rec["Id"], $newObj->getId());
131
132 // create the feed block
133 include_once("./Services/Block/classes/class.ilExternalFeedBlock.php");
134 $fb = new ilExternalFeedBlock();
135 $fb->setTitle($a_rec["Title"]);
136 $fb->setFeedUrl($a_rec["Url"]);
137 $fb->setContextObjId($newObj->getId());
138 $fb->setContextObjType("feed");
139 $fb->create();
140
141 break;
142 }
143 }
144}
145?>
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
Custom block for external feeds.
External feed data set class.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
getTypes($a_entity, $a_version)
Get field types for entity.
getSupportedVersions()
Get supported versions.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
Class ilObjExternalFeed.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
global $ilDB