• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/Block/classes/class.ilHtmlBlock.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 include_once("./Services/Block/classes/class.ilCustomBlock.php");
00025 
00032 class ilHtmlBlock extends ilCustomBlock
00033 {
00034 
00035         protected $content;
00036 
00042         public function __construct($a_id = 0)
00043         {
00044                 if ($a_id > 0)
00045                 {
00046                         $this->setId($a_id);
00047                         $this->read();
00048                 }
00049 
00050         }
00051 
00057         public function setContent($a_content)
00058         {
00059                 $this->content = $a_content;
00060         }
00061 
00067         public function getContent()
00068         {
00069                 return $this->content;
00070         }
00071 
00076         public function create()
00077         {
00078                 global $ilDB;
00079                 
00080                 parent::create();
00081                 
00082                 $query = "INSERT INTO il_html_block (".
00083                         " id".
00084                         ", content".
00085                         " ) VALUES (".
00086                         $ilDB->quote($this->getId())
00087                         .",".$ilDB->quote($this->getContent()).")";
00088                 $ilDB->query($query);
00089                 
00090 
00091         }
00092 
00097         public function read()
00098         {
00099                 global $ilDB;
00100                 
00101                 parent::read();
00102                 
00103                 $query = "SELECT * FROM il_html_block WHERE id = ".
00104                         $ilDB->quote($this->getId());
00105                 $set = $ilDB->query($query);
00106                 $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
00107 
00108                 $this->setContent($rec["content"]);
00109 
00110         }
00111 
00116         public function update()
00117         {
00118                 global $ilDB;
00119                 
00120                 parent::update();
00121                 
00122                 $query = "UPDATE il_html_block SET ".
00123                         " content = ".$ilDB->quote($this->getContent()).
00124                         " WHERE id = ".$ilDB->quote($this->getId());
00125                 
00126                 $ilDB->query($query);
00127 
00128         }
00129 
00134         public function delete()
00135         {
00136                 global $ilDB;
00137                 
00138                 parent::delete();
00139                 
00140                 $query = "DELETE FROM il_html_block".
00141                         " WHERE id = ".$ilDB->quote($this->getId());
00142                 
00143                 $ilDB->query($query);
00144 
00145         }
00146 
00147 
00148 }
00149 ?>

Generated on Fri Dec 13 2013 17:56:55 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1