ILIAS  release_4-4 Revision
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...
 
 createFromXML ()
 Create page from xml. More...
 
 create ($a_prevent_page_creation=false)
 Create new wiki page. More...
 
 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...
 
- Public Member Functions inherited from ilPageObject
 ilPageObject ($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...
 
 _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...
 
 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 ()
 Resolves all internal link targets of the page, if targets are available (after import) More...
 
 resolveMediaAliases ($a_mapping)
 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...
 
 highlightText ($a_text, $proglang, $autoindent)
 Highligths Text with given ProgLang. More...
 
 hasHighlighter ($hfile_ext)
 
 insertSourceCodeParagraphs ($a_output, $outputmode="presentation")
 depending on the SubCharacteristic and ShowLineNumbers attribute the line numbers and html tags for the syntax highlighting will be inserted using the dom xml functions 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)
 
 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...
 

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 Public Member Functions inherited from ilPageObject
static _exists ($a_parent_type, $a_id, $a_lang="")
 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...
 

Protected Attributes

 $blocked = false
 

Additional Inherited Members

- Data Fields inherited from ilPageObject
 $id
 
 $ilias
 
 $dom
 
 $xml
 
 $encoding
 
 $node
 
 $cur_dtd = "ilias_pg_4_4.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 665 of file class.ilWikiPage.php.

References $query.

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

666  {
667  global $ilDB;
668 
669  $query = "SELECT id FROM il_wiki_page".
670  " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
671  " AND title = ".$ilDB->quote($a_title, "text");
672  $set = $ilDB->query($query);
673  if($rec = $ilDB->fetchAssoc($set))
674  {
675  return $rec["id"];
676  }
677 
678  return false;
679  }
+ 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 541 of file class.ilWikiPage.php.

References $query, and ilWikiUtil\makeDbTitle().

Referenced by ilObjWikiGUI\gotoPageObject(), ilWikiUtil\makeLink(), and ilWikiUtil\processInternalLinks().

542  {
543  global $ilDB;
544 
545  $a_title = ilWikiUtil::makeDbTitle($a_title);
546 
547  $query = "SELECT id FROM il_wiki_page".
548  " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
549  " AND title = ".$ilDB->quote($a_title, "text");
550  $set = $ilDB->query($query);
551 
552  $pages = array();
553  if ($rec = $ilDB->fetchAssoc($set))
554  {
555  return true;
556  }
557 
558  return false;
559  }
static makeDbTitle($a_par)
Handle page GET parameter.
+ 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 34 of file class.ilWikiPage.php.

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

35  {
36  $this->getPageConfig()->configureByObjectId($this->getParentId());
37  }
getPageConfig()
Get page config object.
+ 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 711 of file class.ilWikiPage.php.

References $query, and $r.

Referenced by getRandomPage().

712  {
713  global $ilDB;
714 
715  // delete record of table il_wiki_data
716  $query = "SELECT count(*) as cnt FROM il_wiki_page".
717  " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer");
718  $s = $ilDB->query($query);
719  $r = $ilDB->fetchAssoc($s);
720 
721  return $r["cnt"];
722  }
$r
+ Here is the caller graph for this function:

◆ create()

ilWikiPage::create (   $a_prevent_page_creation = false)

Create new wiki page.

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

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

