30 $this->wiki_id = $a_wiki_id;
40 if ($a_type == self::TYPE_NEW_PAGES)
42 $and =
" AND t.new_pages = ".$this->db->quote(1,
"integer");
44 if ($a_type == self::TYPE_ADD_TO_PAGE)
46 $and =
" AND t.add_to_page = ".$this->db->quote(1,
"integer");
49 $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 ".
50 " (t.wpage_id = p.id) ".
51 " WHERE t.wiki_id = ".$this->db->quote($this->wiki_id,
"integer").
55 while ($rec = $this->db->fetchAssoc($set))
67 function save($a_id, $a_new_pages = 0, $a_add_to_page = 0)
74 $set = $this->db->query(
"SELECT * FROM wiki_page_template ".
75 " WHERE wiki_id = ".$this->db->quote($this->wiki_id,
"integer").
76 " AND wpage_id = ".$this->db->quote($a_id,
"integer")
78 if (!$this->db->fetchAssoc($set))
80 $this->db->manipulate(
"INSERT INTO wiki_page_template ".
81 "(wiki_id, wpage_id, new_pages, add_to_page) VALUES (".
82 $this->db->quote($this->wiki_id,
"integer").
",".
83 $this->db->quote($a_id,
"integer").
",".
84 $this->db->quote($a_new_pages,
"integer").
",".
85 $this->db->quote($a_add_to_page,
"integer").
90 $this->db->manipulate(
"UPDATE wiki_page_template SET ".
91 " new_pages = ".$this->db->quote($a_new_pages,
"integer").
",".
92 " add_to_page = ".$this->db->quote($a_add_to_page,
"integer").
93 " WHERE wiki_id = ".$this->db->quote($this->wiki_id,
"integer").
94 " AND wpage_id = ".$this->db->quote($a_id,
"integer")
104 function remove($a_id)
106 $this->db->manipulate(
"DELETE FROM wiki_page_template WHERE ".
107 " wiki_id = ".$this->db->quote($this->wiki_id,
"integer").
108 " AND wpage_id = ".$this->db->quote($a_id,
"integer")
120 $set = $this->db->query(
"SELECT t.wpage_id".
121 " FROM wiki_page_template t".
122 " JOIN il_wiki_page p ON ".
123 " (t.wpage_id = p.id) ".
124 " WHERE t.wiki_id = ".$this->db->quote($this->wiki_id,
"integer").
125 " AND p.id = ".$this->db->quote($a_id,
"integer"));
126 return (
bool)$this->db->numRows($set);