ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 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...
 
 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...
 
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. 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)
 get xml content of page from dom (use this, if any changes are made to the document) More...
 
 getLanguageVariablesXML ()
 Get language variables as XML. More...
 
 appendLangVarXML (&$xml, $var)
 
 getFirstParagraphText ()
 
 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) 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 ()
 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...
 
 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. 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="")
 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...
 
 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. 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...
 

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
 

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 754 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $query.

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

755  {
756  global $DIC;
757 
758  $ilDB = $DIC->database();
759 
760  $query = "SELECT id FROM il_wiki_page" .
761  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
762  " AND title = " . $ilDB->quote($a_title, "text");
763  $set = $ilDB->query($query);
764  if ($rec = $ilDB->fetchAssoc($set)) {
765  return $rec["id"];
766  }
767 
768  return false;
769  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ 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.

public

Definition at line 610 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().

611  {
612  global $DIC;
613 
614  $ilDB = $DIC->database();
615 
616  $a_title = ilWikiUtil::makeDbTitle($a_title);
617 
618  $query = "SELECT id FROM il_wiki_page" .
619  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
620  " AND title = " . $ilDB->quote($a_title, "text");
621  $set = $ilDB->query($query);
622 
623  $pages = array();
624  if ($rec = $ilDB->fetchAssoc($set)) {
625  return true;
626  }
627 
628  return false;
629  }
global $DIC
Definition: saml.php:7
$query
static makeDbTitle($a_par)
Handle page GET parameter.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterConstructor()

ilWikiPage::afterConstructor ( )

After constructor.

Parameters

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

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

37  {
38  $this->getPageConfig()->configureByObjectId($this->getParentId());
39  }
getPageConfig()
Get page config object.
+ 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.

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

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

Count pages of wiki.

Parameters
int$a_wiki_idWiki ID

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

References $DIC, $ilDB, $query, $r, and $s.

Referenced by getRandomPage().

803  {
804  global $DIC;
805 
806  $ilDB = $DIC->database();
807 
808  // delete record of table il_wiki_data
809  $query = "SELECT count(*) as cnt FROM il_wiki_page" .
810  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
811  $s = $ilDB->query($query);
812  $r = $ilDB->fetchAssoc($s);
813 
814  return $r["cnt"];
815  }
global $DIC
Definition: saml.php:7
$s
Definition: pwgen.php:45
$r
Definition: example_031.php:79
$query
global $ilDB
+ 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.

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().

188  {
189  $ilDB = $this->db;
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  }
getBlocked()
Get blocked.
updateNews($a_update=false)
Create.
getWikiId()
Get Wiki Object Id.
getWikiRefId()
Get Wiki Ref Id.
isAdvancedMetadataHidden()
Get adv md visibility status.
getDomDoc()
Get dom doc (php5 dom document)
static sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment=null)
getRating()
Get rating.
const EVENT_PAGE_CREATED
$query
setId($a_id)
set id
static handleEvent($a_event, ilWikiPage $a_page_obj, $a_user_id=null, array $a_additional_data=null)
Handle wiki page event.
saveInternalLinks($a_domdoc)
save internal links of page
global $ilDB
getTitle()
Get Title.
+ Here is the call graph for this function:

◆ createFromXML()

ilWikiPage::createFromXML ( )

Create page from xml.

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

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

