ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjWiki.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4
8include_once "./Services/Object/classes/class.ilObject.php";
9include_once "./Modules/Wiki/classes/class.ilWikiUtil.php";
10include_once "./Services/AdvancedMetaData/interfaces/interface.ilAdvancedMetaDataSubItems.php";
11
21{
25 protected $user;
26
27 protected $online = false;
28 protected $public_notes = true;
29 protected $empty_page_templ = true;
30 protected $link_md_values = false;
31
35 protected $setting;
36
43 public function __construct($a_id = 0, $a_call_by_reference = true)
44 {
45 global $DIC;
46
47 $this->db = $DIC->database();
48 $this->user = $DIC->user();
49 $this->type = "wiki";
50 $this->setting = $DIC->settings();
51 parent::__construct($a_id, $a_call_by_reference);
52 }
53
59 public function setOnline($a_online)
60 {
61 $this->online = $a_online;
62 }
63
69 public function getOnline()
70 {
71 return $this->online;
72 }
73
79 public function setRatingOverall($a_rating)
80 {
81 $this->rating_overall = (bool) $a_rating;
82 }
83
89 public function getRatingOverall()
90 {
91 return $this->rating_overall;
92 }
93
99 public function setRating($a_rating)
100 {
101 $this->rating = (bool) $a_rating;
102 }
103
109 public function getRating()
110 {
111 return $this->rating;
112 }
113
119 public function setRatingAsBlock($a_rating)
120 {
121 $this->rating_block = (bool) $a_rating;
122 }
123
129 public function getRatingAsBlock()
130 {
131 return $this->rating_block;
132 }
133
139 public function setRatingForNewPages($a_rating)
140 {
141 $this->rating_new_pages = (bool) $a_rating;
142 }
143
149 public function getRatingForNewPages()
150 {
151 return $this->rating_new_pages;
152 }
153
159 public function setRatingCategories($a_rating)
160 {
161 $this->rating_categories = (bool) $a_rating;
162 }
163
169 public function getRatingCategories()
170 {
171 return $this->rating_categories;
172 }
173
177 public function setPublicNotes($a_val)
178 {
179 $this->public_notes = $a_val;
180 }
181
185 public function getPublicNotes()
186 {
187 return $this->public_notes;
188 }
189
195 public function setImportantPages($a_val)
196 {
197 $this->imp_pages = $a_val;
198 }
199
205 public function getImportantPages()
206 {
207 return $this->imp_pages;
208 }
209
215 public function setStartPage($a_startpage)
216 {
217 $this->startpage = ilWikiUtil::makeDbTitle($a_startpage);
218 }
219
225 public function getStartPage()
226 {
227 return $this->startpage;
228 }
229
235 public function setShortTitle($a_shorttitle)
236 {
237 $this->shorttitle = $a_shorttitle;
238 }
239
245 public function getShortTitle()
246 {
247 return $this->shorttitle;
248 }
249
255 public function setIntroduction($a_introduction)
256 {
257 $this->introduction = $a_introduction;
258 }
259
265 public function getIntroduction()
266 {
267 return $this->introduction;
268 }
269
273 public function getStyleSheetId()
274 {
275 return $this->style_id;
276 }
277
281 public function setStyleSheetId($a_style_id)
282 {
283 $this->style_id = $a_style_id;
284 }
285
291 public function setPageToc($a_val)
292 {
293 $this->page_toc = $a_val;
294 }
295
301 public function getPageToc()
302 {
303 return $this->page_toc;
304 }
305
311 public function setEmptyPageTemplate($a_val)
312 {
313 $this->empty_page_templ = $a_val;
314 }
315
321 public function getEmptyPageTemplate()
322 {
324 }
325
331 public function setLinkMetadataValues($a_val)
332 {
333 $this->link_md_values = $a_val;
334 }
335
341 public function getLinkMetadataValues()
342 {
344 }
345
351 public static function isOnlineHelpWiki($a_ref_id)
352 {
353 if ($a_ref_id > 0 && $a_ref_id == OH_REF_ID) {
354 // return true;
355 }
356 return false;
357 }
358
362 public function create($a_prevent_start_page_creation = false)
363 {
365
366 parent::create();
367
368 $ilDB->insert("il_wiki_data", array(
369 "id" => array("integer", $this->getId()),
370 "is_online" => array("integer", (int) $this->getOnline()),
371 "startpage" => array("text", $this->getStartPage()),
372 "short" => array("text", $this->getShortTitle()),
373 "rating" => array("integer", (int) $this->getRating()),
374 "public_notes" => array("integer", (int) $this->getPublicNotes()),
375 "introduction" => array("clob", $this->getIntroduction()),
376 "empty_page_templ" => array("integer", (int) $this->getEmptyPageTemplate()),
377 ));
378
379 // create start page
380 if ($this->getStartPage() != "" && !$a_prevent_start_page_creation) {
381 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
382 $start_page = new ilWikiPage();
383 $start_page->setWikiId($this->getId());
384 $start_page->setTitle($this->getStartPage());
385 $start_page->create();
386 }
387
388 if (((int) $this->getStyleSheetId()) > 0) {
389 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
391 }
392 }
393
400 public function update($a_prevent_start_page_creation = false)
401 {
403
404 if (!parent::update()) {
405 return false;
406 }
407
408 $ilDB->update("il_wiki_data", array(
409 "is_online" => array("integer", $this->getOnline()),
410 "startpage" => array("text", $this->getStartPage()),
411 "short" => array("text", $this->getShortTitle()),
412 "rating_overall" => array("integer", $this->getRatingOverall()),
413 "rating" => array("integer", $this->getRating()),
414 "rating_side" => array("integer", (bool) $this->getRatingAsBlock()), // #13455
415 "rating_new" => array("integer", $this->getRatingForNewPages()),
416 "rating_ext" => array("integer", $this->getRatingCategories()),
417 "public_notes" => array("integer", $this->getPublicNotes()),
418 "introduction" => array("clob", $this->getIntroduction()),
419 "imp_pages" => array("integer", $this->getImportantPages()),
420 "page_toc" => array("integer", $this->getPageToc()),
421 "link_md_values" => array("integer", $this->getLinkMetadataValues()),
422 "empty_page_templ" => array("integer", $this->getEmptyPageTemplate())
423 ), array(
424 "id" => array("integer", $this->getId())
425 ));
426
427 // check whether start page exists
428 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
429 if (!ilWikiPage::exists($this->getId(), $this->getStartPage())
430 && !$a_prevent_start_page_creation) {
431 $start_page = new ilWikiPage();
432 $start_page->setWikiId($this->getId());
433 $start_page->setTitle($this->getStartPage());
434 $start_page->create();
435 }
436
437 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
439
440 return true;
441 }
442
446 public function read()
447 {
449
450 parent::read();
451
452 $query = "SELECT * FROM il_wiki_data WHERE id = " .
453 $ilDB->quote($this->getId(), "integer");
454 $set = $ilDB->query($query);
455 $rec = $ilDB->fetchAssoc($set);
456
457 $this->setOnline($rec["is_online"]);
458 $this->setStartPage($rec["startpage"]);
459 $this->setShortTitle($rec["short"]);
460 $this->setRatingOverall($rec["rating_overall"]);
461 $this->setRating($rec["rating"]);
462 $this->setRatingAsBlock($rec["rating_side"]);
463 $this->setRatingForNewPages($rec["rating_new"]);
464 $this->setRatingCategories($rec["rating_ext"]);
465 $this->setPublicNotes($rec["public_notes"]);
466 $this->setIntroduction($rec["introduction"]);
467 $this->setImportantPages($rec["imp_pages"]);
468 $this->setPageToc($rec["page_toc"]);
469 $this->setEmptyPageTemplate($rec["empty_page_templ"]);
470 $this->setLinkMetadataValues($rec["link_md_values"]);
471
472 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
474 }
475
476
483 public function delete()
484 {
486
487 // always call parent delete function first!!
488 if (!parent::delete()) {
489 return false;
490 }
491
492 // delete record of table il_wiki_data
493 $query = "DELETE FROM il_wiki_data" .
494 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
495 $ilDB->manipulate($query);
496
497 // remove all notifications
498 include_once "./Services/Notification/classes/class.ilNotification.php";
500
501 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
503
504 return true;
505 }
506
510 public static function checkShortTitleAvailability($a_short_title)
511 {
512 global $DIC;
513
514 $ilDB = $DIC->database();
515
516 $res = $ilDB->queryF(
517 "SELECT id FROM il_wiki_data WHERE short = %s",
518 array("text"),
519 array($a_short_title)
520 );
521 if ($ilDB->fetchAssoc($res)) {
522 return false;
523 }
524
525 return true;
526 }
527
535 public static function _lookupRatingOverall($a_wiki_id)
536 {
537 return ilObjWiki::_lookup($a_wiki_id, "rating_overall");
538 }
539
547 public static function _lookupRating($a_wiki_id)
548 {
549 return ilObjWiki::_lookup($a_wiki_id, "rating");
550 }
551
559 public static function _lookupRatingCategories($a_wiki_id)
560 {
561 return ilObjWiki::_lookup($a_wiki_id, "rating_ext");
562 }
563
571 public static function _lookupRatingAsBlock($a_wiki_id)
572 {
573 return ilObjWiki::_lookup($a_wiki_id, "rating_side");
574 }
575
583 public static function _lookupPublicNotes($a_wiki_id)
584 {
585 return ilObjWiki::_lookup($a_wiki_id, "public_notes");
586 }
587
595 public static function _lookupLinkMetadataValues($a_wiki_id)
596 {
597 return ilObjWiki::_lookup($a_wiki_id, "link_md_values");
598 }
599
608 private static function _lookup($a_wiki_id, $a_field)
609 {
610 global $DIC;
611
612 $ilDB = $DIC->database();
613
614 $query = "SELECT $a_field FROM il_wiki_data WHERE id = " .
615 $ilDB->quote($a_wiki_id, "integer");
616 $set = $ilDB->query($query);
617 $rec = $ilDB->fetchAssoc($set);
618 return $rec[$a_field];
619 }
620
628 public static function _lookupStartPage($a_wiki_id)
629 {
630 return ilObjWiki::_lookup($a_wiki_id, "startpage");
631 }
632
636 public static function writeStartPage($a_id, $a_name)
637 {
638 global $DIC;
639
640 $ilDB = $DIC->database();
641
642 include_once("./Modules/Wiki/classes/class.ilWikiUtil.php");
643 $ilDB->manipulate(
644 "UPDATE il_wiki_data SET " .
645 " startpage = " . $ilDB->quote(ilWikiUtil::makeDbTitle($a_name), "text") .
646 " WHERE id = " . $ilDB->quote($a_id, "integer")
647 );
648 }
649
653 public static function _performSearch($a_wiki_id, $a_searchterm)
654 {
655 // query parser
656 include_once 'Services/Search/classes/class.ilQueryParser.php';
657
658 $query_parser = new ilQueryParser($a_searchterm);
659 $query_parser->setCombination("or");
660 $query_parser->parse();
661
662 include_once 'Services/Search/classes/class.ilSearchResult.php';
663 $search_result = new ilSearchResult();
664 if ($query_parser->validate()) {
665 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
666 $wiki_search = ilObjectSearchFactory::_getWikiContentSearchInstance($query_parser);
667 $wiki_search->setFilter(array('wpg'));
668 $search_result->mergeEntries($wiki_search->performSearch());
669 }
670
671 $entries = $search_result->getEntries();
672
673 $found_pages = array();
674 foreach ($entries as $entry) {
675 if ($entry["obj_id"] == $a_wiki_id && is_array($entry["child"])) {
676 foreach ($entry["child"] as $child) {
677 $found_pages[] = array("page_id" => $child);
678 }
679 }
680 }
681
682 return $found_pages;
683 }
684
685 //
686 // Important pages
687 //
688
696 public static function _lookupImportantPages($a_wiki_id)
697 {
698 return ilObjWiki::_lookup($a_wiki_id, "imp_pages");
699 }
700
707 public static function _lookupImportantPagesList($a_wiki_id)
708 {
709 global $DIC;
710
711 $ilDB = $DIC->database();
712
713 $set = $ilDB->query(
714 "SELECT * FROM il_wiki_imp_pages WHERE " .
715 " wiki_id = " . $ilDB->quote($a_wiki_id, "integer") . " ORDER BY ord ASC "
716 );
717
718 $imp_pages = array();
719
720 while ($rec = $ilDB->fetchAssoc($set)) {
721 $imp_pages[] = $rec;
722 }
723 return $imp_pages;
724 }
725
732 public static function _lookupMaxOrdNrImportantPages($a_wiki_id)
733 {
734 global $DIC;
735
736 $ilDB = $DIC->database();
737
738 $set = $ilDB->query(
739 "SELECT MAX(ord) as m FROM il_wiki_imp_pages WHERE " .
740 " wiki_id = " . $ilDB->quote($a_wiki_id, "integer")
741 );
742
743 $rec = $ilDB->fetchAssoc($set);
744 return (int) $rec["m"];
745 }
746
747
753 public function addImportantPage($a_page_id, $a_nr = 0, $a_indent = 0)
754 {
756
757 if (!$this->isImportantPage($a_page_id)) {
758 if ($a_nr == 0) {
759 $a_nr = ilObjWiki::_lookupMaxOrdNrImportantPages($this->getId()) + 10;
760 }
761
762 $ilDB->manipulate("INSERT INTO il_wiki_imp_pages " .
763 "(wiki_id, ord, indent, page_id) VALUES (" .
764 $ilDB->quote($this->getId(), "integer") . "," .
765 $ilDB->quote($a_nr, "integer") . "," .
766 $ilDB->quote($a_indent, "integer") . "," .
767 $ilDB->quote($a_page_id, "integer") .
768 ")");
769 }
770 }
771
778 public function isImportantPage($a_page_id)
779 {
781
782 $set = $ilDB->query(
783 "SELECT * FROM il_wiki_imp_pages WHERE " .
784 " wiki_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
785 " page_id = " . $ilDB->quote($a_page_id, "integer")
786 );
787 if ($rec = $ilDB->fetchAssoc($set)) {
788 return true;
789 }
790 return false;
791 }
792
798 public function removeImportantPage($a_id)
799 {
801
802 $ilDB->manipulate(
803 "DELETE FROM il_wiki_imp_pages WHERE "
804 . " wiki_id = " . $ilDB->quote($this->getId(), "integer")
805 . " AND page_id = " . $ilDB->quote($a_id, "integer")
806 );
807
809 }
810
817 public function saveOrderingAndIndentation($a_ord, $a_indent)
818 {
820
822
823 foreach ($ipages as $k => $v) {
824 if (isset($a_ord[$v["page_id"]])) {
825 $ipages[$k]["ord"] = (int) $a_ord[$v["page_id"]];
826 }
827 if (isset($a_indent[$v["page_id"]])) {
828 $ipages[$k]["indent"] = (int) $a_indent[$v["page_id"]];
829 }
830 }
831 $ipages = ilUtil::sortArray($ipages, "ord", "asc", true);
832
833 // fix indentation: no 2 is allowed after a 0
834 $c_indent = 0;
835 $fixed = false;
836 foreach ($ipages as $k => $v) {
837 if ($ipages[$k]["indent"] == 2 && $c_indent == 0) {
838 $ipages[$k]["indent"] = 1;
839 $fixed = true;
840 }
841 $c_indent = $ipages[$k]["indent"];
842 }
843
844 $ord = 10;
845 reset($ipages);
846 foreach ($ipages as $k => $v) {
847 $ilDB->manipulate(
848 $q = "UPDATE il_wiki_imp_pages SET " .
849 " ord = " . $ilDB->quote($ord, "integer") . "," .
850 " indent = " . $ilDB->quote($v["indent"], "integer") .
851 " WHERE wiki_id = " . $ilDB->quote($v["wiki_id"], "integer") .
852 " AND page_id = " . $ilDB->quote($v["page_id"], "integer")
853 );
854 $ord += 10;
855 }
856
857 return $fixed;
858 }
859
864 {
866
868
869 // fix indentation: no 2 is allowed after a 0
870 $c_indent = 0;
871 $fixed = false;
872 foreach ($ipages as $k => $v) {
873 if ($ipages[$k]["indent"] == 2 && $c_indent == 0) {
874 $ipages[$k]["indent"] = 1;
875 $fixed = true;
876 }
877 $c_indent = $ipages[$k]["indent"];
878 }
879
880 $ord = 10;
881 foreach ($ipages as $k => $v) {
882 $ilDB->manipulate(
883 $q = "UPDATE il_wiki_imp_pages SET " .
884 " ord = " . $ilDB->quote($ord, "integer") .
885 ", indent = " . $ilDB->quote($v["indent"], "integer") .
886 " WHERE wiki_id = " . $ilDB->quote($v["wiki_id"], "integer") .
887 " AND page_id = " . $ilDB->quote($v["page_id"], "integer")
888 );
889 $ord += 10;
890 }
891 }
892
893 //
894 // Page TOC
895 //
896
904 public static function _lookupPageToc($a_wiki_id)
905 {
906 return ilObjWiki::_lookup($a_wiki_id, "page_toc");
907 }
908
915 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
916 {
917 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
918
919 // Custom meta data activation is stored in a container setting
921 $new_obj->getId(),
924 $this->getId(),
926 0
927 )
928 );
929
930 //copy online status if object is not the root copy object
931 $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
932
933 if (!$cp_options->isRootNode($this->getRefId())) {
934 $new_obj->setOnline($this->getOnline());
935 }
936
937 //$new_obj->setTitle($this->getTitle()); // see #20074
938 $new_obj->setStartPage($this->getStartPage());
939 $new_obj->setShortTitle($this->getShortTitle());
940 $new_obj->setRatingOverall($this->getRatingOverall());
941 $new_obj->setRating($this->getRating());
942 $new_obj->setRatingAsBlock($this->getRatingAsBlock());
943 $new_obj->setRatingForNewPages($this->getRatingForNewPages());
944 $new_obj->setRatingCategories($this->getRatingCategories());
945 $new_obj->setPublicNotes($this->getPublicNotes());
946 $new_obj->setIntroduction($this->getIntroduction());
947 $new_obj->setImportantPages($this->getImportantPages());
948 $new_obj->setPageToc($this->getPageToc());
949 $new_obj->update();
950
951 // set/copy stylesheet
952 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
953 $style_id = $this->getStyleSheetId();
954 if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
955 $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
956 $new_id = $style_obj->ilClone();
957 $new_obj->setStyleSheetId($new_id);
958 $new_obj->update();
959 }
960
961 // copy content
962 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
963 $pages = ilWikiPage::getAllWikiPages($this->getId());
964 if (count($pages) > 0) {
965 // if we have any pages, delete the start page first
966 $pg_id = ilWikiPage::getPageIdForTitle($new_obj->getId(), $new_obj->getStartPage());
967 $start_page = new ilWikiPage($pg_id);
968 $start_page->delete();
969 }
970 $map = array();
971 foreach ($pages as $p) {
972 $page = new ilWikiPage($p["id"]);
973 $new_page = new ilWikiPage();
974 $new_page->setTitle($page->getTitle());
975 $new_page->setWikiId($new_obj->getId());
976 $new_page->setTitle($page->getTitle());
977 $new_page->setBlocked($page->getBlocked());
978 $new_page->setRating($page->getRating());
979 $new_page->hideAdvancedMetadata($page->isAdvancedMetadataHidden());
980 $new_page->create();
981
982 $page->copy($new_page->getId(), "", 0, true);
983 //$new_page->setXMLContent($page->copyXMLContent(true));
984 //$new_page->buildDom(true);
985 //$new_page->update();
986 $map[$p["id"]] = $new_page->getId();
987
989 $this->getId(),
990 $new_obj->getId(),
991 "wpg",
992 $p["id"],
993 $new_page->getId(),
994 true
995 );
996 }
997
998 // copy important pages
999 foreach (ilObjWiki::_lookupImportantPagesList($this->getId()) as $ip) {
1000 $new_obj->addImportantPage($map[$ip["page_id"]], $ip["ord"], $ip["indent"]);
1001 }
1002 $this->updateInternalLinksOnCopy($map);
1003
1004 // copy rating categories
1005 include_once("./Services/Rating/classes/class.ilRatingCategory.php");
1006 foreach (ilRatingCategory::getAllForObject($this->getId()) as $rc) {
1007 $new_rc = new ilRatingCategory();
1008 $new_rc->setParentId($new_obj->getId());
1009 $new_rc->setTitle($rc["title"]);
1010 $new_rc->setDescription($rc["description"]);
1011 $new_rc->save();
1012 }
1013
1014 return $new_obj;
1015 }
1016
1017 protected function updateInternalLinksOnCopy(array $map) : void
1018 {
1019 foreach ($map as $old_page_id => $new_page_id) {
1020 // get links with targets inside the wiki
1022 "wpg:pg",
1023 $old_page_id,
1024 "-"
1025 );
1026 foreach ($targets as $t) {
1027 if ((int) $t["inst"] === 0 && $t["type"] === "wpag" && isset($map[(int) $t["id"]])) {
1028 $new_page = new ilWikiPage($new_page_id);
1029 if ($new_page->moveIntLinks([$t["id"] => $map[(int) $t["id"]]])) {
1030 $new_page->update(true, true);
1031 }
1032 }
1033 }
1034 }
1035 }
1036
1044 {
1045 $num = (int) $this->getEmptyPageTemplate();
1046 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
1047 $wt = new ilWikiPageTemplate($this->getId());
1048 $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES);
1049 $num += count($ts);
1050 if ($num > 1) {
1051 return true;
1052 }
1053 return false;
1054 }
1055
1063 public function createWikiPage($a_page_title, $a_template_page = 0)
1064 {
1065 // check if template has to be used
1066 if ($a_template_page == 0) {
1067 if (!$this->getEmptyPageTemplate()) {
1068 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
1069 $wt = new ilWikiPageTemplate($this->getId());
1070 $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES);
1071 if (count($ts) == 1) {
1072 $t = current($ts);
1073 $a_template_page = $t["wpage_id"];
1074 }
1075 }
1076 }
1077
1078 // create the page
1079 $page = new ilWikiPage();
1080 $page->setWikiId($this->getId());
1081 $page->setTitle(ilWikiUtil::makeDbTitle($a_page_title));
1082 if ($this->getRating() && $this->getRatingForNewPages()) {
1083 $page->setRating(true);
1084 }
1085
1086 // needed for notification
1087 $page->setWikiRefId($this->getRefId());
1088 $page->create();
1089
1090 // copy template into new page
1091 if ($a_template_page > 0) {
1092 $orig = new ilWikiPage($a_template_page);
1093 $orig->copy($page->getId());
1094
1095 // #15718
1096 include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php";
1098 $this->getId(),
1099 $this->getId(),
1100 "wpg",
1101 $a_template_page,
1102 $page->getId()
1103 );
1104 }
1105
1106 return $page;
1107 }
1108
1109 public static function getAdvMDSubItemTitle($a_obj_id, $a_sub_type, $a_sub_id)
1110 {
1111 global $DIC;
1112
1113 $lng = $DIC->language();
1114
1115 if ($a_sub_type == "wpg") {
1116 $lng->loadLanguageModule("wiki");
1117 include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
1118 return $lng->txt("wiki_wpg") . ' "' . ilWikiPage::lookupTitle($a_sub_id) . '"';
1119 }
1120 }
1121
1128 public function initUserHTMLExport($with_comments = false)
1129 {
1130 $ilDB = $this->db;
1132
1133 include_once("./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1134
1135 $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser, $with_comments);
1136 $user_export->initUserHTMLExport();
1137 }
1138
1145 public function startUserHTMLExport($with_comments = false)
1146 {
1147 $ilDB = $this->db;
1149
1150 include_once("./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1151
1152 $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser, $with_comments);
1153 $user_export->startUserHTMLExport();
1154 }
1155
1161 public function getUserHTMLExportProgress($with_comments = false)
1162 {
1163 $ilDB = $this->db;
1165
1166 include_once("./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1167
1168 $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser, $with_comments);
1169 return $user_export->getProgress();
1170 }
1171
1175 public function deliverUserHTMLExport($with_comments = false)
1176 {
1177 $ilDB = $this->db;
1179
1180 include_once("./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1181
1182 $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser, $with_comments);
1183 $user_export->deliverFile();
1184 }
1185
1186
1193 public function decorateAdvMDValue($a_value)
1194 {
1195 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1196 if (ilWikiPage::_wikiPageExists($this->getId(), $a_value)) {
1197 $url = ilObjWikiGUI::getGotoLink($this->getRefId(), $a_value);
1198 return "<a href='" . $url . "'>" . $a_value . "</a>";
1199 }
1200
1201 return $a_value;
1202 }
1203
1209 {
1212 if ($setting->get("disable_comments")) {
1213 return false;
1214 }
1215
1216 if (!$this->getPublicNotes()) {
1217 return false;
1218 }
1219 if (!$privacy->enabledCommentsExport()) {
1220 return false;
1221 }
1222 return true;
1223 }
1224}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
static _cloneValues($a_source_id, $a_target_id, $a_sub_type=null, $a_source_sub_id=null, $a_target_sub_id=null, $use_stored_record_map=false)
Clone Advanced Meta Data.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static removeForObject($type, $id)
Remove all notifications for given object.
static _lookupStandard($a_id)
Lookup standard flag.
static lookupObjectStyle($a_obj_id)
Lookup object style.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
static getGotoLink($a_ref_id, $a_page="")
Get goto link.
Class ilObjWiki.
getRating()
Get Enable Rating.
isCommentsExportPossible()
Is export possible.
getRatingAsBlock()
Get Enable Rating Side Block.
static _lookupPublicNotes($a_wiki_id)
Lookup whether public notes are activated.
getStartPage()
Get Start Page.
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
createWikiPage($a_page_title, $a_template_page=0)
Create new wiki page.
removeImportantPage($a_id)
Remove important page.
setRatingAsBlock($a_rating)
Set Enable Rating Side Block.
getEmptyPageTemplate()
Get empty page template.
static _lookupRatingOverall($a_wiki_id)
Lookup whether rating is activated for whole object.
getLinkMetadataValues()
Get link md values.
setRatingOverall($a_rating)
Set Enable Rating For Object.
static _lookupRatingCategories($a_wiki_id)
Lookup whether rating categories are activated.
static _performSearch($a_wiki_id, $a_searchterm)
Search in Wiki.
static getAdvMDSubItemTitle($a_obj_id, $a_sub_type, $a_sub_id)
addImportantPage($a_page_id, $a_nr=0, $a_indent=0)
Add important page.
setPageToc($a_val)
Set page toc.
startUserHTMLExport($with_comments=false)
Start user html export.
setShortTitle($a_shorttitle)
Set ShortTitle.
saveOrderingAndIndentation($a_ord, $a_indent)
Save ordering and indentation.
read()
Read wiki data.
static isOnlineHelpWiki($a_ref_id)
Is wiki an online help wiki?
getPublicNotes()
Get public notes.
setStartPage($a_startpage)
Set Start Page.
getShortTitle()
Get ShortTitle.
getOnline()
Get Online.
static _lookupPageToc($a_wiki_id)
Lookup whether important pages are activated.
isImportantPage($a_page_id)
Is page an important page?
create($a_prevent_start_page_creation=false)
Create new wiki.
getIntroduction()
Get Introduction.
getUserHTMLExportProgress($with_comments=false)
Get user html export progress.
setOnline($a_online)
Set Online.
initUserHTMLExport($with_comments=false)
Init user html export.
static _lookupLinkMetadataValues($a_wiki_id)
Lookup whether metadata should be auto linked.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone wiki.
getStyleSheetId()
get ID of assigned style sheet object
static _lookupImportantPagesList($a_wiki_id)
Get important pages list.
setEmptyPageTemplate($a_val)
Set empty page template.
fixImportantPagesNumbering()
Fix important pages numbering.
getRatingOverall()
Get Enable Rating For Object.
updateInternalLinksOnCopy(array $map)
decorateAdvMDValue($a_value)
Decorate adv md value.
getTemplateSelectionOnCreation()
Get template selection on creation? If more than one template (including empty page template) is acti...
setStyleSheetId($a_style_id)
set ID of assigned style sheet object
setImportantPages($a_val)
Set important pages.
static writeStartPage($a_id, $a_name)
Write start page.
setIntroduction($a_introduction)
Set Introduction.
static checkShortTitleAvailability($a_short_title)
Check availability of short title.
static _lookupRatingAsBlock($a_wiki_id)
Lookup whether rating side block is activated.
static _lookupStartPage($a_wiki_id)
Lookup start page.
getRatingForNewPages()
Get Enable Rating For New Pages.
getImportantPages()
Get important pages.
update($a_prevent_start_page_creation=false)
update object data
setRatingCategories($a_rating)
Set Enable Rating Categories.
setRatingForNewPages($a_rating)
Set Enable Rating For New Pages.
deliverUserHTMLExport($with_comments=false)
Send user html export file.
setLinkMetadataValues($a_val)
Set link md values.
setRating($a_rating)
Set Enable Rating.
getPageToc()
Get page toc.
static _lookupMaxOrdNrImportantPages($a_wiki_id)
Get important pages list.
static _lookupRating($a_wiki_id)
Lookup whether rating is activated.
static _lookupImportantPages($a_wiki_id)
Lookup whether important pages are activated.
getRatingCategories()
Get Enable Rating Categories.
setPublicNotes($a_val)
Set public notes.
static _lookup($a_wiki_id, $a_field)
Lookup a data field.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _getWikiContentSearchInstance($query_parser)
get reference of ilFulltextWikiContentSearch
Class ilObject Basic functions for all objects.
getRefId()
get reference id @access public
getId()
get object id @access public
static _getInstance()
Get instance of ilPrivacySettings.
Class ilRatingCategory.
static getAllForObject($a_parent_obj_id)
Get all categories for object.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
Class ilWikiPage.
static deleteAllPagesOfWiki($a_wiki_id)
delete wiki page and al related data
static exists($a_wiki_id, $a_title)
Checks whether a page with given title exists.
static getPageIdForTitle($a_wiki_id, $a_title)
Get wiki page object for id and title.
static _wikiPageExists($a_wiki_id, $a_title)
Check whether page exists for wiki or not.
static getAllWikiPages($a_wiki_id)
Get all pages of wiki.
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
Class manages user html export.
static makeDbTitle($a_par)
Handle page GET parameter.
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
Interface for repository objects to use adv md with subitems.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$query
$url
foreach($_POST as $key=> $value) $res
global $ilDB