35 $ilDB = $DIC->database();
37 $this->wiki_id = $a_wiki_id;
47 if (
$a_type == self::TYPE_NEW_PAGES) {
48 $and =
" AND t.new_pages = " . $this->db->quote(1,
"integer");
50 if (
$a_type == self::TYPE_ADD_TO_PAGE) {
51 $and =
" AND t.add_to_page = " . $this->db->quote(1,
"integer");
54 $set = $this->db->query(
55 $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 " .
56 " (t.wpage_id = p.id) " .
57 " WHERE t.wiki_id = " . $this->db->quote($this->wiki_id,
"integer") .
61 while ($rec = $this->db->fetchAssoc($set)) {
72 public function save($a_id, $a_new_pages = 0, $a_add_to_page = 0)
78 $set = $this->db->query(
79 "SELECT * FROM wiki_page_template " .
80 " WHERE wiki_id = " . $this->db->quote($this->wiki_id,
"integer") .
81 " AND wpage_id = " . $this->db->quote($a_id,
"integer")
83 if (!$this->db->fetchAssoc($set)) {
84 $this->db->manipulate(
"INSERT INTO wiki_page_template " .
85 "(wiki_id, wpage_id, new_pages, add_to_page) VALUES (" .
86 $this->db->quote($this->wiki_id,
"integer") .
"," .
87 $this->db->quote($a_id,
"integer") .
"," .
88 $this->db->quote($a_new_pages,
"integer") .
"," .
89 $this->db->quote($a_add_to_page,
"integer") .
92 $this->db->manipulate(
93 "UPDATE wiki_page_template SET " .
94 " new_pages = " . $this->db->quote($a_new_pages,
"integer") .
"," .
95 " add_to_page = " . $this->db->quote($a_add_to_page,
"integer") .
96 " WHERE wiki_id = " . $this->db->quote($this->wiki_id,
"integer") .
97 " AND wpage_id = " . $this->db->quote($a_id,
"integer")
107 public function remove($a_id)
109 $this->db->manipulate(
110 "DELETE FROM wiki_page_template WHERE " .
111 " wiki_id = " . $this->db->quote($this->wiki_id,
"integer") .
112 " AND wpage_id = " . $this->db->quote($a_id,
"integer")
124 $set = $this->db->query(
"SELECT t.wpage_id" .
125 " FROM wiki_page_template t" .
126 " JOIN il_wiki_page p ON " .
127 " (t.wpage_id = p.id) " .
128 " WHERE t.wiki_id = " . $this->db->quote($this->wiki_id,
"integer") .
129 " AND p.id = " . $this->db->quote($a_id,
"integer"));
130 return (
bool) $this->db->numRows($set);
getAllInfo($a_type=self::TYPE_ALL)
Get all info.
__construct($a_wiki_id)
Constructor.
isPageTemplate($a_id)
Is page set as template?
save($a_id, $a_new_pages=0, $a_add_to_page=0)
Add wiki page template.