ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 = ""
 

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 26 of file class.ilXHTMLPage.php.

References read(), and setId().

27  {
28  if ($a_id > 0)
29  {
30  $this->setId($a_id);
31  $this->read();
32  }
33  }
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 93 of file class.ilXHTMLPage.php.

References $ilDB.

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

94  {
95  global $ilDB;
96 
97  $set = $ilDB->query("SELECT content FROM xhtml_page WHERE id = ".
98  $ilDB->quote($a_id, "integer"));
99  if ($rec = $ilDB->fetchAssoc($set))
100  {
101  return $rec["content"];
102  }
103  }
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupSavedContent()

static ilXHTMLPage::_lookupSavedContent (   $a_id)
static

Lookup Saved Content.

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

References $ilDB.

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

109  {
110  global $ilDB;
111 
112  $set = $ilDB->query("SELECT save_content FROM xhtml_page WHERE id = ".
113  $ilDB->quote($a_id, "integer"));
114  if ($rec = $ilDB->fetchAssoc($set))
115  {
116  return $rec["save_content"];
117  }
118  }
global $ilDB
+ Here is the caller graph for this function:

◆ clear()

ilXHTMLPage::clear ( )

Clear page.

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

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

171  {
172  global $ilDB;
173 
174  if ($this->getId() > 0)
175  {
176  $this->setContent("");
177  $this->save();
178  }
179  }
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 60 of file class.ilXHTMLPage.php.

References $content.

Referenced by save().

61  {
62  return $this->content;
63  }
+ Here is the caller graph for this function:

◆ getId()

ilXHTMLPage::getId ( )

Get page ID.

Returns
int page ID

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

References $id.

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

41  {
42  return $this->id;
43  }
+ Here is the caller graph for this function:

◆ read()

ilXHTMLPage::read ( )

Read page data from database.

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

References $ilDB, and setContent().

Referenced by __construct().

79  {
80  global $ilDB;
81 
82  $set = $ilDB->query("SELECT * FROM xhtml_page WHERE id = ".
83  $ilDB->quote($this->getId(), "integer"));
84  if ($rec = $ilDB->fetchAssoc($set))
85  {
86  $this->setContent($rec["content"]);
87  }
88  }
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 123 of file class.ilXHTMLPage.php.

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

Referenced by clear().

124  {
125  global $ilDB;
126 
127  if ($this->getId() > 0)
128  {
129  $old_content = ilXHTMLPage::_lookupContent($this->getId());
130  $ilDB->update("xhtml_page", array(
131  "content" => array("clob", $this->getContent()),
132  "save_content" => array("clob", $old_content)
133  ), array (
134  "id" => array("integer", $this->getId())
135  ));
136  }
137  else
138  {
139  $this->setId($ilDB->nextId("xhtml_page"));
140  $ilDB->insert("xhtml_page", array(
141  "id" => array("integer", $this->getId()),
142  "content" => array("clob", $this->getContent())
143  ));
144  }
145  }
getId()
Get page ID.
static _lookupContent($a_id)
Lookup Content.
getContent()
Get content of page.
Create styles array
The data for the language used.
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 70 of file class.ilXHTMLPage.php.

References $a_content.

Referenced by clear(), and read().

71  {
72  $this->content = $a_content;
73  }
$a_content
Definition: workflow.php:94
+ Here is the caller graph for this function:

◆ setId()

ilXHTMLPage::setId (   $a_id)

Set page ID.

Parameters
int$a_idpage ID

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

Referenced by __construct(), and save().

51  {
52  $this->id = $a_id;
53  }
+ Here is the caller graph for this function:

◆ undo()

ilXHTMLPage::undo ( )

Undo last change.

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

References $ilDB, _lookupContent(), _lookupSavedContent(), array, and getId().

151  {
152  global $ilDB;
153 
154  if ($this->getId() > 0)
155  {
157  $save_content = ilXHTMLPage::_lookupSavedContent($this->getId());
158  $ilDB->update("xhtml_page", array(
159  "content" => array("clob", $save_content),
160  "save_content" => array("clob", $content)
161  ), array (
162  "id" => array("integer", $this->getId())
163  ));
164  }
165  }
getId()
Get page ID.
static _lookupContent($a_id)
Lookup Content.
Create styles array
The data for the language used.
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 19 of file class.ilXHTMLPage.php.

Referenced by getContent().

◆ $id

ilXHTMLPage::$id = 0

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

Referenced by getId().


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