ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilXHTMLPage Class Reference

XHTML Page class. More...

+ Collaboration diagram for ilXHTMLPage:

Public Member Functions

 __construct ($a_id=0)
 Constructor. More...
 
 getId ()
 Get page ID. More...
 
 setId ($a_id)
 Set page ID. More...
 
 getContent ()
 Get content of page. More...
 
 setContent ($a_content)
 Set content of page. More...
 
 read ()
 Read page data from database. More...
 
 save ()
 Save the page. More...
 
 undo ()
 Undo last change. More...
 
 clear ()
 Clear page. More...
 

Static Public Member Functions

static _lookupContent ($a_id)
 Lookup Content. More...
 
static _lookupSavedContent ($a_id)
 Lookup Saved Content. More...
 

Data Fields

 $id = 0
 
 $content = ""
 

Protected Attributes

 $db
 

Detailed Description

XHTML Page class.

Should be used to store XHTML pages created by tiny (e.g. for ategories).

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 16 of file class.ilXHTMLPage.php.

Constructor & Destructor Documentation

◆ __construct()

ilXHTMLPage::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_idpage ID

Definition at line 31 of file class.ilXHTMLPage.php.

32 {
33 global $DIC;
34
35 $this->db = $DIC->database();
36 if ($a_id > 0) {
37 $this->setId($a_id);
38 $this->read();
39 }
40 }
setId($a_id)
Set page ID.
read()
Read page data from database.
global $DIC
Definition: saml.php:7

References $DIC, read(), and setId().

+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupContent()

static ilXHTMLPage::_lookupContent (   $a_id)
static

Lookup Content.

Definition at line 99 of file class.ilXHTMLPage.php.

100 {
101 global $DIC;
102
103 $ilDB = $DIC->database();
104
105 $set = $ilDB->query("SELECT content FROM xhtml_page WHERE id = " .
106 $ilDB->quote($a_id, "integer"));
107 if ($rec = $ilDB->fetchAssoc($set)) {
108 return $rec["content"];
109 }
110 }
global $ilDB

References $DIC, and $ilDB.

Referenced by save(), ilXHTMLPageTest\testSetGetSettings(), and undo().

+ Here is the caller graph for this function:

◆ _lookupSavedContent()

static ilXHTMLPage::_lookupSavedContent (   $a_id)
static

Lookup Saved Content.

Definition at line 115 of file class.ilXHTMLPage.php.

116 {
117 global $DIC;
118
119 $ilDB = $DIC->database();
120
121 $set = $ilDB->query("SELECT save_content FROM xhtml_page WHERE id = " .
122 $ilDB->quote($a_id, "integer"));
123 if ($rec = $ilDB->fetchAssoc($set)) {
124 return $rec["save_content"];
125 }
126 }

References $DIC, and $ilDB.

Referenced by ilXHTMLPageTest\testSetGetSettings(), and undo().

+ Here is the caller graph for this function:

◆ clear()

ilXHTMLPage::clear ( )

Clear page.

Definition at line 174 of file class.ilXHTMLPage.php.

175 {
177
178 if ($this->getId() > 0) {
179 $this->setContent("");
180 $this->save();
181 }
182 }
getId()
Get page ID.
setContent($a_content)
Set content of page.
save()
Save the page.

References $db, $ilDB, getId(), save(), and setContent().

+ Here is the call graph for this function:

◆ getContent()

ilXHTMLPage::getContent ( )

Get content of page.

Returns
string page content

Definition at line 67 of file class.ilXHTMLPage.php.

68 {
69 return $this->content;
70 }

References $content.

Referenced by save().

+ Here is the caller graph for this function:

◆ getId()

ilXHTMLPage::getId ( )

Get page ID.

Returns
int page ID

Definition at line 47 of file class.ilXHTMLPage.php.

48 {
49 return $this->id;
50 }

References $id.

Referenced by clear(), save(), and undo().

+ Here is the caller graph for this function:

◆ read()

ilXHTMLPage::read ( )

Read page data from database.

Definition at line 85 of file class.ilXHTMLPage.php.

86 {
88
89 $set = $ilDB->query("SELECT * FROM xhtml_page WHERE id = " .
90 $ilDB->quote($this->getId(), "integer"));
91 if ($rec = $ilDB->fetchAssoc($set)) {
92 $this->setContent($rec["content"]);
93 }
94 }

References $db, $ilDB, and setContent().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilXHTMLPage::save ( )

Save the page.

Definition at line 131 of file class.ilXHTMLPage.php.

132 {
134
135 if ($this->getId() > 0) {
136 $old_content = ilXHTMLPage::_lookupContent($this->getId());
137 $ilDB->update("xhtml_page", array(
138 "content" => array("clob", $this->getContent()),
139 "save_content" => array("clob", $old_content)
140 ), array(
141 "id" => array("integer", $this->getId())
142 ));
143 } else {
144 $this->setId($ilDB->nextId("xhtml_page"));
145 $ilDB->insert("xhtml_page", array(
146 "id" => array("integer", $this->getId()),
147 "content" => array("clob", $this->getContent())
148 ));
149 }
150 }
getContent()
Get content of page.
static _lookupContent($a_id)
Lookup Content.

References $db, $ilDB, _lookupContent(), getContent(), getId(), and setId().

Referenced by clear().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContent()

ilXHTMLPage::setContent (   $a_content)

Set content of page.

Parameters
string$a_contentpage content

Definition at line 77 of file class.ilXHTMLPage.php.

78 {
79 $this->content = $a_content;
80 }
$a_content
Definition: workflow.php:93

References $a_content.

Referenced by clear(), and read().

+ Here is the caller graph for this function:

◆ setId()

ilXHTMLPage::setId (   $a_id)

Set page ID.

Parameters
int$a_idpage ID

Definition at line 57 of file class.ilXHTMLPage.php.

58 {
59 $this->id = $a_id;
60 }

Referenced by __construct(), and save().

+ Here is the caller graph for this function:

◆ undo()

ilXHTMLPage::undo ( )

Undo last change.

Definition at line 155 of file class.ilXHTMLPage.php.

156 {
158
159 if ($this->getId() > 0) {
161 $save_content = ilXHTMLPage::_lookupSavedContent($this->getId());
162 $ilDB->update("xhtml_page", array(
163 "content" => array("clob", $save_content),
164 "save_content" => array("clob", $content)
165 ), array(
166 "id" => array("integer", $this->getId())
167 ));
168 }
169 }
static _lookupSavedContent($a_id)
Lookup Saved Content.

References $content, $db, $ilDB, _lookupContent(), _lookupSavedContent(), and getId().

+ Here is the call graph for this function:

Field Documentation

◆ $content

ilXHTMLPage::$content = ""

Definition at line 24 of file class.ilXHTMLPage.php.

Referenced by getContent(), and undo().

◆ $db

ilXHTMLPage::$db
protected

Definition at line 21 of file class.ilXHTMLPage.php.

Referenced by clear(), read(), save(), and undo().

◆ $id

ilXHTMLPage::$id = 0

Definition at line 23 of file class.ilXHTMLPage.php.

Referenced by getId().


The documentation for this class was generated from the following file: