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

Services/XHTMLPage/classes/class.ilXHTMLPage.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 
00036 class ilXHTMLPage
00037 {
00038         var $id = 0;
00039         var $content = "";
00040 
00046         function ilXHTMLPage($a_id = 0)
00047         {
00048                 if ($a_id > 0)
00049                 {
00050                         $this->setId($a_id);
00051                         $this->read();
00052                 }
00053         }
00054         
00060         function getId()
00061         {
00062                 return $this->id;
00063         }
00064         
00070         function setId($a_id)
00071         {
00072                 $this->id = $a_id;
00073         }
00074 
00080         function getContent()
00081         {
00082                 return $this->content;
00083         }
00084         
00090         function setContent($a_content)
00091         {
00092                 $this->content = $a_content;
00093         }
00094 
00098         function read()
00099         {
00100                 global $ilDB;
00101                 
00102                 $set = $ilDB->query("SELECT * FROM xhtml_page WHERE id = ".
00103                         $ilDB->quote($this->getId()));
00104                 if ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
00105                 {
00106                         $this->setContent($rec["content"]);
00107                 }
00108         }
00109         
00113         function save()
00114         {
00115                 global $ilDB;
00116                 
00117                 if ($this->getId() > 0)
00118                 {
00119                         $ilDB->query("UPDATE xhtml_page SET ".
00120                                 " save_content = content ".
00121                                 " WHERE id = ".$ilDB->quote($this->getId()));
00122                         $ilDB->query("UPDATE xhtml_page SET ".
00123                                 "content = ".$ilDB->quote($this->getContent()).
00124                                 " WHERE id = ".$ilDB->quote($this->getId()));
00125                 }
00126                 else
00127                 {
00128                         $ilDB->query("INSERT INTO xhtml_page (content) VALUES ".
00129                                 "(".$ilDB->quote($this->getContent()).")");
00130                         $this->setId($ilDB->getLastInsertId());
00131                 }
00132         }
00133         
00137         function undo()
00138         {
00139                 global $ilDB;
00140                 
00141                 if ($this->getId() > 0)
00142                 {
00143                         $ilDB->query("UPDATE xhtml_page SET ".
00144                                 " content = save_content ".
00145                                 " WHERE id = ".$ilDB->quote($this->getId()));
00146                         $ilDB->query("UPDATE xhtml_page SET ".
00147                                 " save_content = ".$ilDB->quote($this->getContent()).
00148                                 " WHERE id = ".$ilDB->quote($this->getId()));
00149                 }
00150         }
00151 
00155         function clear()
00156         {
00157                 global $ilDB;
00158                 
00159                 if ($this->getId() > 0)
00160                 {
00161                         $ilDB->query("UPDATE xhtml_page SET ".
00162                                 " save_content = content ".
00163                                 " WHERE id = ".$ilDB->quote($this->getId()));
00164                         $ilDB->query("UPDATE xhtml_page SET ".
00165                                 " content = ".$ilDB->quote("").
00166                                 " WHERE id = ".$ilDB->quote($this->getId()));
00167                         $this->setContent("");
00168                 }
00169         }
00170 
00171 }
00172 ?>

Generated on Fri Dec 13 2013 13:52:12 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1