ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjWiki.php
Go to the documentation of this file.
1 <?php
2 
25 {
26  protected bool $page_toc = false;
27  protected int $style_id = 0;
28  protected string $introduction = "";
29  protected string $shorttitle = "";
30  protected string $startpage = "";
31  protected bool $rating_categories = false;
32  protected bool $rating_new_pages = false;
33  protected bool $rating = false;
34  protected bool $rating_block = false;
35  protected bool $rating_overall = false;
36  protected ilObjUser $user;
37  protected bool $online = false;
38  protected bool $public_notes = true;
39  protected bool $empty_page_templ = true;
40  protected bool $link_md_values = false;
41  protected ilSetting $setting;
42  protected \ILIAS\Style\Content\DomainService $content_style_service;
43 
44  public function __construct(
45  int $a_id = 0,
46  bool $a_call_by_reference = true
47  ) {
48  global $DIC;
49 
50  $this->db = $DIC->database();
51  $this->user = $DIC->user();
52  $this->type = "wiki";
53  $this->setting = $DIC->settings();
54  parent::__construct($a_id, $a_call_by_reference);
55 
56  $this->content_style_service = $DIC
57  ->contentStyle()
58  ->domain();
59  }
60 
61  public function setOnline(bool $a_online): void
62  {
63  $this->online = $a_online;
64  }
65 
66  public function getOnline(): bool
67  {
68  return $this->online;
69  }
70 
71  // Set Enable Rating For Object.
72  public function setRatingOverall(bool $a_rating): void
73  {
74  $this->rating_overall = $a_rating;
75  }
76 
77  public function getRatingOverall(): bool
78  {
79  return $this->rating_overall;
80  }
81 
82  // Set Enable Rating.
83  public function setRating(bool $a_rating): void
84  {
85  $this->rating = $a_rating;
86  }
87 
88  public function getRating(): bool
89  {
90  return $this->rating;
91  }
92 
93  public function setRatingAsBlock(bool $a_rating): void
94  {
95  $this->rating_block = $a_rating;
96  }
97 
98  public function getRatingAsBlock(): bool
99  {
100  return $this->rating_block;
101  }
102 
103  public function setRatingForNewPages(bool $a_rating): void
104  {
105  $this->rating_new_pages = $a_rating;
106  }
107 
108  public function getRatingForNewPages(): bool
109  {
111  }
112 
113  public function setRatingCategories(bool $a_rating): void
114  {
115  $this->rating_categories = $a_rating;
116  }
117 
118  public function getRatingCategories(): bool
119  {
121  }
122 
123  public function setPublicNotes(bool $a_val): void
124  {
125  $this->public_notes = $a_val;
126  }
127 
128  public function getPublicNotes(): bool
129  {
130  return $this->public_notes;
131  }
132 
133  public function setStartPage(string $a_startpage): void
134  {
135  $this->startpage = ilWikiUtil::makeDbTitle($a_startpage);
136  }
137 
138  public function getStartPage(): string
139  {
140  return $this->startpage;
141  }
142 
143  public function setShortTitle(string $a_shorttitle): void
144  {
145  $this->shorttitle = $a_shorttitle;
146  }
147 
148  public function getShortTitle(): string
149  {
150  return $this->shorttitle;
151  }
152 
153  public function setIntroduction(string $a_introduction): void
154  {
155  $this->introduction = $a_introduction;
156  }
157 
158  public function getIntroduction(): string
159  {
160  return $this->introduction;
161  }
162 
163  public function setPageToc(bool $a_val): void
164  {
165  $this->page_toc = $a_val;
166  }
167 
168  public function getPageToc(): bool
169  {
170  return $this->page_toc;
171  }
172 
173  public function setEmptyPageTemplate(bool $a_val): void
174  {
175  $this->empty_page_templ = $a_val;
176  }
177 
178  public function getEmptyPageTemplate(): bool
179  {
181  }
182 
183  public function setLinkMetadataValues(bool $a_val): void
184  {
185  $this->link_md_values = $a_val;
186  }
187 
188  public function getLinkMetadataValues(): bool
189  {
190  return $this->link_md_values;
191  }
192 
193  public function create(
194  bool $a_prevent_start_page_creation = false
195  ): int {
196  $ilDB = $this->db;
197 
198  $id = parent::create();
199 
200  $ilDB->insert("il_wiki_data", array(
201  "id" => array("integer", $this->getId()),
202  "is_online" => array("integer", (int) $this->getOnline()),
203  "startpage" => array("text", $this->getStartPage()),
204  "short" => array("text", $this->getShortTitle()),
205  "rating" => array("integer", (int) $this->getRating()),
206  "public_notes" => array("integer", (int) $this->getPublicNotes()),
207  "introduction" => array("clob", $this->getIntroduction()),
208  "empty_page_templ" => array("integer", (int) $this->getEmptyPageTemplate()),
209  ));
210 
211  // create start page
212  if ($this->getStartPage() !== "" && !$a_prevent_start_page_creation) {
213  $start_page = new ilWikiPage();
214  $start_page->setWikiId($this->getId());
215  $start_page->setTitle($this->getStartPage());
216  $start_page->create();
217  }
218 
219  return $id;
220  }
221 
222  public function update(
223  bool $a_prevent_start_page_creation = false
224  ): bool {
225  $ilDB = $this->db;
226 
227  if (!parent::update()) {
228  return false;
229  }
230 
231  $ilDB->update("il_wiki_data", array(
232  "is_online" => array("integer", $this->getOnline()),
233  "startpage" => array("text", $this->getStartPage()),
234  "short" => array("text", $this->getShortTitle()),
235  "rating_overall" => array("integer", $this->getRatingOverall()),
236  "rating" => array("integer", $this->getRating()),
237  "rating_side" => array("integer", $this->getRatingAsBlock()), // #13455
238  "rating_new" => array("integer", $this->getRatingForNewPages()),
239  "rating_ext" => array("integer", $this->getRatingCategories()),
240  "public_notes" => array("integer", $this->getPublicNotes()),
241  "introduction" => array("clob", $this->getIntroduction()),
242  "page_toc" => array("integer", $this->getPageToc()),
243  "link_md_values" => array("integer", $this->getLinkMetadataValues()),
244  "empty_page_templ" => array("integer", $this->getEmptyPageTemplate())
245  ), array(
246  "id" => array("integer", $this->getId())
247  ));
248 
249  // check whether start page exists
250  if (!ilWikiPage::exists($this->getId(), $this->getStartPage())
251  && !$a_prevent_start_page_creation) {
252  $start_page = new ilWikiPage();
253  $start_page->setWikiId($this->getId());
254  $start_page->setTitle($this->getStartPage());
255  $start_page->create();
256  }
257 
258  return true;
259  }
260 
261  public function read(): void
262  {
263  $ilDB = $this->db;
264 
265  parent::read();
266 
267  $query = "SELECT * FROM il_wiki_data WHERE id = " .
268  $ilDB->quote($this->getId(), "integer");
269  $set = $ilDB->query($query);
270  $rec = $ilDB->fetchAssoc($set);
271 
272  $this->setOnline((bool) $rec["is_online"]);
273  $this->setStartPage((string) $rec["startpage"]);
274  $this->setShortTitle((string) $rec["short"]);
275  $this->setRatingOverall((bool) $rec["rating_overall"]);
276  $this->setRating((bool) $rec["rating"]);
277  $this->setRatingAsBlock((bool) $rec["rating_side"]);
278  $this->setRatingForNewPages((bool) $rec["rating_new"]);
279  $this->setRatingCategories((bool) $rec["rating_ext"]);
280  $this->setPublicNotes((bool) $rec["public_notes"]);
281  $this->setIntroduction((string) $rec["introduction"]);
282  $this->setPageToc((bool) $rec["page_toc"]);
283  $this->setEmptyPageTemplate((bool) $rec["empty_page_templ"]);
284  $this->setLinkMetadataValues((bool) $rec["link_md_values"]);
285  }
286 
287 
291  public function delete(): bool
292  {
293  $ilDB = $this->db;
294 
295  // always call parent delete function first!!
296  if (!parent::delete()) {
297  return false;
298  }
299 
300  // delete record of table il_wiki_data
301  $query = "DELETE FROM il_wiki_data" .
302  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
303  $ilDB->manipulate($query);
304 
305  // remove all notifications
307 
309 
310  return true;
311  }
312 
313  public static function checkShortTitleAvailability(
314  string $a_short_title
315  ): bool {
316  global $DIC;
317  $ilDB = $DIC->database();
318 
319  if ($a_short_title === "") {
320  return true;
321  }
322  $res = $ilDB->queryF(
323  "SELECT id FROM il_wiki_data WHERE short = %s",
324  array("text"),
325  array($a_short_title)
326  );
327  if ($ilDB->fetchAssoc($res)) {
328  return false;
329  }
330 
331  return true;
332  }
333 
337  public static function _lookupRatingOverall(int $a_wiki_id): bool
338  {
339  return (bool) self::_lookup($a_wiki_id, "rating_overall");
340  }
341 
345  public static function _lookupRating(int $a_wiki_id): bool
346  {
347  return (bool) self::_lookup($a_wiki_id, "rating");
348  }
349 
353  public static function _lookupRatingCategories(int $a_wiki_id): bool
354  {
355  return (bool) self::_lookup($a_wiki_id, "rating_ext");
356  }
357 
361  public static function _lookupRatingAsBlock(int $a_wiki_id): bool
362  {
363  return (bool) self::_lookup($a_wiki_id, "rating_side");
364  }
365 
369  public static function _lookupPublicNotes(int $a_wiki_id): bool
370  {
371  return (bool) self::_lookup($a_wiki_id, "public_notes");
372  }
373 
377  public static function _lookupLinkMetadataValues(int $a_wiki_id): bool
378  {
379  return (bool) self::_lookup($a_wiki_id, "link_md_values");
380  }
381 
386  private static function _lookup(int $a_wiki_id, string $a_field)
387  {
388  global $DIC;
389 
390  $ilDB = $DIC->database();
391 
392  $query = "SELECT $a_field FROM il_wiki_data WHERE id = " .
393  $ilDB->quote($a_wiki_id, "integer");
394  $set = $ilDB->query($query);
395  $rec = $ilDB->fetchAssoc($set);
396  return $rec[$a_field] ?? null;
397  }
398 
399  public static function _lookupStartPage(int $a_wiki_id): string
400  {
401  return (string) self::_lookup($a_wiki_id, "startpage");
402  }
403 
404  public static function writeStartPage(int $a_id, string $a_name): void
405  {
406  global $DIC;
407 
408  $ilDB = $DIC->database();
409 
410  $ilDB->manipulate(
411  "UPDATE il_wiki_data SET " .
412  " startpage = " . $ilDB->quote(ilWikiUtil::makeDbTitle($a_name), "text") .
413  " WHERE id = " . $ilDB->quote($a_id, "integer")
414  );
415  }
416 
420  public static function _performSearch(
421  int $a_wiki_id,
422  string $a_searchterm
423  ): array {
424  // query parser
425  $query_parser = new ilQueryParser($a_searchterm);
426  $query_parser->setCombination("or");
427  $query_parser->parse();
428 
429  $search_result = new ilSearchResult();
430  if ($query_parser->validate()) {
431  $wiki_search = ilObjectSearchFactory::_getWikiContentSearchInstance($query_parser);
432  $wiki_search->setFilter(array('wpg'));
433  $r = $wiki_search->performSearch();
434  $search_result->mergeEntries($r);
435  }
436 
437  $entries = $search_result->getEntries();
438 
439  $found_pages = array();
440  foreach ($entries as $entry) {
441  if ($entry["obj_id"] == $a_wiki_id && is_array($entry["child"])) {
442  foreach ($entry["child"] as $child) {
443  $found_pages[] = array("page_id" => $child);
444  }
445  }
446  }
447  return $found_pages;
448  }
449 
450  //
451  // Important pages
452  //
453 
454  public static function _lookupImportantPagesList(int $a_wiki_id): array
455  {
456  global $DIC;
457 
458  $ilDB = $DIC->database();
459 
460  $set = $ilDB->query(
461  "SELECT * FROM il_wiki_imp_pages WHERE " .
462  " wiki_id = " . $ilDB->quote($a_wiki_id, "integer") . " ORDER BY ord ASC "
463  );
464 
465  $imp_pages = array();
466 
467  while ($rec = $ilDB->fetchAssoc($set)) {
468  $imp_pages[] = $rec;
469  }
470  return $imp_pages;
471  }
472 
473  public static function _lookupMaxOrdNrImportantPages(
474  int $a_wiki_id
475  ): int {
476  global $DIC;
477 
478  $ilDB = $DIC->database();
479 
480  $set = $ilDB->query(
481  "SELECT MAX(ord) as m FROM il_wiki_imp_pages WHERE " .
482  " wiki_id = " . $ilDB->quote($a_wiki_id, "integer")
483  );
484 
485  $rec = $ilDB->fetchAssoc($set);
486  return (int) $rec["m"];
487  }
488 
489 
490  public function addImportantPage(
491  int $a_page_id,
492  int $a_nr = 0,
493  int $a_indent = 0
494  ): void {
495  $ilDB = $this->db;
496 
497  if (!$this->isImportantPage($a_page_id)) {
498  if ($a_nr === 0) {
499  $a_nr = self::_lookupMaxOrdNrImportantPages($this->getId()) + 10;
500  }
501 
502  $ilDB->manipulate("INSERT INTO il_wiki_imp_pages " .
503  "(wiki_id, ord, indent, page_id) VALUES (" .
504  $ilDB->quote($this->getId(), "integer") . "," .
505  $ilDB->quote($a_nr, "integer") . "," .
506  $ilDB->quote($a_indent, "integer") . "," .
507  $ilDB->quote($a_page_id, "integer") .
508  ")");
509  }
510  }
511 
512  public function isImportantPage(
513  int $a_page_id
514  ): bool {
515  $ilDB = $this->db;
516 
517  $set = $ilDB->query(
518  "SELECT * FROM il_wiki_imp_pages WHERE " .
519  " wiki_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
520  " page_id = " . $ilDB->quote($a_page_id, "integer")
521  );
522  if ($ilDB->fetchAssoc($set)) {
523  return true;
524  }
525  return false;
526  }
527 
528  public function removeImportantPage(
529  int $a_id
530  ): void {
531  $ilDB = $this->db;
532 
533  $ilDB->manipulate(
534  "DELETE FROM il_wiki_imp_pages WHERE "
535  . " wiki_id = " . $ilDB->quote($this->getId(), "integer")
536  . " AND page_id = " . $ilDB->quote($a_id, "integer")
537  );
538 
540  }
541 
542  public function saveOrderingAndIndentation(
543  array $a_ord,
544  array $a_indent
545  ): bool {
546  $ilDB = $this->db;
547 
548  $ipages = self::_lookupImportantPagesList($this->getId());
549 
550  foreach ($ipages as $k => $v) {
551  if (isset($a_ord[$v["page_id"]])) {
552  $ipages[$k]["ord"] = (int) $a_ord[$v["page_id"]];
553  }
554  if (isset($a_indent[$v["page_id"]])) {
555  $ipages[$k]["indent"] = (int) $a_indent[$v["page_id"]];
556  }
557  }
558  $ipages = ilArrayUtil::sortArray($ipages, "ord", "asc", true);
559 
560  // fix indentation: no 2 is allowed after a 0
561  $c_indent = 0;
562  $fixed = false;
563  foreach ($ipages as $k => $v) {
564  if ($v["indent"] == 2 && $c_indent == 0) {
565  $ipages[$k]["indent"] = 1;
566  $fixed = true;
567  }
568  $c_indent = $ipages[$k]["indent"];
569  }
570 
571  $ord = 10;
572  reset($ipages);
573  foreach ($ipages as $k => $v) {
574  $ilDB->manipulate(
575  $q = "UPDATE il_wiki_imp_pages SET " .
576  " ord = " . $ilDB->quote($ord, "integer") . "," .
577  " indent = " . $ilDB->quote($v["indent"], "integer") .
578  " WHERE wiki_id = " . $ilDB->quote($v["wiki_id"], "integer") .
579  " AND page_id = " . $ilDB->quote($v["page_id"], "integer")
580  );
581  $ord += 10;
582  }
583 
584  return $fixed;
585  }
586 
587  public function fixImportantPagesNumbering(): void
588  {
589  $ilDB = $this->db;
590 
591  $ipages = self::_lookupImportantPagesList($this->getId());
592 
593  // fix indentation: no 2 is allowed after a 0
594  $c_indent = 0;
595  foreach ($ipages as $k => $v) {
596  if ($v["indent"] == 2 && $c_indent == 0) {
597  $ipages[$k]["indent"] = 1;
598  }
599  $c_indent = $ipages[$k]["indent"];
600  }
601 
602  $ord = 10;
603  foreach ($ipages as $k => $v) {
604  $ilDB->manipulate(
605  $q = "UPDATE il_wiki_imp_pages SET " .
606  " ord = " . $ilDB->quote($ord, "integer") .
607  ", indent = " . $ilDB->quote($v["indent"], "integer") .
608  " WHERE wiki_id = " . $ilDB->quote($v["wiki_id"], "integer") .
609  " AND page_id = " . $ilDB->quote($v["page_id"], "integer")
610  );
611  $ord += 10;
612  }
613  }
614 
615  //
616  // Page TOC
617  //
618 
619  public static function _lookupPageToc(
620  int $a_wiki_id
621  ): bool {
622  return (bool) self::_lookup($a_wiki_id, "page_toc");
623  }
624 
625  public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree = false): ?ilObject
626  {
627  $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
628 
629  // Custom meta data activation is stored in a container setting
631  $new_obj->getId(),
634  $this->getId(),
636  0
637  )
638  );
639 
640  //copy online status if object is not the root copy object
641  $cp_options = ilCopyWizardOptions::_getInstance($copy_id);
642 
643  if (!$cp_options->isRootNode($this->getRefId())) {
644  $new_obj->setOnline($this->getOnline());
645  }
646 
647  //$new_obj->setTitle($this->getTitle()); // see #20074
648  $new_obj->setStartPage($this->getStartPage());
649  $new_obj->setShortTitle($this->getShortTitle());
650  $new_obj->setRatingOverall($this->getRatingOverall());
651  $new_obj->setRating($this->getRating());
652  $new_obj->setRatingAsBlock($this->getRatingAsBlock());
653  $new_obj->setRatingForNewPages($this->getRatingForNewPages());
654  $new_obj->setRatingCategories($this->getRatingCategories());
655  $new_obj->setPublicNotes($this->getPublicNotes());
656  $new_obj->setIntroduction($this->getIntroduction());
657  $new_obj->setPageToc($this->getPageToc());
658  $new_obj->update();
659 
660  $this->content_style_service
661  ->styleForRefId($this->getRefId())
662  ->cloneTo($new_obj->getId());
663 
664  // copy content
665  $pages = ilWikiPage::getAllWikiPages($this->getId());
666  if (count($pages) > 0) {
667  // if we have any pages, delete the start page first
668  $pg_id = ilWikiPage::getPageIdForTitle($new_obj->getId(), $new_obj->getStartPage());
669  $start_page = new ilWikiPage($pg_id);
670  $start_page->delete();
671  }
672  $map = array();
673  foreach ($pages as $p) {
674  $page = new ilWikiPage($p["id"]);
675  $new_page = new ilWikiPage();
676  $new_page->setTitle($page->getTitle());
677  $new_page->setWikiId($new_obj->getId());
678  $new_page->setTitle($page->getTitle());
679  $new_page->setBlocked($page->getBlocked());
680  $new_page->setRating($page->getRating());
681  $new_page->hideAdvancedMetadata($page->isAdvancedMetadataHidden());
682  $new_page->create();
683 
684  $page->copy($new_page->getId(), "", 0, true);
685  //$new_page->setXMLContent($page->copyXMLContent(true));
686  //$new_page->buildDom(true);
687  //$new_page->update();
688  $map[$p["id"]] = $new_page->getId();
689 
691  $copy_id,
692  $this->getId(),
693  $new_obj->getId(),
694  "wpg",
695  (int) $p["id"],
696  $new_page->getId(),
697  );
698  }
699 
700  // copy important pages
701  foreach (self::_lookupImportantPagesList($this->getId()) as $ip) {
702  $new_obj->addImportantPage($map[$ip["page_id"]], $ip["ord"], $ip["indent"]);
703  }
704  $this->updateInternalLinksOnCopy($map);
705 
706  // copy rating categories
707  foreach (ilRatingCategory::getAllForObject($this->getId()) as $rc) {
708  $new_rc = new ilRatingCategory();
709  $new_rc->setParentId($new_obj->getId());
710  $new_rc->setTitle((string) $rc["title"]);
711  $new_rc->setDescription((string) $rc["description"]);
712  $new_rc->save();
713  }
714 
715  return $new_obj;
716  }
717 
718  protected function updateInternalLinksOnCopy(array $map) : void
719  {
720  foreach ($map as $old_page_id => $new_page_id) {
721  // get links with targets inside the wiki
723  "wpg:pg",
724  $old_page_id,
725  "-"
726  );
727  foreach ($targets as $t) {
728  if ((int) $t["inst"] === 0 && in_array($t["type"], ["wpag", "wpage"]) && isset($map[(int) $t["id"]])) {
729  $new_page = new ilWikiPage($new_page_id);
730  if ($new_page->moveIntLinks([$t["id"] => $map[(int) $t["id"]]])) {
731  $new_page->update(true, true);
732  }
733  }
734  }
735  }
736  }
737 
743  public function getTemplateSelectionOnCreation(): bool
744  {
745  $num = (int) $this->getEmptyPageTemplate();
746  $wt = new ilWikiPageTemplate($this->getId());
747  $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES);
748  $num += count($ts);
749  if ($num > 1) {
750  return true;
751  }
752  return false;
753  }
754 
758  public function createWikiPage(
759  string $a_page_title,
760  int $a_template_page = 0
761  ): ilWikiPage {
762  // check if template has to be used
763  if ($a_template_page === 0) {
764  if (!$this->getEmptyPageTemplate()) {
765  $wt = new ilWikiPageTemplate($this->getId());
766  $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES);
767  if (count($ts) === 1) {
768  $t = current($ts);
769  $a_template_page = $t["wpage_id"];
770  }
771  }
772  }
773 
774  // create the page
775  $page = new ilWikiPage();
776  $page->setWikiId($this->getId());
777  $page->setTitle(ilWikiUtil::makeDbTitle($a_page_title));
778  if ($this->getRating() && $this->getRatingForNewPages()) {
779  $page->setRating(true);
780  }
781 
782  // needed for notification
783  $page->setWikiRefId($this->getRefId());
784  $page->create();
785 
786  // copy template into new page
787  if ($a_template_page > 0) {
788  $orig = new ilWikiPage($a_template_page);
789  $orig->copy($page->getId());
790 
791  // #15718
793  0,
794  $this->getId(),
795  $this->getId(),
796  "wpg",
797  $a_template_page,
798  $page->getId()
799  );
800  }
801 
802  return $page;
803  }
804 
805  public static function getAdvMDSubItemTitle(
806  int $a_obj_id,
807  string $a_sub_type,
808  int $a_sub_id
809  ): string {
810  global $DIC;
811 
812  $lng = $DIC->language();
813 
814  if ($a_sub_type === "wpg") {
815  $lng->loadLanguageModule("wiki");
816  return $lng->txt("wiki_wpg") . ' "' . ilWikiPage::lookupTitle($a_sub_id) . '"';
817  }
818  return "";
819  }
820 
821  public function initUserHTMLExport(
822  bool $with_comments = false
823  ): void {
824  $ilDB = $this->db;
826 
827  $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser, $with_comments);
828  $user_export->initUserHTMLExport();
829  }
830 
831  public function startUserHTMLExport(
832  bool $with_comments = false
833  ): void {
834  $ilDB = $this->db;
836 
837  $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser, $with_comments);
838  $user_export->startUserHTMLExport();
839  }
840 
845  public function getUserHTMLExportProgress(
846  bool $with_comments = false
847  ): array {
848  $ilDB = $this->db;
850 
851  $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser, $with_comments);
852  return $user_export->getProgress();
853  }
854 
855  public function deliverUserHTMLExport(
856  bool $with_comments = false
857  ): void {
858  $ilDB = $this->db;
860 
861  $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser, $with_comments);
862  $user_export->deliverFile();
863  }
864 
865 
871  public function decorateAdvMDValue(string $a_value): string
872  {
873  if (ilWikiPage::_wikiPageExists($this->getId(), $a_value)) {
874  $url = ilObjWikiGUI::getGotoLink($this->getRefId(), $a_value);
875  return "<a href='" . $url . "'>" . $a_value . "</a>";
876  }
877 
878  return $a_value;
879  }
880 
884  public function isCommentsExportPossible(): bool
885  {
886  $setting = $this->setting;
887  $privacy = ilPrivacySettings::getInstance();
888  if ($setting->get("disable_comments")) {
889  return false;
890  }
891 
892  if (!$this->getPublicNotes()) {
893  return false;
894  }
895  if (!$privacy->enabledCommentsExport()) {
896  return false;
897  }
898  return true;
899  }
900 }
setOnline(bool $a_online)
bool $rating_categories
$res
Definition: ltiservices.php:69
setStartPage(string $a_startpage)
setPageToc(bool $a_val)
bool $public_notes
get(string $a_keyword, ?string $a_default_value=null)
get setting
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setRatingOverall(bool $a_rating)
string $shorttitle
__construct(int $a_id=0, bool $a_call_by_reference=true)
setRatingAsBlock(bool $a_rating)
static _lookupRatingAsBlock(int $a_wiki_id)
Lookup whether rating side block is activated.
ilSetting $setting
initUserHTMLExport(bool $with_comments=false)
static _lookup(int $a_wiki_id, string $a_field)
Lookup a data field.
static _getWikiContentSearchInstance(ilQueryParser $query_parser)
static _lookupPageToc(int $a_wiki_id)
static _lookupMaxOrdNrImportantPages(int $a_wiki_id)
update(bool $a_prevent_start_page_creation=false)
isImportantPage(int $a_page_id)
create(bool $a_prevent_start_page_creation=false)
$target_id
Definition: goto.php:52
static _performSearch(int $a_wiki_id, string $a_searchterm)
Search in Wiki.
loadLanguageModule(string $a_module)
Load language module.
static _lookupRatingCategories(int $a_wiki_id)
Lookup whether rating categories are activated.
static getAllWikiPages(int $a_wiki_id)
setLinkMetadataValues(bool $a_val)
static getAdvMDSubItemTitle(int $a_obj_id, string $a_sub_type, int $a_sub_id)
updateInternalLinksOnCopy(array $map)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
bool $link_md_values
static _lookupImportantPagesList(int $a_wiki_id)
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
isCommentsExportPossible()
Is export possible.
Class manages user html export.
global $DIC
Definition: feed.php:28
static _lookupRating(int $a_wiki_id)
Lookup whether rating is activated.
ilObjUser $user
createWikiPage(string $a_page_title, int $a_template_page=0)
Create new wiki page.
static getPageIdForTitle(int $a_wiki_id, string $a_title)
Get wiki page object for id and title.
getUserHTMLExportProgress(bool $with_comments=false)
Get user html export progress.
addImportantPage(int $a_page_id, int $a_nr=0, int $a_indent=0)
setRatingCategories(bool $a_rating)
static checkShortTitleAvailability(string $a_short_title)
fixImportantPagesNumbering()
string $startpage
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTemplateSelectionOnCreation()
Get template selection on creation? If more than one template (including empty page template) is acti...
setPublicNotes(bool $a_val)
ilLanguage $lng
startUserHTMLExport(bool $with_comments=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilDBInterface $db
static getAllForObject(int $a_parent_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static writeStartPage(int $a_id, string $a_name)
static _lookupStartPage(int $a_wiki_id)
decorateAdvMDValue(string $a_value)
Decorate adv md value.
$query
static deleteAllPagesOfWiki(int $a_wiki_id)
saveOrderingAndIndentation(array $a_ord, array $a_indent)
setEmptyPageTemplate(bool $a_val)
static getGotoLink(int $a_ref_id, string $a_page="")
string $introduction
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
setRating(bool $a_rating)
removeImportantPage(int $a_id)
bool $rating_new_pages
static lookupTitle(int $a_page_id)
ILIAS Style Content DomainService $content_style_service
static _cloneValues(int $copy_id, int $a_source_id, int $a_target_id, ?string $a_sub_type=null, ?int $a_source_sub_id=null, ?int $a_target_sub_id=null)
Clone Advanced Meta Data.
setRatingForNewPages(bool $a_rating)
static makeDbTitle(string $a_par)
__construct(Container $dic, ilPlugin $plugin)
$ilUser
Definition: imgupload.php:34
static _wikiPageExists(int $a_wiki_id, string $a_title)
static _lookupRatingOverall(int $a_wiki_id)
Lookup whether rating is activated for whole object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static removeForObject(int $type, int $id)
Remove all notifications for given object.
static _lookupPublicNotes(int $a_wiki_id)
Lookup whether public notes are activated.
static _lookupLinkMetadataValues(int $a_wiki_id)
Lookup whether metadata should be auto linked.
setIntroduction(string $a_introduction)
$url
static _getInstance(int $a_copy_id)
setShortTitle(string $a_shorttitle)
bool $rating_overall
deliverUserHTMLExport(bool $with_comments=false)
static exists(int $a_wiki_id, string $a_title)
Checks whether a page with given title exists.
cloneObject(int $target_id, int $copy_id=0, bool $omit_tree=false)
bool $empty_page_templ
bool $rating_block
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)