46 bool $a_call_by_reference =
true 50 $this->db = $DIC->database();
51 $this->
user = $DIC->user();
53 $this->setting = $DIC->settings();
56 $this->content_style_service = $DIC
63 $this->online = $a_online;
74 $this->rating_overall = $a_rating;
85 $this->rating = $a_rating;
95 $this->rating_block = $a_rating;
105 $this->rating_new_pages = $a_rating;
115 $this->rating_categories = $a_rating;
125 $this->public_notes = $a_val;
145 $this->shorttitle = $a_shorttitle;
155 $this->introduction = $a_introduction;
165 $this->page_toc = $a_val;
175 $this->empty_page_templ = $a_val;
185 $this->link_md_values = $a_val;
194 bool $a_prevent_start_page_creation =
false 198 $id = parent::create();
200 $ilDB->insert(
"il_wiki_data", array(
201 "id" => array(
"integer", $this->
getId()),
202 "is_online" => array(
"integer", (
int) $this->
getOnline()),
205 "rating" => array(
"integer", (
int) $this->
getRating()),
206 "public_notes" => array(
"integer", (
int) $this->
getPublicNotes()),
212 if ($this->
getStartPage() !==
"" && !$a_prevent_start_page_creation) {
214 $start_page->setWikiId($this->
getId());
216 $start_page->create();
223 bool $a_prevent_start_page_creation =
false 227 if (!parent::update()) {
231 $ilDB->update(
"il_wiki_data", array(
232 "is_online" => array(
"integer", $this->
getOnline()),
236 "rating" => array(
"integer", $this->
getRating()),
242 "page_toc" => array(
"integer", $this->
getPageToc()),
246 "id" => array(
"integer", $this->
getId())
251 && !$a_prevent_start_page_creation) {
253 $start_page->setWikiId($this->
getId());
255 $start_page->create();
267 $query =
"SELECT * FROM il_wiki_data WHERE id = " .
270 $rec =
$ilDB->fetchAssoc($set);
272 $this->
setOnline((
bool) $rec[
"is_online"]);
291 public function delete():
bool 296 if (!parent::delete()) {
301 $query =
"DELETE FROM il_wiki_data" .
302 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
314 string $a_short_title
317 $ilDB = $DIC->database();
319 if ($a_short_title ===
"") {
323 "SELECT id FROM il_wiki_data WHERE short = %s",
325 array($a_short_title)
339 return (
bool) self::_lookup($a_wiki_id,
"rating_overall");
347 return (
bool) self::_lookup($a_wiki_id,
"rating");
355 return (
bool) self::_lookup($a_wiki_id,
"rating_ext");
363 return (
bool) self::_lookup($a_wiki_id,
"rating_side");
371 return (
bool) self::_lookup($a_wiki_id,
"public_notes");
379 return (
bool) self::_lookup($a_wiki_id,
"link_md_values");
386 private static function _lookup(
int $a_wiki_id,
string $a_field)
390 $ilDB = $DIC->database();
392 $query =
"SELECT $a_field FROM il_wiki_data WHERE id = " .
393 $ilDB->quote($a_wiki_id,
"integer");
395 $rec =
$ilDB->fetchAssoc($set);
396 return $rec[$a_field] ?? null;
401 return (
string) self::_lookup($a_wiki_id,
"startpage");
408 $ilDB = $DIC->database();
411 "UPDATE il_wiki_data SET " .
413 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
426 $query_parser->setCombination(
"or");
427 $query_parser->parse();
430 if ($query_parser->validate()) {
432 $wiki_search->setFilter(array(
'wpg'));
433 $r = $wiki_search->performSearch();
434 $search_result->mergeEntries($r);
437 $entries = $search_result->getEntries();
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);
458 $ilDB = $DIC->database();
461 "SELECT * FROM il_wiki_imp_pages WHERE " .
462 " wiki_id = " .
$ilDB->quote($a_wiki_id,
"integer") .
" ORDER BY ord ASC " 465 $imp_pages = array();
467 while ($rec =
$ilDB->fetchAssoc($set)) {
478 $ilDB = $DIC->database();
481 "SELECT MAX(ord) as m FROM il_wiki_imp_pages WHERE " .
482 " wiki_id = " .
$ilDB->quote($a_wiki_id,
"integer")
485 $rec =
$ilDB->fetchAssoc($set);
486 return (
int) $rec[
"m"];
499 $a_nr = self::_lookupMaxOrdNrImportantPages($this->
getId()) + 10;
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") .
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")
522 if (
$ilDB->fetchAssoc($set)) {
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")
548 $ipages = self::_lookupImportantPagesList($this->
getId());
550 foreach ($ipages as $k => $v) {
551 if (isset($a_ord[$v[
"page_id"]])) {
552 $ipages[$k][
"ord"] = (
int) $a_ord[$v[
"page_id"]];
554 if (isset($a_indent[$v[
"page_id"]])) {
555 $ipages[$k][
"indent"] = (
int) $a_indent[$v[
"page_id"]];
563 foreach ($ipages as $k => $v) {
564 if ($v[
"indent"] == 2 && $c_indent == 0) {
565 $ipages[$k][
"indent"] = 1;
568 $c_indent = $ipages[$k][
"indent"];
573 foreach ($ipages as $k => $v) {
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")
591 $ipages = self::_lookupImportantPagesList($this->
getId());
595 foreach ($ipages as $k => $v) {
596 if ($v[
"indent"] == 2 && $c_indent == 0) {
597 $ipages[$k][
"indent"] = 1;
599 $c_indent = $ipages[$k][
"indent"];
603 foreach ($ipages as $k => $v) {
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")
622 return (
bool) self::_lookup($a_wiki_id,
"page_toc");
627 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
643 if (!$cp_options->isRootNode($this->getRefId())) {
660 $this->content_style_service
662 ->cloneTo($new_obj->getId());
666 if (count($pages) > 0) {
670 $start_page->delete();
673 foreach ($pages as $p) {
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());
684 $page->copy($new_page->getId(),
"", 0,
true);
688 $map[$p[
"id"]] = $new_page->getId();
701 foreach (self::_lookupImportantPagesList($this->
getId()) as $ip) {
702 $new_obj->addImportantPage($map[$ip[
"page_id"]], $ip[
"ord"], $ip[
"indent"]);
709 $new_rc->setParentId($new_obj->getId());
710 $new_rc->setTitle((
string) $rc[
"title"]);
711 $new_rc->setDescription((
string) $rc[
"description"]);
720 foreach ($map as $old_page_id => $new_page_id) {
727 foreach ($targets as $t) {
728 if ((
int) $t[
"inst"] === 0 && in_array($t[
"type"], [
"wpag",
"wpage"]) && isset($map[(
int) $t[
"id"]])) {
730 if ($new_page->moveIntLinks([$t[
"id"] => $map[(
int) $t[
"id"]]])) {
731 $new_page->update(
true,
true);
759 string $a_page_title,
760 int $a_template_page = 0
763 if ($a_template_page === 0) {
767 if (count($ts) === 1) {
769 $a_template_page = $t[
"wpage_id"];
776 $page->setWikiId($this->
getId());
779 $page->setRating(
true);
783 $page->setWikiRefId($this->
getRefId());
787 if ($a_template_page > 0) {
789 $orig->copy($page->getId());
812 $lng = $DIC->language();
814 if ($a_sub_type ===
"wpg") {
822 bool $with_comments =
false 828 $user_export->initUserHTMLExport();
832 bool $with_comments =
false 838 $user_export->startUserHTMLExport();
846 bool $with_comments =
false 852 return $user_export->getProgress();
856 bool $with_comments =
false 862 $user_export->deliverFile();
875 return "<a href='" .
$url .
"'>" . $a_value .
"</a>";
888 if ($setting->
get(
"disable_comments")) {
895 if (!$privacy->enabledCommentsExport()) {
setOnline(bool $a_online)
static _getTargetsOfSource(string $a_source_type, int $a_source_id, string $a_source_lang="-")
Get all targets of a source object (e.g., a page)
setStartPage(string $a_startpage)
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)
__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.
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)
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...
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.
static _lookupRating(int $a_wiki_id)
Lookup whether rating is activated.
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()
getTemplateSelectionOnCreation()
Get template selection on creation? If more than one template (including empty page template) is acti...
setPublicNotes(bool $a_val)
startUserHTMLExport(bool $with_comments=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
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="")
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
setRating(bool $a_rating)
removeImportantPage(int $a_id)
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)
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)
static _getInstance(int $a_copy_id)
setShortTitle(string $a_shorttitle)
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)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)