166  {
167  global $ilDB;
168 
169  $id = $ilDB->nextId("il_wiki_page");
170  $this->setId($id);
171  $query = "INSERT INTO il_wiki_page (".
172  "id".
173  ", title".
174  ", wiki_id".
175  ", blocked".
176  ", rating".
177  " ) VALUES (".
178  $ilDB->quote($this->getId(), "integer")
179  .",".$ilDB->quote($this->getTitle(), "text")
180  .",".$ilDB->quote((int) $this->getWikiId(), "integer")
181  .",".$ilDB->quote((int) $this->getBlocked(), "integer")
182  .",".$ilDB->quote((int) $this->getRating(), "integer")
183  .")";
184  $ilDB->manipulate($query);
185 
186  // create page object
187  if (!$a_prevent_page_creation)
188  {
189  parent::create();
190  $this->saveInternalLinks($this->getDomDoc());
191 
192  include_once "./Services/Notification/classes/class.ilNotification.php";
194  }
195 
196  $this->updateNews();
197  }
getBlocked()
Get blocked.
updateNews($a_update=false)
Create.
getWikiId()
Get Wiki Object Id.
getWikiRefId()
Get Wiki Ref Id.
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.
setId($a_id)
set id
saveInternalLinks($a_domdoc)
save internal links of page
getTitle()
Get Title.
+ Here is the call graph for this function:

◆ createFromXML()

ilWikiPage::createFromXML ( )

Create page from xml.

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

References ilPageObject\read().

143  {
144  global $ilDB;
145 
146  // ilWikiDataset creates wiki pages without copage objects
147  // (see create function in this class, parameter $a_prevent_page_creation)
148  // The ilCOPageImporter will call createFromXML without running through the read
149  // method -> we will miss the important wiki id, thus we read it now
150  // see also bug #12224
151  $set = $ilDB->query("SELECT id FROM il_wiki_page ".
152  " WHERE id = ".$ilDB->quote($this->getId(), "integer")
153  );
154  if ($rec = $ilDB->fetchAssoc($set))
155  {
156  $this->read(true);
157  }
158 
159  parent::createFromXML();
160  }
read()
Read page data.
+ Here is the call graph for this function:

◆ delete()

ilWikiPage::delete ( )

delete wiki page and al related data

public

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

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

264  {
265  global $ilDB;
266 
267  // get other pages that link to this page
268  $linking_pages = ilWikiPage::getLinksToPage($this->getWikiId(),
269  $this->getId());
270 
271  // delete internal links information to this page
272  include_once("./Services/COPage/classes/class.ilInternalLink.php");
274 
275  include_once "./Services/Notification/classes/class.ilNotification.php";
277 
278  // remove all notifications
279  include_once "./Services/Notification/classes/class.ilNotification.php";
281 
282  // delete record of table il_wiki_data
283  $query = "DELETE FROM il_wiki_page".
284  " WHERE id = ".$ilDB->quote($this->getId(), "integer");
285  $ilDB->manipulate($query);
286 
287  // delete co page
288  parent::delete();
289 
290  // make links of other pages to this page a missing link
291  foreach($linking_pages as $lp)
292  {
293  $ilDB->manipulateF("DELETE FROM il_wiki_missing_page ".
294  " WHERE wiki_id = %s AND source_id = %s AND target_name = %s ",
295  array("integer", "integer", "text"),
296  array($this->getWikiId(), $lp["id"], $this->getTitle()));
297  $ilDB->manipulateF("INSERT INTO il_wiki_missing_page ".
298  "(wiki_id, source_id, target_name) VALUES ".
299  "(%s,%s,%s)",
300  array("integer", "integer", "text"),
301  array($this->getWikiId(), $lp["id"], $this->getTitle()));
302  }
303 
304  return true;
305  }
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)
getTitle()
Get Title.
static getLinksToPage($a_wiki_id, $a_page_id)
Get links to a page.
+ 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 312 of file class.ilWikiPage.php.

References $query.

Referenced by ilObjWiki\delete().

313  {
314  global $ilDB;
315 
316  // delete record of table il_wiki_data
317  $query = "SELECT * FROM il_wiki_page".
318  " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer");
319  $set = $ilDB->query($query);
320 
321  while($rec = $ilDB->fetchAssoc($set))
322  {
323  $wiki_page = new ilWikiPage($rec["id"]);
324  $wiki_page->delete();
325 
326 
327  }
328  }
Class ilWikiPage.
+ 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 333 of file class.ilWikiPage.php.

References $query, and ilWikiUtil\makeDbTitle().

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

334  {
335  global $ilDB;
336 
337  $a_title = ilWikiUtil::makeDbTitle($a_title);
338 
339  $query = "SELECT id FROM il_wiki_page".
340  " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
341  " AND title = ".$ilDB->quote($a_title, "text");
342  $set = $ilDB->query($query);
343  if($rec = $ilDB->fetchAssoc($set))
344  {
345  return true;
346  }
347 
348  return false;
349  }
static makeDbTitle($a_par)
Handle page GET parameter.
+ 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.

public

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

References $query.

Referenced by ilObjWiki\cloneObject(), ilObjWikiGUI\editImportantPagesObject(), ilWikiHTMLExport\exportHTMLPages(), getOrphanedPages(), ilWikiPagesTableGUI\getPages(), ilWikiExporter\getXmlExportTailDependencies(), ilWikiPageGUI\initPrintViewSelectionForm(), ilObjWikiGUI\printViewObject(), and ilInternalLinkGUI\showLinkHelp().

435  {
436  global $ilDB;
437 
438  $pages = parent::getAllPages("wpg", $a_wiki_id);
439 
440  $query = "SELECT * FROM il_wiki_page".
441  " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
442  " ORDER BY title";
443  $set = $ilDB->query($query);
444 
445  $pg = array();
446  while($rec = $ilDB->fetchAssoc($set))
447  {
448  if (isset($pages[$rec["id"]]))
449  {
450  $pg[$rec["id"]] = $pages[$rec["id"]];
451  $pg[$rec["id"]]["title"] = $rec["title"];
452  }
453  }
454 
455  return $pg;
456  }
+ Here is the caller graph for this function:

◆ getBlocked()

ilWikiPage::getBlocked ( )

Get blocked.

Returns
boolean blocked

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

References $blocked.

Referenced by create(), and update().

115  {
116  return $this->blocked;
117  }
+ Here is the caller 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 961 of file class.ilWikiPage.php.

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

962  {
963  if (!$a_offline)
964  {
965  $href = "./goto.php?target=wiki_wpage_".$a_target;
966  }
967  else
968  {
969  $href = ILIAS_HTTP_PATH."/goto.php?target=wiki_wpage_".$a_target;
970  }
971  return $href;
972  }
+ 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 354 of file class.ilWikiPage.php.

References $query, and ilWikiUtil\makeDbTitle().

Referenced by ilWikiUtil\makeLink().

355  {
356  global $ilDB;
357 
358  $a_title = ilWikiUtil::makeDbTitle($a_title);
359 
360  $query = "SELECT id FROM il_wiki_page".
361  " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
362  " AND title = ".$ilDB->quote($a_title, "text");
363  $set = $ilDB->query($query);
364  if($rec = $ilDB->fetchAssoc($set))
365  {
366  return $rec["id"];
367  }
368 
369  return false;
370  }
static makeDbTitle($a_par)
Handle page GET parameter.
+ 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 461 of file class.ilWikiPage.php.

References $query, and ilInternalLink\_getSourcesOfTarget().

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

462  {
463  global $ilDB;
464 
465  include_once("./Services/COPage/classes/class.ilInternalLink.php");
466  $sources = ilInternalLink::_getSourcesOfTarget("wpg", $a_page_id, 0);
467 
468  $ids = array();
469  foreach ($sources as $source)
470  {
471  if ($source["type"] == "wpg:pg")
472  {
473  $ids[] = $source["id"];
474  }
475  }
476  // get wiki page record
477  $query = "SELECT * FROM il_wiki_page wp, page_object p".
478  " WHERE ".$ilDB->in("wp.id", $ids, false, "integer").
479  " AND wp.id = p.page_id AND p.parent_type = ".$ilDB->quote("wpg", "text").
480  " AND wp.wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
481  " ORDER BY title";
482  $set = $ilDB->query($query);
483 
484  $pages = array();
485  while ($rec = $ilDB->fetchAssoc($set))
486  {
487  $pages[] = array_merge($rec, array("user" => $rec["last_change_user"],
488  "date" => $rec["last_change"]));
489  }
490 
491  return $pages;
492  }
+ 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.

public

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

References lookupTitle().

Referenced by ilWikiPagesTableGUI\getPages().

758  {
759  global $ilDB;
760 
761  $pages = parent::getNewPages("wpg", $a_wiki_id);
762 
763  foreach($pages as $k => $page)
764  {
765  $pages[$k]["title"] = ilWikiPage::lookupTitle($page["id"]);
766  }
767 
768  return $pages;
769  }
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
+ 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 950 of file class.ilWikiPage.php.

951  {
952  return "12.1.1: Test User, Max";
953  }

◆ getOrphanedPages()

static ilWikiPage::getOrphanedPages (   $a_wiki_id)
static

Get orphaned pages of wiki.

public

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

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

Referenced by ilWikiPagesTableGUI\getPages().

500  {
501  global $ilDB;
502 
503  $pages = ilWikiPage::getAllPages($a_wiki_id);
504 
505  include_once("./Services/COPage/classes/class.ilInternalLink.php");
506 
507  $orphaned = array();
508  foreach ($pages as $k => $page)
509  {
510  $sources = ilInternalLink::_getSourcesOfTarget("wpg", $page["id"], 0);
511 
512  $ids = array();
513  foreach ($sources as $source)
514  {
515  if ($source["type"] == "wpg:pg")
516  {
517  $ids[] = $source["id"];
518  }
519  }
520  $query = "SELECT count(*) cnt FROM il_wiki_page".
521  " WHERE ".$ilDB->in("id", $ids, false, "integer").
522  " AND wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
523  " GROUP BY wiki_id";
524  $set = $ilDB->query($query);
525  $rec = $ilDB->fetchAssoc($set);
526  if ($rec["cnt"] == 0 &&
527  ilObjWiki::_lookupStartPage($a_wiki_id) != $page["title"])
528  {
529  $orphaned[] = $page;
530  }
531  }
532 
533  return $orphaned;
534  }
static _lookupStartPage($a_wiki_id)
Lookup start page.
static getAllPages($a_wiki_id)
Get all pages of wiki.
+ 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.

public

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

Referenced by ilWikiPageGUI\deleteWikiPageConfirmationScreen().

581  {
582  global $ilDB;
583 
584  $contributors = parent::getPageContributors("wpg", $a_page_id);
585 
586  return $contributors;
587  }
+ 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 375 of file class.ilWikiPage.php.

References $query, and ilWikiUtil\makeDbTitle().

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

376  {
377  global $ilDB;
378 
379  $a_title = ilWikiUtil::makeDbTitle($a_title);
380 
381  $query = "SELECT * FROM il_wiki_page".
382  " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
383  " AND title = ".$ilDB->quote($a_title, "text");
384  $set = $ilDB->query($query);
385  if($rec = $ilDB->fetchAssoc($set))
386  {
387  return $rec["id"];
388  }
389 
390  return false;
391  }
static makeDbTitle($a_par)
Handle page GET parameter.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentObjectContributors()

static ilWikiPage::getParentObjectContributors (   $a_wiki_id)
static

Get all contributors of wiki.

public

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

Referenced by ilWikiContributorsTableGUI\getContributors().

567  {
568  global $ilDB;
569 
570  $contributors = parent::getParentObjectContributors("wpg", $a_wiki_id);
571 
572  return $contributors;
573  }
+ Here is the caller graph for this function:

◆ getParentType()

ilWikiPage::getParentType ( )

Get parent type.

Returns
string parent type

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

24  {
25  return "wpg";
26  }

◆ getPopularPages()

static ilWikiPage::getPopularPages (   $a_wiki_id)
static

Get popular pages of wiki.

public

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

References $query.

Referenced by ilWikiPagesTableGUI\getPages().

687  {
688  global $ilDB;
689 
690  $query = "SELECT wp.*, po.view_cnt as cnt FROM il_wiki_page wp, page_object po".
691  " WHERE wp.wiki_id = ".$ilDB->quote($a_wiki_id, "integer").
692  " AND wp.id = po.page_id ".
693  " AND po.parent_type = ".$ilDB->quote("wpg", "text")." ".
694  " ORDER BY po.view_cnt";
695  $set = $ilDB->query($query);
696 
697  $pages = array();
698  while($rec = $ilDB->fetchAssoc($set))
699  {
700  $pages[] = $rec;
701  }
702 
703  return $pages;
704  }
+ 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 729 of file class.ilWikiPage.php.

References $query, $r, and countPages().

Referenced by ilObjWikiGUI\randomPageObject().

730  {
731  global $ilDB;
732 
733  $cnt = ilWikiPage::countPages($a_wiki_id);
734 
735  if ($cnt < 1)
736  {
737  return "";
738  }
739 
740  $rand = rand(1, $cnt);
741 
742  // delete record of table il_wiki_data
743  $ilDB->setLimit(1, $rand);
744  $query = "SELECT title FROM il_wiki_page".
745  " WHERE wiki_id = ".$ilDB->quote($a_wiki_id, "integer");
746  $s = $ilDB->query($query);
747  $r = $ilDB->fetchAssoc($s);
748 
749  return $r["title"];
750  }
static countPages($a_wiki_id)
Count pages of wiki.
$r
+ 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 134 of file class.ilWikiPage.php.

Referenced by create(), and update().

135  {
136  return $this->rating;
137  }
+ Here is the caller graph for this function:

◆ getTitle()

ilWikiPage::getTitle ( )

Get Title.

Returns
string Title

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

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

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

◆ getWikiId()

ilWikiPage::getWikiId ( )

Get Wiki Object Id.

Returns
int Wiki Object Id

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

References ilPageObject\getParentId().

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

75  {
76  return $this->getParentId();
77  }
+ 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 94 of file class.ilWikiPage.php.

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

95  {
96  return $this->parent_ref_id;
97  }
+ 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 778 of file class.ilWikiPage.php.

References $query.

Referenced by ilObjMediaObject\getParentObjectIdForUsage().

779  {
780  global $ilDB;
781 
782  $query = "SELECT wiki_id FROM il_wiki_page".
783  " WHERE id = ".$ilDB->quote($a_page_id, "integer");
784  $set = $ilDB->query($query);
785  if($rec = $ilDB->fetchAssoc($set))
786  {
787  return $rec["wiki_id"];
788  }
789 
790  return false;
791  }
+ Here is the caller graph for this function:

◆ lookupTitle()

static ilWikiPage::lookupTitle (   $a_page_id)
static

◆ lookupWikiId()

static ilWikiPage::lookupWikiId (   $a_page_id)
static

Lookup wiki id.

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

References $query.

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

415  {
416  global $ilDB;
417 
418  $query = "SELECT wiki_id FROM il_wiki_page".
419  " WHERE id = ".$ilDB->quote($a_page_id, "integer");
420  $set = $ilDB->query($query);
421  if ($rec = $ilDB->fetchAssoc($set))
422  {
423  return $rec["wiki_id"];
424  }
425 
426  return false;
427  }
+ Here is the caller graph for this function:

◆ read()

ilWikiPage::read (   $a_omit_page_read = false)

Read wiki data.

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

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

237  {
238  global $ilDB;
239 
240  $query = "SELECT * FROM il_wiki_page WHERE id = ".
241  $ilDB->quote($this->getId(), "integer");
242  $set = $ilDB->query($query);
243  $rec = $ilDB->fetchAssoc($set);
244 
245  $this->setTitle($rec["title"]);
246  $this->setWikiId($rec["wiki_id"]);
247  $this->setBlocked($rec["blocked"]);
248  $this->setRating($rec["rating"]);
249 
250  // get co page
251  if (!$a_omit_page_read)
252  {
253  parent::read();
254  }
255  }
setTitle($a_title)
Set Title.
setBlocked($a_val)
Set blocked.
setWikiId($a_wikiid)
Set Wiki Object Id.
setRating($a_val)
Set rating.
+ Here is the call graph for this function:

