4 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
73 $id = $ilDB->nextId(
"il_wiki_page");
75 $query =
"INSERT INTO il_wiki_page (".
80 $ilDB->quote($this->
getId(),
"integer")
81 .
",".$ilDB->quote($this->
getTitle(),
"text")
82 .
",".$ilDB->quote($this->
getWikiId(),
"integer")
98 function update($a_validate =
true, $a_no_history =
false)
103 $query =
"UPDATE il_wiki_page SET ".
104 " title = ".$ilDB->quote($this->
getTitle(),
"text").
105 ",wiki_id = ".$ilDB->quote($this->
getWikiId(),
"integer").
106 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
107 $ilDB->manipulate(
$query);
120 $query =
"SELECT * FROM il_wiki_page WHERE id = ".
121 $ilDB->quote($this->
getId(),
"integer");
122 $set = $ilDB->query(
$query);
123 $rec = $ilDB->fetchAssoc($set);
147 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
154 $query =
"DELETE FROM il_wiki_page".
155 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
157 $ilDB->manipulate(
$query);
163 foreach($linking_pages as $lp)
165 $ilDB->manipulateF(
"DELETE FROM il_wiki_missing_page ".
166 " WHERE wiki_id = %s AND source_id = %s AND target_name = %s ",
167 array(
"integer",
"integer",
"text"),
169 $ilDB->manipulateF(
"INSERT INTO il_wiki_missing_page ".
170 "(wiki_id, source_id, target_name) VALUES ".
172 array(
"integer",
"integer",
"text"),
189 $query =
"SELECT * FROM il_wiki_page".
190 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer");
191 $set = $ilDB->query(
$query);
193 while($rec = $ilDB->fetchAssoc($set))
196 $wiki_page->delete();
203 static function exists($a_wiki_id, $a_title)
209 $query =
"SELECT * FROM il_wiki_page".
210 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
211 " AND title = ".$ilDB->quote($a_title,
"text");
212 $set = $ilDB->query(
$query);
213 if($rec = $ilDB->fetchAssoc($set))
230 $query =
"SELECT * FROM il_wiki_page".
231 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
232 " AND title = ".$ilDB->quote($a_title,
"text");
233 $set = $ilDB->query(
$query);
234 if($rec = $ilDB->fetchAssoc($set))
249 $query =
"SELECT * FROM il_wiki_page".
250 " WHERE id = ".$ilDB->quote($a_page_id,
"integer");
251 $set = $ilDB->query(
$query);
252 if($rec = $ilDB->fetchAssoc($set))
254 return $rec[
"title"];
271 $query =
"SELECT * FROM il_wiki_page".
272 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
274 $set = $ilDB->query(
$query);
276 while($rec = $ilDB->fetchAssoc($set))
278 if (isset($pages[$rec[
"id"]]))
280 $pages[$rec[
"id"]][
"title"] = $rec[
"title"];
294 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
298 foreach ($sources as $source)
300 if ($source[
"type"] ==
"wpg:pg")
302 $ids[] = $source[
"id"];
306 $query =
"SELECT * FROM il_wiki_page wp, page_object p".
307 " WHERE ".$ilDB->in(
"wp.id", $ids,
false,
"integer").
308 " AND wp.id = p.page_id AND p.parent_type = ".$ilDB->quote(
"wpg",
"text").
309 " AND wp.wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
311 $set = $ilDB->query(
$query);
314 while ($rec = $ilDB->fetchAssoc($set))
316 $pages[] = array_merge($rec, array(
"user" => $rec[
"last_change_user"],
317 "date" => $rec[
"last_change"]));
334 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
337 foreach ($pages as $k => $page)
342 foreach ($sources as $source)
344 if ($source[
"type"] ==
"wpg:pg")
346 $ids[] = $source[
"id"];
350 $query =
"SELECT count(*) AS cnt FROM il_wiki_page".
351 " WHERE ".$ilDB->in(
"id", $ids,
false,
"integer").
352 " AND wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
354 $set = $ilDB->query(
$query);
355 $rec = $ilDB->fetchAssoc($set);
356 if ($rec[
"cnt"] == 0 &&
377 $query =
"SELECT id FROM il_wiki_page".
378 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
379 " AND title = ".$ilDB->quote($a_title,
"text");
380 $set = $ilDB->query(
$query);
383 if ($rec = $ilDB->fetchAssoc($set))
402 return $contributors;
416 return $contributors;
439 $set = $ilDB->queryF(
"SELECT * FROM il_wiki_missing_page WHERE ".
440 " wiki_id = %s AND target_name = %s",
441 array(
"integer",
"text"),
443 while ($anmiss = $ilDB->fetchAssoc($set))
450 $ilDB->manipulateF(
"DELETE FROM il_wiki_missing_page WHERE ".
451 " wiki_id = %s AND target_name = %s",
452 array(
"integer",
"text"),
459 $ilDB->manipulateF(
"DELETE FROM il_wiki_missing_page WHERE ".
460 " wiki_id = %s AND source_id = %s",
461 array(
"integer",
"integer"),
465 include_once(
"./Modules/Wiki/classes/class.ilWikiUtil.php");
468 foreach($int_wiki_links as $wlink)
479 $ilDB->manipulateF(
"DELETE FROM il_wiki_missing_page WHERE".
480 " wiki_id = %s AND source_id = %s AND target_name = %s",
481 array(
"integer",
"integer",
"text"),
483 $ilDB->manipulateF(
"INSERT INTO il_wiki_missing_page (wiki_id, source_id, target_name)".
484 " VALUES (%s,%s,%s)",
485 array(
"integer",
"integer",
"text"),
498 $query =
"SELECT id FROM il_wiki_page".
499 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
500 " AND title = ".$ilDB->quote($a_title,
"text");
501 $set = $ilDB->query(
$query);
502 if($rec = $ilDB->fetchAssoc($set))
519 $query =
"SELECT wp.*, po.view_cnt as cnt FROM il_wiki_page wp, page_object po".
520 " WHERE wp.wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
521 " AND wp.id = po.page_id ".
522 " AND po.parent_type = ".$ilDB->quote(
"wpg",
"text").
" ".
523 " ORDER BY po.view_cnt";
524 $set = $ilDB->query(
$query);
527 while($rec = $ilDB->fetchAssoc($set))
545 $query =
"SELECT count(*) as cnt FROM il_wiki_page".
546 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer");
547 $s = $ilDB->query(
$query);
548 $r = $ilDB->fetchAssoc($s);
569 $rand = rand(1, $cnt);
572 $ilDB->setLimit(1, $rand);
573 $query =
"SELECT title FROM il_wiki_page".
574 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer");
575 $s = $ilDB->query(
$query);
576 $r = $ilDB->fetchAssoc($s);
592 foreach($pages as $k => $page)
611 $query =
"SELECT wiki_id FROM il_wiki_page".
612 " WHERE id = ".$ilDB->quote($a_page_id,
"integer");
613 $set = $ilDB->query(
$query);
614 if($rec = $ilDB->fetchAssoc($set))
616 return $rec[
"wiki_id"];