4 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
73 $this->parent_ref_id = $a_wiki_ref_id;
83 return $this->parent_ref_id;
89 function create($a_prevent_page_creation =
false)
93 $id = $ilDB->nextId(
"il_wiki_page");
95 $query =
"INSERT INTO il_wiki_page (".
100 $ilDB->quote($this->
getId(),
"integer")
101 .
",".$ilDB->quote($this->
getTitle(),
"text")
102 .
",".$ilDB->quote($this->
getWikiId(),
"integer")
104 $ilDB->manipulate(
$query);
107 if (!$a_prevent_page_creation)
112 include_once
"./Services/Notification/classes/class.ilNotification.php";
123 function update($a_validate =
true, $a_no_history =
false)
128 $query =
"UPDATE il_wiki_page SET ".
129 " title = ".$ilDB->quote($this->
getTitle(),
"text").
130 ",wiki_id = ".$ilDB->quote($this->
getWikiId(),
"integer").
131 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
132 $ilDB->manipulate(
$query);
135 include_once
"./Services/Notification/classes/class.ilNotification.php";
148 $query =
"SELECT * FROM il_wiki_page WHERE id = ".
149 $ilDB->quote($this->
getId(),
"integer");
150 $set = $ilDB->query(
$query);
151 $rec = $ilDB->fetchAssoc($set);
175 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
178 include_once
"./Services/Notification/classes/class.ilNotification.php";
182 include_once
"./Services/Notification/classes/class.ilNotification.php";
189 $query =
"DELETE FROM il_wiki_page".
190 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
192 $ilDB->manipulate(
$query);
198 foreach($linking_pages as $lp)
200 $ilDB->manipulateF(
"DELETE FROM il_wiki_missing_page ".
201 " WHERE wiki_id = %s AND source_id = %s AND target_name = %s ",
202 array(
"integer",
"integer",
"text"),
204 $ilDB->manipulateF(
"INSERT INTO il_wiki_missing_page ".
205 "(wiki_id, source_id, target_name) VALUES ".
207 array(
"integer",
"integer",
"text"),
224 $query =
"SELECT * FROM il_wiki_page".
225 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer");
226 $set = $ilDB->query(
$query);
228 while($rec = $ilDB->fetchAssoc($set))
231 $wiki_page->delete();
240 static function exists($a_wiki_id, $a_title)
246 $query =
"SELECT * FROM il_wiki_page".
247 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
248 " AND title = ".$ilDB->quote($a_title,
"text");
249 $set = $ilDB->query(
$query);
250 if($rec = $ilDB->fetchAssoc($set))
267 $query =
"SELECT * FROM il_wiki_page".
268 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
269 " AND title = ".$ilDB->quote($a_title,
"text");
270 $set = $ilDB->query(
$query);
271 if($rec = $ilDB->fetchAssoc($set))
286 $query =
"SELECT * FROM il_wiki_page".
287 " WHERE id = ".$ilDB->quote($a_page_id,
"integer");
288 $set = $ilDB->query(
$query);
289 if($rec = $ilDB->fetchAssoc($set))
291 return $rec[
"title"];
304 $query =
"SELECT wiki_id FROM il_wiki_page".
305 " WHERE id = ".$ilDB->quote($a_page_id,
"integer");
306 $set = $ilDB->query(
$query);
307 if ($rec = $ilDB->fetchAssoc($set))
309 return $rec[
"wiki_id"];
326 $query =
"SELECT * FROM il_wiki_page".
327 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
329 $set = $ilDB->query(
$query);
332 while($rec = $ilDB->fetchAssoc($set))
334 if (isset($pages[$rec[
"id"]]))
336 $pg[$rec[
"id"]] = $pages[$rec[
"id"]];
337 $pg[$rec[
"id"]][
"title"] = $rec[
"title"];
351 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
355 foreach ($sources as $source)
357 if ($source[
"type"] ==
"wpg:pg")
359 $ids[] = $source[
"id"];
363 $query =
"SELECT * FROM il_wiki_page wp, page_object p".
364 " WHERE ".$ilDB->in(
"wp.id", $ids,
false,
"integer").
365 " AND wp.id = p.page_id AND p.parent_type = ".$ilDB->quote(
"wpg",
"text").
366 " AND wp.wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
368 $set = $ilDB->query(
$query);
371 while ($rec = $ilDB->fetchAssoc($set))
373 $pages[] = array_merge($rec, array(
"user" => $rec[
"last_change_user"],
374 "date" => $rec[
"last_change"]));
391 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
394 foreach ($pages as $k => $page)
399 foreach ($sources as $source)
401 if ($source[
"type"] ==
"wpg:pg")
403 $ids[] = $source[
"id"];
407 $query =
"SELECT count(*) AS cnt FROM il_wiki_page".
408 " WHERE ".$ilDB->in(
"id", $ids,
false,
"integer").
409 " AND wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
411 $set = $ilDB->query(
$query);
412 $rec = $ilDB->fetchAssoc($set);
413 if ($rec[
"cnt"] == 0 &&
434 $query =
"SELECT id FROM il_wiki_page".
435 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
436 " AND title = ".$ilDB->quote($a_title,
"text");
437 $set = $ilDB->query(
$query);
440 if ($rec = $ilDB->fetchAssoc($set))
459 return $contributors;
473 return $contributors;
496 $set = $ilDB->queryF(
"SELECT * FROM il_wiki_missing_page WHERE ".
497 " wiki_id = %s AND target_name = %s",
498 array(
"integer",
"text"),
500 while ($anmiss = $ilDB->fetchAssoc($set))
507 $ilDB->manipulateF(
"DELETE FROM il_wiki_missing_page WHERE ".
508 " wiki_id = %s AND target_name = %s",
509 array(
"integer",
"text"),
516 $ilDB->manipulateF(
"DELETE FROM il_wiki_missing_page WHERE ".
517 " wiki_id = %s AND source_id = %s",
518 array(
"integer",
"integer"),
522 include_once(
"./Modules/Wiki/classes/class.ilWikiUtil.php");
525 foreach($int_wiki_links as $wlink)
536 $ilDB->manipulateF(
"DELETE FROM il_wiki_missing_page WHERE".
537 " wiki_id = %s AND source_id = %s AND target_name = %s",
538 array(
"integer",
"integer",
"text"),
540 $ilDB->manipulateF(
"INSERT INTO il_wiki_missing_page (wiki_id, source_id, target_name)".
541 " VALUES (%s,%s,%s)",
542 array(
"integer",
"integer",
"text"),
555 $query =
"SELECT id FROM il_wiki_page".
556 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
557 " AND title = ".$ilDB->quote($a_title,
"text");
558 $set = $ilDB->query(
$query);
559 if($rec = $ilDB->fetchAssoc($set))
576 $query =
"SELECT wp.*, po.view_cnt as cnt FROM il_wiki_page wp, page_object po".
577 " WHERE wp.wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
578 " AND wp.id = po.page_id ".
579 " AND po.parent_type = ".$ilDB->quote(
"wpg",
"text").
" ".
580 " ORDER BY po.view_cnt";
581 $set = $ilDB->query(
$query);
584 while($rec = $ilDB->fetchAssoc($set))
602 $query =
"SELECT count(*) as cnt FROM il_wiki_page".
603 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer");
604 $s = $ilDB->query(
$query);
605 $r = $ilDB->fetchAssoc($s);
626 $rand = rand(1, $cnt);
629 $ilDB->setLimit(1, $rand);
630 $query =
"SELECT title FROM il_wiki_page".
631 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id,
"integer");
632 $s = $ilDB->query(
$query);
633 $r = $ilDB->fetchAssoc($s);
649 foreach($pages as $k => $page)
668 $query =
"SELECT wiki_id FROM il_wiki_page".
669 " WHERE id = ".$ilDB->quote($a_page_id,
"integer");
670 $set = $ilDB->query(
$query);
671 if($rec = $ilDB->fetchAssoc($set))
673 return $rec[
"wiki_id"];