ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilWikiPageTemplate Class Reference

Wiki page template. More...

+ Collaboration diagram for ilWikiPageTemplate:

Public Member Functions

 __construct ($a_wiki_id)
 Constructor.
 getAllInfo ($a_type=self::TYPE_ALL)
 Get all info.
 save ($a_id, $a_new_pages=0, $a_add_to_page=0)
 Add wiki page template.
 remove ($a_id)
 Remove template status of a page.
 isPageTemplate ($a_id)
 Is page set as template?

Data Fields

const TYPE_ALL = 0
const TYPE_NEW_PAGES = 1
const TYPE_ADD_TO_PAGE = 2

Protected Attributes

 $wiki_id
 $ilDB

Detailed Description

Wiki page template.

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

Definition at line 12 of file class.ilWikiPageTemplate.php.

Constructor & Destructor Documentation

ilWikiPageTemplate::__construct (   $a_wiki_id)

Constructor.

Parameters
int$a_wiki_idwiki id

Definition at line 26 of file class.ilWikiPageTemplate.php.

References $ilDB.

{
global $ilDB;
$this->wiki_id = $a_wiki_id;
$this->db = $ilDB;
}

Member Function Documentation

ilWikiPageTemplate::getAllInfo (   $a_type = self::TYPE_ALL)

Get all info.

Definition at line 37 of file class.ilWikiPageTemplate.php.

Referenced by ilObjWikiGUI\initTemplateSelectionForm().

{
$and = "";
if ($a_type == self::TYPE_NEW_PAGES)
{
$and = " AND t.new_pages = ".$this->db->quote(1, "integer");
}
if ($a_type == self::TYPE_ADD_TO_PAGE)
{
$and = " AND t.add_to_page = ".$this->db->quote(1, "integer");
}
$set = $this->db->query($q = "SELECT t.wiki_id, t.wpage_id, p.title, t.new_pages, t.add_to_page FROM wiki_page_template t JOIN il_wiki_page p ON ".
" (t.wpage_id = p.id) ".
" WHERE t.wiki_id = ".$this->db->quote($this->wiki_id, "integer").
$and
);
$templates = array();
while ($rec = $this->db->fetchAssoc($set))
{
$templates[] = $rec;
}
return $templates;
}

+ Here is the caller graph for this function:

ilWikiPageTemplate::isPageTemplate (   $a_id)

Is page set as template?

Parameters
int$a_idwiki page id
Returns
type bool

Definition at line 118 of file class.ilWikiPageTemplate.php.

{
$set = $this->db->query("SELECT t.wpage_id".
" FROM wiki_page_template t".
" JOIN il_wiki_page p ON ".
" (t.wpage_id = p.id) ".
" WHERE t.wiki_id = ".$this->db->quote($this->wiki_id, "integer").
" AND p.id = ".$this->db->quote($a_id, "integer"));
return (bool)$this->db->numRows($set);
}
ilWikiPageTemplate::remove (   $a_id)

Remove template status of a page.

Parameters
int$a_idwiki page id

Definition at line 104 of file class.ilWikiPageTemplate.php.

Referenced by ilWikiPageTemplateGUI\remove(), and ilWikiPageTemplateGUI\removePageTemplateFromPageAction().

{
$this->db->manipulate("DELETE FROM wiki_page_template WHERE ".
" wiki_id = ".$this->db->quote($this->wiki_id, "integer").
" AND wpage_id = ".$this->db->quote($a_id, "integer")
);
}

+ Here is the caller graph for this function:

ilWikiPageTemplate::save (   $a_id,
  $a_new_pages = 0,
  $a_add_to_page = 0 
)

Add wiki page template.

Parameters
int$a_idwiki page id

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

Referenced by ilWikiPageTemplateGUI\add(), ilWikiPageTemplateGUI\addPageTemplateFromPageAction(), and ilWikiPageTemplateGUI\saveTemplateSettings().

{
if ($a_id <= 0)
{
return;
}
$set = $this->db->query("SELECT * FROM wiki_page_template ".
" WHERE wiki_id = ".$this->db->quote($this->wiki_id, "integer").
" AND wpage_id = ".$this->db->quote($a_id, "integer")
);
if (!$this->db->fetchAssoc($set))
{
$this->db->manipulate("INSERT INTO wiki_page_template ".
"(wiki_id, wpage_id, new_pages, add_to_page) VALUES (".
$this->db->quote($this->wiki_id, "integer").",".
$this->db->quote($a_id, "integer").",".
$this->db->quote($a_new_pages, "integer").",".
$this->db->quote($a_add_to_page, "integer").
")");
}
else
{
$this->db->manipulate("UPDATE wiki_page_template SET ".
" new_pages = ".$this->db->quote($a_new_pages, "integer").",".
" add_to_page = ".$this->db->quote($a_add_to_page, "integer").
" WHERE wiki_id = ".$this->db->quote($this->wiki_id, "integer").
" AND wpage_id = ".$this->db->quote($a_id, "integer")
);
}
}

+ Here is the caller graph for this function:

Field Documentation

ilWikiPageTemplate::$ilDB
protected

Definition at line 19 of file class.ilWikiPageTemplate.php.

Referenced by __construct().

ilWikiPageTemplate::$wiki_id
protected

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

const ilWikiPageTemplate::TYPE_ADD_TO_PAGE = 2

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

Referenced by ilWikiPage\getContentTemplates().

const ilWikiPageTemplate::TYPE_ALL = 0

Definition at line 14 of file class.ilWikiPageTemplate.php.

const ilWikiPageTemplate::TYPE_NEW_PAGES = 1

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