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";
43 public function __construct($a_id = 0, $a_call_by_reference =
true)
47 $this->db = $DIC->database();
48 $this->
user = $DIC->user();
50 $this->setting = $DIC->settings();
61 $this->online = $a_online;
81 $this->rating_overall = (bool) $a_rating;
91 return $this->rating_overall;
101 $this->rating = (bool) $a_rating;
111 return $this->rating;
121 $this->rating_block = (bool) $a_rating;
131 return $this->rating_block;
141 $this->rating_new_pages = (bool) $a_rating;
151 return $this->rating_new_pages;
161 $this->rating_categories = (bool) $a_rating;
171 return $this->rating_categories;
179 $this->public_notes = $a_val;
197 $this->imp_pages = $a_val;
207 return $this->imp_pages;
227 return $this->startpage;
237 $this->shorttitle = $a_shorttitle;
247 return $this->shorttitle;
257 $this->introduction = $a_introduction;
267 return $this->introduction;
275 return $this->style_id;
283 $this->style_id = $a_style_id;
293 $this->page_toc = $a_val;
303 return $this->page_toc;
313 $this->empty_page_templ = $a_val;
333 $this->link_md_values = $a_val;
353 if ($a_ref_id > 0 && $a_ref_id == OH_REF_ID) {
362 public function create($a_prevent_start_page_creation =
false)
368 $ilDB->insert(
"il_wiki_data", array(
369 "id" => array(
"integer", $this->
getId()),
370 "is_online" => array(
"integer", (
int) $this->
getOnline()),
373 "rating" => array(
"integer", (
int) $this->
getRating()),
374 "public_notes" => array(
"integer", (
int) $this->
getPublicNotes()),
380 if ($this->
getStartPage() !=
"" && !$a_prevent_start_page_creation) {
381 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
383 $start_page->setWikiId($this->
getId());
385 $start_page->create();
389 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
400 public function update($a_prevent_start_page_creation =
false)
404 if (!parent::update()) {
408 $ilDB->update(
"il_wiki_data", array(
409 "is_online" => array(
"integer", $this->
getOnline()),
413 "rating" => array(
"integer", $this->
getRating()),
420 "page_toc" => array(
"integer", $this->
getPageToc()),
424 "id" => array(
"integer", $this->
getId())
428 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
430 && !$a_prevent_start_page_creation) {
432 $start_page->setWikiId($this->
getId());
434 $start_page->create();
437 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
452 $query =
"SELECT * FROM il_wiki_data WHERE id = " .
455 $rec =
$ilDB->fetchAssoc($set);
472 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
483 public function delete()
488 if (!parent::delete()) {
493 $query =
"DELETE FROM il_wiki_data" .
494 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
498 include_once
"./Services/Notification/classes/class.ilNotification.php";
501 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
514 $ilDB = $DIC->database();
517 "SELECT id FROM il_wiki_data WHERE short = %s",
519 array($a_short_title)
608 private static function _lookup($a_wiki_id, $a_field)
612 $ilDB = $DIC->database();
614 $query =
"SELECT $a_field FROM il_wiki_data WHERE id = " .
615 $ilDB->quote($a_wiki_id,
"integer");
617 $rec =
$ilDB->fetchAssoc($set);
618 return $rec[$a_field];
640 $ilDB = $DIC->database();
642 include_once(
"./Modules/Wiki/classes/class.ilWikiUtil.php");
644 "UPDATE il_wiki_data SET " .
646 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
656 include_once
'Services/Search/classes/class.ilQueryParser.php';
659 $query_parser->setCombination(
"or");
660 $query_parser->parse();
662 include_once
'Services/Search/classes/class.ilSearchResult.php';
664 if ($query_parser->validate()) {
665 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
667 $wiki_search->setFilter(array(
'wpg'));
668 $search_result->mergeEntries($wiki_search->performSearch());
671 $entries = $search_result->getEntries();
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);
711 $ilDB = $DIC->database();
714 "SELECT * FROM il_wiki_imp_pages WHERE " .
715 " wiki_id = " .
$ilDB->quote($a_wiki_id,
"integer") .
" ORDER BY ord ASC " 718 $imp_pages = array();
720 while ($rec =
$ilDB->fetchAssoc($set)) {
736 $ilDB = $DIC->database();
739 "SELECT MAX(ord) as m FROM il_wiki_imp_pages WHERE " .
740 " wiki_id = " .
$ilDB->quote($a_wiki_id,
"integer")
743 $rec =
$ilDB->fetchAssoc($set);
744 return (
int) $rec[
"m"];
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") .
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")
787 if ($rec =
$ilDB->fetchAssoc($set)) {
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")
823 foreach ($ipages as $k => $v) {
824 if (isset($a_ord[$v[
"page_id"]])) {
825 $ipages[$k][
"ord"] = (int) $a_ord[$v[
"page_id"]];
827 if (isset($a_indent[$v[
"page_id"]])) {
828 $ipages[$k][
"indent"] = (int) $a_indent[$v[
"page_id"]];
836 foreach ($ipages as $k => $v) {
837 if ($ipages[$k][
"indent"] == 2 && $c_indent == 0) {
838 $ipages[$k][
"indent"] = 1;
841 $c_indent = $ipages[$k][
"indent"];
846 foreach ($ipages as $k => $v) {
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")
872 foreach ($ipages as $k => $v) {
873 if ($ipages[$k][
"indent"] == 2 && $c_indent == 0) {
874 $ipages[$k][
"indent"] = 1;
877 $c_indent = $ipages[$k][
"indent"];
881 foreach ($ipages as $k => $v) {
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")
915 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
917 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
933 if (!$cp_options->isRootNode($this->getRefId())) {
952 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
956 $new_id = $style_obj->ilClone();
957 $new_obj->setStyleSheetId($new_id);
962 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
964 if (count($pages) > 0) {
968 $start_page->delete();
971 foreach ($pages as $p) {
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());
982 $page->copy($new_page->getId(),
"", 0,
true);
986 $map[$p[
"id"]] = $new_page->getId();
1000 $new_obj->addImportantPage($map[$ip[
"page_id"]], $ip[
"ord"], $ip[
"indent"]);
1005 include_once(
"./Services/Rating/classes/class.ilRatingCategory.php");
1008 $new_rc->setParentId($new_obj->getId());
1009 $new_rc->setTitle($rc[
"title"]);
1010 $new_rc->setDescription($rc[
"description"]);
1019 foreach ($map as $old_page_id => $new_page_id) {
1026 foreach ($targets as $t) {
1027 if ((
int) $t[
"inst"] === 0 && $t[
"type"] ===
"wpag" && isset($map[(
int) $t[
"id"]])) {
1029 if ($new_page->moveIntLinks([$t[
"id"] => $map[(
int) $t[
"id"]]])) {
1030 $new_page->update(
true,
true);
1046 include_once(
"./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
1066 if ($a_template_page == 0) {
1068 include_once(
"./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
1071 if (count($ts) == 1) {
1073 $a_template_page = $t[
"wpage_id"];
1080 $page->setWikiId($this->
getId());
1083 $page->setRating(
true);
1087 $page->setWikiRefId($this->
getRefId());
1091 if ($a_template_page > 0) {
1093 $orig->copy($page->getId());
1096 include_once
"Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php";
1113 $lng = $DIC->language();
1115 if ($a_sub_type ==
"wpg") {
1116 $lng->loadLanguageModule(
"wiki");
1117 include_once
"./Modules/Wiki/classes/class.ilWikiPage.php";
1133 include_once(
"./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1136 $user_export->initUserHTMLExport();
1150 include_once(
"./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1153 $user_export->startUserHTMLExport();
1166 include_once(
"./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1169 return $user_export->getProgress();
1180 include_once(
"./Modules/Wiki/classes/class.ilWikiUserHTMLExport.php");
1183 $user_export->deliverFile();
1195 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
1198 return "<a href='" .
$url .
"'>" . $a_value .
"</a>";
1212 if (
$setting->get(
"disable_comments")) {
1219 if (!$privacy->enabledCommentsExport()) {
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.
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.
static _lookupLinkMetadataValues($a_wiki_id)
Lookup whether metadata should be auto linked.
getPublicNotes()
Get public notes.
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.
setStyleSheetId($a_style_id)
set ID of assigned style sheet object
updateInternalLinksOnCopy(array $map)
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.
isCommentsExportPossible()
Is export possible.
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.
startUserHTMLExport($with_comments=false)
Start user html export.
fixImportantPagesNumbering()
Fix important pages numbering.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
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
getTemplateSelectionOnCreation()
Get template selection on creation? If more than one template (including empty page template) is acti...
getRatingAsBlock()
Get Enable Rating Side Block.
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
setShortTitle($a_shorttitle)
Set ShortTitle.
static _getTargetsOfSource($a_source_type, $a_source_id, $a_source_lang="-")
Get all targets of a source object (e.g., a page)
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.
initUserHTMLExport($with_comments=false)
Init user html export.
setStartPage($a_startpage)
Set Start Page.
setLinkMetadataValues($a_val)
Set link md values.
setRating($a_rating)
Set Enable Rating.
static _lookup($a_wiki_id, $a_field)
Lookup a data field.
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 _wikiPageExists($a_wiki_id, $a_title)
Check whether page exists for wiki or not.
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.
deliverUserHTMLExport($with_comments=false)
Send user html export file.
__construct(Container $dic, ilPlugin $plugin)
static isOnlineHelpWiki($a_ref_id)
Is wiki an online help wiki?
getRefId()
get reference id public
static _writeContainerSetting($a_id, $a_keyword, $a_value)
getImportantPages()
Get important pages.
static _getInstance()
Get instance of ilPrivacySettings.
setRatingOverall($a_rating)
Set Enable Rating For Object.
create($a_prevent_start_page_creation=false)
Create new wiki.
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.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
setPageToc($a_val)
Set page toc.
getUserHTMLExportProgress($with_comments=false)
Get user html export progress.
static writeStartPage($a_id, $a_name)
Write start page.
removeImportantPage($a_id)
Remove important page.