ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilWikiPage Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilWikiPage:
+ Collaboration diagram for ilWikiPage:

Public Member Functions

 getParentType ()
 
 afterConstructor ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setWikiId (int $a_wikiid)
 
 getWikiId ()
 
 setWikiRefId (int $a_wiki_ref_id)
 
 getWikiRefId ()
 
 setBlocked (bool $a_val)
 
 getBlocked ()
 
 setRating (bool $a_val)
 
 getRating ()
 
 hideAdvancedMetadata (bool $a_val)
 
 isAdvancedMetadataHidden ()
 
 createFromXML ()
 
 create (bool $a_import=false)
 
 afterUpdate (DOMDocument $domdoc, string $xml)
 
 update (bool $a_validate=true, bool $a_no_history=false)
 
 read (bool $a_omit_page_read=false)
 
 delete ()
 
 saveInternalLinks (DOMDocument $a_domdoc)
 
 rename (string $a_new_name)
 Rename page. More...
 
 updateNews (bool $a_update=false)
 
 getContentTemplates ()
 Get content templates. More...
 
- Public Member Functions inherited from ilPageObject
 __construct (int $a_id=0, int $a_old_nr=0, string $a_lang="-")
 
 afterConstructor ()
 
 getParentType ()
 
 initPageConfig ()
 
 setLanguage (string $a_val)
 Set language. More...
 
 getLanguage ()
 
 setPageConfig (ilPageConfig $a_val)
 
 setConcreteLang (string $a_val)
 
 getConcreteLang ()
 
 getPageConfig ()
 
 setRenderMd5 (string $a_rendermd5)
 
 getRenderMd5 ()
 
 setRenderedContent (string $a_renderedcontent)
 
 getRenderedContent ()
 
 setRenderedTime (string $a_renderedtime)
 
 getRenderedTime ()
 
 setLastChange (string $a_lastchange)
 
 getLastChange ()
 
 setLastChangeUser (int $a_val)
 
 getLastChangeUser ()
 
 setShowActivationInfo (bool $a_val)
 
 getShowActivationInfo ()
 
 getCreationUserId ()
 
 read ()
 Read page data. More...
 
 buildDom (bool $a_force=false)
 
 freeDom ()
 
 getDom ()
 
 setId (int $a_id)
 
 getId ()
 
 setParentId (int $a_id)
 
 getParentId ()
 
 addUpdateListener (object $a_object, string $a_method, $a_parameters="")
 
 callUpdateListeners ()
 
 setActive (bool $a_active)
 
 getActive (bool $a_check_scheduled_activation=false)
 
 setActivationStart (?string $a_activationstart)
 
 getActivationStart ()
 
 setActivationEnd (?string $a_activationend)
 Set Activation End. More...
 
 getActivationEnd ()
 
 getContentObject (string $a_hier_id, string $a_pc_id="")
 Get a content object of the page. More...
 
 getContentObjectForPcId (string $pcid)
 Get content object for pc id. More...
 
 getParentContentObjectForPcId (string $pcid)
 Get parent content object for pc id. More...
 
 getContentNode (string $a_hier_id, string $a_pc_id="")
 
 checkForTag (string $a_content_tag, string $a_hier_id, string $a_pc_id="")
 Get content node from dom. More...
 
 getNode ()
 
 setXMLContent (string $a_xml, string $a_encoding="UTF-8")
 set xml content of page, start with <PageObject...>, end with </PageObject>, comply with ILIAS DTD, omit MetaData, use utf-8! More...
 
 appendXMLContent (string $a_xml)
 
   append xml content to page
   setXMLContent must be called before and the same encoding must be used

s More...

 
 getXMLContent (bool $a_incl_head=false)
 get xml content of page More...
 
 copyXmlContent (bool $a_clone_mobs=false, int $a_new_parent_id=0, int $obj_copy_id=0, bool $self_ass=true)
 Copy content of page; replace page components with copies where necessary (e.g. More...
 
 handleCopiedContent (php4DOMDocument $a_dom, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)
 Handle copied content This function copies items, that must be copied, if page content is duplicated. More...
 
 newIIMCopies (php4DOMDocument $temp_dom)
 Replaces media objects in interactive images with copies of the interactive images. More...
 
 newMobCopies (php4DOMDocument $temp_dom)
 Replaces media objects with copies. More...
 
 newQuestionCopies (php4DOMDocument $temp_dom)
 Replaces existing question content elements with new copies. More...
 
 removeQuestions (php4DOMDocument $temp_dom)
 Remove questions from document. More...
 
 countPageContents ()
 
 getXMLFromDom (bool $a_incl_head=false, bool $a_append_mobs=false, bool $a_append_bib=false, string $a_append_str="", bool $a_omit_pageobject_tag=false, int $style_id=0)
 get xml content of page from dom (use this, if any changes are made to the document) More...
 
 getLanguageVariablesXML (int $style_id=0)
 Get language variables as XML. More...
 
 getFirstParagraphText ()
 
 getParagraphForPCID (string $pcid)
 
 setParagraphContent (string $a_hier_id, string $a_content)
 Set content of paragraph. More...
 
 setContainsIntLink (bool $a_contains_link)
 lm parser set this flag to true, if the page contains intern links (this method should only be called by the import parser) todo: move to ilLMPageObject !? More...
 
 containsIntLink ()
 returns true, if page was marked as containing an intern link (via setContainsIntLink) (this method should only be called by the import parser) More...
 
 setImportMode (bool $a_val)
 
 getImportMode ()
 
 needsImportParsing (?bool $a_parse=null)
 
 setContainsQuestion (bool $a_val)
 
 getContainsQuestion ()
 
 collectMediaObjects (bool $a_inline_only=true)
 get all media objects, that are referenced and used within the page More...
 
 getInternalLinks (bool $a_cnt_multiple=false)
 get all internal links that are used within the page More...
 
 getMultimediaXML ()
 get a xml string that contains all media object elements, that are referenced by any media alias in the page More...
 
 getMediaAliasElement (int $a_mob_id, int $a_nr=1)
 get complete media object (alias) element More...
 
 validateDom (bool $throw=false)
 Validate the page content agains page DTD. More...
 
 addHierIDs ()
 Add hierarchical ID (e.g. More...
 
 getHierIds ()
 get all hierarchical ids More...
 
 getFirstRowIds ()
 get ids of all first table rows More...
 
 getFirstColumnIds ()
 get ids of all first table columns More...
 
 getListItemIds ()
 get ids of all list items More...
 
 getFileItemIds ()
 get ids of all file items More...
 
 stripHierIDs ()
 strip all hierarchical id attributes out of the dom tree More...
 
 getHierIdsForPCIds (array $a_pc_ids)
 Get hier ids for a set of pc ids. More...
 
 getHierIdForPcId (string $pcid)
 
 getPCIdsForHierIds (array $hier_ids)
 Get hier ids for a set of pc ids. More...
 
 getPCIdForHierId (string $hier_id)
 
 addFileSizes ()
 add file sizes More...
 
 resolveIntLinks (array $a_link_map=null)
 Resolves all internal link targets of the page, if targets are available (after import) More...
 
 resolveMediaAliases (array $a_mapping, bool $a_reuse_existing_by_import=false)
 Resolve media aliases (after import) More...
 
 resolveIIMMediaAliases (array $a_mapping)
 Resolve iim media aliases (in ilContObjParse) More...
 
 resolveFileItems (array $a_mapping)
 Resolve file items (after import) More...
 
 resolveQuestionReferences (array $a_mapping)
 Resolve all quesiont references (after import) More...
 
 moveIntLinks (array $a_from_to)
 Move internal links from one destination to another. More...
 
 handleImportRepositoryLink (string $a_rep_import_id, string $a_rep_type, int $a_rep_ref_id)
 
 handleRepositoryLinksOnCopy (array $a_mapping, int $a_source_ref_id)
 Handle repository links on copy process. More...
 
 createFromXML ()
 Create new page object with current xml content. More...
 
 updateFromXML ()
 Updates page object with current xml content This function is currently (8 beta) called by: More...
 
 afterUpdate (DOMDocument $domdoc, string $xml)
 After update. More...
 
 update (bool $a_validate=true, bool $a_no_history=false)
 update complete page content in db (dom xml content is used) More...
 
 delete ()
 
 saveStyleUsage (DOMDocument $a_domdoc, int $a_old_nr=0)
 Save all style class/template usages. More...
 
 deleteStyleUsages (int $a_old_nr=0)
 Delete style usages. More...
 
 getLastUpdateOfIncludedElements ()
 Get last update of included elements (media objects and files). More...
 
 deleteInternalLinks ()
 Delete internal links. More...
 
 saveInternalLinks (DOMDocument $a_domdoc)
 save internal links of page More...
 
 create (bool $a_import=false)
 create new page (with current xml data) More...
 
 deleteContent (string $a_hid, bool $a_update=true, string $a_pcid="", bool $move_operation=false)
 delete content object with hierarchical id $a_hid More...
 
 deleteContents (array $a_hids, bool $a_update=true, bool $a_self_ass=false, bool $move_operation=false)
 Delete multiple content objects. More...
 
 cutContents (array $a_hids)
 Copy contents to clipboard and cut them from the page. More...
 
 copyContents (array $a_hids)
 Copy contents to clipboard. More...
 
 pasteContents (string $a_hier_id, bool $a_self_ass=false)
 Paste contents from pc clipboard. More...
 
 switchEnableMultiple (array $a_hids, bool $a_update=true, bool $a_self_ass=false)
 (De-)activate elements More...
 
 deleteContentFromHierId (string $a_hid, bool $a_update=true)
 delete content object with hierarchical id >= $a_hid as part of a split page operation More...
 
 deleteContentBeforeHierId (string $a_hid, bool $a_update=true)
 delete content object with hierarchical id < $a_hid as part of the split page operation More...
 
 insertContent (ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
 insert a content node before/after a sibling or as first child of a parent More...
 
 insertContentNode (php4DOMElement $a_cont_node, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="")
 insert a content node before/after a sibling or as first child of a parent More...
 
 moveContentBefore (string $a_source, string $a_target, string $a_spcid="", string $a_tpcid="")
 move content object from position $a_source before position $a_target (both hierarchical content ids) More...
 
 moveContentAfter (string $a_source, string $a_target, string $a_spcid="", string $a_tpcid="")
 move content object from position $a_source before position $a_target (both hierarchical content ids) More...
 
 bbCode2XML (string &$a_content)
 transforms bbCode to corresponding xml More...
 
 insertInstIntoIDs (string $a_inst, bool $a_res_ref_to_obj_id=true)
 inserts installation id into ids (e.g. More...
 
 checkPCIds ()
 Check, whether (all) page content hashes are set. More...
 
 getAllPCIds ()
 Get all pc ids. More...
 
 hasDuplicatePCIds ()
 
 getDuplicatePCIds ()
 Get all duplicate PC Ids. More...
 
 existsPCId (string $a_pc_id)
 
 generatePcId ()
 
 insertPCIds ()
 Insert Page Content IDs. More...
 
 getPageContentsHashes ()
 Get page contents hashes. More...
 
 getQuestionIds ()
 Get question ids. More...
 
 send_paragraph (string $par_id, string $filename)
 
 getFO ()
 get fo page content More...
 
 registerOfflineHandler (object $handler)
 
 getOfflineHandler ()
 
 containsDeactivatedElements (string $a_content)
 Check whether content contains deactivated elements. More...
 
 getHistoryEntries ()
 Get History Entries. More...
 
 getHistoryEntry (int $a_old_nr)
 Get History Entry. More...
 
 getHistoryInfo (int $a_nr)
 Get information about a history entry, its predecessor and its successor. More...
 
 addChangeDivClasses (array $a_hashes)
 
 compareVersion (int $a_left, int $a_right)
 Compares to revisions of the page. More...
 
 increaseViewCnt ()
 Increase view cnt. More...
 
 writeRenderedContent (string $a_content, string $a_md5)
 Write rendered content. More...
 
 containsIntLinks (string $a_content)
 Check whether content contains internal links. More...
 
 performAutomaticModifications ()
 Perform automatic modifications (may be overwritten by sub classes) More...
 
 saveInitialOpenedContent (string $a_type, int $a_id, string $a_target)
 Save initial opened content. More...
 
 getInitialOpenedContent ()
 Get initial opened content. More...
 
 beforePageContentUpdate (ilPageContent $a_page_content)
 Before page content update Note: This one is "work in progress", currently only text paragraphs call this hook It is called before the page content object invokes the update procedure of ilPageObject. More...
 
 copy (int $a_id, string $a_parent_type="", int $a_new_parent_id=0, bool $a_clone_mobs=false, int $obj_copy_id=0)
 Copy page. More...
 
 copyPageToTranslation (string $a_target_lang)
 Copy page to translation. More...
 
 getEditLock ()
 Get page lock. More...
 
 releasePageLock ()
 Release page lock. More...
 
 getEditLockInfo ()
 Get edit lock info. More...
 
 getContentTemplates ()
 Get content templates. More...
 
 getEffectiveEditLockTime ()
 
 getAllFileObjIds ()
 Get all file object ids. More...
 
 resolveResources (array $ref_mapping)
 Resolve resources. More...
 
 getRepoObjId ()
 Get object id of repository object that contains this page, return 0 if page does not belong to a repo object. More...
 
 getPCModel ()
 Get page component model. More...
 
 assignCharacteristic (array $targets, string $char_par, string $char_sec, string $char_med)
 Assign characteristic. More...
 

Static Public Member Functions

static deleteAllPagesOfWiki (int $a_wiki_id)
 
static exists (int $a_wiki_id, string $a_title)
 Checks whether a page with given title exists. More...
 
static getPageIdForTitle (int $a_wiki_id, string $a_title)
 Get wiki page object for id and title. More...
 
static lookupTitle (int $a_page_id)
 
static lookupWikiId (int $a_page_id)
 
static getAllWikiPages (int $a_wiki_id)
 
static getLinksToPage (int $a_wiki_id, int $a_page_id)
 
static getOrphanedPages (int $a_wiki_id)
 
static _wikiPageExists (int $a_wiki_id, string $a_title)
 
static getWikiContributors (int $a_wiki_id)
 
static getWikiPageContributors (int $a_page_id)
 
static _getPageIdForWikiTitle (int $a_wiki_id, string $a_title)
 
static getPopularPages (int $a_wiki_id)
 
static countPages (int $a_wiki_id)
 
static getRandomPage (int $a_wiki_id)
 
static getNewWikiPages (int $a_wiki_id)
 
static lookupObjIdByPage (int $a_page_id)
 returns the wiki/object id to a given page id More...
 
static getGotoForWikiPageTarget (string $a_target, bool $a_offline=false)
 
static getPagesForSearch (int $a_wiki_id, string $a_term)
 
static lookupAdvancedMetadataHidden (int $a_page_id)
 
- Static Public Member Functions inherited from ilPageObject
static randomhash ()
 
static _exists (string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
 Checks whether page exists. More...
 
static _existsAndNotEmpty (string $a_parent_type, int $a_id, string $a_lang="-")
 Checks whether page exists and is not empty (may return true on some empty pages) More...
 
static preloadActivationDataByParentId (int $a_parent_id)
 Preload activation data by Parent Id. More...
 
static _lookupActive (int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
 lookup activation status More...
 
static _isScheduledActivation (int $a_id, string $a_parent_type, string $a_lang="-")
 Check whether page is activated by time schedule. More...
 
static _writeActive (int $a_id, string $a_parent_type, bool $a_active)
 write activation status More...
 
static _lookupActivationData (int $a_id, string $a_parent_type, string $a_lang="-")
 Lookup activation data. More...
 
static lookupParentId (int $a_id, string $a_type)
 
static _writeParentId (string $a_parent_type, int $a_pg_id, int $a_par_id)
 
static _handleImportRepositoryLinks (string $a_rep_import_id, string $a_rep_type, int $a_rep_ref_id)
 Change targest of repository links. More...
 
static _moveContentAfterHierId (ilPageObject $a_source_page, ilPageObject $a_target_page, string $a_hid)
 move content of hierarchical id >= $a_hid to other page More...
 
static _lookupContainsDeactivatedElements (int $a_id, string $a_parent_type, string $a_lang="-")
 lookup whether page contains deactivated elements More...
 
static getRecentChanges (string $a_parent_type, int $a_parent_id, int $a_period=30, string $a_lang="")
 Get recent pages changes for parent object. More...
 
static getAllPages (string $a_parent_type, int $a_parent_id, string $a_lang="-")
 Get all pages for parent object. More...
 
static getNewPages (string $a_parent_type, int $a_parent_id, string $a_lang="-")
 Get new pages. More...
 
static getParentObjectContributors (string $a_parent_type, int $a_parent_id, string $a_lang="-")
 Get all contributors for parent object. More...
 
static getPageContributors (string $a_parent_type, int $a_page_id, string $a_lang="-")
 Get all contributors for parent object. More...
 
static getPagesWithLinks (string $a_parent_type, int $a_parent_id, string $a_lang="-")
 Get all pages for parent object that contain internal links. More...
 
static lookupTranslations (string $a_parent_type, int $a_id)
 Lookup translations. More...
 
static truncateHTML (string $a_text, int $a_length=100, string $a_ending='...', bool $a_exact=false, bool $a_consider_html=true)
 Truncate (html) string. More...
 
static getLastChangeByParent (string $a_parent_type, int $a_parent_id, string $a_lang="")
 Get all pages for parent object. More...
 

Protected Member Functions

 preparePageForCompare (ilPageObject $page)
 
- Protected Member Functions inherited from ilPageObject
 getLangVarXML (string $var)
 
 __afterUpdate (DOMDocument $a_domdoc, string $a_xml, bool $a_creation=false, bool $a_empty=false)
 After update event handler (internal). More...
 
 __beforeDelete ()
 Before deletion handler (internal). More...
 
 __afterDelete ()
 
 afterDelete ()
 
 __afterHistoryEntry (DOMDocument $a_old_domdoc, string $a_old_content, int $a_old_nr)
 
 preparePageForCompare (ilPageObject $page)
 

Protected Attributes

int $parent_ref_id = 0
 
string $title = ""
 
bool $blocked = false
 
bool $rating = false
 
bool $hide_adv_md = false
 
- Protected Attributes inherited from ilPageObject
int $create_user = 0
 
array $id_elements
 
bool $page_not_found = false
 
bool $show_page_act_info = false
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilObjUser $user
 
ilLanguage $lng
 
ilTree $tree
 
int $id
 
string $language = "-"
 
bool $import_mode = false
 
ilLogger $log
 
array $page_record = array()
 
bool $active = false
 
ilPageConfig $page_config
 
string $rendermd5 = ""
 
string $renderedcontent = ""
 
string $renderedtime = ""
 
string $lastchange = ""
 
bool $contains_question = false
 
array $hier_ids = []
 
array $first_row_ids = []
 
array $first_col_ids = []
 
array $list_item_ids = []
 
array $file_item_ids = []
 
string $activationstart = null
 
string $activationend = null
 
ILIAS COPage ReadingTime ReadingTimeManager $reading_time_manager
 
 $concrete_lang = ""
 

Additional Inherited Members

- Data Fields inherited from ilPageObject
int $old_nr
 
php4DOMDocument $dom = null
 
string $xml = ""
 
string $encoding = ""
 
php4DOMElement $node
 
string $cur_dtd = "ilias_pg_8.dtd"
 
bool $contains_int_link = false
 
bool $needs_parsing = false
 
string $parent_type = ""
 
int $parent_id = 0
 
array $update_listeners = []
 
int $update_listener_cnt = 0
 
object $offline_handler = null
 
bool $dom_builded = false
 
bool $history_saved = false
 
int $last_change_user = 0
 
- Static Public Attributes inherited from ilPageObject
static array $exists = array()
 
- Static Protected Attributes inherited from ilPageObject
static array $activation_data = array()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilWikiPage

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilWikiPage.php.

Member Function Documentation

◆ _getPageIdForWikiTitle()

static ilWikiPage::_getPageIdForWikiTitle ( int  $a_wiki_id,
string  $a_title 
)
static
Deprecated:
use getPageIdForTitle instead

Definition at line 624 of file class.ilWikiPage.php.

Referenced by ilObjWikiGUI\getSettingsFormValues(), and ilWikiPageGUI\renamePage().

627  : ?int {
628  return self::getPageIdForTitle($a_wiki_id, $a_title);
629  }
+ Here is the caller graph for this function:

◆ _wikiPageExists()

static ilWikiPage::_wikiPageExists ( int  $a_wiki_id,
string  $a_title 
)
static

Definition at line 496 of file class.ilWikiPage.php.

References $DIC, $ilDB, $query, and ilWikiUtil\makeDbTitle().

Referenced by ilObjWiki\decorateAdvMDValue(), ilObjWikiGUI\gotoPageObject(), ilWikiPageGUI\insertWikiLinkAC(), ilWikiUtil\makeLink(), and ilWikiUtil\processInternalLinks().

499  : bool {
500  global $DIC;
501 
502  $ilDB = $DIC->database();
503 
504  $a_title = ilWikiUtil::makeDbTitle($a_title);
505 
506  $query = "SELECT id FROM il_wiki_page" .
507  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
508  " AND title = " . $ilDB->quote($a_title, "text");
509  $set = $ilDB->query($query);
510 
511  if ($ilDB->fetchAssoc($set)) {
512  return true;
513  }
514 
515  return false;
516  }
global $DIC
Definition: feed.php:28
$query
static makeDbTitle(string $a_par)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterConstructor()

ilWikiPage::afterConstructor ( )

Definition at line 37 of file class.ilWikiPage.php.

References ilPageObject\getPageConfig(), and ilPageObject\getParentId().

37  : void
38  {
39  $this->getPageConfig()->configureByObjectId($this->getParentId());
40  }
+ Here is the call graph for this function:

◆ afterUpdate()

ilWikiPage::afterUpdate ( DOMDocument  $domdoc,
string  $xml 
)

Definition at line 158 of file class.ilWikiPage.php.

References ilWikiUtil\collectInternalLinks(), ilWikiStat\EVENT_PAGE_UPDATED, getWikiId(), ilWikiStat\handleEvent(), and ilStr\strLen().

161  : void {
162  // internal == wiki links
163 
164  $this->log->debug("collect internal links");
165  $int_links = count(ilWikiUtil::collectInternalLinks($xml, $this->getWikiId(), true));
166 
167  $xpath = new DOMXPath($domdoc);
168 
169  // external = internal + external links
170  $ext_links = count($xpath->query('//IntLink'));
171  $ext_links += count($xpath->query('//ExtLink'));
172 
173  $footnotes = count($xpath->query('//Footnote'));
174 
175 
176  // words/characters (xml)
177 
178  $xml = strip_tags($xml);
179 
180  $num_chars = ilStr::strLen($xml);
181  $num_words = count(explode(" ", $xml));
182 
183  $page_data = array(
184  "int_links" => $int_links,
185  "ext_links" => $ext_links,
186  "footnotes" => $footnotes,
187  "num_words" => $num_words,
188  "num_chars" => $num_chars
189  );
190  $this->log->debug("handle stats");
192  }
static strLen(string $a_string)
Definition: class.ilStr.php:63
static collectInternalLinks(string $s, int $a_wiki_id, bool $a_collect_non_ex=false, string $mode=IL_WIKI_MODE_COLLECT)
Collect internal wiki links of a string.
static handleEvent(int $a_event, ilWikiPage $a_page_obj, ?int $a_user_id=null, array $a_additional_data=null)
Handle wiki page event.
const EVENT_PAGE_UPDATED
+ Here is the call graph for this function:

◆ countPages()

static ilWikiPage::countPages ( int  $a_wiki_id)
static

Definition at line 653 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $query.

655  : int {
656  global $DIC;
657 
658  $ilDB = $DIC->database();
659 
660  // delete record of table il_wiki_data
661  $query = "SELECT count(*) as cnt FROM il_wiki_page" .
662  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
663  $s = $ilDB->query($query);
664  $r = $ilDB->fetchAssoc($s);
665 
666  return $r["cnt"];
667  }
global $DIC
Definition: feed.php:28
$query

◆ create()

ilWikiPage::create ( bool  $a_import = false)

Definition at line 122 of file class.ilWikiPage.php.

References ilPageObject\$db, ilPageObject\$id, $ilDB, $query, ilWikiStat\EVENT_PAGE_CREATED, getBlocked(), ilPageObject\getId(), getRating(), getTitle(), getWikiId(), getWikiRefId(), ilWikiStat\handleEvent(), isAdvancedMetadataHidden(), saveInternalLinks(), ilWikiUtil\sendNotification(), ilPageObject\setId(), ilNotification\TYPE_WIKI, and updateNews().

124  : void {
125  $ilDB = $this->db;
126 
127  $id = $ilDB->nextId("il_wiki_page");
128  $this->setId($id);
129  $query = "INSERT INTO il_wiki_page (" .
130  "id" .
131  ", title" .
132  ", wiki_id" .
133  ", blocked" .
134  ", rating" .
135  ", hide_adv_md" .
136  " ) VALUES (" .
137  $ilDB->quote($this->getId(), "integer")
138  . "," . $ilDB->quote($this->getTitle(), "text")
139  . "," . $ilDB->quote($this->getWikiId(), "integer")
140  . "," . $ilDB->quote((int) $this->getBlocked(), "integer")
141  . "," . $ilDB->quote((int) $this->getRating(), "integer")
142  . "," . $ilDB->quote((int) $this->isAdvancedMetadataHidden(), "integer")
143  . ")";
144  $ilDB->manipulate($query);
145 
146  // create page object
147  if (!$a_import) {
148  parent::create($a_import);
149  $this->saveInternalLinks($this->getDomDoc());
150 
153  }
154 
155  $this->updateNews();
156  }
static sendNotification(string $a_action, int $a_type, int $a_wiki_ref_id, int $a_page_id, ?string $a_comment=null)
const EVENT_PAGE_CREATED
$query
updateNews(bool $a_update=false)
ilDBInterface $db
static handleEvent(int $a_event, ilWikiPage $a_page_obj, ?int $a_user_id=null, array $a_additional_data=null)
Handle wiki page event.
saveInternalLinks(DOMDocument $a_domdoc)
+ Here is the call graph for this function:

◆ createFromXML()

ilWikiPage::createFromXML ( )

Definition at line 102 of file class.ilWikiPage.php.

References ilPageObject\$db, $ilDB, and ilPageObject\read().

102  : void
103  {
104  $ilDB = $this->db;
105 
106  // ilWikiDataset creates wiki pages without copage objects
107  // (see create function in this class, parameter $a_prevent_page_creation)
108  // The ilCOPageImporter will call createFromXML without running through the read
109  // method -> we will miss the important wiki id, thus we read it now
110  // see also bug #12224
111  $set = $ilDB->query(
112  "SELECT id FROM il_wiki_page " .
113  " WHERE id = " . $ilDB->quote($this->getId(), "integer")
114  );
115  if ($rec = $ilDB->fetchAssoc($set)) {
116  $this->read(true);
117  }
118 
119  parent::createFromXML();
120  }
read()
Read page data.
ilDBInterface $db
+ Here is the call graph for this function:

◆ delete()

ilWikiPage::delete ( )

Definition at line 251 of file class.ilWikiPage.php.

References ilPageObject\$db, $ilDB, $query, ilInternalLink\_deleteAllLinksToTarget(), ilObject\_exists(), ilWikiStat\EVENT_PAGE_DELETED, ilPageObject\getId(), getTitle(), getWikiId(), getWikiRefId(), ilWikiStat\handleEvent(), ilNotification\removeForObject(), ilWikiUtil\sendNotification(), and ilNotification\TYPE_WIKI_PAGE.

251  : void
252  {
253  $ilDB = $this->db;
254 
255  // get other pages that link to this page
256  $linking_pages = self::getLinksToPage(
257  $this->getWikiId(),
258  $this->getId()
259  );
260 
261  // delete important page
262  // note: the wiki might be already deleted here
263  if (ilObject::_exists($this->getWikiId())) {
264  $wiki = new ilObjWiki($this->getWikiId(), false);
265  if ($wiki->isImportantPage($this->getId())) {
266  $wiki->removeImportantPage($this->getId());
267  }
268  }
269 
270  // delete internal links information to this page
272 
274 
276 
277  // remove all notifications
279 
280  // delete record of table il_wiki_data
281  $query = "DELETE FROM il_wiki_page" .
282  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
283  $ilDB->manipulate($query);
284 
285  // delete co page
286  parent::delete();
287 
288  // make links of other pages to this page a missing link
289  foreach ($linking_pages as $lp) {
290  $ilDB->manipulateF(
291  "DELETE FROM il_wiki_missing_page " .
292  " WHERE wiki_id = %s AND source_id = %s AND target_name = %s ",
293  array("integer", "integer", "text"),
294  array($this->getWikiId(), $lp["id"], $this->getTitle())
295  );
296  $ilDB->manipulateF(
297  "INSERT INTO il_wiki_missing_page " .
298  "(wiki_id, source_id, target_name) VALUES " .
299  "(%s,%s,%s)",
300  array("integer", "integer", "text"),
301  array($this->getWikiId(), $lp["id"], $this->getTitle())
302  );
303  }
304  }
static sendNotification(string $a_action, int $a_type, int $a_wiki_ref_id, int $a_page_id, ?string $a_comment=null)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$query
ilDBInterface $db
static handleEvent(int $a_event, ilWikiPage $a_page_obj, ?int $a_user_id=null, array $a_additional_data=null)
Handle wiki page event.
static removeForObject(int $type, int $id)
Remove all notifications for given object.
const EVENT_PAGE_DELETED
+ Here is the call graph for this function:

◆ deleteAllPagesOfWiki()

static ilWikiPage::deleteAllPagesOfWiki ( int  $a_wiki_id)
static

Definition at line 306 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $query.

Referenced by ilObjWiki\delete().

306  : void
307  {
308  global $DIC;
309 
310  $ilDB = $DIC->database();
311 
312  // delete record of table il_wiki_data
313  $query = "SELECT * FROM il_wiki_page" .
314  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
315  $set = $ilDB->query($query);
316 
317  while ($rec = $ilDB->fetchAssoc($set)) {
318  $wiki_page = new ilWikiPage($rec["id"]);
319  $wiki_page->delete();
320  }
321  }
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$query
+ Here is the caller graph for this function:

◆ exists()

static ilWikiPage::exists ( int  $a_wiki_id,
string  $a_title 
)
static

Checks whether a page with given title exists.

Definition at line 326 of file class.ilWikiPage.php.

References $DIC, $ilDB, $query, and ilWikiUtil\makeDbTitle().

Referenced by ilWikiHandlerGUI\executeCommand(), ilObjWiki\update(), and ilObjWikiGUI\viewPageObject().

329  : bool {
330  global $DIC;
331 
332  $ilDB = $DIC->database();
333 
334  $a_title = ilWikiUtil::makeDbTitle($a_title);
335 
336  $query = "SELECT id FROM il_wiki_page" .
337  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
338  " AND title = " . $ilDB->quote($a_title, "text");
339  $set = $ilDB->query($query);
340  if ($rec = $ilDB->fetchAssoc($set)) {
341  return true;
342  }
343 
344  return false;
345  }
global $DIC
Definition: feed.php:28
$query
static makeDbTitle(string $a_par)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllWikiPages()

static ilWikiPage::getAllWikiPages ( int  $a_wiki_id)
static

Definition at line 404 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $query.

Referenced by ILIAS\Wiki\WikiPrintViewProviderGUI\__construct(), ilObjWiki\cloneObject(), ilWikiStat\countPages(), ilObjWikiGUI\editImportantPagesObject(), ILIAS\Wiki\Export\WikiHtmlExport\exportHTMLPages(), ILIAS\Wiki\Export\WikiHtmlExport\exportHTMLPagesPrint(), ilWikiPagesTableGUI\getPages(), ILIAS\Wiki\WikiPrintViewProviderGUI\getSelectionForm(), ilWikiExporter\getXmlExportTailDependencies(), ilObjWikiGUI\initSettingsForm(), ilWikiPageTemplateGUI\listTemplates(), ilWikiPageGUI\printViewOrderList(), and ilInternalLinkGUI\showLinkHelp().

406  : array {
407  global $DIC;
408 
409  $ilDB = $DIC->database();
410 
411  $pages = parent::getAllPages("wpg", $a_wiki_id);
412 
413  $query = "SELECT * FROM il_wiki_page" .
414  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
415  " ORDER BY title";
416  $set = $ilDB->query($query);
417 
418  $pg = array();
419  while ($rec = $ilDB->fetchAssoc($set)) {
420  if (isset($pages[$rec["id"]])) {
421  $pg[$rec["id"]] = $pages[$rec["id"]];
422  $pg[$rec["id"]]["title"] = $rec["title"];
423  }
424  }
425 
426  return $pg;
427  }
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ getBlocked()

ilWikiPage::getBlocked ( )

Definition at line 77 of file class.ilWikiPage.php.

References $blocked.

Referenced by create(), and update().

77  : bool
78  {
79  return $this->blocked;
80  }
+ Here is the caller graph for this function:

◆ getContentTemplates()

ilWikiPage::getContentTemplates ( )

Get content templates.

Returns
array array of arrays with "id" => page id (int), "parent_type" => parent type (string), "title" => title (string)

Definition at line 909 of file class.ilWikiPage.php.

References getWikiId(), and ilWikiPageTemplate\TYPE_ADD_TO_PAGE.

909  : array
910  {
911  $wt = new ilWikiPageTemplate($this->getWikiId());
912  $templates = array();
913  foreach ($wt->getAllInfo(ilWikiPageTemplate::TYPE_ADD_TO_PAGE) as $t) {
914  $templates[] = array("id" => $t["wpage_id"], "parent_type" => "wpg", "title" => $t["title"]);
915  }
916  return $templates;
917  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getGotoForWikiPageTarget()

static ilWikiPage::getGotoForWikiPageTarget ( string  $a_target,
bool  $a_offline = false 
)
static

Definition at line 892 of file class.ilWikiPage.php.

Referenced by ilPageLinker\getLinkXML(), ilLMPageObjectGUI\getLinkXML(), and ilLMPresentationLinker\getLinkXML().

895  : string {
896  if (!$a_offline) {
897  $href = "./goto.php?target=wiki_wpage_" . $a_target;
898  } else {
899  $href = ILIAS_HTTP_PATH . "/goto.php?target=wiki_wpage_" . $a_target;
900  }
901  return $href;
902  }
+ Here is the caller graph for this function:

◆ getLinksToPage()

static ilWikiPage::getLinksToPage ( int  $a_wiki_id,
int  $a_page_id 
)
static

Definition at line 429 of file class.ilWikiPage.php.

References $DIC, $ilDB, $query, $source, and ilInternalLink\_getSourcesOfTarget().

Referenced by ilWikiPageGUI\deleteWikiPageConfirmationScreen(), and ilWikiPagesTableGUI\getPages().

432  : array {
433  global $DIC;
434 
435  $ilDB = $DIC->database();
436 
437  $sources = ilInternalLink::_getSourcesOfTarget("wpg", $a_page_id, 0);
438 
439  $ids = array();
440  foreach ($sources as $source) {
441  if ($source["type"] === "wpg:pg") {
442  $ids[] = $source["id"];
443  }
444  }
445  // get wiki page record
446  $query = "SELECT * FROM il_wiki_page wp, page_object p" .
447  " WHERE " . $ilDB->in("wp.id", $ids, false, "integer") .
448  " AND wp.id = p.page_id AND p.parent_type = " . $ilDB->quote("wpg", "text") .
449  " AND wp.wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
450  " ORDER BY title";
451  $set = $ilDB->query($query);
452 
453  $pages = array();
454  while ($rec = $ilDB->fetchAssoc($set)) {
455  $pages[] = array_merge($rec, array("user" => $rec["last_change_user"],
456  "date" => $rec["last_change"]));
457  }
458 
459  return $pages;
460  }
global $DIC
Definition: feed.php:28
$query
$source
Definition: metadata.php:93
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewWikiPages()

static ilWikiPage::getNewWikiPages ( int  $a_wiki_id)
static

Definition at line 695 of file class.ilWikiPage.php.

Referenced by ilWikiPagesTableGUI\getPages().

697  : array {
698  $pages = parent::getNewPages("wpg", $a_wiki_id);
699  foreach ($pages as $k => $page) {
700  $pages[$k]["title"] = self::lookupTitle($page["id"]);
701  }
702 
703  return $pages;
704  }
+ Here is the caller graph for this function:

◆ getOrphanedPages()

static ilWikiPage::getOrphanedPages ( int  $a_wiki_id)
static

Definition at line 462 of file class.ilWikiPage.php.

References $DIC, $ilDB, $query, $source, ilInternalLink\_getSourcesOfTarget(), and ilObjWiki\_lookupStartPage().

Referenced by ilWikiPagesTableGUI\getPages().

464  : array {
465  global $DIC;
466 
467  $ilDB = $DIC->database();
468 
469  $pages = self::getAllWikiPages($a_wiki_id);
470 
471  $orphaned = array();
472  foreach ($pages as $k => $page) {
473  $sources = ilInternalLink::_getSourcesOfTarget("wpg", $page["id"], 0);
474  $ids = array();
475  foreach ($sources as $source) {
476  if ($source["type"] === "wpg:pg") {
477  $ids[] = $source["id"];
478  }
479  }
480  $query = "SELECT count(*) cnt FROM il_wiki_page" .
481  " WHERE " . $ilDB->in("id", $ids, false, "integer") .
482  " AND wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
483  " GROUP BY wiki_id";
484  $set = $ilDB->query($query);
485  $rec = $ilDB->fetchAssoc($set);
486  if (count($ids) === 0 || ($rec && (int) $rec["cnt"] === 0)) {
487  if (ilObjWiki::_lookupStartPage($a_wiki_id) !== $page["title"]) {
488  $orphaned[] = $page;
489  }
490  }
491  }
492 
493  return $orphaned;
494  }
global $DIC
Definition: feed.php:28
static _lookupStartPage(int $a_wiki_id)
$query
$source
Definition: metadata.php:93
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageIdForTitle()

static ilWikiPage::getPageIdForTitle ( int  $a_wiki_id,
string  $a_title 
)
static

Get wiki page object for id and title.

Definition at line 351 of file class.ilWikiPage.php.

References $DIC, $ilDB, $query, and ilWikiUtil\makeDbTitle().

Referenced by ilObjWikiGUI\addPagesSubTabs(), ilObjWikiGUI\addPageTabs(), ilObjWiki\cloneObject(), ilWikiHandlerGUI\executeCommand(), ilWikiPageGUI\getGUIForTitle(), ilWikiPageGUI\getTabs(), and ilWikiUtil\makeLink().

354  : ?int {
355  global $DIC;
356 
357  $ilDB = $DIC->database();
358 
359  $a_title = ilWikiUtil::makeDbTitle($a_title);
360 
361  $query = "SELECT * FROM il_wiki_page" .
362  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
363  " AND title = " . $ilDB->quote($a_title, "text");
364  $set = $ilDB->query($query);
365  if ($rec = $ilDB->fetchAssoc($set)) {
366  return (int) $rec["id"];
367  }
368 
369  return null;
370  }
global $DIC
Definition: feed.php:28
$query
static makeDbTitle(string $a_par)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPagesForSearch()

static ilWikiPage::getPagesForSearch ( int  $a_wiki_id,
string  $a_term 
)
static

Definition at line 919 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $res.

Referenced by ilWikiPageGUI\insertWikiLinkAC().

922  : array {
923  global $DIC;
924 
925  $ilDB = $DIC->database();
926 
927  $set = $ilDB->query("SELECT DISTINCT title FROM il_wiki_page" .
928  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
929  " AND " . $ilDB->like("title", "text", "%" . $a_term . "%") .
930  " ORDER by title");
931  $res = array();
932  while ($rec = $ilDB->fetchAssoc($set)) {
933  $res[] = $rec["title"];
934  }
935 
936  return $res;
937  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getParentType()

ilWikiPage::getParentType ( )

Definition at line 32 of file class.ilWikiPage.php.

32  : string
33  {
34  return "wpg";
35  }

◆ getPopularPages()

static ilWikiPage::getPopularPages ( int  $a_wiki_id)
static

Definition at line 631 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $query.

Referenced by ilWikiPagesTableGUI\getPages().

633  : array {
634  global $DIC;
635 
636  $ilDB = $DIC->database();
637 
638  $query = "SELECT wp.*, po.view_cnt as cnt FROM il_wiki_page wp, page_object po" .
639  " WHERE wp.wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
640  " AND wp.id = po.page_id " .
641  " AND po.parent_type = " . $ilDB->quote("wpg", "text") . " " .
642  " ORDER BY po.view_cnt";
643  $set = $ilDB->query($query);
644 
645  $pages = array();
646  while ($rec = $ilDB->fetchAssoc($set)) {
647  $pages[] = $rec;
648  }
649 
650  return $pages;
651  }
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ getRandomPage()

static ilWikiPage::getRandomPage ( int  $a_wiki_id)
static

Definition at line 669 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $query.

Referenced by ilObjWikiGUI\randomPageObject().

671  : string {
672  global $DIC;
673 
674  $ilDB = $DIC->database();
675 
676  $cnt = self::countPages($a_wiki_id);
677 
678  if ($cnt < 1) {
679  return "";
680  }
681 
682  $random = new \ilRandom();
683  $rand = $random->int(1, $cnt);
684 
685  // delete record of table il_wiki_data
686  $ilDB->setLimit(1, $rand);
687  $query = "SELECT title FROM il_wiki_page" .
688  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
689  $s = $ilDB->query($query);
690  $r = $ilDB->fetchAssoc($s);
691 
692  return $r["title"];
693  }
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ getRating()

ilWikiPage::getRating ( )

Definition at line 87 of file class.ilWikiPage.php.

References $rating.

Referenced by create(), and update().

87  : bool
88  {
89  return $this->rating;
90  }
+ Here is the caller graph for this function:

◆ getTitle()

ilWikiPage::getTitle ( )

Definition at line 47 of file class.ilWikiPage.php.

References $title.

Referenced by create(), delete(), rename(), saveInternalLinks(), update(), and updateNews().

47  : string
48  {
49  return $this->title;
50  }
+ Here is the caller graph for this function:

◆ getWikiContributors()

static ilWikiPage::getWikiContributors ( int  $a_wiki_id)
static

Definition at line 518 of file class.ilWikiPage.php.

Referenced by ilWikiContributorsTableGUI\getContributors().

520  : array {
521  return parent::getParentObjectContributors("wpg", $a_wiki_id);
522  }
+ Here is the caller graph for this function:

◆ getWikiId()

ilWikiPage::getWikiId ( )

Definition at line 57 of file class.ilWikiPage.php.

References ilPageObject\getParentId().

Referenced by afterUpdate(), create(), delete(), getContentTemplates(), ilWikiStat\handlePageCreated(), ilWikiStat\handlePageDeletion(), ilWikiStat\handlePageRating(), ilWikiStat\handlePageRead(), ilWikiStat\handlePageUpdated(), rename(), saveInternalLinks(), update(), and updateNews().

57  : int
58  {
59  return $this->getParentId();
60  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWikiPageContributors()

static ilWikiPage::getWikiPageContributors ( int  $a_page_id)
static

Definition at line 524 of file class.ilWikiPage.php.

Referenced by ilWikiPageGUI\deleteWikiPageConfirmationScreen().

526  : array {
527  return parent::getPageContributors("wpg", $a_page_id);
528  }
+ Here is the caller graph for this function:

◆ getWikiRefId()

ilWikiPage::getWikiRefId ( )

Definition at line 67 of file class.ilWikiPage.php.

References $parent_ref_id.

Referenced by create(), delete(), preparePageForCompare(), and update().

67  : int
68  {
69  return $this->parent_ref_id;
70  }
+ Here is the caller graph for this function:

◆ hideAdvancedMetadata()

ilWikiPage::hideAdvancedMetadata ( bool  $a_val)

Definition at line 92 of file class.ilWikiPage.php.

Referenced by read().

92  : void
93  {
94  $this->hide_adv_md = $a_val;
95  }
+ Here is the caller graph for this function:

◆ isAdvancedMetadataHidden()

ilWikiPage::isAdvancedMetadataHidden ( )

Definition at line 97 of file class.ilWikiPage.php.

References $hide_adv_md.

Referenced by create(), and update().

97  : bool
98  {
99  return $this->hide_adv_md;
100  }
+ Here is the caller graph for this function:

◆ lookupAdvancedMetadataHidden()

static ilWikiPage::lookupAdvancedMetadataHidden ( int  $a_page_id)
static

Definition at line 939 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $query.

Referenced by ilWikiFunctionsBlockGUI\getLegacyContent(), and ilObjWikiGUI\renderSideBlock().

941  : bool {
942  global $DIC;
943 
944  $ilDB = $DIC->database();
945 
946  $query = "SELECT * FROM il_wiki_page" .
947  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
948  $set = $ilDB->query($query);
949  if ($rec = $ilDB->fetchAssoc($set)) {
950  return (bool) $rec["hide_adv_md"];
951  }
952 
953  return false;
954  }
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ lookupObjIdByPage()

static ilWikiPage::lookupObjIdByPage ( int  $a_page_id)
static

returns the wiki/object id to a given page id

Definition at line 710 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $query.

Referenced by ilObjMediaObject\getParentObjectIdForUsage().

712  : ?int {
713  global $DIC;
714 
715  $ilDB = $DIC->database();
716 
717  $query = "SELECT wiki_id FROM il_wiki_page" .
718  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
719  $set = $ilDB->query($query);
720  if ($rec = $ilDB->fetchAssoc($set)) {
721  return (int) $rec["wiki_id"];
722  }
723 
724  return null;
725  }
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ lookupTitle()

static ilWikiPage::lookupTitle ( int  $a_page_id)
static

Definition at line 372 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $query.

Referenced by ilObjectFeedWriter\__construct(), ilUserFeedWriter\__construct(), ilWikiPagesTableGUI\__construct(), ilObjWikiGUI\_goto(), ilObjWikiGUI\confirmRemoveImportantPagesObject(), ilWikiHandlerGUI\executeCommand(), ilWikiStatGUI\export(), ilWikiSearchResultsTableGUI\fillRow(), ilWikiRecentChangesTableGUI\fillRow(), ilImportantPagesTableGUI\fillRow(), ilTermUsagesTableGUI\fillRow(), ilWikiContributorsTableGUI\fillRow(), ilMediaPoolPageUsagesTableGUI\fillRow(), ilMediaObjectUsagesTableGUI\fillRow(), ilPDNewsTableGUI\fillRow(), ilObjWiki\getAdvMDSubItemTitle(), ilObjWikiSubItemListGUI\getHTML(), ilWikiImportantPagesBlockGUI\getLegacyContent(), ilWikiNewsRendererGUI\getObjectLink(), ilObjWikiGUI\getSubObjectTitle(), ilLinkInputGUI\getTranslatedValue(), ilObjWikiSearchResultTableGUI\parse(), ilObjWikiGUI\saveSettingsObject(), ilWikiPageGUI\searchWikiLinkAC(), ILIAS\Notes\NotificationsManager\sendNotifications(), ilObjWikiGUI\setAsStartPageObject(), and ilNewsForContextBlockGUI\showNews().

372  : ?string
373  {
374  global $DIC;
375 
376  $ilDB = $DIC->database();
377 
378  $query = "SELECT * FROM il_wiki_page" .
379  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
380  $set = $ilDB->query($query);
381  if ($rec = $ilDB->fetchAssoc($set)) {
382  return (string) $rec["title"];
383  }
384  return null;
385  }
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ lookupWikiId()

static ilWikiPage::lookupWikiId ( int  $a_page_id)
static

Definition at line 387 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $query.

Referenced by ilObjWikiAccess\_checkGoto(), ilObjWikiGUI\_goto(), ilWikiImporter\finalProcessing(), and rename().

389  : ?int {
390  global $DIC;
391 
392  $ilDB = $DIC->database();
393 
394  $query = "SELECT wiki_id FROM il_wiki_page" .
395  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
396  $set = $ilDB->query($query);
397  if ($rec = $ilDB->fetchAssoc($set)) {
398  return (int) $rec["wiki_id"];
399  }
400 
401  return null;
402  }
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ preparePageForCompare()

ilWikiPage::preparePageForCompare ( ilPageObject  $page)
protected

Definition at line 956 of file class.ilWikiPage.php.

References getWikiRefId().

956  : void
957  {
958  $page->setWikiRefId($this->getWikiRefId());
959  }
+ Here is the call graph for this function:

◆ read()

ilWikiPage::read ( bool  $a_omit_page_read = false)

Definition at line 228 of file class.ilWikiPage.php.

References ilPageObject\$db, $ilDB, $query, ilPageObject\getId(), hideAdvancedMetadata(), setBlocked(), setRating(), setTitle(), and setWikiId().

230  : void {
231  $ilDB = $this->db;
232 
233  $query = "SELECT * FROM il_wiki_page WHERE id = " .
234  $ilDB->quote($this->getId(), "integer");
235  $set = $ilDB->query($query);
236  $rec = $ilDB->fetchAssoc($set);
237 
238  $this->setTitle($rec["title"]);
239  $this->setWikiId((int) $rec["wiki_id"]);
240  $this->setBlocked((bool) $rec["blocked"]);
241  $this->setRating((bool) $rec["rating"]);
242  $this->hideAdvancedMetadata((bool) $rec["hide_adv_md"]);
243 
244  // get co page
245  if (!$a_omit_page_read) {
246  parent::read();
247  }
248  }
setRating(bool $a_val)
hideAdvancedMetadata(bool $a_val)
setBlocked(bool $a_val)
setTitle(string $a_title)
$query
setWikiId(int $a_wikiid)
ilDBInterface $db
+ Here is the call graph for this function:

◆ rename()

ilWikiPage::rename ( string  $a_new_name)

Rename page.

Definition at line 730 of file class.ilWikiPage.php.

References $c, ilPageObject\$db, $ilDB, ilPageObject\_exists(), ilInternalLink\_getSourcesOfTarget(), ilObjWiki\_lookupStartPage(), ilWikiUtil\collectInternalLinks(), ilPageObject\getId(), getTitle(), getWikiId(), IL_WIKI_MODE_EXT_COLLECT, lookupWikiId(), ilWikiUtil\makeDbTitle(), setTitle(), update(), and ilObjWiki\writeStartPage().

732  : string {
733  $ilDB = $this->db;
734 
735  // replace unallowed characters
736  $a_new_name = str_replace(array("<", ">"), '', $a_new_name);
737 
738  // replace multiple whitespace characters by one single space
739  $a_new_name = trim(preg_replace('!\s+!', ' ', $a_new_name));
740 
741  $page_title = ilWikiUtil::makeDbTitle($a_new_name);
742  $pg_id = self::_getPageIdForWikiTitle($this->getWikiId(), $page_title);
743 
744  $xml_new_name = str_replace("&", "&amp;", $a_new_name);
745 
746  if ($pg_id == 0 || $pg_id == $this->getId()) {
747  $sources = ilInternalLink::_getSourcesOfTarget("wpg", $this->getId(), 0);
748 
749  $this->log->debug("nr of pages linking to renamed page: " . count($sources));
750  foreach ($sources as $s) {
751  if ($s["type"] === "wpg:pg" && ilPageObject::_exists("wpg", $s["id"])) {
752  $wpage = new ilWikiPage($s["id"]);
753  $wiki_id = ilWikiPage::lookupWikiId($s["id"]);
754  $this->log->debug("Getting links of page " . $s["id"]);
756  $wpage->getXMLContent(),
757  $wiki_id,
758  false,
760  );
761  $this->log->debug("nr internal links: " . count($col));
762  $new_content = $wpage->getXMLContent();
763  foreach ($col as $c) {
764 
765  $this->log->debug("found link " . print_r($c, true));
766 
767  // this complicated procedure is needed due to the fact
768  // that depending on the collation e = é is true
769  // in the (mysql) database
770  // see bug http://www.ilias.de/mantis/view.php?id=11227
771  $t1 = ilWikiUtil::makeDbTitle($c["nt"]->mTextform);
772  $t2 = ilWikiUtil::makeDbTitle($this->getTitle());
773 
774  // this one replaces C2A0 (&nbsp;) by a usual space
775  // otherwise the comparision will fail, since you
776  // get these characters from tiny if more than one
777  // space is repeated in a string. This may not be
778  // 100% but we do not store $t1 anywhere and only
779  // modify it for the comparison
780  $t1 = preg_replace('/\xC2\xA0/', ' ', $t1);
781  $t2 = preg_replace('/\xC2\xA0/', ' ', $t2);
782 
783  $set = $ilDB->query($q = "SELECT " . $ilDB->quote($t1, "text") . " = " . $ilDB->quote($t2, "text") . " isequal");
784  $rec = $ilDB->fetchAssoc($set);
785 
786  if ($rec["isequal"]) {
787  $new_content =
788  str_replace(
789  "[[" . $c["nt"]->mTextform . "]]",
790  "[[" . $xml_new_name . "]]",
791  $new_content
792  );
793  if ($c["text"] != "") {
794  $new_content =
795  str_replace(
796  "[[" . $c["text"] . "]]",
797  "[[" . $xml_new_name . "]]",
798  $new_content
799  );
800  }
801  $add = ($c["text"] != "")
802  ? "|" . $c["text"]
803  : "";
804  $new_content =
805  str_replace(
806  "[[" . $c["nt"]->mTextform . $add . "]]",
807  "[[" . $xml_new_name . $add . "]]",
808  $new_content
809  );
810  }
811  }
812  $wpage->setXMLContent($new_content);
813  //echo htmlentities($new_content);
814  $wpage->update();
815  }
816  }
817 
818  if (ilObjWiki::_lookupStartPage($this->getWikiId()) === $this->getTitle()) {
819  ilObjWiki::writeStartPage($this->getWikiId(), $a_new_name);
820  }
821 
822  $this->setTitle($a_new_name);
823 
824  $this->update();
825  }
826 
827  return $a_new_name;
828  }
$c
Definition: cli.php:38
static lookupWikiId(int $a_page_id)
setTitle(string $a_title)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static collectInternalLinks(string $s, int $a_wiki_id, bool $a_collect_non_ex=false, string $mode=IL_WIKI_MODE_COLLECT)
Collect internal wiki links of a string.
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)
update(bool $a_validate=true, bool $a_no_history=false)
static makeDbTitle(string $a_par)
ilDBInterface $db
const IL_WIKI_MODE_EXT_COLLECT
+ Here is the call graph for this function:

◆ saveInternalLinks()

ilWikiPage::saveInternalLinks ( DOMDocument  $a_domdoc)

Definition at line 530 of file class.ilWikiPage.php.

References ilPageObject\$db, $ilDB, ilPageObject\$xml, ilInternalLink\_saveLink(), ilWikiUtil\collectInternalLinks(), ilPageObject\getId(), getTitle(), getWikiId(), and ilWikiUtil\makeDbTitle().

Referenced by create().

532  : void {
533  $ilDB = $this->db;
534 
535  $this->log->debug("start...");
536  // *** STEP 1: Standard Processing ***
537 
538  parent::saveInternalLinks($a_domdoc);
539 
540 
541  // *** STEP 2: Other Pages -> This Page ***
542  $this->log->debug("this page <- other pages.");
543 
544  // Check, whether ANOTHER page links to this page as a "missing" page
545  // (this is the case, when this page is created newly)
546  $set = $ilDB->queryF(
547  "SELECT * FROM il_wiki_missing_page WHERE " .
548  " wiki_id = %s AND target_name = %s",
549  array("integer", "text"),
550  array($this->getWikiId(), ilWikiUtil::makeDbTitle($this->getTitle()))
551  );
552  while ($anmiss = $ilDB->fetchAssoc($set)) { // insert internal links instead
553  $this->log->debug("link found, source: " . $anmiss["source_id"] . ", target" .
554  $this->getId());
555  //echo "adding link";
557  "wpg:pg",
558  $anmiss["source_id"],
559  "wpg",
560  $this->getId(),
561  0
562  );
563  }
564  //exit;
565  // now remove the missing page entries
566  $ilDB->manipulateF(
567  "DELETE FROM il_wiki_missing_page WHERE " .
568  " wiki_id = %s AND target_name = %s",
569  array("integer", "text"),
570  array($this->getWikiId(), $this->getTitle())
571  );
572 
573 
574  // *** STEP 3: This Page -> Other Pages ***
575  $this->log->debug("this page -> other pages.");
576 
577  // remove the exising "missing page" links for THIS page (they will be re-inserted below)
578  $ilDB->manipulateF(
579  "DELETE FROM il_wiki_missing_page WHERE " .
580  " wiki_id = %s AND source_id = %s",
581  array("integer", "integer"),
582  array($this->getWikiId(), $this->getId())
583  );
584 
585  // collect the wiki links of the page
586  $xml = $a_domdoc->saveXML();
587  $int_wiki_links = ilWikiUtil::collectInternalLinks($xml, $this->getWikiId(), true);
588  foreach ($int_wiki_links as $wlink) {
589  $this->log->debug("found link : " . $wlink);
590  $page_id = self::_getPageIdForWikiTitle($this->getWikiId(), $wlink);
591  if ($page_id > 0) { // save internal link for existing page
592  $this->log->debug("save link " .
593  $this->getId() . ", target " . $page_id);
595  "wpg:pg",
596  $this->getId(),
597  "wpg",
598  $page_id,
599  0
600  );
601  } else { // save missing link for non-existing page
602  $ilDB->manipulateF(
603  "DELETE FROM il_wiki_missing_page WHERE" .
604  " wiki_id = %s AND source_id = %s AND target_name = %s",
605  array("integer", "integer", "text"),
606  array($this->getWikiId(), $this->getId(), $wlink)
607  );
608  $this->log->debug("target does not exist, save missing page source" .
609  $this->getId() . ", target " . $wlink);
610  $ilDB->manipulateF(
611  "INSERT INTO il_wiki_missing_page (wiki_id, source_id, target_name)" .
612  " VALUES (%s,%s,%s)",
613  array("integer", "integer", "text"),
614  array($this->getWikiId(), $this->getId(), $wlink)
615  );
616  }
617  }
618  $this->log->debug("...end");
619  }
static collectInternalLinks(string $s, int $a_wiki_id, bool $a_collect_non_ex=false, string $mode=IL_WIKI_MODE_COLLECT)
Collect internal wiki links of a string.
static makeDbTitle(string $a_par)
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBlocked()

ilWikiPage::setBlocked ( bool  $a_val)

Definition at line 72 of file class.ilWikiPage.php.

Referenced by read().

72  : void
73  {
74  $this->blocked = $a_val;
75  }
+ Here is the caller graph for this function:

◆ setRating()

ilWikiPage::setRating ( bool  $a_val)

Definition at line 82 of file class.ilWikiPage.php.

Referenced by read().

82  : void
83  {
84  $this->rating = $a_val;
85  }
+ Here is the caller graph for this function:

◆ setTitle()

ilWikiPage::setTitle ( string  $a_title)

Definition at line 42 of file class.ilWikiPage.php.

References ilWikiUtil\makeDbTitle().

Referenced by read(), and rename().

42  : void
43  {
44  $this->title = ilWikiUtil::makeDbTitle($a_title);
45  }
static makeDbTitle(string $a_par)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWikiId()

ilWikiPage::setWikiId ( int  $a_wikiid)

Definition at line 52 of file class.ilWikiPage.php.

References ilPageObject\setParentId().

Referenced by read().

52  : void
53  {
54  $this->setParentId($a_wikiid);
55  }
setParentId(int $a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWikiRefId()

ilWikiPage::setWikiRefId ( int  $a_wiki_ref_id)

Definition at line 62 of file class.ilWikiPage.php.

62  : void
63  {
64  $this->parent_ref_id = $a_wiki_ref_id;
65  }

◆ update()

ilWikiPage::update ( bool  $a_validate = true,
bool  $a_no_history = false 
)
Returns
array|bool
Exceptions
ilDateTimeException

Definition at line 198 of file class.ilWikiPage.php.

References ilPageObject\$db, $ilDB, $query, ILIAS\LTI\ToolProvider\$updated, getBlocked(), ilPageObject\getId(), getRating(), getTitle(), getWikiId(), getWikiRefId(), isAdvancedMetadataHidden(), ilWikiUtil\sendNotification(), ilNotification\TYPE_WIKI_PAGE, and updateNews().

Referenced by rename().

201  {
202  $ilDB = $this->db;
203  $this->log->debug("start...");
204  // update wiki page data
205  $query = "UPDATE il_wiki_page SET " .
206  " title = " . $ilDB->quote($this->getTitle(), "text") .
207  ",wiki_id = " . $ilDB->quote($this->getWikiId(), "integer") .
208  ",blocked = " . $ilDB->quote((int) $this->getBlocked(), "integer") .
209  ",rating = " . $ilDB->quote((int) $this->getRating(), "integer") .
210  ",hide_adv_md = " . $ilDB->quote((int) $this->isAdvancedMetadataHidden(), "integer") .
211  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
212  $ilDB->manipulate($query);
213  $updated = parent::update($a_validate, $a_no_history);
214 
215  if ($updated === true) {
216  $this->log->debug("send notification");
218 
219  $this->log->debug("update news");
220  $this->updateNews(true);
221  } else {
222  return $updated;
223  }
224 
225  return true;
226  }
static sendNotification(string $a_action, int $a_type, int $a_wiki_ref_id, int $a_page_id, ?string $a_comment=null)
int $updated
Timestamp for when the object was last updated.
Definition: System.php:158
$query
updateNews(bool $a_update=false)
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateNews()

ilWikiPage::updateNews ( bool  $a_update = false)

Definition at line 831 of file class.ilWikiPage.php.

References $ilUser, ilPageObject\$user, ilPageObject\getId(), ilNewsItem\getLastNewsIdForContext(), getTitle(), getWikiId(), and NEWS_NOTICE.

Referenced by create(), and update().

833  : void {
835 
836  $news_set = new ilSetting("news");
837  $default_visibility = ($news_set->get("default_visibility") != "")
838  ? $news_set->get("default_visibility")
839  : "users";
840 
841  if (!$a_update) {
842  $news_item = new ilNewsItem();
843  $news_item->setContext(
844  $this->getWikiId(),
845  "wiki",
846  $this->getId(),
847  "wpg"
848  );
849  $news_item->setPriority(NEWS_NOTICE);
850  $news_item->setTitle($this->getTitle());
851  $news_item->setContentTextIsLangVar(true);
852  $news_item->setContent("wiki_news_page_created");
853  $news_item->setUserId($ilUser->getId());
854  $news_item->setVisibility($default_visibility);
855  $news_item->create();
856  } else {
857  // get last news item of the day (if existing)
859  $this->getWikiId(),
860  "wiki",
861  $this->getId(),
862  "wpg",
863  true
864  );
865 
866  if ($news_id > 0) {
867  $news_item = new ilNewsItem($news_id);
868  $news_item->setContent("wiki_news_page_changed");
869  $news_item->setUserId($ilUser->getId());
870  $news_item->setTitle($this->getTitle());
871  $news_item->setContentTextIsLangVar(true);
872  $news_item->update(true);
873  } else {
874  $news_item = new ilNewsItem();
875  $news_item->setContext(
876  $this->getWikiId(),
877  "wiki",
878  $this->getId(),
879  "wpg"
880  );
881  $news_item->setPriority(NEWS_NOTICE);
882  $news_item->setTitle($this->getTitle());
883  $news_item->setContentTextIsLangVar(true);
884  $news_item->setContent("wiki_news_page_changed");
885  $news_item->setUserId($ilUser->getId());
886  $news_item->setVisibility($default_visibility);
887  $news_item->create();
888  }
889  }
890  }
static getLastNewsIdForContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="", bool $a_only_today=false)
Get last news id of news set related to a certain context.
const NEWS_NOTICE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A news item can be created by different sources.
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $blocked

bool ilWikiPage::$blocked = false
protected

Definition at line 28 of file class.ilWikiPage.php.

Referenced by getBlocked().

◆ $hide_adv_md

bool ilWikiPage::$hide_adv_md = false
protected

Definition at line 30 of file class.ilWikiPage.php.

Referenced by isAdvancedMetadataHidden().

◆ $parent_ref_id

int ilWikiPage::$parent_ref_id = 0
protected

Definition at line 26 of file class.ilWikiPage.php.

Referenced by getWikiRefId().

◆ $rating

bool ilWikiPage::$rating = false
protected

Definition at line 29 of file class.ilWikiPage.php.

Referenced by getRating().

◆ $title

string ilWikiPage::$title = ""
protected

Definition at line 27 of file class.ilWikiPage.php.

Referenced by getTitle().


The documentation for this class was generated from the following file: