ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
8 include_once "./Services/Object/classes/class.ilObject.php";
9 include_once "./Modules/Wiki/classes/class.ilWikiUtil.php";
10 include_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 
38  public function __construct($a_id = 0, $a_call_by_reference = true)
39  {
40  global $DIC;
41 
42  $this->db = $DIC->database();
43  $this->user = $DIC->user();
44  $this->type = "wiki";
45  parent::__construct($a_id, $a_call_by_reference);
46  }
47 
53  public function setOnline($a_online)
54  {
55  $this->online = $a_online;
56  }
57 
63  public function getOnline()
64  {
65  return $this->online;
66  }
67 
73  public function setRatingOverall($a_rating)
74  {
75  $this->rating_overall = (bool) $a_rating;
76  }
77 
83  public function getRatingOverall()
84  {
85  return $this->rating_overall;
86  }
87 
93  public function setRating($a_rating)
94  {
95  $this->rating = (bool) $a_rating;
96  }
97 
103  public function getRating()
104  {
105  return $this->rating;
106  }
107 
113  public function setRatingAsBlock($a_rating)
114  {
115  $this->rating_block = (bool) $a_rating;
116  }
117 
123  public function getRatingAsBlock()
124  {
125  return $this->rating_block;
126  }
127 
133  public function setRatingForNewPages($a_rating)
134  {
135  $this->rating_new_pages = (bool) $a_rating;
136  }
137 
143  public function getRatingForNewPages()
144  {
145  return $this->rating_new_pages;
146  }
147 
153  public function setRatingCategories($a_rating)
154  {
155  $this->rating_categories = (bool) $a_rating;
156  }
157 
163  public function getRatingCategories()
164  {
165  return $this->rating_categories;
166  }
167 
171  public function setPublicNotes($a_val)
172  {
173  $this->public_notes = $a_val;
174  }
175 
179  public function getPublicNotes()
180  {
181  return $this->public_notes;
182  }
183 
189  public function setImportantPages($a_val)
190  {
191  $this->imp_pages = $a_val;
192  }
193 
199  public function getImportantPages()
200  {
201  return $this->imp_pages;
202  }
203 
209  public function setStartPage($a_startpage)
210  {
211  $this->startpage = ilWikiUtil::makeDbTitle($a_startpage);
212  }
213 
219  public function getStartPage()
220  {
221  return $this->startpage;
222  }
223 
229  public function setShortTitle($a_shorttitle)
230  {
231  $this->shorttitle = $a_shorttitle;
232  }
233 
239  public function getShortTitle()
240  {
241  return $this->shorttitle;
242  }
243 
249  public function setIntroduction($a_introduction)
250  {
251  $this->introduction = $a_introduction;
252  }
253 
259  public function getIntroduction()
260  {
261  return $this->introduction;
262  }
263 
267  public function getStyleSheetId()
268  {
269  return $this->style_id;
270  }
271 
275  public function setStyleSheetId($a_style_id)
276  {
277  $this->style_id = $a_style_id;
278  }
279 
285  public function setPageToc($a_val)
286  {
287  $this->page_toc = $a_val;
288  }
289 
295  public function getPageToc()
296  {
297  return $this->page_toc;
298  }
299 
305  public function setEmptyPageTemplate($a_val)
306  {
307  $this->empty_page_templ = $a_val;
308  }
309 
315  public function getEmptyPageTemplate()
316  {
318  }
319 
325  public function setLinkMetadataValues($a_val)
326  {
327  $this->link_md_values = $a_val;
328  }
329 
335  public function getLinkMetadataValues()
336  {
337  return $this->link_md_values;
338  }
339 
345  public static function isOnlineHelpWiki($a_ref_id)
346  {
347  if ($a_ref_id > 0 && $a_ref_id == OH_REF_ID) {
348  // return true;
349  }
350  return false;
351  }
352 
356  public function create($a_prevent_start_page_creation = false)
357  {
358  $ilDB = $this->db;
359 
360  parent::create();
361 
362  $ilDB->insert("il_wiki_data", array(
363  "id" => array("integer", $this->getId()),
364  "is_online" => array("integer", (int) $this->getOnline()),
365  "startpage" => array("text", $this->getStartPage()),
366  "short" => array("text", $this->getShortTitle()),
367  "rating" => array("integer", (int) $this->getRating()),
368  "public_notes" => array("integer", (int) $this->getPublicNotes()),
369  "introduction" => array("clob", $this->getIntroduction()),
370  "empty_page_templ" => array("integer", (int) $this->getEmptyPageTemplate()),
371  ));
372 
373  // create start page
374  if ($this->getStartPage() != "" && !$a_prevent_start_page_creation) {
375  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
376  $start_page = new ilWikiPage();
377  $start_page->setWikiId($this->getId());
378  $start_page->setTitle($this->getStartPage());
379  $start_page->create();
380  }
381 
382  if (((int) $this->getStyleSheetId()) > 0) {
383  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
385  }
386  }
387 
394  public function update($a_prevent_start_page_creation = false)
395  {
396  $ilDB = $this->db;
397 
398  if (!parent::update()) {
399  return false;
400  }
401 
402  $ilDB->update("il_wiki_data", array(
403  "is_online" => array("integer", $this->getOnline()),
404  "startpage" => array("text", $this->getStartPage()),
405  "short" => array("text", $this->getShortTitle()),
406  "rating_overall" => array("integer", $this->getRatingOverall()),
407  "rating" => array("integer", $this->getRating()),
408  "rating_side" => array("integer", (bool) $this->getRatingAsBlock()), // #13455
409  "rating_new" => array("integer", $this->getRatingForNewPages()),
410  "rating_ext" => array("integer", $this->getRatingCategories()),
411  "public_notes" => array("integer", $this->getPublicNotes()),
412  "introduction" => array("clob", $this->getIntroduction()),
413  "imp_pages" => array("integer", $this->getImportantPages()),
414  "page_toc" => array("integer", $this->getPageToc()),
415  "link_md_values" => array("integer", $this->getLinkMetadataValues()),
416  "empty_page_templ" => array("integer", $this->getEmptyPageTemplate())
417  ), array(
418  "id" => array("integer", $this->getId())
419  ));
420 
421  // check whether start page exists
422  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
423  if (!ilWikiPage::exists($this->getId(), $this->getStartPage())
424  && !$a_prevent_start_page_creation) {
425  $start_page = new ilWikiPage();
426  $start_page->setWikiId($this->getId());
427  $start_page->setTitle($this->getStartPage());
428  $start_page->create();
429  }
430 
431  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
433 
434  return true;
435  }
436 
440  public function read()
441  {
442  $ilDB = $this->db;
443 
444  parent::read();
445 
446  $query = "SELECT * FROM il_wiki_data WHERE id = " .
447  $ilDB->quote($this->getId(), "integer");
448  $set = $ilDB->query($query);
449  $rec = $ilDB->fetchAssoc($set);
450 
451  $this->setOnline($rec["is_online"]);
452  $this->setStartPage($rec["startpage"]);
453  $this->setShortTitle($rec["short"]);
454  $this->setRatingOverall($rec["rating_overall"]);
455  $this->setRating($rec["rating"]);
456  $this->setRatingAsBlock($rec["rating_side"]);
457  $this->setRatingForNewPages($rec["rating_new"]);
458  $this->setRatingCategories($rec["rating_ext"]);
459  $this->setPublicNotes($rec["public_notes"]);
460  $this->setIntroduction($rec["introduction"]);
461  $this->setImportantPages($rec["imp_pages"]);
462  $this->setPageToc($rec["page_toc"]);
463  $this->setEmptyPageTemplate($rec["empty_page_templ"]);
464  $this->setLinkMetadataValues($rec["link_md_values"]);
465 
466  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
468  }
469 
470 
477  public function delete()
478  {
479  $ilDB = $this->db;
480 
481  // always call parent delete function first!!
482  if (!parent::delete()) {
483  return false;
484  }
485 
486  // delete record of table il_wiki_data
487  $query = "DELETE FROM il_wiki_data" .
488  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
489  $ilDB->manipulate($query);
490 
491  // remove all notifications
492  include_once "./Services/Notification/classes/class.ilNotification.php";
494 
495  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
497 
498  return true;
499  }
500 
504  public static function checkShortTitleAvailability($a_short_title)
505  {
506  global $DIC;
507 
508  $ilDB = $DIC->database();
509 
510  $res = $ilDB->queryF(
511  "SELECT id FROM il_wiki_data WHERE short = %s",
512  array("text"),
513  array($a_short_title)
514  );
515  if ($ilDB->fetchAssoc($res)) {
516  return false;
517  }
518 
519  return true;
520  }
521 
529  public static function _lookupRatingOverall($a_wiki_id)
530  {
531  return ilObjWiki::_lookup($a_wiki_id, "rating_overall");
532  }
533 
541  public static function _lookupRating($a_wiki_id)
542  {
543  return ilObjWiki::_lookup($a_wiki_id, "rating");
544  }
545 
553  public static function _lookupRatingCategories($a_wiki_id)
554  {
555  return ilObjWiki::_lookup($a_wiki_id, "rating_ext");
556  }
557 
565  public static function _lookupRatingAsBlock($a_wiki_id)
566  {
567  return ilObjWiki::_lookup($a_wiki_id, "rating_side");
568  }
569 
577  public static function _lookupPublicNotes($a_wiki_id)
578  {
579  return ilObjWiki::_lookup($a_wiki_id, "public_notes");
580  }
581 
589  public static function _lookupLinkMetadataValues($a_wiki_id)
590  {
591  return ilObjWiki::_lookup($a_wiki_id, "link_md_values");
592  }
593 
602  private static function _lookup($a_wiki_id, $a_field)
603  {
604  global $DIC;
605 
606  $ilDB = $DIC->database();
607 
608  $query = "SELECT $a_field FROM il_wiki_data WHERE id = " .
609  $ilDB->quote($a_wiki_id, "integer");
610  $set = $ilDB->query($query);
611  $rec = $ilDB->fetchAssoc($set);
612  return $rec[$a_field];
613  }
614 
622  public static function _lookupStartPage($a_wiki_id)
623  {
624  return ilObjWiki::_lookup($a_wiki_id, "startpage");
625  }
626 
630  public static function writeStartPage($a_id, $a_name)
631  {
632  global $DIC;
633 
634  $ilDB = $DIC->database();
635 
636  include_once("./Modules/Wiki/classes/class.ilWikiUtil.php");
637  $ilDB->manipulate(
638  "UPDATE il_wiki_data SET " .
639  " startpage = " . $ilDB->quote(ilWikiUtil::makeDbTitle($a_name), "text") .
640  " WHERE id = " . $ilDB->quote($a_id, "integer")
641  );
642  }
643 
647  public static function _performSearch($a_wiki_id, $a_searchterm)
648  {
649  // query parser
650  include_once 'Services/Search/classes/class.ilQueryParser.php';
651 
652  $query_parser = new ilQueryParser($a_searchterm);
653  $query_parser->setCombination("or");
654  $query_parser->parse();
655 
656  include_once 'Services/Search/classes/class.ilSearchResult.php';
657  $search_result = new ilSearchResult();
658  if ($query_parser->validate()) {
659  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
660  $wiki_search = ilObjectSearchFactory::_getWikiContentSearchInstance($query_parser);
661  $wiki_search->setFilter(array('wpg'));
662  $search_result->mergeEntries($wiki_search->performSearch());
663  }
664 
665  $entries = $search_result->getEntries();
666 
667  $found_pages = array();
668  foreach ($entries as $entry) {
669  if ($entry["obj_id"] == $a_wiki_id && is_array($entry["child"])) {
670  foreach ($entry["child"] as $child) {
671  $found_pages[] = array("page_id" => $child);
672  }
673  }
674  }
675 
676  return $found_pages;
677  }
678 
679  //
680  // Important pages
681  //
682 
690  public static function _lookupImportantPages($a_wiki_id)
691  {
692  return ilObjWiki::_lookup($a_wiki_id, "imp_pages");
693  }
694 
701  public static function _lookupImportantPagesList($a_wiki_id)
702  {
703  global $DIC;
704 
705  $ilDB = $DIC->database();
706 
707  $set = $ilDB->query(
708  "SELECT * FROM il_wiki_imp_pages WHERE " .
709  " wiki_id = " . $ilDB->quote($a_wiki_id, "integer") . " ORDER BY ord ASC "
710  );
711 
712  $imp_pages = array();
713 
714  while ($rec = $ilDB->fetchAssoc($set)) {
715  $imp_pages[] = $rec;
716  }
717  return $imp_pages;
718  }
719 
726  public static function _lookupMaxOrdNrImportantPages($a_wiki_id)
727  {
728  global $DIC;
729 
730  $ilDB = $DIC->database();
731 
732  $set = $ilDB->query(
733  "SELECT MAX(ord) as m FROM il_wiki_imp_pages WHERE " .
734  " wiki_id = " . $ilDB->quote($a_wiki_id, "integer")
735  );
736 
737  $rec = $ilDB->fetchAssoc($set);
738  return (int) $rec["m"];
739  }
740 
741 
747  public function addImportantPage($a_page_id, $a_nr = 0, $a_indent = 0)
748  {
749  $ilDB = $this->db;
750 
751  if (!$this->isImportantPage($a_page_id)) {
752  if ($a_nr == 0) {
753  $a_nr = ilObjWiki::_lookupMaxOrdNrImportantPages($this->getId()) + 10;
754  }
755 
756  $ilDB->manipulate("INSERT INTO il_wiki_imp_pages " .
757  "(wiki_id, ord, indent, page_id) VALUES (" .
758  $ilDB->quote($this->getId(), "integer") . "," .
759  $ilDB->quote($a_nr, "integer") . "," .
760  $ilDB->quote($a_indent, "integer") . "," .
761  $ilDB->quote($a_page_id, "integer") .
762  ")");
763  }
764  }
765 
772  public function isImportantPage($a_page_id)
773  {
774  $ilDB = $this->db;
775 
776  $set = $ilDB->query(
777  "SELECT * FROM il_wiki_imp_pages WHERE " .
778  " wiki_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
779  " page_id = " . $ilDB->quote($a_page_id, "integer")
780  );
781  if ($rec = $ilDB->fetchAssoc($set)) {
782  return true;
783  }
784  return false;
785  }
786 
792  public function removeImportantPage($a_id)
793  {
794  $ilDB = $this->db;
795 
796  $ilDB->manipulate(
797  "DELETE FROM il_wiki_imp_pages WHERE "
798  . " wiki_id = " . $ilDB->quote($this->getId(), "integer")
799  . " AND page_id = " . $ilDB->quote($a_id, "integer")
800  );
801 
803  }
804 
811  public function saveOrderingAndIndentation($a_ord, $a_indent)
812  {
813  $ilDB = $this->db;
814 
815  $ipages = ilObjWiki::_lookupImportantPagesList($this->getId());
816 
817  foreach ($ipages as $k => $v) {
818  if (isset($a_ord[$v["page_id"]])) {
819  $ipages[$k]["ord"] = (int) $a_ord[$v["page_id"]];
820  }
821  if (isset($a_indent[$v["page_id"]])) {
822  $ipages[$k]["indent"] = (int) $a_indent[$v["page_id"]];
823  }
824  }
825  $ipages = ilUtil::sortArray($ipages, "ord", "asc", true);
826 
827  // fix indentation: no 2 is allowed after a 0
828  $c_indent = 0;
829  $fixed = false;
830  foreach ($ipages as $k => $v) {
831  if ($ipages[$k]["indent"] == 2 && $c_indent == 0) {
832  $ipages[$k]["indent"] = 1;
833  $fixed = true;
834  }
835  $c_indent = $ipages[$k]["indent"];
836  }
837 
838  $ord = 10;
839  reset($ipages);
840  foreach ($ipages as $k => $v) {
841  $ilDB->manipulate(
842  $q = "UPDATE il_wiki_imp_pages SET " .
843  " ord = " . $ilDB->quote($ord, "integer") . "," .
844  " indent = " . $ilDB->quote($v["indent"], "integer") .
845  " WHERE wiki_id = " . $ilDB->quote($v["wiki_id"], "integer") .
846  " AND page_id = " . $ilDB->quote($v["page_id"], "integer")
847  );
848  $ord+=10;
849  }
850 
851  return $fixed;
852  }
853 
857  public function fixImportantPagesNumbering()
858  {
859  $ilDB = $this->db;
860 
861  $ipages = ilObjWiki::_lookupImportantPagesList($this->getId());
862 
863  // fix indentation: no 2 is allowed after a 0
864  $c_indent = 0;
865  $fixed = false;
866  foreach ($ipages as $k => $v) {
867  if ($ipages[$k]["indent"] == 2 && $c_indent == 0) {
868  $ipages[$k]["indent"] = 1;
869  $fixed = true;
870  }
871  $c_indent = $ipages[$k]["indent"];
872  }
873 
874  $ord = 10;
875  foreach ($ipages as $k => $v) {
876  $ilDB->manipulate(
877  $q = "UPDATE il_wiki_imp_pages SET " .
878  " ord = " . $ilDB->quote($ord, "integer") .
879  ", indent = " . $ilDB->quote($v["indent"], "integer") .
880  " WHERE wiki_id = " . $ilDB->quote($v["wiki_id"], "integer") .
881  " AND page_id = " . $ilDB->quote($v["page_id"], "integer")
882  );
883  $ord+=10;
884  }
885  }
886 
887  //
888  // Page TOC
889  //
890 
898  public static function _lookupPageToc($a_wiki_id)
899  {
900  return ilObjWiki::_lookup($a_wiki_id, "page_toc");
901  }
902 
909  public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
910  {
911  $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
912 
913  //copy online status if object is not the root copy object
914  $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
915 
916  if (!$cp_options->isRootNode($this->getRefId())) {
917  $new_obj->setOnline($this->getOnline());
918  }
919 
920  //$new_obj->setTitle($this->getTitle()); // see #20074
921  $new_obj->setStartPage($this->getStartPage());
922  $new_obj->setShortTitle($this->getShortTitle());
923  $new_obj->setRatingOverall($this->getRatingOverall());
924  $new_obj->setRating($this->getRating());
925  $new_obj->setRatingAsBlock($this->getRatingAsBlock());
926  $new_obj->setRatingForNewPages($this->getRatingForNewPages());
927  $new_obj->setRatingCategories($this->getRatingCategories());
928  $new_obj->setPublicNotes($this->getPublicNotes());
929  $new_obj->setIntroduction($this->getIntroduction());
930  $new_obj->setImportantPages($this->getImportantPages());
931  $new_obj->setPageToc($this->getPageToc());
932  $new_obj->update();
933 
934  // set/copy stylesheet
935  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
936  $style_id = $this->getStyleSheetId();
937  if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
938  $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
939  $new_id = $style_obj->ilClone();
940  $new_obj->setStyleSheetId($new_id);
941  $new_obj->update();
942  }
943 
944  // copy content
945  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
946  $pages = ilWikiPage::getAllWikiPages($this->getId());
947  if (count($pages) > 0) {
948  // if we have any pages, delete the start page first
949  $pg_id = ilWikiPage::getPageIdForTitle($new_obj->getId(), $new_obj->getStartPage());
950  $start_page = new ilWikiPage($pg_id);
951  $start_page->delete();
952  }
953  $map = array();
954  foreach ($pages as $p) {
955  $page = new ilWikiPage($p["id"]);
956  $new_page = new ilWikiPage();
957  $new_page->setTitle($page->getTitle());
958  $new_page->setWikiId($new_obj->getId());
959  $new_page->setTitle($page->getTitle());
960  $new_page->setBlocked($page->getBlocked());
961  $new_page->setRating($page->getRating());
962  $new_page->hideAdvancedMetadata($page->isAdvancedMetadataHidden());
963  $new_page->create();
964 
965  $page->copy($new_page->getId(), "", 0, true);
966  //$new_page->setXMLContent($page->copyXMLContent(true));
967  //$new_page->buildDom(true);
968  //$new_page->update();
969  $map[$p["id"]] = $new_page->getId();
970  }
971 
972  // copy important pages
973  foreach (ilObjWiki::_lookupImportantPagesList($this->getId()) as $ip) {
974  $new_obj->addImportantPage($map[$ip["page_id"]], $ip["ord"], $ip["indent"]);
975  }
976 
977  // copy rating categories
978  include_once("./Services/Rating/classes/class.ilRatingCategory.php");
979  foreach (ilRatingCategory::getAllForObject($this->getId()) as $rc) {
980  $new_rc = new ilRatingCategory();
981  $new_rc->setParentId($new_obj->getId());
982  $new_rc->setTitle($rc["title"]);
983  $new_rc->setDescription($rc["description"]);
984  $new_rc->save();
985  }
986 
987  return $new_obj;
988  }
989 
997  {
998  $num = (int) $this->getEmptyPageTemplate();
999  include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
1000  $wt = new ilWikiPageTemplate($this->getId());
1001  $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES);
1002  $num += count($ts);
1003  if ($num > 1) {
1004  return true;
1005  }
1006  return false;
1007  }
1008 
1016  public function createWikiPage($a_page_title, $a_template_page = 0)
1017  {
1018  // check if template has to be used
1019  if ($a_template_page == 0) {
1020  if (!$this->getEmptyPageTemplate()) {
1021  include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
1022  $wt = new ilWikiPageTemplate($this->getId());
1023  $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES);
1024  if (count($ts) == 1) {
1025  $t = current($ts);
1026  $a_template_page = $t["wpage_id"];
1027  }
1028  }
1029  }
1030 
1031  // create the page
1032  $page = new ilWikiPage();
1033  $page->setWikiId($this->getId());
1034  $page->setTitle(ilWikiUtil::makeDbTitle($a_page_title));
1035  if ($this->getRating() && $this->getRatingForNewPages()) {
1036  $page->setRating(true);
1037  }
1038 
1039  // needed for notification
1040  $page->setWikiRefId($this->getRefId());
1041  $page->create();
1042 
1043  // copy template into new page
1044  if ($a_template_page > 0) {
1045  $orig = new ilWikiPage($a_template_page);
1046  $orig->copy($page->getId());
1047 
1048  // #15718
1049  include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php";
1051  $this->getId(),
1052  $this->getId(),
1053  "wpg",
1054  $a_template_page,
1055  $page->getId()
1056  );
1057  }
1058 
1059  return $page;
1060  }
1061 
1062  public static function getAdvMDSubItemTitle($a_obj_id, $a_sub_type, $a_sub_id)
1063  {
1064  global $DIC;
1065 
1066  $lng = $DIC->language();
1067 
1068  if ($a_sub_type == "wpg") {
1069  $lng->loadLanguageModule("wiki");
1070  include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
1071  return $lng->txt("wiki_wpg") . ' "' . ilWikiPage::lookupTitle($a_sub_id) . '"';
1072  }
1073  }
1074 
1081  public function initUserHTMLExport()
1082  {
1083  $ilDB = $this->db;
1084  $ilUser = $this->user;
1085 
1086  include_once("./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1087 
1088  $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser);
1089  $user_export->initUserHTMLExport();
1090  }
1091 
1098  public function startUserHTMLExport()
1099  {
1100  $ilDB = $this->db;
1101  $ilUser = $this->user;
1102 
1103  include_once("./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1104 
1105  $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser);
1106  $user_export->startUserHTMLExport();
1107  }
1108 
1114  public function getUserHTMLExportProgress()
1115  {
1116  $ilDB = $this->db;
1117  $ilUser = $this->user;
1118 
1119  include_once("./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1120 
1121  $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser);
1122  return $user_export->getProgress();
1123  }
1124 
1128  public function deliverUserHTMLExport()
1129  {
1130  $ilDB = $this->db;
1131  $ilUser = $this->user;
1132 
1133  include_once("./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1134 
1135  $user_export = new ilWikiUserHTMLExport($this, $ilDB, $ilUser);
1136  return $user_export->deliverFile();
1137  }
1138 
1139 
1146  public function decorateAdvMDValue($a_value)
1147  {
1148  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1149  if (ilWikiPage::_wikiPageExists($this->getId(), $a_value)) {
1150  $url = ilObjWikiGUI::getGotoLink($this->getRefId(), $a_value);
1151  return "<a href='" . $url . "'>" . $a_value . "</a>";
1152  }
1153 
1154  return $a_value;
1155  }
1156 }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static getGotoLink($a_ref_id, $a_page="")
Get goto link.
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
static _getWikiContentSearchInstance($query_parser)
get reference of ilFulltextWikiContentSearch
static removeForObject($type, $id)
Remove all notifications for given object.
static _lookupRatingOverall($a_wiki_id)
Lookup whether rating is activated for whole object.
saveOrderingAndIndentation($a_ord, $a_indent)
Save ordering and indentation.
static _lookupImportantPagesList($a_wiki_id)
Get important pages list.
setImportantPages($a_val)
Set important pages.
getRatingOverall()
Get Enable Rating For Object.
__construct($a_id=0, $a_call_by_reference=true)
Constructor public.
update($a_prevent_start_page_creation=false)
update object data
setOnline($a_online)
Set Online.
getUserHTMLExportProgress()
Get user html export progress.
global $DIC
Definition: saml.php:7
initUserHTMLExport()
Init user html export.
getStartPage()
Get Start Page.
setIntroduction($a_introduction)
Set Introduction.
static checkShortTitleAvailability($a_short_title)
Check availability of short title.
getLinkMetadataValues()
Get link md values.
getShortTitle()
Get ShortTitle.
setPublicNotes($a_val)
Set public notes.
static _lookupStartPage($a_wiki_id)
Lookup start page.
deliverUserHTMLExport()
Send user html export file.
static _lookupLinkMetadataValues($a_wiki_id)
Lookup whether metadata should be auto linked.
getPublicNotes()
Get public notes.
startUserHTMLExport()
Start user html export.
getRatingForNewPages()
Get Enable Rating For New Pages.
static _lookupRatingCategories($a_wiki_id)
Lookup whether rating categories are activated.
getRatingCategories()
Get Enable Rating Categories.
static getAllForObject($a_parent_obj_id)
Get all categories for object.
static lookupObjectStyle($a_obj_id)
Lookup object style.
static getPageIdForTitle($a_wiki_id, $a_title)
Get wiki page object for id and title.
setRatingCategories($a_rating)
Set Enable Rating Categories.
user()
Definition: user.php:4
setStyleSheetId($a_style_id)
set ID of assigned style sheet object
isImportantPage($a_page_id)
Is page an important page?
addImportantPage($a_page_id, $a_nr=0, $a_indent=0)
Add important page.
static _lookupStandard($a_id)
Lookup standard flag.
createWikiPage($a_page_title, $a_template_page=0)
Create new wiki page.
Class manages user html export.
static _lookupRating($a_wiki_id)
Lookup whether rating is activated.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
getPageToc()
Get page toc.
static getAdvMDSubItemTitle($a_obj_id, $a_sub_type, $a_sub_id)
setRatingAsBlock($a_rating)
Set Enable Rating Side Block.
static _performSearch($a_wiki_id, $a_searchterm)
Search in Wiki.
fixImportantPagesNumbering()
Fix important pages numbering.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
Interface for repository objects to use adv md with subitems.
getEmptyPageTemplate()
Get empty page template.
setEmptyPageTemplate($a_val)
Set empty page template.
decorateAdvMDValue($a_value)
Decorate adv md value.
foreach($_POST as $key=> $value) $res
getId()
get object id public
static _cloneValues($a_source_id, $a_target_id, $a_sub_type=null, $a_source_sub_id=null, $a_target_sub_id=null)
Clone Advanced Meta Data.
getTemplateSelectionOnCreation()
Get template selection on creation? If more than one template (including empty page template) is acti...
getRatingAsBlock()
Get Enable Rating Side Block.
Class ilObjWiki.
static _lookupRatingAsBlock($a_wiki_id)
Lookup whether rating side block is activated.
static _lookupMaxOrdNrImportantPages($a_wiki_id)
Get important pages list.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone wiki.
getStyleSheetId()
get ID of assigned style sheet object
$ilUser
Definition: imgupload.php:18
Class ilWikiPage.
$query
setShortTitle($a_shorttitle)
Set ShortTitle.
static _lookupPageToc($a_wiki_id)
Lookup whether important pages are activated.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getAllWikiPages($a_wiki_id)
Get all pages of wiki.
static makeDbTitle($a_par)
Handle page GET parameter.
Create styles array
The data for the language used.
setStartPage($a_startpage)
Set Start Page.
setLinkMetadataValues($a_val)
Set link md values.
setRating($a_rating)
Set Enable Rating.
update($pash, $contents, Config $config)
static _lookup($a_wiki_id, $a_field)
Lookup a data field.
static _wikiPageExists($a_wiki_id, $a_title)
Check whether page exists for wiki or not.
read()
Read wiki data.
static exists($a_wiki_id, $a_title)
Checks whether a page with given title exists.
getIntroduction()
Get Introduction.
setRatingForNewPages($a_rating)
Set Enable Rating For New Pages.
global $ilDB
static isOnlineHelpWiki($a_ref_id)
Is wiki an online help wiki?
getRefId()
get reference id public
Class ilRatingCategory.
getImportantPages()
Get important pages.
$url
setRatingOverall($a_rating)
Set Enable Rating For Object.
create($a_prevent_start_page_creation=false)
Create new wiki.
getOnline()
Get Online.
static deleteAllPagesOfWiki($a_wiki_id)
delete wiki page and al related data
getRating()
Get Enable Rating.
static _lookupImportantPages($a_wiki_id)
Lookup whether important pages are activated.
static _lookupPublicNotes($a_wiki_id)
Lookup whether public notes are activated.
setPageToc($a_val)
Set page toc.
static writeStartPage($a_id, $a_name)
Write start page.
removeImportantPage($a_id)
Remove important page.