◆ rename()

ilWikiPage::rename (   $a_new_name)

Rename page.

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

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

797  {
798  global $ilDB;
799 
800  // replace unallowed characters
801  $a_new_name = str_replace(array("<", ">"), '', $a_new_name);
802 
803  // replace multiple whitespace characters by one single space
804  $a_new_name = trim(preg_replace('!\s+!', ' ', $a_new_name));
805 
806  $page_title = ilWikiUtil::makeDbTitle($a_new_name);
807  $pg_id = ilWikiPage::_getPageIdForWikiTitle($this->getWikiId(), $page_title);
808 
809  $xml_new_name = str_replace("&", "&amp;", $a_new_name);
810 
811  if ($pg_id == 0 || $pg_id == $this->getId())
812  {
813  include_once("./Services/COPage/classes/class.ilInternalLink.php");
814  $sources = ilInternalLink::_getSourcesOfTarget("wpg", $this->getId(), 0);
815 
816  foreach ($sources as $s)
817  {
818  if ($s["type"] == "wpg:pg" && ilPageObject::_exists("wpg", $s["id"]))
819  {
820  $wpage = new ilWikiPage($s["id"]);
821 
822  $col = ilWikiUtil::processInternalLinks($wpage->getXmlContent(), 0,
824  $new_content = $wpage->getXmlContent();
825  foreach ($col as $c)
826  {
827 
828  // this complicated procedure is needed due to the fact
829  // that depending on the collation e = é is true
830  // in the (mysql) database
831  // see bug http://www.ilias.de/mantis/view.php?id=11227
832  $t1 = ilWikiUtil::makeDbTitle($c["nt"]->mTextform);
833  $t2 = ilWikiUtil::makeDbTitle($this->getTitle());
834 
835  // this one replaces C2A0 (&nbsp;) by a usual space
836  // otherwise the comparision will fail, since you
837  // get these characters from tiny if more than one
838  // space is repeated in a string. This may not be
839  // 100% but we do not store $t1 anywhere and only
840  // modify it for the comparison
841  $t1 = preg_replace('/\xC2\xA0/', ' ', $t1);
842  $t2 = preg_replace('/\xC2\xA0/', ' ', $t2);
843 
844  $set = $ilDB->query($q = "SELECT ".$ilDB->quote($t1, "text")." = ".$ilDB->quote($t2, "text")." isequal");
845  $rec = $ilDB->fetchAssoc($set);
846 
847  if ($rec["isequal"])
848  {
849  $new_content =
850  str_replace("[[".$c["nt"]->mTextform."]]",
851  "[[".$xml_new_name."]]", $new_content);
852  if ($c["text"] != "")
853  {
854  $new_content =
855  str_replace("[[".$c["text"]."]]",
856  "[[".$xml_new_name."]]", $new_content);
857  }
858  $add = ($c["text"] != "")
859  ? "|".$c["text"]
860  : "";
861  $new_content =
862  str_replace("[[".$c["nt"]->mTextform.$add."]]",
863  "[[".$xml_new_name.$add."]]", $new_content);
864  }
865  }
866  $wpage->setXmlContent($new_content);
867 //echo htmlentities($new_content);
868  $wpage->update();
869  }
870  }
871 
872  include_once("./Modules/Wiki/classes/class.ilObjWiki.php");
873  if (ilObjWiki::_lookupStartPage($this->getWikiId()) == $this->getTitle())
874  {
875  ilObjWiki::writeStartPage($this->getWikiId(), $a_new_name);
876  }
877 
878  $this->setTitle($a_new_name);
879 
880  $this->update();
881  }
882 
883  return $a_new_name;
884  }
setTitle($a_title)
Set Title.
getWikiId()
Get Wiki Object Id.
static _lookupStartPage($a_wiki_id)
Lookup start page.
static _getPageIdForWikiTitle($a_wiki_id, $a_title)
Checks whether a page with given title exists.
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
Class ilWikiPage.
static processInternalLinks($s, $a_wiki_id, $a_mode=IL_WIKI_MODE_REPLACE, $a_collect_non_ex=false, $a_offline=false)
Process internal links.
static makeDbTitle($a_par)
Handle page GET parameter.
const IL_WIKI_MODE_EXT_COLLECT
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 595 of file class.ilWikiPage.php.

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

Referenced by create().

596  {
597  global $ilDB;
598 
599 
600  // *** STEP 1: Standard Processing ***
601 
602  parent::saveInternalLinks($a_domdoc);
603 
604 
605  // *** STEP 2: Other Pages -> This Page ***
606 
607  // Check, whether ANOTHER page links to this page as a "missing" page
608  // (this is the case, when this page is created newly)
609  $set = $ilDB->queryF("SELECT * FROM il_wiki_missing_page WHERE ".
610  " wiki_id = %s AND target_name = %s",
611  array("integer", "text"),
612  array($this->getWikiId(), ilWikiUtil::makeDbTitle($this->getTitle())));
613  while ($anmiss = $ilDB->fetchAssoc($set)) // insert internal links instead
614  {
615 //echo "adding link";
616  ilInternalLink::_saveLink("wpg:pg", $anmiss["source_id"], "wpg",
617  $this->getId(), 0);
618  }
619 //exit;
620  // now remove the missing page entries
621  $ilDB->manipulateF("DELETE FROM il_wiki_missing_page WHERE ".
622  " wiki_id = %s AND target_name = %s",
623  array("integer", "text"),
624  array($this->getWikiId(), $this->getTitle()));
625 
626 
627  // *** STEP 3: This Page -> Other Pages ***
628 
629  // remove the exising "missing page" links for THIS page (they will be re-inserted below)
630  $ilDB->manipulateF("DELETE FROM il_wiki_missing_page WHERE ".
631  " wiki_id = %s AND source_id = %s",
632  array("integer", "integer"),
633  array($this->getWikiId(), $this->getId()));
634 
635  // collect the wiki links of the page
636  include_once("./Modules/Wiki/classes/class.ilWikiUtil.php");
637  $xml = $a_domdoc->saveXML();
638  $int_wiki_links = ilWikiUtil::collectInternalLinks($xml, $this->getWikiId(), true);
639  foreach($int_wiki_links as $wlink)
640  {
641  $page_id = ilWikiPage::_getPageIdForWikiTitle($this->getWikiId(), $wlink);
642 
643  if ($page_id > 0) // save internal link for existing page
644  {
645  ilInternalLink::_saveLink("wpg:pg", $this->getId(), "wpg",
646  $page_id, 0);
647  }
648  else // save missing link for non-existing page
649  {
650  $ilDB->manipulateF("DELETE FROM il_wiki_missing_page WHERE".
651  " wiki_id = %s AND source_id = %s AND target_name = %s",
652  array("integer", "integer", "text"),
653  array($this->getWikiId(), $this->getId(), $wlink));
654  $ilDB->manipulateF("INSERT INTO il_wiki_missing_page (wiki_id, source_id, target_name)".
655  " VALUES (%s,%s,%s)",
656  array("integer", "integer", "text"),
657  array($this->getWikiId(), $this->getId(), $wlink));
658  }
659  }
660  }
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.
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 104 of file class.ilWikiPage.php.

Referenced by read().

105  {
106  $this->blocked = $a_val;
107  }
+ Here is the caller graph for this function:

◆ setRating()

ilWikiPage::setRating (   $a_val)

Set rating.

Parameters
boolean$a_val

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

Referenced by read().

125  {
126  $this->rating = (bool)$a_val;
127  }
+ Here is the caller graph for this function:

◆ setTitle()

ilWikiPage::setTitle (   $a_title)

Set Title.

Parameters
string$a_titleTitle

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

References ilWikiUtil\makeDbTitle().

Referenced by read(), and rename().

45  {
46  $this->title = ilWikiUtil::makeDbTitle($a_title);
47  }
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 64 of file class.ilWikiPage.php.

References ilPageObject\setParentId().

Referenced by read().

65  {
66  $this->setParentId($a_wikiid);
67  }
+ 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 84 of file class.ilWikiPage.php.

85  {
86  $this->parent_ref_id = $a_wiki_ref_id;
87  }

◆ update()

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

update object data

public

Returns
boolean

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

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

Referenced by rename().

206  {
207  global $ilDB;
208 
209  // update wiki page data
210  $query = "UPDATE il_wiki_page SET ".
211  " title = ".$ilDB->quote($this->getTitle(), "text").
212  ",wiki_id = ".$ilDB->quote((int) $this->getWikiId(), "integer").
213  ",blocked = ".$ilDB->quote((int) $this->getBlocked(), "integer").
214  ",rating = ".$ilDB->quote((int) $this->getRating(), "integer").
215  " WHERE id = ".$ilDB->quote($this->getId(), "integer");
216  $ilDB->manipulate($query);
217  $updated = parent::update($a_validate, $a_no_history);
218 
219  if ($updated === true)
220  {
221  include_once "./Services/Notification/classes/class.ilNotification.php";
223  $this->updateNews(true);
224  }
225  else
226  {
227  return $updated;
228  }
229 
230  return true;
231  }
getBlocked()
Get blocked.
updateNews($a_update=false)
Create.
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)
getRating()
Get rating.
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 890 of file class.ilWikiPage.php.

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

