ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilExternalFeedBlock.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("./Services/Block/classes/class.ilCustomBlock.php");
25 
33 {
34 
35  protected $feed_url;
36 
42  public function __construct($a_id = 0)
43  {
44  if ($a_id > 0)
45  {
46  $this->setId($a_id);
47  $this->read();
48  }
49 
50  }
51 
57  public function setFeedUrl($a_feed_url)
58  {
59  $this->feed_url = $a_feed_url;
60  }
61 
67  public function getFeedUrl()
68  {
69  return $this->feed_url;
70  }
71 
76  public function create()
77  {
78  global $ilDB, $ilLog;
79 
81 
82  $query = "INSERT INTO il_external_feed_block (".
83  " id".
84  ", feed_url".
85  " ) VALUES (".
86  $ilDB->quote($this->getId())
87  .",".$ilDB->quote($this->getFeedUrl()).")";
88  $ilDB->query($query);
89 
90  }
91 
96  public function read()
97  {
98  global $ilDB;
99 
100  parent::read();
101 
102  $query = "SELECT * FROM il_external_feed_block WHERE id = ".
103  $ilDB->quote($this->getId());
104  $set = $ilDB->query($query);
105  $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
106 
107  $this->setFeedUrl($rec["feed_url"]);
108 
109  }
110 
115  public function update()
116  {
117  global $ilDB;
118 
119  parent::update();
120 
121  $query = "UPDATE il_external_feed_block SET ".
122  " feed_url = ".$ilDB->quote($this->getFeedUrl()).
123  " WHERE id = ".$ilDB->quote($this->getId());
124 
125  $ilDB->query($query);
126 
127  }
128 
133  public function delete()
134  {
135  global $ilDB;
136 
137  parent::delete();
138 
139  $query = "DELETE FROM il_external_feed_block".
140  " WHERE id = ".$ilDB->quote($this->getId());
141 
142  $ilDB->query($query);
143 
144  }
145 
146 
147 }
148 ?>