165  {
166  $ilDB = $this->db;
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.
global $ilDB
+ Here is the call graph for this function:

◆ delete()

ilWikiPage::delete ( )

delete wiki page and al related data

public

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

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

324  {
325  $ilDB = $this->db;
326 
327  // get other pages that link to this page
328  $linking_pages = ilWikiPage::getLinksToPage(
329  $this->getWikiId(),
330  $this->getId()
331  );
332 
333  // delete internal links information to this page
334  include_once("./Services/Link/classes/class.ilInternalLink.php");
336 
337  include_once "./Modules/Wiki/classes/class.ilWikiStat.php";
339 
340  include_once "./Services/Notification/classes/class.ilNotification.php";
342 
343  // remove all notifications
344  include_once "./Services/Notification/classes/class.ilNotification.php";
346 
347  // delete record of table il_wiki_data
348  $query = "DELETE FROM il_wiki_page" .
349  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
350  $ilDB->manipulate($query);
351 
352  // delete co page
353  parent::delete();
354 
355  // make links of other pages to this page a missing link
356  foreach ($linking_pages as $lp) {
357  $ilDB->manipulateF(
358  "DELETE FROM il_wiki_missing_page " .
359  " WHERE wiki_id = %s AND source_id = %s AND target_name = %s ",
360  array("integer", "integer", "text"),
361  array($this->getWikiId(), $lp["id"], $this->getTitle())
362  );
363  $ilDB->manipulateF(
364  "INSERT INTO il_wiki_missing_page " .
365  "(wiki_id, source_id, target_name) VALUES " .
366  "(%s,%s,%s)",
367  array("integer", "integer", "text"),
368  array($this->getWikiId(), $lp["id"], $this->getTitle())
369  );
370  }
371 
372  return true;
373  }
static removeForObject($type, $id)
Remove all notifications for given object.
getWikiId()
Get Wiki Object Id.
getWikiRefId()
Get Wiki Ref Id.
static sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment=null)
$query
static handleEvent($a_event, ilWikiPage $a_page_obj, $a_user_id=null, array $a_additional_data=null)
Handle wiki page event.
global $ilDB
getTitle()
Get Title.
static getLinksToPage($a_wiki_id, $a_page_id)
Get links to a page.
const EVENT_PAGE_DELETED
+ Here is the call graph for this function:

◆ deleteAllPagesOfWiki()

static ilWikiPage::deleteAllPagesOfWiki (   $a_wiki_id)
static

delete wiki page and al related data

public

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

References $DIC, $ilDB, and $query.

Referenced by ilObjWiki\delete().

381  {
382  global $DIC;
383 
384  $ilDB = $DIC->database();
385 
386  // delete record of table il_wiki_data
387  $query = "SELECT * FROM il_wiki_page" .
388  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
389  $set = $ilDB->query($query);
390 
391  while ($rec = $ilDB->fetchAssoc($set)) {
392  $wiki_page = new ilWikiPage($rec["id"]);
393  $wiki_page->delete();
394  }
395  }
global $DIC
Definition: saml.php:7
Class ilWikiPage.
$query
global $ilDB
+ 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 400 of file class.ilWikiPage.php.

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

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

401  {
402  global $DIC;
403 
404  $ilDB = $DIC->database();
405 
406  $a_title = ilWikiUtil::makeDbTitle($a_title);
407 
408  $query = "SELECT id FROM il_wiki_page" .
409  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
410  " AND title = " . $ilDB->quote($a_title, "text");
411  $set = $ilDB->query($query);
412  if ($rec = $ilDB->fetchAssoc($set)) {
413  return true;
414  }
415 
416  return false;
417  }
global $DIC
Definition: saml.php:7
$query
static makeDbTitle($a_par)
Handle page GET parameter.
global $ilDB
+ 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.

public

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

References $DIC, $ilDB, and $query.

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

507  {
508  global $DIC;
509 
510  $ilDB = $DIC->database();
511 
512  $pages = parent::getAllPages("wpg", $a_wiki_id);
513 
514  $query = "SELECT * FROM il_wiki_page" .
515  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
516  " ORDER BY title";
517  $set = $ilDB->query($query);
518 
519  $pg = array();
520  while ($rec = $ilDB->fetchAssoc($set)) {
521  if (isset($pages[$rec["id"]])) {
522  $pg[$rec["id"]] = $pages[$rec["id"]];
523  $pg[$rec["id"]]["title"] = $rec["title"];
524  }
525  }
526 
527  return $pg;
528  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ 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.

References $blocked.

Referenced by create(), and update().

117  {
118  return $this->blocked;
119  }
+ 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 1083 of file class.ilWikiPage.php.

References $t, getWikiId(), and ilWikiPageTemplate\TYPE_ADD_TO_PAGE.

1084  {
1085  include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
1086  $wt = new ilWikiPageTemplate($this->getWikiId());
1087  $templates = array();
1088  foreach ($wt->getAllInfo(ilWikiPageTemplate::TYPE_ADD_TO_PAGE) as $t) {
1089  $templates[] = array("id" => $t["wpage_id"], "parent_type" => "wpg", "title" => $t["title"]);
1090  }
1091  return $templates;
1092  }
getWikiId()
Get Wiki Object Id.
+ 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

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

Referenced by ilGlossaryPresentationGUI\getLinkXML(), ilLMPresentationGUI\getLinkXML(), and ilPageObjectGUI\setDefaultLinkXml().

1068  {
1069  if (!$a_offline) {
1070  $href = "./goto.php?target=wiki_wpage_" . $a_target;
1071  } else {
1072  $href = ILIAS_HTTP_PATH . "/goto.php?target=wiki_wpage_" . $a_target;
1073  }
1074  return $href;
1075  }
+ 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 422 of file class.ilWikiPage.php.

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

Referenced by ilWikiUtil\makeLink().

423  {
424  global $DIC;
425 
426  $ilDB = $DIC->database();
427 
428  $a_title = ilWikiUtil::makeDbTitle($a_title);
429 
430  $query = "SELECT id FROM il_wiki_page" .
431  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
432  " AND title = " . $ilDB->quote($a_title, "text");
433  $set = $ilDB->query($query);
434  if ($rec = $ilDB->fetchAssoc($set)) {
435  return $rec["id"];
436  }
437 
438  return false;
439  }
global $DIC
Definition: saml.php:7
$query
static makeDbTitle($a_par)
Handle page GET parameter.
global $ilDB
+ 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 533 of file class.ilWikiPage.php.

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

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

534  {
535  global $DIC;
536 
537  $ilDB = $DIC->database();
538 
539  include_once("./Services/Link/classes/class.ilInternalLink.php");
540  $sources = ilInternalLink::_getSourcesOfTarget("wpg", $a_page_id, 0);
541 
542  $ids = array();
543  foreach ($sources as $source) {
544  if ($source["type"] == "wpg:pg") {
545  $ids[] = $source["id"];
546  }
547  }
548  // get wiki page record
549  $query = "SELECT * FROM il_wiki_page wp, page_object p" .
550  " WHERE " . $ilDB->in("wp.id", $ids, false, "integer") .
551  " AND wp.id = p.page_id AND p.parent_type = " . $ilDB->quote("wpg", "text") .
552  " AND wp.wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
553  " ORDER BY title";
554  $set = $ilDB->query($query);
555 
556  $pages = array();
557  while ($rec = $ilDB->fetchAssoc($set)) {
558  $pages[] = array_merge($rec, array("user" => $rec["last_change_user"],
559  "date" => $rec["last_change"]));
560  }
561 
562  return $pages;
563  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
$source
Definition: linkback.php:22
+ 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 1056 of file class.ilWikiPage.php.

1057  {
1058  return "12.1.1: Test User, Max";
1059  }

◆ getNewWikiPages()

static ilWikiPage::getNewWikiPages (   $a_wiki_id)
static

Get all pages of wiki.

public

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

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

Referenced by ilWikiPagesTableGUI\getPages().

853  {
854  global $DIC;
855 
856  $ilDB = $DIC->database();
857 
858  $pages = parent::getNewPages("wpg", $a_wiki_id);
859 
860  foreach ($pages as $k => $page) {
861  $pages[$k]["title"] = ilWikiPage::lookupTitle($page["id"]);
862  }
863 
864  return $pages;
865  }
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
global $DIC
Definition: saml.php:7
global $ilDB
+ 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.

public

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

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

Referenced by ilWikiPagesTableGUI\getPages().

571  {
572  global $DIC;
573 
574  $ilDB = $DIC->database();
575 
576  $pages = ilWikiPage::getAllWikiPages($a_wiki_id);
577 
578  include_once("./Services/Link/classes/class.ilInternalLink.php");
579 
580  $orphaned = array();
581  foreach ($pages as $k => $page) {
582  $sources = ilInternalLink::_getSourcesOfTarget("wpg", $page["id"], 0);
583 
584  $ids = array();
585  foreach ($sources as $source) {
586  if ($source["type"] == "wpg:pg") {
587  $ids[] = $source["id"];
588  }
589  }
590  $query = "SELECT count(*) cnt FROM il_wiki_page" .
591  " WHERE " . $ilDB->in("id", $ids, false, "integer") .
592  " AND wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
593  " GROUP BY wiki_id";
594  $set = $ilDB->query($query);
595  $rec = $ilDB->fetchAssoc($set);
596  if ($rec["cnt"] == 0 &&
597  ilObjWiki::_lookupStartPage($a_wiki_id) != $page["title"]) {
598  $orphaned[] = $page;
599  }
600  }
601 
602  return $orphaned;
603  }
global $DIC
Definition: saml.php:7
static _lookupStartPage($a_wiki_id)
Lookup start page.
$query
static getAllWikiPages($a_wiki_id)
Get all pages of wiki.
global $ilDB
$source
Definition: linkback.php:22
+ 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 444 of file class.ilWikiPage.php.

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

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

445  {
446  global $DIC;
447 
448  $ilDB = $DIC->database();
449 
450  $a_title = ilWikiUtil::makeDbTitle($a_title);
451 
452  $query = "SELECT * FROM il_wiki_page" .
453  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
454  " AND title = " . $ilDB->quote($a_title, "text");
455  $set = $ilDB->query($query);
456  if ($rec = $ilDB->fetchAssoc($set)) {
457  return $rec["id"];
458  }
459 
460  return false;
461  }
global $DIC
Definition: saml.php:7
$query
static makeDbTitle($a_par)
Handle page GET parameter.
global $ilDB
+ 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

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

References $DIC, $ilDB, and $res.

Referenced by ilWikiPageGUI\insertWikiLinkAC().

1101  {
1102  global $DIC;
1103 
1104  $ilDB = $DIC->database();
1105 
1106  $set = $ilDB->query("SELECT DISTINCT title FROM il_wiki_page" .
1107  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
1108  " AND " . $ilDB->like("title", "text", "%" . $a_term . "%") .
1109  " ORDER by title");
1110  $res = array();
1111  while ($rec = $ilDB->fetchAssoc($set)) {
1112  $res[] = $rec["title"];
1113  }
1114 
1115  return $res;
1116  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB
+ Here is the caller graph for this function:

◆ getParentType()

ilWikiPage::getParentType ( )

Get parent type.

Returns
string parent type

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.

public

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

References $DIC, $ilDB, and $query.

Referenced by ilWikiPagesTableGUI\getPages().

777  {
778  global $DIC;
779 
780  $ilDB = $DIC->database();
781 
782  $query = "SELECT wp.*, po.view_cnt as cnt FROM il_wiki_page wp, page_object po" .
783  " WHERE wp.wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
784  " AND wp.id = po.page_id " .
785  " AND po.parent_type = " . $ilDB->quote("wpg", "text") . " " .
786  " ORDER BY po.view_cnt";
787  $set = $ilDB->query($query);
788 
789  $pages = array();
790  while ($rec = $ilDB->fetchAssoc($set)) {
791  $pages[] = $rec;
792  }
793 
794  return $pages;
795  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ 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 822 of file class.ilWikiPage.php.

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

Referenced by ilObjWikiGUI\randomPageObject().

823  {
824  global $DIC;
825 
826  $ilDB = $DIC->database();
827 
828  $cnt = ilWikiPage::countPages($a_wiki_id);
829 
830  if ($cnt < 1) {
831  return "";
832  }
833 
834  $random = new \ilRandom();
835  $rand = $random->int(1, $cnt);
836 
837  // delete record of table il_wiki_data
838  $ilDB->setLimit(1, $rand);
839  $query = "SELECT title FROM il_wiki_page" .
840  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
841  $s = $ilDB->query($query);
842  $r = $ilDB->fetchAssoc($s);
843 
844  return $r["title"];
845  }
global $DIC
Definition: saml.php:7
$s
Definition: pwgen.php:45
$r
Definition: example_031.php:79
$query
static countPages($a_wiki_id)
Count pages of wiki.
global $ilDB
+ 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.

References $rating.

Referenced by create(), and update().

137  {
138  return $this->rating;
139  }
+ 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.

References $title.

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

57  {
58  return $this->title;
59  }
+ Here is the caller graph for this function:

◆ getWikiContributors()

static ilWikiPage::getWikiContributors (   $a_wiki_id)
static

Get all contributors of wiki.

public

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

References $DIC, and $ilDB.

Referenced by ilWikiContributorsTableGUI\getContributors().

637  {
638  global $DIC;
639 
640  $ilDB = $DIC->database();
641 
642  $contributors = parent::getParentObjectContributors("wpg", $a_wiki_id);
643 
644  return $contributors;
645  }
global $DIC
Definition: saml.php:7
global $ilDB
+ 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.

References ilPageObject\getParentId().

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

77  {
78  return $this->getParentId();
79  }
+ 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.

public

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

References $DIC, and $ilDB.

Referenced by ilWikiPageGUI\deleteWikiPageConfirmationScreen().

653  {
654  global $DIC;
655 
656  $ilDB = $DIC->database();
657 
658  $contributors = parent::getPageContributors("wpg", $a_page_id);
659 
660  return $contributors;
661  }
global $DIC
Definition: saml.php:7
global $ilDB
+ 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.

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

97  {
98  return $this->parent_ref_id;
99  }
+ 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.

Referenced by read().

147  {
148  $this->hide_adv_md = (bool) $a_val;
149  }
+ 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.

References $hide_adv_md.

Referenced by create(), and update().

157  {
158  return $this->hide_adv_md;
159  }
+ Here is the caller graph for this function:

◆ lookupAdvancedMetadataHidden()

static ilWikiPage::lookupAdvancedMetadataHidden (   $a_page_id)
static

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

References $DIC, $ilDB, and $query.

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

1119  {
1120  global $DIC;
1121 
1122  $ilDB = $DIC->database();
1123 
1124  $query = "SELECT * FROM il_wiki_page" .
1125  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
1126  $set = $ilDB->query($query);
1127  if ($rec = $ilDB->fetchAssoc($set)) {
1128  return (bool) $rec["hide_adv_md"];
1129  }
1130 
1131  return false;
1132  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ 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 874 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $query.

Referenced by ilObjMediaObject\getParentObjectIdForUsage().

875  {
876  global $DIC;
877 
878  $ilDB = $DIC->database();
879 
880  $query = "SELECT wiki_id FROM il_wiki_page" .
881  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
882  $set = $ilDB->query($query);
883  if ($rec = $ilDB->fetchAssoc($set)) {
884  return $rec["wiki_id"];
885  }
886 
887  return false;
888  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the caller graph for this function:

◆ lookupTitle()

static ilWikiPage::lookupTitle (   $a_page_id)
static

Checks whether a page with given title exists.

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

References $DIC, $ilDB, and $query.

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

467  {
468  global $DIC;
469 
470  $ilDB = $DIC->database();
471 
472  $query = "SELECT * FROM il_wiki_page" .
473  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
474  $set = $ilDB->query($query);
475  if ($rec = $ilDB->fetchAssoc($set)) {
476  return $rec["title"];
477  }
478 
479  return false;
480  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the caller graph for this function:

◆ lookupWikiId()

static ilWikiPage::lookupWikiId (   $a_page_id)
static

Lookup wiki id.

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

References $DIC, $ilDB, and $query.

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

486  {
487  global $DIC;
488 
489  $ilDB = $DIC->database();
490 
491  $query = "SELECT wiki_id FROM il_wiki_page" .
492  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
493  $set = $ilDB->query($query);
494  if ($rec = $ilDB->fetchAssoc($set)) {
495  return $rec["wiki_id"];
496  }
497 
498  return false;
499  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the caller graph for this function:

◆ read()

ilWikiPage::read (   $a_omit_page_read = false)

Read wiki data.

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

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

297  {
298  $ilDB = $this->db;
299 
300  $query = "SELECT * FROM il_wiki_page WHERE id = " .
301  $ilDB->quote($this->getId(), "integer");
302  $set = $ilDB->query($query);
303  $rec = $ilDB->fetchAssoc($set);
304 
305  $this->setTitle($rec["title"]);
306  $this->setWikiId($rec["wiki_id"]);
307  $this->setBlocked($rec["blocked"]);
308  $this->setRating($rec["rating"]);
309  $this->hideAdvancedMetadata($rec["hide_adv_md"]);
310 
311  // get co page
312  if (!$a_omit_page_read) {
313  parent::read();
314  }
315  }
setTitle($a_title)
Set Title.
setBlocked($a_val)
Set blocked.
$query
global $ilDB
setWikiId($a_wikiid)
Set Wiki Object Id.
hideAdvancedMetadata($a_val)
Toggle adv md visibility.
setRating($a_val)
Set rating.
+ Here is the call graph for this function:

◆ rename()

ilWikiPage::rename (   $a_new_name)

Rename page.

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

References $c, ilPageObject\$db, $ilDB, $s, 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().

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

◆ saveInternalLinks()

ilWikiPage::saveInternalLinks (   $a_domdoc)

save internal links of page

Parameters
stringxml page code

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

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

Referenced by create().

670  {
671  $ilDB = $this->db;
672 
673 
674  // *** STEP 1: Standard Processing ***
675 
676  parent::saveInternalLinks($a_domdoc);
677 
678 
679  // *** STEP 2: Other Pages -> This Page ***
680 
681  // Check, whether ANOTHER page links to this page as a "missing" page
682  // (this is the case, when this page is created newly)
683  $set = $ilDB->queryF(
684  "SELECT * FROM il_wiki_missing_page WHERE " .
685  " wiki_id = %s AND target_name = %s",
686  array("integer", "text"),
687  array($this->getWikiId(), ilWikiUtil::makeDbTitle($this->getTitle()))
688  );
689  while ($anmiss = $ilDB->fetchAssoc($set)) { // insert internal links instead
690  //echo "adding link";
692  "wpg:pg",
693  $anmiss["source_id"],
694  "wpg",
695  $this->getId(),
696  0
697  );
698  }
699  //exit;
700  // now remove the missing page entries
701  $ilDB->manipulateF(
702  "DELETE FROM il_wiki_missing_page WHERE " .
703  " wiki_id = %s AND target_name = %s",
704  array("integer", "text"),
705  array($this->getWikiId(), $this->getTitle())
706  );
707 
708 
709  // *** STEP 3: This Page -> Other Pages ***
710 
711  // remove the exising "missing page" links for THIS page (they will be re-inserted below)
712  $ilDB->manipulateF(
713  "DELETE FROM il_wiki_missing_page WHERE " .
714  " wiki_id = %s AND source_id = %s",
715  array("integer", "integer"),
716  array($this->getWikiId(), $this->getId())
717  );
718 
719  // collect the wiki links of the page
720  include_once("./Modules/Wiki/classes/class.ilWikiUtil.php");
721  $xml = $a_domdoc->saveXML();
722  $int_wiki_links = ilWikiUtil::collectInternalLinks($xml, $this->getWikiId(), true);
723  foreach ($int_wiki_links as $wlink) {
724  $page_id = ilWikiPage::_getPageIdForWikiTitle($this->getWikiId(), $wlink);
725 
726  if ($page_id > 0) { // save internal link for existing page
728  "wpg:pg",
729  $this->getId(),
730  "wpg",
731  $page_id,
732  0
733  );
734  } else { // save missing link for non-existing page
735  $ilDB->manipulateF(
736  "DELETE FROM il_wiki_missing_page WHERE" .
737  " wiki_id = %s AND source_id = %s AND target_name = %s",
738  array("integer", "integer", "text"),
739  array($this->getWikiId(), $this->getId(), $wlink)
740  );
741  $ilDB->manipulateF(
742  "INSERT INTO il_wiki_missing_page (wiki_id, source_id, target_name)" .
743  " VALUES (%s,%s,%s)",
744  array("integer", "integer", "text"),
745  array($this->getWikiId(), $this->getId(), $wlink)
746  );
747  }
748  }
749  }
getWikiId()
Get Wiki Object Id.
static collectInternalLinks($s, $a_wiki_id, $a_collect_non_ex=false)
Collect internal wiki links of a string.
static _getPageIdForWikiTitle($a_wiki_id, $a_title)
Checks whether a page with given title exists.
static makeDbTitle($a_par)
Handle page GET parameter.
global $ilDB
getTitle()
Get Title.
+ 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.

Referenced by read().

107  {
108  $this->blocked = $a_val;
109  }
+ 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.

Referenced by read().

127  {
128  $this->rating = (bool) $a_val;
129  }
+ 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.

References ilWikiUtil\makeDbTitle().

Referenced by read(), and rename().

47  {
48  $this->title = ilWikiUtil::makeDbTitle($a_title);
49  }
static makeDbTitle($a_par)
Handle page GET parameter.
+ 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.

References ilPageObject\setParentId().

Referenced by read().

67  {
68  $this->setParentId($a_wikiid);
69  }
+ 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

public

Returns
boolean

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

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

Referenced by rename().

267  {
268  $ilDB = $this->db;
269 
270  // update wiki page data
271  $query = "UPDATE il_wiki_page SET " .
272  " title = " . $ilDB->quote($this->getTitle(), "text") .
273  ",wiki_id = " . $ilDB->quote((int) $this->getWikiId(), "integer") .
274  ",blocked = " . $ilDB->quote((int) $this->getBlocked(), "integer") .
275  ",rating = " . $ilDB->quote((int) $this->getRating(), "integer") .
276  ",hide_adv_md = " . $ilDB->quote((int) $this->isAdvancedMetadataHidden(), "integer") .
277  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
278  $ilDB->manipulate($query);
279  $updated = parent::update($a_validate, $a_no_history);
280 
281  if ($updated === true) {
282  include_once "./Services/Notification/classes/class.ilNotification.php";
284 
285  $this->updateNews(true);
286  } else {
287  return $updated;
288  }
289 
290  return true;
291  }
getBlocked()
Get blocked.
updateNews($a_update=false)
Create.
getWikiId()
Get Wiki Object Id.
getWikiRefId()
Get Wiki Ref Id.
isAdvancedMetadataHidden()
Get adv md visibility status.
static sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment=null)
getRating()
Get rating.
$query
update($pash, $contents, Config $config)
global $ilDB
getTitle()
Get Title.
+ 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 992 of file class.ilWikiPage.php.

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

Referenced by create(), and update().

993  {
995 
996  $news_set = new ilSetting("news");
997  $default_visibility = ($news_set->get("default_visibility") != "")
998  ? $news_set->get("default_visibility")
999  : "users";
1000 
1001  include_once("./Services/News/classes/class.ilNewsItem.php");
1002  if (!$a_update) {
1003  $news_item = new ilNewsItem();
1004  $news_item->setContext(
1005  $this->getWikiId(),
1006  "wiki",
1007  $this->getId(),
1008  "wpg"
1009  );
1010  $news_item->setPriority(NEWS_NOTICE);
1011  $news_item->setTitle($this->getTitle());
1012  $news_item->setContentTextIsLangVar(true);
1013  $news_item->setContent("wiki_news_page_created");
1014  $news_item->setUserId($ilUser->getId());
1015  $news_item->setVisibility($default_visibility);
1016  $news_item->create();
1017  } else {
1018  // get last news item of the day (if existing)
1020  $this->getWikiId(),
1021  "wiki",
1022  $this->getId(),
1023  "wpg",
1024  true
1025  );
1026 
1027  if ($news_id > 0) {
1028  $news_item = new ilNewsItem($news_id);
1029  $news_item->setContent("wiki_news_page_changed");
1030  $news_item->setUserId($ilUser->getId());
1031  $news_item->setTitle($this->getTitle());
1032  $news_item->setContentTextIsLangVar(true);
1033  $news_item->update(true);
1034  } else {
1035  $news_item = new ilNewsItem();
1036  $news_item->setContext(
1037  $this->getWikiId(),
1038  "wiki",
1039  $this->getId(),
1040  "wpg"
1041  );
1042  $news_item->setPriority(NEWS_NOTICE);
1043  $news_item->setTitle($this->getTitle());
1044  $news_item->setContentTextIsLangVar(true);
1045  $news_item->setContent("wiki_news_page_changed");
1046  $news_item->setUserId($ilUser->getId());
1047  $news_item->setVisibility($default_visibility);
1048  $news_item->create();
1049  }
1050  }
1051  }
getWikiId()
Get Wiki Object Id.
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.
const NEWS_NOTICE
$ilUser
Definition: imgupload.php:18
getTitle()
Get Title.
+ 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: