ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilHtmlBlock.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 $content;
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 setContent($a_content)
58  {
59  $this->content = $a_content;
60  }
61 
67  public function getContent()
68  {
69  return $this->content;
70  }
71 
76  public function create()
77  {
78  global $ilDB;
79 
81 
82  $query = "INSERT INTO il_html_block (".
83  " id".
84  ", content".
85  " ) VALUES (".
86  $ilDB->quote($this->getId())
87  .",".$ilDB->quote($this->getContent()).")";
88  $ilDB->query($query);
89 
90 
91  }
92 
97  public function read()
98  {
99  global $ilDB;
100 
101  parent::read();
102 
103  $query = "SELECT * FROM il_html_block WHERE id = ".
104  $ilDB->quote($this->getId());
105  $set = $ilDB->query($query);
106  $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
107 
108  $this->setContent($rec["content"]);
109 
110  }
111 
116  public function update()
117  {
118  global $ilDB;
119 
120  parent::update();
121 
122  $query = "UPDATE il_html_block SET ".
123  " content = ".$ilDB->quote($this->getContent()).
124  " WHERE id = ".$ilDB->quote($this->getId());
125 
126  $ilDB->query($query);
127 
128  }
129 
134  public function delete()
135  {
136  global $ilDB;
137 
138  parent::delete();
139 
140  $query = "DELETE FROM il_html_block".
141  " WHERE id = ".$ilDB->quote($this->getId());
142 
143  $ilDB->query($query);
144 
145  }
146 
147 
148 }
149 ?>