Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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 ?>