ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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, $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
 ilPageObject ($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...
 
 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...
 
 _writeActive ($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
 write activation status More...
 
 _lookupActivationData ($a_id, $a_parent_type, $a_lang="-")
 Lookup activation data. More...
 
 _writeParentId ($a_parent_type, $a_pg_id, $a_par_id)
 Write parent id. 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)
 
 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...
 
 _moveContentAfterHierId (&$a_source_page, &$a_target_page, $a_hid)
 move content of hierarchical id >= $a_hid to other page 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...
 
 getAllFileObjIds ()
 Get all file object ids. 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 getAllPages ($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 getParentObjectContributors ($a_wiki_id)
 Get all contributors of wiki. More...
 
static getPageContributors ($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 getNewPages ($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 lookupParentId ($a_id, $a_type)
 Lookup parent id. More...
 
static _handleImportRepositoryLinks ($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
 Change targest of repository links. 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
 $import_mode = false
 
 $log
 

Additional Inherited Members

- Data Fields inherited from ilPageObject
 $id
 
 $ilias
 
 $dom
 
 $xml
 
 $encoding
 
 $node
 
 $cur_dtd = "ilias_pg_5_1.dtd"
 
 $contains_int_link
 
 $needs_parsing
 
 $parent_type
 
 $parent_id
 
 $update_listeners
 
 $update_listener_cnt
 
 $offline_handler
 
 $dom_builded
 
 $history_saved
 
 $language = "-"
 
- 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 733 of file class.ilWikiPage.php.

734 {
735 global $ilDB;
736
737 $query = "SELECT id FROM il_wiki_page".
738 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
739 " AND title = ".$ilDB->quote($a_title, "text");
740 $set = $ilDB->query($query);
741 if($rec = $ilDB->fetchAssoc($set))
742 {
743 return $rec["id"];
744 }
745
746 return false;
747 }
global $ilDB

References $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 609 of file class.ilWikiPage.php.

610 {
611 global $ilDB;
612
613 $a_title = ilWikiUtil::makeDbTitle($a_title);
614
615 $query = "SELECT id FROM il_wiki_page".
616 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
617 " AND title = ".$ilDB->quote($a_title, "text");
618 $set = $ilDB->query($query);
619
620 $pages = array();
621 if ($rec = $ilDB->fetchAssoc($set))
622 {
623 return true;
624 }
625
626 return false;
627 }
static makeDbTitle($a_par)
Handle page GET parameter.

References $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,
  $a_xml 
)

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

227 {
228 // internal == wiki links
229 include_once "Modules/Wiki/classes/class.ilWikiUtil.php";
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";
259 }
static strLen($a_string)
Definition: class.ilStr.php:79
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 779 of file class.ilWikiPage.php.

780 {
781 global $ilDB;
782
783 // delete record of table il_wiki_data
784 $query = "SELECT count(*) as cnt FROM il_wiki_page".
785 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer");
786 $s = $ilDB->query($query);
787 $r = $ilDB->fetchAssoc($s);
788
789 return $r["cnt"];
790 }
$r
Definition: example_031.php:79

References $ilDB, $query, and $r.

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 {
189 global $ilDB;
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 {
213 parent::create();
214 $this->saveInternalLinks($this->getDomDoc());
215
216 include_once "./Modules/Wiki/classes/class.ilWikiStat.php";
218
219 include_once "./Services/Notification/classes/class.ilNotification.php";
221 }
222
223 $this->updateNews();
224 }
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\$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 {
166 global $ilDB;
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("SELECT id FROM il_wiki_page ".
174 " WHERE id = ".$ilDB->quote($this->getId(), "integer")
175 );
176 if ($rec = $ilDB->fetchAssoc($set))
177 {
178 $this->read(true);
179 }
180
181 parent::createFromXML();
182 }
read()
Read page data.

References $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 328 of file class.ilWikiPage.php.

329 {
330 global $ilDB;
331
332 // get other pages that link to this page
333 $linking_pages = ilWikiPage::getLinksToPage($this->getWikiId(),
334 $this->getId());
335
336 // delete internal links information to this page
337 include_once("./Services/Link/classes/class.ilInternalLink.php");
339
340 include_once "./Modules/Wiki/classes/class.ilWikiStat.php";
342
343 include_once "./Services/Notification/classes/class.ilNotification.php";
345
346 // remove all notifications
347 include_once "./Services/Notification/classes/class.ilNotification.php";
349
350 // delete record of table il_wiki_data
351 $query = "DELETE FROM il_wiki_page".
352 " WHERE id = ".$ilDB->quote($this->getId(), "integer");
353 $ilDB->manipulate($query);
354
355 // delete co page
356 parent::delete();
357
358 // make links of other pages to this page a missing link
359 foreach($linking_pages as $lp)
360 {
361 $ilDB->manipulateF("DELETE FROM il_wiki_missing_page ".
362 " WHERE wiki_id = %s AND source_id = %s AND target_name = %s ",
363 array("integer", "integer", "text"),
364 array($this->getWikiId(), $lp["id"], $this->getTitle()));
365 $ilDB->manipulateF("INSERT INTO il_wiki_missing_page ".
366 "(wiki_id, source_id, target_name) VALUES ".
367 "(%s,%s,%s)",
368 array("integer", "integer", "text"),
369 array($this->getWikiId(), $lp["id"], $this->getTitle()));
370 }
371
372 return true;
373 }
static removeForObject($type, $id)
Remove all notifications for given object.
static getLinksToPage($a_wiki_id, $a_page_id)
Get links to a page
const EVENT_PAGE_DELETED

References $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.

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

381 {
382 global $ilDB;
383
384 // delete record of table il_wiki_data
385 $query = "SELECT * FROM il_wiki_page".
386 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer");
387 $set = $ilDB->query($query);
388
389 while($rec = $ilDB->fetchAssoc($set))
390 {
391 $wiki_page = new ilWikiPage($rec["id"]);
392 $wiki_page->delete();
393
394
395 }
396 }
Class ilWikiPage.

References $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 401 of file class.ilWikiPage.php.

402 {
403 global $ilDB;
404
405 $a_title = ilWikiUtil::makeDbTitle($a_title);
406
407 $query = "SELECT id FROM il_wiki_page".
408 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
409 " AND title = ".$ilDB->quote($a_title, "text");
410 $set = $ilDB->query($query);
411 if($rec = $ilDB->fetchAssoc($set))
412 {
413 return true;
414 }
415
416 return false;
417 }

References $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:

◆ getAllPages()

static ilWikiPage::getAllPages (   $a_wiki_id)
static

Get all pages of wiki

@access public

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

503 {
504 global $ilDB;
505
506 $pages = parent::getAllPages("wpg", $a_wiki_id);
507
508 $query = "SELECT * FROM il_wiki_page".
509 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
510 " ORDER BY title";
511 $set = $ilDB->query($query);
512
513 $pg = array();
514 while($rec = $ilDB->fetchAssoc($set))
515 {
516 if (isset($pages[$rec["id"]]))
517 {
518 $pg[$rec["id"]] = $pages[$rec["id"]];
519 $pg[$rec["id"]]["title"] = $rec["title"];
520 }
521 }
522
523 return $pg;
524 }

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

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

1049 {
1050 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
1051 $wt = new ilWikiPageTemplate($this->getWikiId());
1052 $templates = array();
1053 foreach ($wt->getAllInfo(ilWikiPageTemplate::TYPE_ADD_TO_PAGE) as $t)
1054 {
1055 $templates[] = array("id" => $t["wpage_id"], "parent_type" => "wpg", "title" => $t["title"]);
1056 }
1057 return $templates;
1058 }

References $t, 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 1029 of file class.ilWikiPage.php.

1030 {
1031 if (!$a_offline)
1032 {
1033 $href = "./goto.php?target=wiki_wpage_".$a_target;
1034 }
1035 else
1036 {
1037 $href = ILIAS_HTTP_PATH."/goto.php?target=wiki_wpage_".$a_target;
1038 }
1039 return $href;
1040 }

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

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

423 {
424 global $ilDB;
425
426 $a_title = ilWikiUtil::makeDbTitle($a_title);
427
428 $query = "SELECT id FROM il_wiki_page".
429 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
430 " AND title = ".$ilDB->quote($a_title, "text");
431 $set = $ilDB->query($query);
432 if($rec = $ilDB->fetchAssoc($set))
433 {
434 return $rec["id"];
435 }
436
437 return false;
438 }

References $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 529 of file class.ilWikiPage.php.

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

References $ilDB, $query, 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:

◆ getNewPages()

static ilWikiPage::getNewPages (   $a_wiki_id)
static

Get all pages of wiki

@access public

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

826 {
827 global $ilDB;
828
829 $pages = parent::getNewPages("wpg", $a_wiki_id);
830
831 foreach($pages as $k => $page)
832 {
833 $pages[$k]["title"] = ilWikiPage::lookupTitle($page["id"]);
834 }
835
836 return $pages;
837 }
static lookupTitle($a_page_id)
Checks whether a page with given title exists.

References $ilDB, and lookupTitle().

Referenced by 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 1018 of file class.ilWikiPage.php.

1019 {
1020 return "12.1.1: Test User, Max";
1021 }

◆ getOrphanedPages()

static ilWikiPage::getOrphanedPages (   $a_wiki_id)
static

Get orphaned pages of wiki

@access public

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

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

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

Referenced by ilWikiPagesTableGUI\getPages().

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

◆ getPageContributors()

static ilWikiPage::getPageContributors (   $a_page_id)
static

Get all contributors of wiki.

@access public

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

649 {
650 global $ilDB;
651
652 $contributors = parent::getPageContributors("wpg", $a_page_id);
653
654 return $contributors;
655 }

References $ilDB.

Referenced by ilWikiPageGUI\deleteWikiPageConfirmationScreen().

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

444 {
445 global $ilDB;
446
447 $a_title = ilWikiUtil::makeDbTitle($a_title);
448
449 $query = "SELECT * FROM il_wiki_page".
450 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
451 " AND title = ".$ilDB->quote($a_title, "text");
452 $set = $ilDB->query($query);
453 if($rec = $ilDB->fetchAssoc($set))
454 {
455 return $rec["id"];
456 }
457
458 return false;
459 }

References $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 1066 of file class.ilWikiPage.php.

1067 {
1068 global $ilDB;
1069
1070 $set = $ilDB->query("SELECT DISTINCT title FROM il_wiki_page".
1071 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
1072 " AND ".$ilDB->like("title", "text", "%".$a_term."%").
1073 " ORDER by title");
1074 $res = array();
1075 while ($rec = $ilDB->fetchAssoc($set))
1076 {
1077 $res[] = $rec["title"];
1078 }
1079
1080 return $res;
1081 }

References $ilDB, and $res.

Referenced by ilWikiPageGUI\insertWikiLinkAC().

+ Here is the caller graph for this function:

◆ getParentObjectContributors()

static ilWikiPage::getParentObjectContributors (   $a_wiki_id)
static

Get all contributors of wiki.

@access public

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

635 {
636 global $ilDB;
637
638 $contributors = parent::getParentObjectContributors("wpg", $a_wiki_id);
639
640 return $contributors;
641 }

References $ilDB.

Referenced by ilWikiContributorsTableGUI\getContributors().

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

755 {
756 global $ilDB;
757
758 $query = "SELECT wp.*, po.view_cnt as cnt FROM il_wiki_page wp, page_object po".
759 " WHERE wp.wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
760 " AND wp.id = po.page_id ".
761 " AND po.parent_type = ".$ilDB->quote("wpg", "text")." ".
762 " ORDER BY po.view_cnt";
763 $set = $ilDB->query($query);
764
765 $pages = array();
766 while($rec = $ilDB->fetchAssoc($set))
767 {
768 $pages[] = $rec;
769 }
770
771 return $pages;
772 }

References $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 797 of file class.ilWikiPage.php.

798 {
799 global $ilDB;
800
801 $cnt = ilWikiPage::countPages($a_wiki_id);
802
803 if ($cnt < 1)
804 {
805 return "";
806 }
807
808 $rand = rand(1, $cnt);
809
810 // delete record of table il_wiki_data
811 $ilDB->setLimit(1, $rand);
812 $query = "SELECT title FROM il_wiki_page".
813 " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer");
814 $s = $ilDB->query($query);
815 $r = $ilDB->fetchAssoc($s);
816
817 return $r["title"];
818 }
static countPages($a_wiki_id)
Count pages of wiki.

References $ilDB, $query, $r, 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:

◆ 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:

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

1084 {
1085 global $ilDB;
1086
1087 $query = "SELECT * FROM il_wiki_page".
1088 " WHERE id = ".$ilDB->quote($a_page_id, "integer");
1089 $set = $ilDB->query($query);
1090 if($rec = $ilDB->fetchAssoc($set))
1091 {
1092 return (bool)$rec["hide_adv_md"];
1093 }
1094
1095 return false;
1096 }

References $ilDB, and $query.

Referenced by ilWikiFunctionsBlockGUI\fillDataSection(), 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 846 of file class.ilWikiPage.php.

847 {
848 global $ilDB;
849
850 $query = "SELECT wiki_id FROM il_wiki_page".
851 " WHERE id = ".$ilDB->quote($a_page_id, "integer");
852 $set = $ilDB->query($query);
853 if($rec = $ilDB->fetchAssoc($set))
854 {
855 return $rec["wiki_id"];
856 }
857
858 return false;
859 }

References $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 482 of file class.ilWikiPage.php.

483 {
484 global $ilDB;
485
486 $query = "SELECT wiki_id FROM il_wiki_page".
487 " WHERE id = ".$ilDB->quote($a_page_id, "integer");
488 $set = $ilDB->query($query);
489 if ($rec = $ilDB->fetchAssoc($set))
490 {
491 return $rec["wiki_id"];
492 }
493
494 return false;
495 }

References $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 {
302 global $ilDB;
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 {
318 parent::read();
319 }
320 }
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 $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 864 of file class.ilWikiPage.php.

865 {
866 global $ilDB;
867
868 // replace unallowed characters
869 $a_new_name = str_replace(array("<", ">"), '', $a_new_name);
870
871 // replace multiple whitespace characters by one single space
872 $a_new_name = trim(preg_replace('!\s+!', ' ', $a_new_name));
873
874 $page_title = ilWikiUtil::makeDbTitle($a_new_name);
875 $pg_id = ilWikiPage::_getPageIdForWikiTitle($this->getWikiId(), $page_title);
876
877 $xml_new_name = str_replace("&", "&amp;", $a_new_name);
878
879 if ($pg_id == 0 || $pg_id == $this->getId())
880 {
881 include_once("./Services/Link/classes/class.ilInternalLink.php");
882 $sources = ilInternalLink::_getSourcesOfTarget("wpg", $this->getId(), 0);
883
884 foreach ($sources as $s)
885 {
886 if ($s["type"] == "wpg:pg" && ilPageObject::_exists("wpg", $s["id"]))
887 {
888 $wpage = new ilWikiPage($s["id"]);
889
890 $col = ilWikiUtil::processInternalLinks($wpage->getXmlContent(), 0,
892 $new_content = $wpage->getXmlContent();
893 foreach ($col as $c)
894 {
895
896 // this complicated procedure is needed due to the fact
897 // that depending on the collation e = é is true
898 // in the (mysql) database
899 // see bug http://www.ilias.de/mantis/view.php?id=11227
900 $t1 = ilWikiUtil::makeDbTitle($c["nt"]->mTextform);
901 $t2 = ilWikiUtil::makeDbTitle($this->getTitle());
902
903 // this one replaces C2A0 (&nbsp;) by a usual space
904 // otherwise the comparision will fail, since you
905 // get these characters from tiny if more than one
906 // space is repeated in a string. This may not be
907 // 100% but we do not store $t1 anywhere and only
908 // modify it for the comparison
909 $t1 = preg_replace('/\xC2\xA0/', ' ', $t1);
910 $t2 = preg_replace('/\xC2\xA0/', ' ', $t2);
911
912 $set = $ilDB->query($q = "SELECT ".$ilDB->quote($t1, "text")." = ".$ilDB->quote($t2, "text")." isequal");
913 $rec = $ilDB->fetchAssoc($set);
914
915 if ($rec["isequal"])
916 {
917 $new_content =
918 str_replace("[[".$c["nt"]->mTextform."]]",
919 "[[".$xml_new_name."]]", $new_content);
920 if ($c["text"] != "")
921 {
922 $new_content =
923 str_replace("[[".$c["text"]."]]",
924 "[[".$xml_new_name."]]", $new_content);
925 }
926 $add = ($c["text"] != "")
927 ? "|".$c["text"]
928 : "";
929 $new_content =
930 str_replace("[[".$c["nt"]->mTextform.$add."]]",
931 "[[".$xml_new_name.$add."]]", $new_content);
932 }
933 }
934 $wpage->setXmlContent($new_content);
935//echo htmlentities($new_content);
936 $wpage->update();
937 }
938 }
939
940 include_once("./Modules/Wiki/classes/class.ilObjWiki.php");
941 if (ilObjWiki::_lookupStartPage($this->getWikiId()) == $this->getTitle())
942 {
943 ilObjWiki::writeStartPage($this->getWikiId(), $a_new_name);
944 }
945
946 $this->setTitle($a_new_name);
947
948 $this->update();
949 }
950
951 return $a_new_name;
952 }
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.

References $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 663 of file class.ilWikiPage.php.

664 {
665 global $ilDB;
666
667
668 // *** STEP 1: Standard Processing ***
669
670 parent::saveInternalLinks($a_domdoc);
671
672
673 // *** STEP 2: Other Pages -> This Page ***
674
675 // Check, whether ANOTHER page links to this page as a "missing" page
676 // (this is the case, when this page is created newly)
677 $set = $ilDB->queryF("SELECT * FROM il_wiki_missing_page WHERE ".
678 " wiki_id = %s AND target_name = %s",
679 array("integer", "text"),
680 array($this->getWikiId(), ilWikiUtil::makeDbTitle($this->getTitle())));
681 while ($anmiss = $ilDB->fetchAssoc($set)) // insert internal links instead
682 {
683//echo "adding link";
684 ilInternalLink::_saveLink("wpg:pg", $anmiss["source_id"], "wpg",
685 $this->getId(), 0);
686 }
687//exit;
688 // now remove the missing page entries
689 $ilDB->manipulateF("DELETE FROM il_wiki_missing_page WHERE ".
690 " wiki_id = %s AND target_name = %s",
691 array("integer", "text"),
692 array($this->getWikiId(), $this->getTitle()));
693
694
695 // *** STEP 3: This Page -> Other Pages ***
696
697 // remove the exising "missing page" links for THIS page (they will be re-inserted below)
698 $ilDB->manipulateF("DELETE FROM il_wiki_missing_page WHERE ".
699 " wiki_id = %s AND source_id = %s",
700 array("integer", "integer"),
701 array($this->getWikiId(), $this->getId()));
702
703 // collect the wiki links of the page
704 include_once("./Modules/Wiki/classes/class.ilWikiUtil.php");
705 $xml = $a_domdoc->saveXML();
706 $int_wiki_links = ilWikiUtil::collectInternalLinks($xml, $this->getWikiId(), true);
707 foreach($int_wiki_links as $wlink)
708 {
709 $page_id = ilWikiPage::_getPageIdForWikiTitle($this->getWikiId(), $wlink);
710
711 if ($page_id > 0) // save internal link for existing page
712 {
713 ilInternalLink::_saveLink("wpg:pg", $this->getId(), "wpg",
714 $page_id, 0);
715 }
716 else // save missing link for non-existing page
717 {
718 $ilDB->manipulateF("DELETE FROM il_wiki_missing_page WHERE".
719 " wiki_id = %s AND source_id = %s AND target_name = %s",
720 array("integer", "integer", "text"),
721 array($this->getWikiId(), $this->getId(), $wlink));
722 $ilDB->manipulateF("INSERT INTO il_wiki_missing_page (wiki_id, source_id, target_name)".
723 " VALUES (%s,%s,%s)",
724 array("integer", "integer", "text"),
725 array($this->getWikiId(), $this->getId(), $wlink));
726 }
727 }
728 }

References $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 267 of file class.ilWikiPage.php.

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

References $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 958 of file class.ilWikiPage.php.

959 {
960 global $ilUser;
961
962 $news_set = new ilSetting("news");
963 $default_visibility = ($news_set->get("default_visibility") != "")
964 ? $news_set->get("default_visibility")
965 : "users";
966
967 include_once("./Services/News/classes/class.ilNewsItem.php");
968 if (!$a_update)
969 {
970 $news_item = new ilNewsItem();
971 $news_item->setContext(
972 $this->getWikiId(), "wiki",
973 $this->getId(), "wpg");
974 $news_item->setPriority(NEWS_NOTICE);
975 $news_item->setTitle($this->getTitle());
976 $news_item->setContentTextIsLangVar(true);
977 $news_item->setContent("wiki_news_page_created");
978 $news_item->setUserId($ilUser->getId());
979 $news_item->setVisibility($default_visibility);
980 $news_item->create();
981 }
982 else
983 {
984 // get last news item of the day (if existing)
986 $this->getWikiId(), "wiki",
987 $this->getId(), "wpg", true);
988
989 if ($news_id > 0)
990 {
991 $news_item = new ilNewsItem($news_id);
992 $news_item->setContent("wiki_news_page_changed");
993 $news_item->setUserId($ilUser->getId());
994 $news_item->setTitle($this->getTitle());
995 $news_item->setContentTextIsLangVar(true);
996 $news_item->update(true);
997 }
998 else
999 {
1000 $news_item = new ilNewsItem();
1001 $news_item->setContext(
1002 $this->getWikiId(), "wiki",
1003 $this->getId(), "wpg");
1004 $news_item->setPriority(NEWS_NOTICE);
1005 $news_item->setTitle($this->getTitle());
1006 $news_item->setContentTextIsLangVar(true);
1007 $news_item->setContent("wiki_news_page_changed");
1008 $news_item->setUserId($ilUser->getId());
1009 $news_item->setVisibility($default_visibility);
1010 $news_item->create();
1011 }
1012 }
1013 }
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.
global $ilUser
Definition: imgupload.php:15

References $ilUser, 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: