ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.

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

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  }
global $DIC
Definition: saml.php:7
read()
Read page data from database.
setId($a_id)
Set page ID.
+ 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.

References $DIC, and $ilDB.

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

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 $DIC
Definition: saml.php:7
global $ilDB
+ 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.

References $DIC, and $ilDB.

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

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  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ clear()

ilXHTMLPage::clear ( )

Clear page.

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

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

175  {
176  $ilDB = $this->db;
177 
178  if ($this->getId() > 0) {
179  $this->setContent("");
180  $this->save();
181  }
182  }
getId()
Get page ID.
save()
Save the page.
global $ilDB
setContent($a_content)
Set content of page.
+ 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.

References $content.

Referenced by save().

68  {
69  return $this->content;
70  }
+ 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.

References $id.

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

48  {
49  return $this->id;
50  }
+ 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.

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

Referenced by __construct().

86  {
87  $ilDB = $this->db;
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  }
global $ilDB
setContent($a_content)
Set content of page.
+ 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.

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

Referenced by clear().

132  {
133  $ilDB = $this->db;
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  }
getId()
Get page ID.
static _lookupContent($a_id)
Lookup Content.
getContent()
Get content of page.
global $ilDB
setId($a_id)
Set page ID.
+ 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.

References $a_content.

Referenced by clear(), and read().

78  {
79  $this->content = $a_content;
80  }
$a_content
Definition: workflow.php:93
+ 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.

Referenced by __construct(), and save().

58  {
59  $this->id = $a_id;
60  }
+ Here is the caller graph for this function:

◆ undo()

ilXHTMLPage::undo ( )

Undo last change.

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

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

156  {
157  $ilDB = $this->db;
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  }
getId()
Get page ID.
static _lookupContent($a_id)
Lookup Content.
global $ilDB
static _lookupSavedContent($a_id)
Lookup Saved Content.
+ 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: