ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilExternalFeedBlock.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Block/classes/class.ilCustomBlock.php");
5 
13 {
14 
15  protected $feed_url;
16 
22  public function __construct($a_id = 0)
23  {
24  if ($a_id > 0)
25  {
26  $this->setId($a_id);
27  $this->read();
28  }
29 
30  }
31 
37  public function setFeedUrl($a_feed_url)
38  {
39  $this->feed_url = $a_feed_url;
40  }
41 
47  public function getFeedUrl()
48  {
49  return $this->feed_url;
50  }
51 
56  public function create()
57  {
58  global $ilDB, $ilLog;
59 
60  parent::create();
61 
62  $query = "INSERT INTO il_external_feed_block (".
63  " id".
64  ", feed_url".
65  " ) VALUES (".
66  $ilDB->quote($this->getId(), "integer")
67  .",".$ilDB->quote($this->getFeedUrl(), "text").")";
68  $ilDB->manipulate($query);
69 
70  }
71 
76  public function read()
77  {
78  global $ilDB;
79 
80  parent::read();
81 
82  $query = "SELECT * FROM il_external_feed_block WHERE id = ".
83  $ilDB->quote($this->getId(), "integer");
84  $set = $ilDB->query($query);
85  $rec = $ilDB->fetchAssoc($set);
86 
87  $this->setFeedUrl($rec["feed_url"]);
88 
89  }
90 
95  public function update()
96  {
97  global $ilDB;
98 
99  parent::update();
100 
101  $query = "UPDATE il_external_feed_block SET ".
102  " feed_url = ".$ilDB->quote($this->getFeedUrl(), "text").
103  " WHERE id = ".$ilDB->quote($this->getId(), "integer");
104 
105  $ilDB->manipulate($query);
106 
107  }
108 
113  public function delete()
114  {
115  global $ilDB;
116 
117  parent::delete();
118 
119  $query = "DELETE FROM il_external_feed_block".
120  " WHERE id = ".$ilDB->quote($this->getId(), "integer");
121 
122  $ilDB->manipulate($query);
123 
124  }
125 
126 
127 }
128 ?>
update()
Update item in database.
setId($a_id)
Set Id.
setFeedUrl($a_feed_url)
Set FeedUrl.
__construct($a_id=0)
Constructor.
Custom block for external feeds.
This is the super class of all custom blocks.
read()
Read item from database.
global $ilDB