Referenced by create(), and update().

891  {
892  global $ilUser;
893 
894  $news_set = new ilSetting("news");
895  $default_visibility = ($news_set->get("default_visibility") != "")
896  ? $news_set->get("default_visibility")
897  : "users";
898 
899  include_once("./Services/News/classes/class.ilNewsItem.php");
900  if (!$a_update)
901  {
902  $news_item = new ilNewsItem();
903  $news_item->setContext(
904  $this->getWikiId(), "wiki",
905  $this->getId(), "wpg");
906  $news_item->setPriority(NEWS_NOTICE);
907  $news_item->setTitle($this->getTitle());
908  $news_item->setContentTextIsLangVar(true);
909  $news_item->setContent("wiki_news_page_created");
910  $news_item->setUserId($ilUser->getId());
911  $news_item->setVisibility($default_visibility);
912  $news_item->create();
913  }
914  else
915  {
916  // get last news item of the day (if existing)
918  $this->getWikiId(), "wiki",
919  $this->getId(), "wpg", true);
920 
921  if ($news_id > 0)
922  {
923  $news_item = new ilNewsItem($news_id);
924  $news_item->setContent("wiki_news_page_changed");
925  $news_item->setUserId($ilUser->getId());
926  $news_item->setTitle($this->getTitle());
927  $news_item->setContentTextIsLangVar(true);
928  $news_item->update(true);
929  }
930  else
931  {
932  $news_item = new ilNewsItem();
933  $news_item->setContext(
934  $this->getWikiId(), "wiki",
935  $this->getId(), "wpg");
936  $news_item->setPriority(NEWS_NOTICE);
937  $news_item->setTitle($this->getTitle());
938  $news_item->setContentTextIsLangVar(true);
939  $news_item->setContent("wiki_news_page_changed");
940  $news_item->setUserId($ilUser->getId());
941  $news_item->setVisibility($default_visibility);
942  $news_item->create();
943  }
944  }
945  }
ILIAS Setting Class.
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
global $ilUser
Definition: imgupload.php:15
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().


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