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()),
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()),
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())
246 "id" => array(
"integer", $this->
getId())
251 && !$a_prevent_start_page_creation) {
253 $start_page->setWikiId($this->
getId());
254 $start_page->setTitle($this->getStartPage());
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"]);
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"]);
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
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)
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");
411 "UPDATE il_wiki_data SET " .
413 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
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);
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)) {
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"];
497 if (!$this->isImportantPage($a_page_id)) {
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")
539 $this->fixImportantPagesNumbering();
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())) {
644 $new_obj->setOnline($this->getOnline());
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());
660 $this->content_style_service
661 ->styleForRefId($this->getRefId())
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"]);
704 $this->updateInternalLinksOnCopy($map);
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);
745 $num = (
int) $this->getEmptyPageTemplate();
759 string $a_page_title,
760 int $a_template_page = 0
763 if ($a_template_page === 0) {
764 if (!$this->getEmptyPageTemplate()) {
767 if (count($ts) === 1) {
769 $a_template_page = $t[
"wpage_id"];
776 $page->setWikiId($this->
getId());
778 if ($this->getRating() && $this->getRatingForNewPages()) {
779 $page->setRating(
true);
783 $page->setWikiRefId($this->getRefId());
787 if ($a_template_page > 0) {
789 $orig->copy($page->getId());
814 if ($a_sub_type ===
"wpg") {
815 $lng->loadLanguageModule(
"wiki");
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>";
886 $setting = $this->setting;
888 if ($setting->
get(
"disable_comments")) {
892 if (!$this->getPublicNotes()) {
895 if (!$privacy->enabledCommentsExport()) {
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.
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
static _getInstance(int $a_copy_id)
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)
static removeForObject(int $type, int $id)
Remove all notifications for given object.
static getGotoLink(int $a_ref_id, string $a_page="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLinkMetadataValues(bool $a_val)
decorateAdvMDValue(string $a_value)
Decorate adv md value.
setRatingAsBlock(bool $a_rating)
static checkShortTitleAvailability(string $a_short_title)
static _lookupRating(int $a_wiki_id)
Lookup whether rating is activated.
isCommentsExportPossible()
Is export possible.
setRating(bool $a_rating)
static _lookupPageToc(int $a_wiki_id)
static writeStartPage(int $a_id, string $a_name)
setOnline(bool $a_online)
static _lookupStartPage(int $a_wiki_id)
ILIAS Style Content DomainService $content_style_service
removeImportantPage(int $a_id)
static _performSearch(int $a_wiki_id, string $a_searchterm)
Search in Wiki.
setStartPage(string $a_startpage)
setIntroduction(string $a_introduction)
setEmptyPageTemplate(bool $a_val)
deliverUserHTMLExport(bool $with_comments=false)
isImportantPage(int $a_page_id)
saveOrderingAndIndentation(array $a_ord, array $a_indent)
getUserHTMLExportProgress(bool $with_comments=false)
Get user html export progress.
update(bool $a_prevent_start_page_creation=false)
setRatingForNewPages(bool $a_rating)
fixImportantPagesNumbering()
static _lookupPublicNotes(int $a_wiki_id)
Lookup whether public notes are activated.
updateInternalLinksOnCopy(array $map)
static _lookupRatingCategories(int $a_wiki_id)
Lookup whether rating categories are activated.
static _lookupImportantPagesList(int $a_wiki_id)
static _lookupMaxOrdNrImportantPages(int $a_wiki_id)
static _lookupRatingAsBlock(int $a_wiki_id)
Lookup whether rating side block is activated.
getTemplateSelectionOnCreation()
Get template selection on creation? If more than one template (including empty page template) is acti...
setPublicNotes(bool $a_val)
cloneObject(int $target_id, int $copy_id=0, bool $omit_tree=false)
static _lookupLinkMetadataValues(int $a_wiki_id)
Lookup whether metadata should be auto linked.
setShortTitle(string $a_shorttitle)
create(bool $a_prevent_start_page_creation=false)
addImportantPage(int $a_page_id, int $a_nr=0, int $a_indent=0)
setRatingOverall(bool $a_rating)
setRatingCategories(bool $a_rating)
createWikiPage(string $a_page_title, int $a_template_page=0)
Create new wiki page.
__construct(int $a_id=0, bool $a_call_by_reference=true)
startUserHTMLExport(bool $with_comments=false)
static _lookup(int $a_wiki_id, string $a_field)
Lookup a data field.
static getAdvMDSubItemTitle(int $a_obj_id, string $a_sub_type, int $a_sub_id)
static _lookupRatingOverall(int $a_wiki_id)
Lookup whether rating is activated for whole object.
initUserHTMLExport(bool $with_comments=false)
static _getWikiContentSearchInstance(ilQueryParser $query_parser)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setCombination(string $a_combination)
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...
get(string $a_keyword, ?string $a_default_value=null)
get setting
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllWikiPages(int $a_wiki_id)
static exists(int $a_wiki_id, string $a_title)
Checks whether a page with given title exists.
static getPageIdForTitle(int $a_wiki_id, string $a_title)
Get wiki page object for id and title.
static deleteAllPagesOfWiki(int $a_wiki_id)
static _wikiPageExists(int $a_wiki_id, string $a_title)
static lookupTitle(int $a_page_id)
Class manages user html export.
static makeDbTitle(string $a_par)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc