ILIAS  release_7 Revision v7.30-3-g800a261c036
ilWikiPage Class Reference

Class ilWikiPage. More...

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

Public Member Functions

 getParentType ()
 Get parent type. More...
 
 afterConstructor ()
 After constructor. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setWikiId ($a_wikiid)
 Set Wiki Object Id. More...
 
 getWikiId ()
 Get Wiki Object Id. More...
 
 setWikiRefId ($a_wiki_ref_id)
 Set Wiki Ref Id. More...
 
 getWikiRefId ()
 Get Wiki Ref Id. More...
 
 setBlocked ($a_val)
 Set blocked. More...
 
 getBlocked ()
 Get blocked. More...
 
 setRating ($a_val)
 Set rating. More...
 
 getRating ()
 Get rating. More...
 
 hideAdvancedMetadata ($a_val)
 Toggle adv md visibility. More...
 
 isAdvancedMetadataHidden ()
 Get adv md visibility status. More...
 
 createFromXML ()
 Create page from xml. More...
 
 create ($a_prevent_page_creation=false)
 Create new wiki page. More...
 
 afterUpdate ($a_domdoc=null, $a_xml="")
 
 update ($a_validate=true, $a_no_history=false)
 update object data More...
 
 read ($a_omit_page_read=false)
 Read wiki data. More...
 
 delete ()
 delete wiki page and al related data More...
 
 saveInternalLinks ($a_domdoc)
 save internal links of page More...
 
 rename ($a_new_name)
 Rename page. More...
 
 updateNews ($a_update=false)
 Create. More...
 
 getNewsContent ()
 Get content for a wiki news item. More...
 
 getContentTemplates ()
 Get content templates. More...
 
- Public Member Functions inherited from ilPageObject
 __construct ($a_id=0, $a_old_nr=0, $a_lang="-")
 Constructor @access public. More...
 
 afterConstructor ()
 After constructor. More...
 
 getParentType ()
 Get parent type. More...
 
 initPageConfig ()
 Init page config. More...
 
 setLanguage ($a_val)
 Set language. More...
 
 getLanguage ()
 Get language. More...
 
 setConcreteLang ($a_val)
 
 getConcreteLang ()
 
 setPageConfig ($a_val)
 Set page config object. More...
 
 getPageConfig ()
 Get page config object. More...
 
 setRenderMd5 ($a_rendermd5)
 Set Render MD5. More...
 
 getRenderMd5 ()
 Get Render MD5. More...
 
 setRenderedContent ($a_renderedcontent)
 Set Rendered Content. More...
 
 getRenderedContent ()
 Get Rendered Content. More...
 
 setRenderedTime ($a_renderedtime)
 Set Rendered Time. More...
 
 getRenderedTime ()
 Get Rendered Time. More...
 
 setLastChange ($a_lastchange)
 Set Last Change. More...
 
 getLastChange ()
 Get Last Change. More...
 
 setLastChangeUser ($a_val)
 Set last change user. More...
 
 getLastChangeUser ()
 Get last change user. More...
 
 setShowActivationInfo ($a_val)
 Set show page activation info. More...
 
 getShowActivationInfo ()
 Get show page activation info. More...
 
 read ()
 Read page data. More...
 
 buildDom ($a_force=false)
 
 freeDom ()
 
 getDom ()
 Deprecated php4DomDocument. More...
 
 getDomDoc ()
 Get dom doc (php5 dom document) More...
 
 setId ($a_id)
 set id More...
 
 getId ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 addUpdateListener (&$a_object, $a_method, $a_parameters="")
 
 callUpdateListeners ()
 
 setActive ($a_active)
 set activation More...
 
 getActive ($a_check_scheduled_activation=false)
 get activation More...
 
 setActivationStart ($a_activationstart)
 Set Activation Start. More...
 
 getActivationStart ()
 Get Activation Start. More...
 
 setActivationEnd ($a_activationend)
 Set Activation End. More...
 
 getActivationEnd ()
 Get Activation End. More...
 
 getContentObject ($a_hier_id, $a_pc_id="")
 Get a content object of the page. More...
 
 getContentObjectForPcId ($pcid)
 Get content object for pc id. More...
 
 getParentContentObjectForPcId ($pcid)
 Get parent content object for pc id. More...
 
getContentNode ($a_hier_id, $a_pc_id="")
 Get content node from dom. More...
 
 checkForTag ($a_content_tag, $a_hier_id, $a_pc_id="")
 Get content node from dom. More...
 
 lookforhier ($a_hier_id)
 
getNode ()
 
 setXMLContent ($a_xml, $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 ($a_xml)
 append xml content to page setXMLContent must be called before and the same encoding must be used More...
 
 getXMLContent ($a_incl_head=false)
 get xml content of page More...
 
 copyXmlContent ($a_clone_mobs=false)
 Copy content of page; replace page components with copies where necessary (e.g. More...
 
 handleCopiedContent ($a_dom, $a_self_ass=true, $a_clone_mobs=false)
 Handle copied content This function copies items, that must be copied, if page content is duplicated. More...
 
 newIIMCopies ($temp_dom)
 Replaces media objects in interactive images with copies of the interactive images. More...
 
 newMobCopies ($temp_dom)
 Replaces media objects with copies. More...
 
 newQuestionCopies (&$temp_dom)
 Replaces existing question content elements with new copies. More...
 
 removeQuestions (&$temp_dom)
 Remove questions from document. More...
 
 countPageContents ()
 Remove questions from document. More...
 
 getXMLFromDom ( $a_incl_head=false, $a_append_mobs=false, $a_append_bib=false, $a_append_str="", $a_omit_pageobject_tag=false, $style_id=0)
 get xml content of page from dom (use this, if any changes are made to the document) More...
 
 getLanguageVariablesXML ($style_id=0)
 Get language variables as XML. More...
 
 appendLangVarXML (&$xml, $var)
 
 getFirstParagraphText ()
 
 getParagraphForPCID ($pcid)
 
 setParagraphContent ($a_hier_id, $a_content)
 Set content of paragraph. More...
 
 setContainsIntLink ($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 ($a_val)
 Set import mode. More...
 
 getImportMode ()
 Get import mode. More...
 
 needsImportParsing ($a_parse="")
 
 setContainsQuestion ($a_val)
 Set contains question. More...
 
 getContainsQuestion ()
 Get contains question. More...
 
 collectMediaObjects ($a_inline_only=true)
 get all media objects, that are referenced and used within the page More...
 
 getInternalLinks ($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 ($a_mob_id, $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 ($a_pc_ids)
 Get hier ids for a set of pc ids. More...
 
 getHierIdForPcId ($pcid)
 
 getPCIdsForHierIds ($hier_ids)
 Get hier ids for a set of pc ids. More...
 
 getPCIdForHierId ($hier_id)
 
 addFileSizes ()
 add file sizes More...
 
 resolveIntLinks ($a_link_map=null)
 Resolves all internal link targets of the page, if targets are available (after import) More...
 
 resolveMediaAliases ($a_mapping, $a_reuse_existing_by_import=false)
 Resolve media aliases (after import) More...
 
 resolveIIMMediaAliases ($a_mapping)
 Resolve iim media aliases (in ilContObjParse) More...
 
 resolveFileItems ($a_mapping)
 Resolve file items (after import) More...
 
 resolveQuestionReferences ($a_mapping)
 Resolve all quesion references (after import) More...
 
 moveIntLinks ($a_from_to)
 Move internal links from one destination to another. More...
 
 handleImportRepositoryLink ($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
 
 handleRepositoryLinksOnCopy ($a_mapping, $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 (4.4.0 alpha) called by: More...
 
 afterUpdate ()
 After update. More...
 
 update ($a_validate=true, $a_no_history=false)
 update complete page content in db (dom xml content is used) More...
 
 delete ()
 delete page object More...
 
 saveStyleUsage ($a_domdoc, $a_old_nr=0)
 Save all style class/template usages. More...
 
 deleteStyleUsages ($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 ($a_domdoc)
 save internal links of page More...
 
 create ()
 create new page (with current xml data) More...
 
 deleteContent ($a_hid, $a_update=true, $a_pcid="")
 delete content object with hierarchical id $a_hid More...
 
 deleteContents ($a_hids, $a_update=true, $a_self_ass=false)
 Delete multiple content objects. More...
 
 cutContents ($a_hids)
 Copy contents to clipboard and cut them from the page. More...
 
 copyContents ($a_hids)
 Copy contents to clipboard. More...
 
 pasteContents ($a_hier_id, $a_self_ass=false)
 Paste contents from pc clipboard. More...
 
 switchEnableMultiple ($a_hids, $a_update=true, $a_self_ass=false)
 (De-)activate elements More...
 
 deleteContentFromHierId ($a_hid, $a_update=true)
 delete content object with hierarchical id >= $a_hid More...
 
 deleteContentBeforeHierId ($a_hid, $a_update=true)
 delete content object with hierarchical id < $a_hid More...
 
 insertContent (&$a_cont_obj, $a_pos, $a_mode=IL_INSERT_AFTER, $a_pcid="", bool $remove_placeholder=true)
 insert a content node before/after a sibling or as first child of a parent More...
 
 insertContentNode (&$a_cont_node, $a_pos, $a_mode=IL_INSERT_AFTER, $a_pcid="")
 insert a content node before/after a sibling or as first child of a parent More...
 
 moveContentBefore ($a_source, $a_target, $a_spcid="", $a_tpcid="")
 move content object from position $a_source before position $a_target (both hierarchical content ids) More...
 
 moveContentAfter ($a_source, $a_target, $a_spcid="", $a_tpcid="")
 move content object from position $a_source before position $a_target (both hierarchical content ids) More...
 
 bbCode2XML (&$a_content)
 transforms bbCode to corresponding xml More...
 
 insertInstIntoIDs ($a_inst, $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 ()
 Get all pc ids. More...
 
 getDuplicatePCIds ()
 Get all duplicate PC Ids. More...
 
 existsPCId ($a_pc_id)
 existsPCId More...
 
 generatePcId ($a_pc_ids=false)
 Generate new pc id. More...
 
 insertPCIds ()
 Insert Page Content IDs. More...
 
 getPageContentsHashes ()
 Get page contents hashes. More...
 
 getQuestionIds ()
 Get question ids. More...
 
 send_paragraph ($par_id, $filename)
 
 getFO ()
 get fo page content More...
 
 registerOfflineHandler ($handler)
 
 getOfflineHandler ()
 Get offline handler. More...
 
 containsDeactivatedElements ($a_content)
 Check whether content contains deactivated elements. More...
 
 getHistoryEntries ()
 Get History Entries. More...
 
 getHistoryEntry ($a_old_nr)
 Get History Entry. More...
 
 getHistoryInfo ($a_nr)
 Get information about a history entry, its predecessor and its successor. More...
 
 addChangeDivClasses ($a_hashes)
 
 compareVersion ($a_left, $a_right)
 Compares to revisions of the page. More...
 
 increaseViewCnt ()
 Increase view cnt. More...
 
 writeRenderedContent ($a_content, $a_md5)
 Write rendered content. More...
 
 containsIntLinks ($a_content)
 Check whether content contains internal links. More...
 
 performAutomaticModifications ()
 Perform automatic modifications (may be overwritten by sub classes) More...
 
 saveInitialOpenedContent ($a_type, $a_id, $a_target)
 Save initial opened content. More...
 
 getInitialOpenedContent ()
 Get initial opened content. More...
 
 beforePageContentUpdate ($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 ($a_id, $a_parent_type="", $a_parent_id=0, $a_clone_mobs=false)
 Copy page. More...
 
 copyPageToTranslation ($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 ($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 ($targets, $char_par, $char_sec, $char_med)
 Assign characteristic. More...
 

Static Public Member Functions

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

Protected Attributes

 $blocked = false
 
 $rating = false
 
 $hide_adv_md = false
 
- Protected Attributes inherited from ilPageObject
 $obj_definition
 
 $db
 
 $user
 
 $lng
 
 $tree
 
 $id
 
 $language = "-"
 
 $import_mode = false
 
 $log
 
 $page_record = array()
 
 $active = false
 
 $page_config
 
 $concrete_lang
 

Additional Inherited Members

- Data Fields inherited from ilPageObject
 $dom
 
 $xml
 
 $encoding
 
 $node
 
 $cur_dtd = "ilias_pg_5_4.dtd"
 
 $contains_int_link
 
 $needs_parsing
 
 $parent_type
 
 $parent_id
 
 $update_listeners
 
 $update_listener_cnt
 
 $offline_handler
 
 $dom_builded
 
 $history_saved
 
- Static Public Attributes inherited from ilPageObject
static $exists = array()
 
- Protected Member Functions inherited from ilPageObject
 __afterUpdate ($a_domdoc, $a_xml, $a_creation=false, $a_empty=false)
 After update event handler (internal). More...
 
 __beforeDelete ()
 Before deletion handler (internal). More...
 
 __afterHistoryEntry ($a_old_domdoc, $a_old_content, $a_old_nr)
 Before deletion handler (internal). More...
 
- Static Protected Attributes inherited from ilPageObject
static $activation_data = array()
 

Detailed Description

Class ilWikiPage.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

◆ _getPageIdForWikiTitle()

static ilWikiPage::_getPageIdForWikiTitle (   $a_wiki_id,
  $a_title 
)
static

Checks whether a page with given title exists.

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

769 {
770 global $DIC;
771
772 $ilDB = $DIC->database();
773
774 $query = "SELECT id FROM il_wiki_page" .
775 " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
776 " AND title = " . $ilDB->quote($a_title, "text");
777 $set = $ilDB->query($query);
778 if ($rec = $ilDB->fetchAssoc($set)) {
779 return $rec["id"];
780 }
781
782 return false;
783 }
global $DIC
Definition: goto.php:24
$query
global $ilDB

References $DIC, $ilDB, and $query.

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

+ Here is the caller graph for this function:

◆ _wikiPageExists()

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

Check whether page exists for wiki or not.

@access public

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

624 {
625 global $DIC;
626
627 $ilDB = $DIC->database();
628
629 $a_title = ilWikiUtil::makeDbTitle($a_title);
630
631 $query = "SELECT id FROM il_wiki_page" .
632 " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
633 " AND title = " . $ilDB->quote($a_title, "text");
634 $set = $ilDB->query($query);
635
636 $pages = array();
637 if ($rec = $ilDB->fetchAssoc($set)) {
638 return true;
639 }
640
641 return false;
642 }
static makeDbTitle($a_par)
Handle page GET parameter.

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterConstructor()

ilWikiPage::afterConstructor ( )

After constructor.

Parameters

return

Reimplemented from ilPageObject.

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

37 {
38 $this->getPageConfig()->configureByObjectId($this->getParentId());
39 }
getPageConfig()
Get page config object.

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

+ Here is the call graph for this function:

◆ afterUpdate()

ilWikiPage::afterUpdate (   $a_domdoc = null,
  $a_xml = "" 
)

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

226 {
227 // internal == wiki links
228 include_once "Modules/Wiki/classes/class.ilWikiUtil.php";
229 $this->log->debug("collect internal links");
230 $int_links = sizeof(ilWikiUtil::collectInternalLinks($a_xml, $this->getWikiId(), true));
231
232 $xpath = new DOMXPath($a_domdoc);
233
234 // external = internal + external links
235 $ext_links = sizeof($xpath->query('//IntLink'));
236 $ext_links += sizeof($xpath->query('//ExtLink'));
237
238 $footnotes = sizeof($xpath->query('//Footnote'));
239
240
241 // words/characters (xml)
242
243 $xml = strip_tags($a_xml);
244
245 include_once "Services/Utilities/classes/class.ilStr.php";
246 $num_chars = ilStr::strLen($xml);
247 $num_words = sizeof(explode(" ", $xml));
248
249 $page_data = array(
250 "int_links" => $int_links,
251 "ext_links" => $ext_links,
252 "footnotes" => $footnotes,
253 "num_words" => $num_words,
254 "num_chars" => $num_chars
255 );
256
257 include_once "./Modules/Wiki/classes/class.ilWikiStat.php";
258 $this->log->debug("handle stats");
260 }
static strLen($a_string)
Definition: class.ilStr.php:78
getWikiId()
Get Wiki Object Id.
const EVENT_PAGE_UPDATED
static handleEvent($a_event, ilWikiPage $a_page_obj, $a_user_id=null, array $a_additional_data=null)
Handle wiki page event.
static collectInternalLinks($s, $a_wiki_id, $a_collect_non_ex=false)
Collect internal wiki links of a string.

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

+ Here is the call graph for this function:

◆ countPages()

static ilWikiPage::countPages (   $a_wiki_id)
static

Count pages of wiki.

Parameters
int$a_wiki_idWiki ID

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

817 {
818 global $DIC;
819
820 $ilDB = $DIC->database();
821
822 // delete record of table il_wiki_data
823 $query = "SELECT count(*) as cnt FROM il_wiki_page" .
824 " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
825 $s = $ilDB->query($query);
826 $r = $ilDB->fetchAssoc($s);
827
828 return $r["cnt"];
829 }

References $DIC, $ilDB, and $query.

Referenced by getRandomPage().

+ Here is the caller graph for this function:

◆ create()

ilWikiPage::create (   $a_prevent_page_creation = false)

Create new wiki page.

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

188 {
190
191 $id = $ilDB->nextId("il_wiki_page");
192 $this->setId($id);
193 $query = "INSERT INTO il_wiki_page (" .
194 "id" .
195 ", title" .
196 ", wiki_id" .
197 ", blocked" .
198 ", rating" .
199 ", hide_adv_md" .
200 " ) VALUES (" .
201 $ilDB->quote($this->getId(), "integer")
202 . "," . $ilDB->quote($this->getTitle(), "text")
203 . "," . $ilDB->quote((int) $this->getWikiId(), "integer")
204 . "," . $ilDB->quote((int) $this->getBlocked(), "integer")
205 . "," . $ilDB->quote((int) $this->getRating(), "integer")
206 . "," . $ilDB->quote((int) $this->isAdvancedMetadataHidden(), "integer")
207 . ")";
208 $ilDB->manipulate($query);
209
210 // create page object
211 if (!$a_prevent_page_creation) {
212 parent::create();
213 $this->saveInternalLinks($this->getDomDoc());
214
215 include_once "./Modules/Wiki/classes/class.ilWikiStat.php";
217
218 include_once "./Services/Notification/classes/class.ilNotification.php";
220 }
221
222 $this->updateNews();
223 }
getDomDoc()
Get dom doc (php5 dom document)
setId($a_id)
set id
getBlocked()
Get blocked.
isAdvancedMetadataHidden()
Get adv md visibility status.
getTitle()
Get Title.
getRating()
Get rating.
saveInternalLinks($a_domdoc)
save internal links of page
getWikiRefId()
Get Wiki Ref Id.
updateNews($a_update=false)
Create.
const EVENT_PAGE_CREATED
static sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment=null)

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

+ Here is the call graph for this function:

◆ createFromXML()

ilWikiPage::createFromXML ( )

Create page from xml.

Reimplemented from ilPageObject.

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

165 {
167
168 // ilWikiDataset creates wiki pages without copage objects
169 // (see create function in this class, parameter $a_prevent_page_creation)
170 // The ilCOPageImporter will call createFromXML without running through the read
171 // method -> we will miss the important wiki id, thus we read it now
172 // see also bug #12224
173 $set = $ilDB->query(
174 "SELECT id FROM il_wiki_page " .
175 " WHERE id = " . $ilDB->quote($this->getId(), "integer")
176 );
177 if ($rec = $ilDB->fetchAssoc($set)) {
178 $this->read(true);
179 }
180
181 parent::createFromXML();
182 }
read()
Read page data.

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

+ Here is the call graph for this function:

◆ delete()

ilWikiPage::delete ( )

delete wiki page and al related data

@access public

Reimplemented from ilPageObject.

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

328 {
330
331 // get other pages that link to this page
332 $linking_pages = ilWikiPage::getLinksToPage(
333 $this->getWikiId(),
334 $this->getId()
335 );
336
337 // delete important page
338 // note: the wiki might be already deleted here
339 if (ilObject::_exists($this->getWikiId())) {
340 $wiki = new ilObjWiki($this->getWikiId(), false);
341 if ($wiki->isImportantPage($this->getId())) {
342 $wiki->removeImportantPage($this->getId());
343 }
344 }
345
346 // delete internal links information to this page
347 include_once("./Services/Link/classes/class.ilInternalLink.php");
349
350 include_once "./Modules/Wiki/classes/class.ilWikiStat.php";
352
353 include_once "./Services/Notification/classes/class.ilNotification.php";
355
356 // remove all notifications
357 include_once "./Services/Notification/classes/class.ilNotification.php";
359
360 // delete record of table il_wiki_data
361 $query = "DELETE FROM il_wiki_page" .
362 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
363 $ilDB->manipulate($query);
364
365 // delete co page
366 parent::delete();
367
368 // make links of other pages to this page a missing link
369 foreach ($linking_pages as $lp) {
370 $ilDB->manipulateF(
371 "DELETE FROM il_wiki_missing_page " .
372 " WHERE wiki_id = %s AND source_id = %s AND target_name = %s ",
373 array("integer", "integer", "text"),
374 array($this->getWikiId(), $lp["id"], $this->getTitle())
375 );
376 $ilDB->manipulateF(
377 "INSERT INTO il_wiki_missing_page " .
378 "(wiki_id, source_id, target_name) VALUES " .
379 "(%s,%s,%s)",
380 array("integer", "integer", "text"),
381 array($this->getWikiId(), $lp["id"], $this->getTitle())
382 );
383 }
384
385 return true;
386 }
static removeForObject($type, $id)
Remove all notifications for given object.
Class ilObjWiki.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static getLinksToPage($a_wiki_id, $a_page_id)
Get links to a page.
const EVENT_PAGE_DELETED

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

+ Here is the call graph for this function:

◆ deleteAllPagesOfWiki()

static ilWikiPage::deleteAllPagesOfWiki (   $a_wiki_id)
static

delete wiki page and al related data

@access public

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

394 {
395 global $DIC;
396
397 $ilDB = $DIC->database();
398
399 // delete record of table il_wiki_data
400 $query = "SELECT * FROM il_wiki_page" .
401 " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
402 $set = $ilDB->query($query);
403
404 while ($rec = $ilDB->fetchAssoc($set)) {
405 $wiki_page = new ilWikiPage($rec["id"]);
406 $wiki_page->delete();
407 }
408 }
Class ilWikiPage.

References $DIC, $ilDB, and $query.

Referenced by ilObjWiki\delete().

+ Here is the caller graph for this function:

◆ exists()

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

Checks whether a page with given title exists.

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

414 {
415 global $DIC;
416
417 $ilDB = $DIC->database();
418
419 $a_title = ilWikiUtil::makeDbTitle($a_title);
420
421 $query = "SELECT id FROM il_wiki_page" .
422 " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
423 " AND title = " . $ilDB->quote($a_title, "text");
424 $set = $ilDB->query($query);
425 if ($rec = $ilDB->fetchAssoc($set)) {
426 return true;
427 }
428
429 return false;
430 }

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllWikiPages()

static ilWikiPage::getAllWikiPages (   $a_wiki_id)
static

Get all pages of wiki.

@access public

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

520 {
521 global $DIC;
522
523 $ilDB = $DIC->database();
524
525 $pages = parent::getAllPages("wpg", $a_wiki_id);
526
527 $query = "SELECT * FROM il_wiki_page" .
528 " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
529 " ORDER BY title";
530 $set = $ilDB->query($query);
531
532 $pg = array();
533 while ($rec = $ilDB->fetchAssoc($set)) {
534 if (isset($pages[$rec["id"]])) {
535 $pg[$rec["id"]] = $pages[$rec["id"]];
536 $pg[$rec["id"]]["title"] = $rec["title"];
537 }
538 }
539
540 return $pg;
541 }

References $DIC, $ilDB, and $query.

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

+ Here is the caller graph for this function:

◆ getBlocked()

ilWikiPage::getBlocked ( )

Get blocked.

Returns
boolean blocked

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

117 {
118 return $this->blocked;
119 }

References $blocked.

Referenced by create(), and update().

+ 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)

Reimplemented from ilPageObject.

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

1098 {
1099 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
1100 $wt = new ilWikiPageTemplate($this->getWikiId());
1101 $templates = array();
1102 foreach ($wt->getAllInfo(ilWikiPageTemplate::TYPE_ADD_TO_PAGE) as $t) {
1103 $templates[] = array("id" => $t["wpage_id"], "parent_type" => "wpg", "title" => $t["title"]);
1104 }
1105 return $templates;
1106 }

References getWikiId(), and ilWikiPageTemplate\TYPE_ADD_TO_PAGE.

+ Here is the call graph for this function:

◆ getGotoForWikiPageTarget()

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

Get goto href for internal wiki page link target.

Parameters

return

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

1082 {
1083 if (!$a_offline) {
1084 $href = "./goto.php?target=wiki_wpage_" . $a_target;
1085 } else {
1086 $href = ILIAS_HTTP_PATH . "/goto.php?target=wiki_wpage_" . $a_target;
1087 }
1088 return $href;
1089 }

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

+ Here is the caller graph for this function:

◆ getIdForPageTitle()

static ilWikiPage::getIdForPageTitle (   $a_wiki_id,
  $a_title 
)
static

Checks whether a page with given title exists.

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

436 {
437 global $DIC;
438
439 $ilDB = $DIC->database();
440
441 $a_title = ilWikiUtil::makeDbTitle($a_title);
442
443 $query = "SELECT id FROM il_wiki_page" .
444 " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
445 " AND title = " . $ilDB->quote($a_title, "text");
446 $set = $ilDB->query($query);
447 if ($rec = $ilDB->fetchAssoc($set)) {
448 return $rec["id"];
449 }
450
451 return false;
452 }

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

Referenced by ilWikiUtil\makeLink().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLinksToPage()

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

Get links to a page.

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

547 {
548 global $DIC;
549
550 $ilDB = $DIC->database();
551
552 include_once("./Services/Link/classes/class.ilInternalLink.php");
553 $sources = ilInternalLink::_getSourcesOfTarget("wpg", $a_page_id, 0);
554
555 $ids = array();
556 foreach ($sources as $source) {
557 if ($source["type"] == "wpg:pg") {
558 $ids[] = $source["id"];
559 }
560 }
561 // get wiki page record
562 $query = "SELECT * FROM il_wiki_page wp, page_object p" .
563 " WHERE " . $ilDB->in("wp.id", $ids, false, "integer") .
564 " AND wp.id = p.page_id AND p.parent_type = " . $ilDB->quote("wpg", "text") .
565 " AND wp.wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
566 " ORDER BY title";
567 $set = $ilDB->query($query);
568
569 $pages = array();
570 while ($rec = $ilDB->fetchAssoc($set)) {
571 $pages[] = array_merge($rec, array("user" => $rec["last_change_user"],
572 "date" => $rec["last_change"]));
573 }
574
575 return $pages;
576 }
$source
Definition: metadata.php:76

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewsContent()

ilWikiPage::getNewsContent ( )

Get content for a wiki news item.

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

1071 {
1072 return "12.1.1: Test User, Max";
1073 }

◆ getNewWikiPages()

static ilWikiPage::getNewWikiPages (   $a_wiki_id)
static

Get all pages of wiki.

@access public

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

867 {
868 global $DIC;
869
870 $ilDB = $DIC->database();
871
872 $pages = parent::getNewPages("wpg", $a_wiki_id);
873
874 foreach ($pages as $k => $page) {
875 $pages[$k]["title"] = ilWikiPage::lookupTitle($page["id"]);
876 }
877
878 return $pages;
879 }
static lookupTitle($a_page_id)
Checks whether a page with given title exists.

References $DIC, $ilDB, and lookupTitle().

Referenced by ilWikiPagesTableGUI\getPages().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrphanedPages()

static ilWikiPage::getOrphanedPages (   $a_wiki_id)
static

Get orphaned pages of wiki.

@access public

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

584 {
585 global $DIC;
586
587 $ilDB = $DIC->database();
588
589 $pages = ilWikiPage::getAllWikiPages($a_wiki_id);
590
591 include_once("./Services/Link/classes/class.ilInternalLink.php");
592
593 $orphaned = array();
594 foreach ($pages as $k => $page) {
595 $sources = ilInternalLink::_getSourcesOfTarget("wpg", $page["id"], 0);
596
597 $ids = array();
598 foreach ($sources as $source) {
599 if ($source["type"] == "wpg:pg") {
600 $ids[] = $source["id"];
601 }
602 }
603 $query = "SELECT count(*) cnt FROM il_wiki_page" .
604 " WHERE " . $ilDB->in("id", $ids, false, "integer") .
605 " AND wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
606 " GROUP BY wiki_id";
607 $set = $ilDB->query($query);
608 $rec = $ilDB->fetchAssoc($set);
609 if ($rec["cnt"] == 0 &&
610 ilObjWiki::_lookupStartPage($a_wiki_id) != $page["title"]) {
611 $orphaned[] = $page;
612 }
613 }
614
615 return $orphaned;
616 }
static _lookupStartPage($a_wiki_id)
Lookup start page.
static getAllWikiPages($a_wiki_id)
Get all pages of wiki.

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

Referenced by ilWikiPagesTableGUI\getPages().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageIdForTitle()

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

Get wiki page object for id and title.

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

458 {
459 global $DIC;
460
461 $ilDB = $DIC->database();
462
463 $a_title = ilWikiUtil::makeDbTitle($a_title);
464
465 $query = "SELECT * FROM il_wiki_page" .
466 " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
467 " AND title = " . $ilDB->quote($a_title, "text");
468 $set = $ilDB->query($query);
469 if ($rec = $ilDB->fetchAssoc($set)) {
470 return $rec["id"];
471 }
472
473 return false;
474 }

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPagesForSearch()

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

Get pages for search.

Parameters

return

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

1115 {
1116 global $DIC;
1117
1118 $ilDB = $DIC->database();
1119
1120 $set = $ilDB->query("SELECT DISTINCT title FROM il_wiki_page" .
1121 " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
1122 " AND " . $ilDB->like("title", "text", "%" . $a_term . "%") .
1123 " ORDER by title");
1124 $res = array();
1125 while ($rec = $ilDB->fetchAssoc($set)) {
1126 $res[] = $rec["title"];
1127 }
1128
1129 return $res;
1130 }
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, and $res.

Referenced by ilWikiPageGUI\insertWikiLinkAC().

+ Here is the caller graph for this function:

◆ getParentType()

ilWikiPage::getParentType ( )

Get parent type.

Returns
string parent type

Reimplemented from ilPageObject.

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

26 {
27 return "wpg";
28 }

◆ getPopularPages()

static ilWikiPage::getPopularPages (   $a_wiki_id)
static

Get popular pages of wiki.

@access public

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

791 {
792 global $DIC;
793
794 $ilDB = $DIC->database();
795
796 $query = "SELECT wp.*, po.view_cnt as cnt FROM il_wiki_page wp, page_object po" .
797 " WHERE wp.wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
798 " AND wp.id = po.page_id " .
799 " AND po.parent_type = " . $ilDB->quote("wpg", "text") . " " .
800 " ORDER BY po.view_cnt";
801 $set = $ilDB->query($query);
802
803 $pages = array();
804 while ($rec = $ilDB->fetchAssoc($set)) {
805 $pages[] = $rec;
806 }
807
808 return $pages;
809 }

References $DIC, $ilDB, and $query.

Referenced by ilWikiPagesTableGUI\getPages().

+ Here is the caller graph for this function:

◆ getRandomPage()

static ilWikiPage::getRandomPage (   $a_wiki_id)
static

Get a random page.

Parameters
int$a_wiki_idWiki ID

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

837 {
838 global $DIC;
839
840 $ilDB = $DIC->database();
841
842 $cnt = ilWikiPage::countPages($a_wiki_id);
843
844 if ($cnt < 1) {
845 return "";
846 }
847
848 $random = new \ilRandom();
849 $rand = $random->int(1, $cnt);
850
851 // delete record of table il_wiki_data
852 $ilDB->setLimit(1, $rand);
853 $query = "SELECT title FROM il_wiki_page" .
854 " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
855 $s = $ilDB->query($query);
856 $r = $ilDB->fetchAssoc($s);
857
858 return $r["title"];
859 }
static countPages($a_wiki_id)
Count pages of wiki.

References $DIC, $ilDB, $query, and countPages().

Referenced by ilObjWikiGUI\randomPageObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRating()

ilWikiPage::getRating ( )

Get rating.

Returns
boolean

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

137 {
138 return $this->rating;
139 }

References $rating.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilWikiPage::getTitle ( )

Get Title.

Returns
string Title

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

57 {
58 return $this->title;
59 }

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

+ Here is the caller graph for this function:

◆ getWikiContributors()

static ilWikiPage::getWikiContributors (   $a_wiki_id)
static

Get all contributors of wiki.

@access public

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

650 {
651 global $DIC;
652
653 $ilDB = $DIC->database();
654
655 $contributors = parent::getParentObjectContributors("wpg", $a_wiki_id);
656
657 return $contributors;
658 }

References $DIC, and $ilDB.

Referenced by ilWikiContributorsTableGUI\getContributors().

+ Here is the caller graph for this function:

◆ getWikiId()

ilWikiPage::getWikiId ( )

Get Wiki Object Id.

Returns
int Wiki Object Id

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

77 {
78 return $this->getParentId();
79 }

References ilPageObject\getParentId().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWikiPageContributors()

static ilWikiPage::getWikiPageContributors (   $a_page_id)
static

Get all contributors of wiki.

@access public

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

666 {
667 global $DIC;
668
669 $ilDB = $DIC->database();
670
671 $contributors = parent::getPageContributors("wpg", $a_page_id);
672
673 return $contributors;
674 }

References $DIC, and $ilDB.

Referenced by ilWikiPageGUI\deleteWikiPageConfirmationScreen().

+ Here is the caller graph for this function:

◆ getWikiRefId()

ilWikiPage::getWikiRefId ( )

Get Wiki Ref Id.

Returns
int Wiki Ref Id

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

97 {
98 return $this->parent_ref_id;
99 }

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

+ Here is the caller graph for this function:

◆ hideAdvancedMetadata()

ilWikiPage::hideAdvancedMetadata (   $a_val)

Toggle adv md visibility.

Parameters
boolean$a_val

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

147 {
148 $this->hide_adv_md = (bool) $a_val;
149 }

Referenced by read().

+ Here is the caller graph for this function:

◆ isAdvancedMetadataHidden()

ilWikiPage::isAdvancedMetadataHidden ( )

Get adv md visibility status.

Returns
boolean

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

157 {
158 return $this->hide_adv_md;
159 }

References $hide_adv_md.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ lookupAdvancedMetadataHidden()

static ilWikiPage::lookupAdvancedMetadataHidden (   $a_page_id)
static

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

1133 {
1134 global $DIC;
1135
1136 $ilDB = $DIC->database();
1137
1138 $query = "SELECT * FROM il_wiki_page" .
1139 " WHERE id = " . $ilDB->quote($a_page_id, "integer");
1140 $set = $ilDB->query($query);
1141 if ($rec = $ilDB->fetchAssoc($set)) {
1142 return (bool) $rec["hide_adv_md"];
1143 }
1144
1145 return false;
1146 }

References $DIC, $ilDB, and $query.

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

+ Here is the caller graph for this function:

◆ lookupObjIdByPage()

static ilWikiPage::lookupObjIdByPage (   $a_page_id)
static

returns the wiki/object id to a given page id

Parameters
$a_page_id
Returns
int the object id

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

889 {
890 global $DIC;
891
892 $ilDB = $DIC->database();
893
894 $query = "SELECT wiki_id FROM il_wiki_page" .
895 " WHERE id = " . $ilDB->quote($a_page_id, "integer");
896 $set = $ilDB->query($query);
897 if ($rec = $ilDB->fetchAssoc($set)) {
898 return $rec["wiki_id"];
899 }
900
901 return false;
902 }

References $DIC, $ilDB, and $query.

Referenced by ilObjMediaObject\getParentObjectIdForUsage().

+ Here is the caller graph for this function:

◆ lookupTitle()

◆ lookupWikiId()

static ilWikiPage::lookupWikiId (   $a_page_id)
static

Lookup wiki id.

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

499 {
500 global $DIC;
501
502 $ilDB = $DIC->database();
503
504 $query = "SELECT wiki_id FROM il_wiki_page" .
505 " WHERE id = " . $ilDB->quote($a_page_id, "integer");
506 $set = $ilDB->query($query);
507 if ($rec = $ilDB->fetchAssoc($set)) {
508 return $rec["wiki_id"];
509 }
510
511 return false;
512 }

References $DIC, $ilDB, and $query.

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

+ Here is the caller graph for this function:

◆ read()

ilWikiPage::read (   $a_omit_page_read = false)

Read wiki data.

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

301 {
303
304 $query = "SELECT * FROM il_wiki_page WHERE id = " .
305 $ilDB->quote($this->getId(), "integer");
306 $set = $ilDB->query($query);
307 $rec = $ilDB->fetchAssoc($set);
308
309 $this->setTitle($rec["title"]);
310 $this->setWikiId($rec["wiki_id"]);
311 $this->setBlocked($rec["blocked"]);
312 $this->setRating($rec["rating"]);
313 $this->hideAdvancedMetadata($rec["hide_adv_md"]);
314
315 // get co page
316 if (!$a_omit_page_read) {
317 parent::read();
318 }
319 }
hideAdvancedMetadata($a_val)
Toggle adv md visibility.
setWikiId($a_wikiid)
Set Wiki Object Id.
setRating($a_val)
Set rating.
setBlocked($a_val)
Set blocked.
setTitle($a_title)
Set Title.

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

+ Here is the call graph for this function:

◆ rename()

ilWikiPage::rename (   $a_new_name)

Rename page.

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

908 {
910
911 // replace unallowed characters
912 $a_new_name = str_replace(array("<", ">"), '', $a_new_name);
913
914 // replace multiple whitespace characters by one single space
915 $a_new_name = trim(preg_replace('!\s+!', ' ', $a_new_name));
916
917 $page_title = ilWikiUtil::makeDbTitle($a_new_name);
918 $pg_id = ilWikiPage::_getPageIdForWikiTitle($this->getWikiId(), $page_title);
919
920 $xml_new_name = str_replace("&", "&amp;", $a_new_name);
921
922 if ($pg_id == 0 || $pg_id == $this->getId()) {
923 include_once("./Services/Link/classes/class.ilInternalLink.php");
924 $sources = ilInternalLink::_getSourcesOfTarget("wpg", $this->getId(), 0);
925
926 foreach ($sources as $s) {
927 if ($s["type"] == "wpg:pg" && ilPageObject::_exists("wpg", $s["id"])) {
928 $wpage = new ilWikiPage($s["id"]);
929
931 $wpage->getXmlContent(),
932 0,
934 );
935 $new_content = $wpage->getXmlContent();
936 foreach ($col as $c) {
937
938 // this complicated procedure is needed due to the fact
939 // that depending on the collation e = é is true
940 // in the (mysql) database
941 // see bug http://www.ilias.de/mantis/view.php?id=11227
942 $t1 = ilWikiUtil::makeDbTitle($c["nt"]->mTextform);
943 $t2 = ilWikiUtil::makeDbTitle($this->getTitle());
944
945 // this one replaces C2A0 (&nbsp;) by a usual space
946 // otherwise the comparision will fail, since you
947 // get these characters from tiny if more than one
948 // space is repeated in a string. This may not be
949 // 100% but we do not store $t1 anywhere and only
950 // modify it for the comparison
951 $t1 = preg_replace('/\xC2\xA0/', ' ', $t1);
952 $t2 = preg_replace('/\xC2\xA0/', ' ', $t2);
953
954 $set = $ilDB->query($q = "SELECT " . $ilDB->quote($t1, "text") . " = " . $ilDB->quote($t2, "text") . " isequal");
955 $rec = $ilDB->fetchAssoc($set);
956
957 if ($rec["isequal"]) {
958 $new_content =
959 str_replace(
960 "[[" . $c["nt"]->mTextform . "]]",
961 "[[" . $xml_new_name . "]]",
962 $new_content
963 );
964 if ($c["text"] != "") {
965 $new_content =
966 str_replace(
967 "[[" . $c["text"] . "]]",
968 "[[" . $xml_new_name . "]]",
969 $new_content
970 );
971 }
972 $add = ($c["text"] != "")
973 ? "|" . $c["text"]
974 : "";
975 $new_content =
976 str_replace(
977 "[[" . $c["nt"]->mTextform . $add . "]]",
978 "[[" . $xml_new_name . $add . "]]",
979 $new_content
980 );
981 }
982 }
983 $wpage->setXmlContent($new_content);
984 //echo htmlentities($new_content);
985 $wpage->update();
986 }
987 }
988
989 include_once("./Modules/Wiki/classes/class.ilObjWiki.php");
990 if (ilObjWiki::_lookupStartPage($this->getWikiId()) == $this->getTitle()) {
991 ilObjWiki::writeStartPage($this->getWikiId(), $a_new_name);
992 }
993
994 $this->setTitle($a_new_name);
995
996 $this->update();
997 }
998
999 return $a_new_name;
1000 }
const IL_WIKI_MODE_EXT_COLLECT
static writeStartPage($a_id, $a_name)
Write start page.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
update($a_validate=true, $a_no_history=false)
update object data
static _getPageIdForWikiTitle($a_wiki_id, $a_title)
Checks whether a page with given title exists.
static processInternalLinks( $s, $a_wiki_id, $a_mode=IL_WIKI_MODE_REPLACE, $a_collect_non_ex=false, $a_offline=false)
Process internal links.
$c
Definition: cli.php:37

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

+ Here is the call graph for this function:

◆ saveInternalLinks()

ilWikiPage::saveInternalLinks (   $a_domdoc)

save internal links of page

Parameters
stringxml page code

Reimplemented from ilPageObject.

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

683 {
685
686 $this->log->debug("start...");
687 // *** STEP 1: Standard Processing ***
688
689 parent::saveInternalLinks($a_domdoc);
690
691
692 // *** STEP 2: Other Pages -> This Page ***
693
694 // Check, whether ANOTHER page links to this page as a "missing" page
695 // (this is the case, when this page is created newly)
696 $set = $ilDB->queryF(
697 "SELECT * FROM il_wiki_missing_page WHERE " .
698 " wiki_id = %s AND target_name = %s",
699 array("integer", "text"),
700 array($this->getWikiId(), ilWikiUtil::makeDbTitle($this->getTitle()))
701 );
702 while ($anmiss = $ilDB->fetchAssoc($set)) { // insert internal links instead
703 //echo "adding link";
705 "wpg:pg",
706 $anmiss["source_id"],
707 "wpg",
708 $this->getId(),
709 0
710 );
711 }
712 //exit;
713 // now remove the missing page entries
714 $ilDB->manipulateF(
715 "DELETE FROM il_wiki_missing_page WHERE " .
716 " wiki_id = %s AND target_name = %s",
717 array("integer", "text"),
718 array($this->getWikiId(), $this->getTitle())
719 );
720
721
722 // *** STEP 3: This Page -> Other Pages ***
723
724 // remove the exising "missing page" links for THIS page (they will be re-inserted below)
725 $ilDB->manipulateF(
726 "DELETE FROM il_wiki_missing_page WHERE " .
727 " wiki_id = %s AND source_id = %s",
728 array("integer", "integer"),
729 array($this->getWikiId(), $this->getId())
730 );
731
732 // collect the wiki links of the page
733 include_once("./Modules/Wiki/classes/class.ilWikiUtil.php");
734 $xml = $a_domdoc->saveXML();
735 $int_wiki_links = ilWikiUtil::collectInternalLinks($xml, $this->getWikiId(), true);
736 foreach ($int_wiki_links as $wlink) {
737 $page_id = ilWikiPage::_getPageIdForWikiTitle($this->getWikiId(), $wlink);
738
739 if ($page_id > 0) { // save internal link for existing page
741 "wpg:pg",
742 $this->getId(),
743 "wpg",
744 $page_id,
745 0
746 );
747 } else { // save missing link for non-existing page
748 $ilDB->manipulateF(
749 "DELETE FROM il_wiki_missing_page WHERE" .
750 " wiki_id = %s AND source_id = %s AND target_name = %s",
751 array("integer", "integer", "text"),
752 array($this->getWikiId(), $this->getId(), $wlink)
753 );
754 $ilDB->manipulateF(
755 "INSERT INTO il_wiki_missing_page (wiki_id, source_id, target_name)" .
756 " VALUES (%s,%s,%s)",
757 array("integer", "integer", "text"),
758 array($this->getWikiId(), $this->getId(), $wlink)
759 );
760 }
761 }
762 $this->log->debug("...end");
763 }

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

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBlocked()

ilWikiPage::setBlocked (   $a_val)

Set blocked.

Parameters
boolean$a_valblocked

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

107 {
108 $this->blocked = $a_val;
109 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setRating()

ilWikiPage::setRating (   $a_val)

Set rating.

Parameters
boolean$a_val

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

127 {
128 $this->rating = (bool) $a_val;
129 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilWikiPage::setTitle (   $a_title)

Set Title.

Parameters
string$a_titleTitle

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

47 {
48 $this->title = ilWikiUtil::makeDbTitle($a_title);
49 }

References ilWikiUtil\makeDbTitle().

Referenced by read(), and rename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWikiId()

ilWikiPage::setWikiId (   $a_wikiid)

Set Wiki Object Id.

Parameters
int$a_wikiidWiki Object Id

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

67 {
68 $this->setParentId($a_wikiid);
69 }

References ilPageObject\setParentId().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWikiRefId()

ilWikiPage::setWikiRefId (   $a_wiki_ref_id)

Set Wiki Ref Id.

Parameters
int$a_wiki_ref_idWiki Ref Id

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

87 {
88 $this->parent_ref_id = $a_wiki_ref_id;
89 }

◆ update()

ilWikiPage::update (   $a_validate = true,
  $a_no_history = false 
)

update object data

@access public

Returns
boolean

Reimplemented from ilPageObject.

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

269 {
271 $this->log->debug("start...");
272 // update wiki page data
273 $query = "UPDATE il_wiki_page SET " .
274 " title = " . $ilDB->quote($this->getTitle(), "text") .
275 ",wiki_id = " . $ilDB->quote((int) $this->getWikiId(), "integer") .
276 ",blocked = " . $ilDB->quote((int) $this->getBlocked(), "integer") .
277 ",rating = " . $ilDB->quote((int) $this->getRating(), "integer") .
278 ",hide_adv_md = " . $ilDB->quote((int) $this->isAdvancedMetadataHidden(), "integer") .
279 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
280 $ilDB->manipulate($query);
281 $updated = parent::update($a_validate, $a_no_history);
282
283 if ($updated === true) {
284 include_once "./Services/Notification/classes/class.ilNotification.php";
285 $this->log->debug("send notification");
287
288 $this->log->debug("update news");
289 $this->updateNews(true);
290 } else {
291 return $updated;
292 }
293
294 return true;
295 }

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

Referenced by rename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateNews()

ilWikiPage::updateNews (   $a_update = false)

Create.

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

1007 {
1009
1010 $news_set = new ilSetting("news");
1011 $default_visibility = ($news_set->get("default_visibility") != "")
1012 ? $news_set->get("default_visibility")
1013 : "users";
1014
1015 include_once("./Services/News/classes/class.ilNewsItem.php");
1016 if (!$a_update) {
1017 $news_item = new ilNewsItem();
1018 $news_item->setContext(
1019 $this->getWikiId(),
1020 "wiki",
1021 $this->getId(),
1022 "wpg"
1023 );
1024 $news_item->setPriority(NEWS_NOTICE);
1025 $news_item->setTitle($this->getTitle());
1026 $news_item->setContentTextIsLangVar(true);
1027 $news_item->setContent("wiki_news_page_created");
1028 $news_item->setUserId($ilUser->getId());
1029 $news_item->setVisibility($default_visibility);
1030 $news_item->create();
1031 } else {
1032 // get last news item of the day (if existing)
1034 $this->getWikiId(),
1035 "wiki",
1036 $this->getId(),
1037 "wpg",
1038 true
1039 );
1040
1041 if ($news_id > 0) {
1042 $news_item = new ilNewsItem($news_id);
1043 $news_item->setContent("wiki_news_page_changed");
1044 $news_item->setUserId($ilUser->getId());
1045 $news_item->setTitle($this->getTitle());
1046 $news_item->setContentTextIsLangVar(true);
1047 $news_item->update(true);
1048 } else {
1049 $news_item = new ilNewsItem();
1050 $news_item->setContext(
1051 $this->getWikiId(),
1052 "wiki",
1053 $this->getId(),
1054 "wpg"
1055 );
1056 $news_item->setPriority(NEWS_NOTICE);
1057 $news_item->setTitle($this->getTitle());
1058 $news_item->setContentTextIsLangVar(true);
1059 $news_item->setContent("wiki_news_page_changed");
1060 $news_item->setUserId($ilUser->getId());
1061 $news_item->setVisibility($default_visibility);
1062 $news_item->create();
1063 }
1064 }
1065 }
const NEWS_NOTICE
static getLastNewsIdForContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="", $a_only_today=false)
Get last news id of news set related to a certain context.
ILIAS Setting Class.
$ilUser
Definition: imgupload.php:18

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

Referenced by create(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $blocked

ilWikiPage::$blocked = false
protected

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

Referenced by getBlocked().

◆ $hide_adv_md

ilWikiPage::$hide_adv_md = false
protected

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

Referenced by isAdvancedMetadataHidden().

◆ $rating

ilWikiPage::$rating = false
protected

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

Referenced by getRating().


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