ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilWikiPage Class Reference

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

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

Public Member Functions

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

s More...

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

Static Public Member Functions

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

Protected Member Functions

 getNotificationGUI ()
 This currently violates the layer model, since notifications render the abstracts with a GUI class. More...
 
 setTranslationProperties (ilPageObject $transl_page)
 
 setCopyProperties (ilPageObject $new_page)
 
- Protected Member Functions inherited from ilPageObject
 getIliasAbsolutePath ()
 
 getLangVarXML (string $var)
 
 __afterUpdate (DOMDocument $a_domdoc, string $a_xml, bool $a_creation=false, bool $a_empty=false)
 After update event handler (internal). More...
 
 isTranslationPage ()
 
 __beforeDelete ()
 Before deletion handler (internal). More...
 
 __afterDelete ()
 
 afterDelete ()
 
 __afterHistoryEntry (DOMDocument $a_old_domdoc, string $a_old_content, int $a_old_nr)
 
 getContentManager ()
 
 setCopyProperties (ilPageObject $new_page)
 
 setTranslationProperties (self $transl_page)
 

Protected Attributes

ILIAS Wiki Page PageDBRepository $repo
 
ilLogger $wiki_log
 
ILIAS Wiki InternalService $service
 
int $parent_ref_id = 0
 
string $title = ""
 
bool $blocked = false
 
bool $rating = false
 
bool $hide_adv_md = false
 
- Protected Attributes inherited from ilPageObject
ILIAS COPage Dom DomUtil $dom_util
 
ILIAS COPage Link LinkManager $link
 
ILIAS COPage PC PCDefinition $pc_definition
 
int $create_user = 0
 
array $id_elements
 
bool $page_not_found = false
 
bool $show_page_act_info = false
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilObjUser $user
 
ilLanguage $lng
 
ilTree $tree
 
LOMServices $lom_services
 
int $id
 
string $language = "-"
 
bool $import_mode = false
 
ilLogger $log
 
array $page_record = array()
 
bool $active = false
 
ilPageConfig $page_config
 
string $rendermd5 = ""
 
string $renderedcontent = ""
 
string $renderedtime = ""
 
string $lastchange = ""
 
bool $contains_question = false
 
array $hier_ids = []
 
string $activationstart = null
 
string $activationend = null
 
ILIAS COPage ReadingTime ReadingTimeManager $reading_time_manager
 
 $concrete_lang = ""
 
ILIAS COPage ID ContentIdManager $content_id_manager
 
ILIAS COPage Page PageManager $page_manager
 
ILIAS COPage Style StyleManager $style_manager
 
ILIAS COPage PC DomainService $pc_service
 

Additional Inherited Members

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

Detailed Description

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

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

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

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

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

Member Function Documentation

◆ _getPageIdForWikiTitle()

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

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

580  : ?int {
581  return self::getPageIdForTitle($a_wiki_id, $a_title);
582  }

◆ _wikiPageExists()

static ilWikiPage::_wikiPageExists ( int  $a_wiki_id,
string  $a_title,
string  $lang = "-" 
)
static

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

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

Referenced by ilObjWiki\decorateAdvMDValue(), ilWikiPageGUI\insertWikiLinkAC(), and ilObjWikiGUI\isNewTranslatedPage().

522  : bool {
523  global $DIC;
524 
525  if ($lang === "") {
526  $lang = "-";
527  }
528 
529  $ilDB = $DIC->database();
530 
531  $a_title = ilWikiUtil::makeDbTitle($a_title);
532 
533  $query = "SELECT id FROM il_wiki_page" .
534  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
535  " AND title = " . $ilDB->quote($a_title, "text") .
536  " AND lang = " . $ilDB->quote($lang, "text");
537  $set = $ilDB->query($query);
538 
539  if ($ilDB->fetchAssoc($set)) {
540  return true;
541  }
542 
543  return false;
544  }
global $DIC
Definition: shib_login.php:26
$lang
Definition: xapiexit.php:25
static makeDbTitle(string $a_par)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterConstructor()

ilWikiPage::afterConstructor ( )

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

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

40  : void
41  {
42  global $DIC;
43  $this->service = $DIC->wiki()->internal();
44  $this->getPageConfig()->configureByObjectId($this->getParentId());
45  $this->wiki_log = $this->service->domain()->log();
46  $this->repo = $this->service->repo()->page();
47  }
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

◆ afterUpdate()

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

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

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

192  : void {
193  // internal == wiki links
194 
195  $this->wiki_log->debug("collect internal links");
196  $int_links = count(ilWikiUtil::collectInternalLinks($xml, $this->getWikiId(), true));
197 
198  $xpath = new DOMXPath($domdoc);
199 
200  // external = internal + external links
201  $ext_links = count($xpath->query('//IntLink'));
202  $ext_links += count($xpath->query('//ExtLink'));
203 
204  $footnotes = count($xpath->query('//Footnote'));
205 
206 
207  // words/characters (xml)
208 
209  $xml = strip_tags($xml);
210 
211  $num_chars = ilStr::strLen($xml);
212  $num_words = count(explode(" ", $xml));
213 
214  $page_data = array(
215  "int_links" => $int_links,
216  "ext_links" => $ext_links,
217  "footnotes" => $footnotes,
218  "num_words" => $num_words,
219  "num_chars" => $num_chars
220  );
221  $this->wiki_log->debug("handle stats");
223  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static strLen(string $a_string)
Definition: class.ilStr.php:60
static collectInternalLinks(string $s, int $a_wiki_id, bool $a_collect_non_ex=false, string $mode=IL_WIKI_MODE_COLLECT)
Collect internal wiki links of a string.
static handleEvent(int $a_event, ilWikiPage $a_page_obj, ?int $a_user_id=null, ?array $a_additional_data=null)
Handle wiki page event.
const EVENT_PAGE_UPDATED
+ Here is the call graph for this function:

◆ countPages()

static ilWikiPage::countPages ( int  $a_wiki_id)
static

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

References $DIC, $ilDB, and $r.

608  : int {
609  global $DIC;
610 
611  $ilDB = $DIC->database();
612 
613  // delete record of table il_wiki_data
614  $query = "SELECT count(*) as cnt FROM il_wiki_page" .
615  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
616  " WHERE lang = " . $ilDB->quote("-", "text");
617  $s = $ilDB->query($query);
618  $r = $ilDB->fetchAssoc($s);
619 
620  return $r["cnt"];
621  }
global $DIC
Definition: shib_login.php:26
$r

◆ create()

ilWikiPage::create ( bool  $a_import = false)

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

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

141  : void {
142  $ilDB = $this->db;
143 
144  // get new id, if not a translation page
145  if (in_array($this->getLanguage(), ["-", ""]) && $this->getId() == 0) {
146  $id = $ilDB->nextId("il_wiki_page");
147  $this->setId($id);
148  }
149 
150  $query = "INSERT INTO il_wiki_page (" .
151  "id" .
152  ", title" .
153  ", wiki_id" .
154  ", blocked" .
155  ", rating" .
156  ", hide_adv_md" .
157  ", lang" .
158  " ) VALUES (" .
159  $ilDB->quote($this->getId(), "integer")
160  . "," . $ilDB->quote($this->getTitle(), "text")
161  . "," . $ilDB->quote($this->getWikiId(), "integer")
162  . "," . $ilDB->quote((int) $this->getBlocked(), "integer")
163  . "," . $ilDB->quote((int) $this->getRating(), "integer")
164  . "," . $ilDB->quote((int) $this->isAdvancedMetadataHidden(), "integer")
165  . "," . $ilDB->quote($this->getLanguage(), "text")
166  . ")";
167  $this->wiki_log->debug($query);
168  $ilDB->manipulate($query);
169 
170  // create page object
171  if (!$a_import) {
172  parent::create($a_import);
173  $this->saveInternalLinks($this->getDomDoc());
174 
176  $this->getNotificationGUI()->send(
177  "new",
179  $this->getWikiRefId(),
180  $this->getId(),
181  null,
182  $this->getLanguage()
183  );
184  }
185 
186  $this->updateNews();
187  }
getNotificationGUI()
This currently violates the layer model, since notifications render the abstracts with a GUI class...
getDomDoc()
Get dom doc (DOMDocument)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const EVENT_PAGE_CREATED
updateNews(bool $a_update=false)
static handleEvent(int $a_event, ilWikiPage $a_page_obj, ?int $a_user_id=null, ?array $a_additional_data=null)
Handle wiki page event.
ilDBInterface $db
saveInternalLinks(DOMDocument $a_domdoc)
+ Here is the call graph for this function:

◆ createFromXML()

ilWikiPage::createFromXML ( )

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

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

118  : void
119  {
120  $ilDB = $this->db;
121 
122  // ilWikiDataset creates wiki pages without copage objects
123  // (see create function in this class, parameter $a_prevent_page_creation)
124  // The ilCOPageImporter will call createFromXML without running through the read
125  // method -> we will miss the important wiki id, thus we read it now
126  // see also bug #12224
127  $set = $ilDB->query(
128  "SELECT id FROM il_wiki_page " .
129  " WHERE id = " . $ilDB->quote($this->getId(), "integer") .
130  " AND lang = " . $ilDB->quote($this->getLanguage(), "text")
131  );
132  if ($rec = $ilDB->fetchAssoc($set)) {
133  $this->read(true);
134  }
135 
136  parent::createFromXML();
137  }
read()
Read page data.
ilDBInterface $db
+ Here is the call graph for this function:

◆ delete()

ilWikiPage::delete ( )

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

References ilPageObject\$db, $ilDB, ilInternalLink\_deleteAllLinksToTarget(), ilWikiStat\EVENT_PAGE_DELETED, ilPageObject\getId(), ilPageObject\getLanguage(), getNotificationGUI(), getTitle(), getWikiId(), getWikiRefId(), ilWikiStat\handleEvent(), ilPageObject\isTranslationPage(), null, ilNotification\removeForObject(), and ilNotification\TYPE_WIKI_PAGE.

292  : void
293  {
294  $imp_pages = $this->service->domain()->importantPage($this->getWikiRefId());
295 
296  $ilDB = $this->db;
297 
298  // get other pages that link to this page
299  $linking_pages = self::getLinksToPage(
300  $this->getWikiId(),
301  $this->getId()
302  );
303 
304  // delete important page
305  // note: the wiki might be already deleted here
306  if (!$this->isTranslationPage()) {
307  if ($imp_pages->isImportantPage($this->getId())) {
308  $imp_pages->removeImportantPage($this->getId());
309  }
310  }
311 
312  // delete internal links information to this page
314 
316 
317  $this->getNotificationGUI()->send(
318  "delete",
320  $this->getWikiRefId(),
321  $this->getId(),
322  null,
323  $this->getLanguage()
324  );
325 
326  // remove all notifications
328 
329  // delete record of table il_wiki_data
330  $this->repo->delete($this->getId(), $this->getLanguage());
331 
332  // delete co page
333  parent::delete();
334 
335  // make links of other pages to this page a missing link
336  $missing_page_repo = $this->service->repo()->missingPage();
337  foreach ($linking_pages as $lp) {
338  $missing_page_repo->save(
339  $this->getWikiId(),
340  $lp["id"],
341  $this->getTitle(),
342  $this->getLanguage()
343  );
344  }
345  }
getNotificationGUI()
This currently violates the layer model, since notifications render the abstracts with a GUI class...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static handleEvent(int $a_event, ilWikiPage $a_page_obj, ?int $a_user_id=null, ?array $a_additional_data=null)
Handle wiki page event.
ilDBInterface $db
static removeForObject(int $type, int $id)
Remove all notifications for given object.
const EVENT_PAGE_DELETED
+ Here is the call graph for this function:

◆ deleteAllPagesOfWiki()

static ilWikiPage::deleteAllPagesOfWiki ( int  $a_wiki_id)
static

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

References $DIC, and $ilDB.

Referenced by ilObjWiki\delete().

347  : void
348  {
349  global $DIC;
350 
351  $ilDB = $DIC->database();
352 
353  // delete record of table il_wiki_data
354  $query = "SELECT * FROM il_wiki_page" .
355  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
356  $set = $ilDB->query($query);
357 
358  while ($rec = $ilDB->fetchAssoc($set)) {
359  $wiki_page = new ilWikiPage($rec["id"], 0, $rec["lang"]);
360  $wiki_page->delete();
361  }
362  }
global $DIC
Definition: shib_login.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ exists()

static ilWikiPage::exists ( int  $a_wiki_id,
string  $a_title,
string  $lang = "-" 
)
static

Checks whether a page with given title exists.

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

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

Referenced by ilObjWiki\update().

371  : bool {
372  global $DIC;
373 
374  $ilDB = $DIC->database();
375 
376  $a_title = ilWikiUtil::makeDbTitle($a_title);
377 
378  $query = "SELECT id FROM il_wiki_page" .
379  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
380  " AND title = " . $ilDB->quote($a_title, "text") .
381  " AND lang = " . $ilDB->quote($lang, "text");
382  $set = $ilDB->query($query);
383  if ($rec = $ilDB->fetchAssoc($set)) {
384  return true;
385  }
386 
387  return false;
388  }
global $DIC
Definition: shib_login.php:26
$lang
Definition: xapiexit.php:25
static makeDbTitle(string $a_par)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllWikiPages()

static ilWikiPage::getAllWikiPages ( int  $a_wiki_id,
string  $lang = "-" 
)
static

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

References $DIC, $ilDB, and $lang.

Referenced by ILIAS\Wiki\WikiPrintViewProviderGUI\__construct(), ilObjWiki\cloneObject(), ilWikiStat\countPages(), ILIAS\Wiki\Export\WikiHtmlExport\exportHTMLPages(), ILIAS\Wiki\Export\WikiHtmlExport\exportHTMLPagesPrint(), ILIAS\Wiki\WikiPrintViewProviderGUI\getSelectionForm(), ilWikiPageTemplateGUI\listTemplates(), ilWikiPageGUI\printViewOrderList(), and ilInternalLinkGUI\showLinkHelp().

457  : array {
458  global $DIC;
459 
460  $ilDB = $DIC->database();
461 
462  $pages = parent::getAllPages("wpg", $a_wiki_id);
463 
464  $query = "SELECT * FROM il_wiki_page" .
465  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
466  " AND lang = " . $ilDB->quote($lang, "text") .
467  " ORDER BY title";
468  $set = $ilDB->query($query);
469 
470  $pg = array();
471  while ($rec = $ilDB->fetchAssoc($set)) {
472  if (isset($pages[$rec["id"]])) {
473  $pg[$rec["id"]] = $pages[$rec["id"]];
474  $pg[$rec["id"]]["title"] = $rec["title"];
475  }
476  }
477 
478  return $pg;
479  }
global $DIC
Definition: shib_login.php:26
$lang
Definition: xapiexit.php:25
+ Here is the caller graph for this function:

◆ getBlocked()

ilWikiPage::getBlocked ( )

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

References $blocked.

Referenced by create(), and update().

93  : bool
94  {
95  return $this->blocked;
96  }
+ Here is the caller graph for this function:

◆ getContentTemplates()

ilWikiPage::getContentTemplates ( )

Get content templates.

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

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

References getWikiId(), and ilWikiPageTemplate\TYPE_ADD_TO_PAGE.

860  : array
861  {
862  $wt = new ilWikiPageTemplate($this->getWikiId());
863  $templates = array();
864  foreach ($wt->getAllInfo(ilWikiPageTemplate::TYPE_ADD_TO_PAGE, $this->getLanguage()) as $t) {
865  $templates[] = array("id" => $t["wpage_id"], "parent_type" => "wpg", "title" => $t["title"]);
866  }
867  return $templates;
868  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getGotoForWikiPageTarget()

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

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

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

846  : string {
847  if (!$a_offline) {
848  $href = "./goto.php?target=wiki_wpage_" . $a_target;
849  } else {
850  $href = ILIAS_HTTP_PATH . "/goto.php?target=wiki_wpage_" . $a_target;
851  }
852  return $href;
853  }
+ Here is the caller graph for this function:

◆ getLinksToPage()

static ilWikiPage::getLinksToPage ( int  $a_wiki_id,
int  $a_page_id,
string  $lang = "-" 
)
static

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

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

Referenced by ilWikiPageGUI\deleteWikiPageConfirmationScreen().

485  : array {
486  global $DIC;
487 
488  if ($lang === "") {
489  $lang = "-";
490  }
491  $ilDB = $DIC->database();
492 
493  $sources = ilInternalLink::_getSourcesOfTarget("wpg", $a_page_id, 0);
494  $ids = array();
495  foreach ($sources as $source) {
496  if ($source["type"] === "wpg:pg" && $source["lang"] === $lang) {
497  $ids[] = $source["id"];
498  }
499  }
500 
501  // get wiki page record
502  $query = "SELECT * FROM il_wiki_page wp, page_object p" .
503  " WHERE " . $ilDB->in("wp.id", $ids, false, "integer") .
504  " AND wp.id = p.page_id AND wp.lang = p.lang AND p.parent_type = " . $ilDB->quote("wpg", "text") .
505  " AND wp.wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
506  " AND wp.lang = " . $ilDB->quote($lang, "text") .
507  " ORDER BY title";
508  $set = $ilDB->query($query);
509 
510  $pages = array();
511  while ($rec = $ilDB->fetchAssoc($set)) {
512  $pages[] = array_merge($rec, array("user" => $rec["last_change_user"],
513  "date" => $rec["last_change"]));
514  }
515  return $pages;
516  }
global $DIC
Definition: shib_login.php:26
$lang
Definition: xapiexit.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewWikiPages()

static ilWikiPage::getNewWikiPages ( int  $a_wiki_id)
static

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

650  : array {
651  $pages = parent::getNewPages("wpg", $a_wiki_id);
652  foreach ($pages as $k => $page) {
653  $pages[$k]["title"] = self::lookupTitle($page["id"]);
654  }
655 
656  return $pages;
657  }

◆ getNotificationGUI()

ilWikiPage::getNotificationGUI ( )
protected

This currently violates the layer model, since notifications render the abstracts with a GUI class.

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

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

53  : \ILIAS\Wiki\Notification\NotificationGUI
54  {
55  return $this->service->gui()->notification();
56  }
+ Here is the caller graph for this function:

◆ getPageIdForTitle()

static ilWikiPage::getPageIdForTitle ( int  $a_wiki_id,
string  $a_title,
string  $lang = "-" 
)
static

Get wiki page object for id and title.

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

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

Referenced by ilObjWikiGUI\addPagesSubTabs(), ilObjWikiGUI\addPageTabs(), ilObjWiki\cloneObject(), ilWikiUtil\makeLink(), and ilWikiPageGUI\renamePage().

398  : ?int {
399  global $DIC;
400 
401  if ($lang === "") {
402  $lang = "-";
403  }
404 
405  $ilDB = $DIC->database();
406 
407  $a_title = ilWikiUtil::makeDbTitle($a_title);
408 
409  $query = "SELECT * FROM il_wiki_page" .
410  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
411  " AND title = " . $ilDB->quote($a_title, "text") .
412  " AND lang = " . $ilDB->quote($lang, "text");
413  $set = $ilDB->query($query);
414  if ($rec = $ilDB->fetchAssoc($set)) {
415  return (int) $rec["id"];
416  }
417 
418  return null;
419  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26
$lang
Definition: xapiexit.php:25
static makeDbTitle(string $a_par)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPagesForSearch()

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

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

References $DIC, $ilDB, and $res.

Referenced by ilWikiPageGUI\insertWikiLinkAC().

873  : array {
874  global $DIC;
875 
876  $ilDB = $DIC->database();
877 
878  $set = $ilDB->query("SELECT DISTINCT title FROM il_wiki_page" .
879  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
880  " AND " . $ilDB->like("title", "text", "%" . $a_term . "%") .
881  " ORDER by title");
882  $res = array();
883  while ($rec = $ilDB->fetchAssoc($set)) {
884  $res[] = $rec["title"];
885  }
886 
887  return $res;
888  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ getParentType()

ilWikiPage::getParentType ( )

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

35  : string
36  {
37  return "wpg";
38  }

◆ getPopularPages()

static ilWikiPage::getPopularPages ( int  $a_wiki_id)
static

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

References $DIC, and $ilDB.

586  : array {
587  global $DIC;
588 
589  $ilDB = $DIC->database();
590 
591  $query = "SELECT wp.*, po.view_cnt as cnt FROM il_wiki_page wp, page_object po" .
592  " WHERE wp.wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
593  " AND wp.id = po.page_id " .
594  " AND po.parent_type = " . $ilDB->quote("wpg", "text") . " " .
595  " ORDER BY po.view_cnt";
596  $set = $ilDB->query($query);
597 
598  $pages = array();
599  while ($rec = $ilDB->fetchAssoc($set)) {
600  $pages[] = $rec;
601  }
602 
603  return $pages;
604  }
global $DIC
Definition: shib_login.php:26

◆ getRandomPage()

static ilWikiPage::getRandomPage ( int  $a_wiki_id)
static

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

References $DIC, $ilDB, and $r.

Referenced by ilObjWikiGUI\randomPageObject().

625  : string {
626  global $DIC;
627 
628  $ilDB = $DIC->database();
629 
630  $cnt = self::countPages($a_wiki_id);
631 
632  if ($cnt < 1) {
633  return "";
634  }
635 
636  $random = new \Random\Randomizer();
637  $rand = $random->getInt(1, $cnt);
638 
639  $ilDB->setLimit(1, $rand);
640  $query = "SELECT title FROM il_wiki_page" .
641  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
642  $s = $ilDB->query($query);
643  $r = $ilDB->fetchAssoc($s);
644 
645  return $r["title"];
646  }
global $DIC
Definition: shib_login.php:26
$r
+ Here is the caller graph for this function:

◆ getRating()

ilWikiPage::getRating ( )

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

References $rating.

Referenced by create(), and update().

103  : bool
104  {
105  return $this->rating;
106  }
+ Here is the caller graph for this function:

◆ getTitle()

ilWikiPage::getTitle ( )

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

References $title.

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

63  : string
64  {
65  return $this->title;
66  }
+ Here is the caller graph for this function:

◆ getWikiContributors()

static ilWikiPage::getWikiContributors ( int  $a_wiki_id)
static

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

Referenced by ilWikiContributorsTableGUI\getContributors().

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

◆ getWikiId()

ilWikiPage::getWikiId ( )

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

References ilPageObject\getParentId().

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

73  : int
74  {
75  return $this->getParentId();
76  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWikiPageContributors()

static ilWikiPage::getWikiPageContributors ( int  $a_page_id)
static

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

Referenced by ilWikiPageGUI\deleteWikiPageConfirmationScreen().

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

◆ getWikiRefId()

ilWikiPage::getWikiRefId ( )

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

References $parent_ref_id.

Referenced by create(), delete(), preparePageForCompare(), rename(), saveInternalLinks(), setCopyProperties(), setTranslationProperties(), and update().

83  : int
84  {
85  return $this->parent_ref_id;
86  }
+ Here is the caller graph for this function:

◆ hideAdvancedMetadata()

ilWikiPage::hideAdvancedMetadata ( bool  $a_val)

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

Referenced by read().

108  : void
109  {
110  $this->hide_adv_md = $a_val;
111  }
+ Here is the caller graph for this function:

◆ isAdvancedMetadataHidden()

ilWikiPage::isAdvancedMetadataHidden ( )

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

References $hide_adv_md.

Referenced by create(), and update().

113  : bool
114  {
115  return $this->hide_adv_md;
116  }
+ Here is the caller graph for this function:

◆ lookupAdvancedMetadataHidden()

static ilWikiPage::lookupAdvancedMetadataHidden ( int  $a_page_id)
static

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

References $DIC, and $ilDB.

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

892  : bool {
893  global $DIC;
894 
895  $ilDB = $DIC->database();
896 
897  $query = "SELECT * FROM il_wiki_page" .
898  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
899  $set = $ilDB->query($query);
900  if ($rec = $ilDB->fetchAssoc($set)) {
901  return (bool) $rec["hide_adv_md"];
902  }
903 
904  return false;
905  }
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ lookupObjIdByPage()

static ilWikiPage::lookupObjIdByPage ( int  $a_page_id)
static

returns the wiki/object id to a given page id

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

References $DIC, $ilDB, and null.

Referenced by ilObjMediaObject\getParentObjectIdForUsage().

665  : ?int {
666  global $DIC;
667 
668  $ilDB = $DIC->database();
669 
670  $query = "SELECT wiki_id FROM il_wiki_page" .
671  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
672  $set = $ilDB->query($query);
673  if ($rec = $ilDB->fetchAssoc($set)) {
674  return (int) $rec["wiki_id"];
675  }
676 
677  return null;
678  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ lookupTitle()

static ilWikiPage::lookupTitle ( int  $a_page_id,
string  $lang = "-" 
)
static

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

References $DIC, $ilDB, $lang, and null.

Referenced by ilObjectFeedWriter\__construct(), ilUserFeedWriter\__construct(), ilWikiPagesTableGUI\__construct(), ilObjWikiGUI\_goto(), ilObjWikiGUI\confirmRemoveImportantPagesObject(), ilWikiStatGUI\export(), ilWikiSearchResultsTableGUI\fillRow(), ilWikiContributorsTableGUI\fillRow(), ilImportantPagesTableGUI\fillRow(), ilMediaPoolPageUsagesTableGUI\fillRow(), ilMediaObjectUsagesTableGUI\fillRow(), ilPDNewsTableGUI\fillRow(), ilObjWiki\getAdvMDSubItemTitle(), ILIAS\components\ILIAS\Glossary\Table\TermUsagesTable\getDataRetrieval(), ilObjWikiSubItemListGUI\getHTML(), ilWikiNewsRendererGUI\getObjectLink(), ilObjWikiGUI\getSubObjectTitle(), ilLinkInputGUI\getTranslatedValue(), ilObjWikiSearchResultTableGUI\parse(), ILIAS\Wiki\Settings\SettingsGUI\save(), ilWikiPageGUI\searchWikiLinkAC(), ILIAS\Notes\NotificationsManager\sendNotifications(), ilObjWikiGUI\setAsStartPageObject(), and ilNewsForContextBlockGUI\showNews().

421  : ?string
422  {
423  global $DIC;
424 
425  $ilDB = $DIC->database();
426 
427  $query = "SELECT * FROM il_wiki_page" .
428  " WHERE id = " . $ilDB->quote($a_page_id, "integer") .
429  " AND lang = " . $ilDB->quote($lang, "text");
430  $set = $ilDB->query($query);
431  if ($rec = $ilDB->fetchAssoc($set)) {
432  return (string) $rec["title"];
433  }
434  return null;
435  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26
$lang
Definition: xapiexit.php:25
+ Here is the caller graph for this function:

◆ lookupWikiId()

static ilWikiPage::lookupWikiId ( int  $a_page_id)
static

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

References $DIC, $ilDB, and null.

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

439  : ?int {
440  global $DIC;
441 
442  $ilDB = $DIC->database();
443 
444  $query = "SELECT wiki_id FROM il_wiki_page" .
445  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
446  $set = $ilDB->query($query);
447  if ($rec = $ilDB->fetchAssoc($set)) {
448  return (int) $rec["wiki_id"];
449  }
450 
451  return null;
452  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ preparePageForCompare()

ilWikiPage::preparePageForCompare ( ilPageObject  $page)

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

References getWikiRefId().

907  : void
908  {
909  $page->setWikiRefId($this->getWikiRefId());
910  }
+ Here is the call graph for this function:

◆ read()

ilWikiPage::read ( bool  $a_omit_page_read = false)

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

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

269  : void {
270  $ilDB = $this->db;
271 
272  $query = "SELECT * FROM il_wiki_page WHERE id = " .
273  $ilDB->quote($this->getId(), "integer") .
274  " AND lang = " . $ilDB->quote($this->getLanguage(), "text");
275 
276  $set = $ilDB->query($query);
277  $rec = $ilDB->fetchAssoc($set);
278 
279  $this->setTitle($rec["title"]);
280  $this->setWikiId((int) $rec["wiki_id"]);
281  $this->setBlocked((bool) $rec["blocked"]);
282  $this->setRating((bool) $rec["rating"]);
283  $this->hideAdvancedMetadata((bool) $rec["hide_adv_md"]);
284 
285  // get co page
286  if (!$a_omit_page_read) {
287  parent::read();
288  }
289  }
setRating(bool $a_val)
hideAdvancedMetadata(bool $a_val)
setBlocked(bool $a_val)
setTitle(string $a_title)
setWikiId(int $a_wikiid)
ilDBInterface $db
+ Here is the call graph for this function:

◆ rename()

ilWikiPage::rename ( string  $a_new_name)

Rename page.

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

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

685  : string {
686  $ilDB = $this->db;
687 
688  // replace unallowed characters
689  $a_new_name = str_replace(array("<", ">"), '', $a_new_name);
690 
691  // replace multiple whitespace characters by one single space
692  $a_new_name = trim(preg_replace('!\s+!', ' ', $a_new_name));
693 
694  $page_title = ilWikiUtil::makeDbTitle($a_new_name);
695  $pg_id = self::getPageIdForTitle($this->getWikiId(), $page_title, $this->getLanguage());
696 
697  $xml_new_name = str_replace("&", "&amp;", $a_new_name);
698 
699  if ($pg_id == 0 || $pg_id == $this->getId()) {
700  $sources = ilInternalLink::_getSourcesOfTarget("wpg", $this->getId(), 0);
701 
702  $this->log->debug("nr of pages linking to renamed page: " . count($sources));
703  foreach ($sources as $s) {
704  if ($s["type"] === "wpg:pg" && ilPageObject::_exists("wpg", $s["id"])) {
705  $wpage = new ilWikiPage($s["id"], 0, $s["lang"]);
706  $wpage->setWikiRefId($this->getWikiRefId());
707 
708  $wiki_id = ilWikiPage::lookupWikiId($s["id"]);
710  $wpage->getXMLContent(),
711  $wiki_id,
712  false,
714  );
715  $this->log->debug("nr internal links: " . count($col));
716  $new_content = $wpage->getXMLContent();
717  foreach ($col as $c) {
718  // this complicated procedure is needed due to the fact
719  // that depending on the collation e = é is true
720  // in the (mysql) database
721  // see bug http://www.ilias.de/mantis/view.php?id=11227
722  $t1 = ilWikiUtil::makeDbTitle($c["nt"]->mTextform);
723  $t2 = ilWikiUtil::makeDbTitle($this->getTitle());
724 
725  // this one replaces C2A0 (&nbsp;) by a usual space
726  // otherwise the comparision will fail, since you
727  // get these characters from tiny if more than one
728  // space is repeated in a string. This may not be
729  // 100% but we do not store $t1 anywhere and only
730  // modify it for the comparison
731  $t1 = preg_replace('/\xC2\xA0/', ' ', $t1);
732  $t2 = preg_replace('/\xC2\xA0/', ' ', $t2);
733 
734  $set = $ilDB->query($q = "SELECT " . $ilDB->quote($t1, "text") . " = " . $ilDB->quote($t2, "text") . " isequal");
735  $rec = $ilDB->fetchAssoc($set);
736 
737  if ($rec["isequal"]) {
738  $new_content =
739  str_replace(
740  "[[" . $c["nt"]->mTextform . "]]",
741  "[[" . $xml_new_name . "]]",
742  $new_content
743  );
744  if ($c["text"] != "") {
745  $new_content =
746  str_replace(
747  "[[" . $c["text"] . "]]",
748  "[[" . $xml_new_name . "]]",
749  $new_content
750  );
751  }
752  $add = ($c["text"] != "")
753  ? "|" . $c["text"]
754  : "";
755  $new_content =
756  str_replace(
757  "[[" . $c["nt"]->mTextform . $add . "]]",
758  "[[" . $xml_new_name . $add . "]]",
759  $new_content
760  );
761  }
762  }
763  $wpage->setXMLContent($new_content);
764  //echo htmlentities($new_content);
765  $wpage->update();
766  }
767  }
768 
769  if (ilObjWiki::_lookupStartPage($this->getWikiId()) === $this->getTitle()) {
770  ilObjWiki::writeStartPage($this->getWikiId(), $a_new_name);
771  }
772 
773  $this->setTitle($a_new_name);
774 
775  $this->update();
776  }
777 
778  return $a_new_name;
779  }
static lookupWikiId(int $a_page_id)
$c
Definition: deliver.php:25
setTitle(string $a_title)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static collectInternalLinks(string $s, int $a_wiki_id, bool $a_collect_non_ex=false, string $mode=IL_WIKI_MODE_COLLECT)
Collect internal wiki links of a string.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static writeStartPage(int $a_id, string $a_name)
static _lookupStartPage(int $a_wiki_id)
update(bool $a_validate=true, bool $a_no_history=false)
static makeDbTitle(string $a_par)
ilDBInterface $db
const IL_WIKI_MODE_EXT_COLLECT
$q
Definition: shib_logout.php:23
+ Here is the call graph for this function:

◆ saveInternalLinks()

ilWikiPage::saveInternalLinks ( DOMDocument  $a_domdoc)

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

References ilPageObject\getId(), ilPageObject\getLanguage(), getTitle(), and getWikiRefId().

Referenced by create().

560  : void {
561  parent::saveInternalLinks($a_domdoc);
562 
563  if ($this->getWikiRefId() > 0) {
564  $link_manager = $this->service->domain()->links($this->getWikiRefId());
565  $link_manager->saveInternalLinksForPage(
566  $a_domdoc,
567  $this->getId(),
568  $this->getTitle(),
569  $this->getLanguage()
570  );
571  }
572  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBlocked()

ilWikiPage::setBlocked ( bool  $a_val)

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

Referenced by read().

88  : void
89  {
90  $this->blocked = $a_val;
91  }
+ Here is the caller graph for this function:

◆ setCopyProperties()

ilWikiPage::setCopyProperties ( ilPageObject  $new_page)
protected

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

References getWikiId(), and getWikiRefId().

918  : void
919  {
920  // see #44256
921  if ($new_page->getWikiId() === 0 || $new_page->getWikiId() === $this->getWikiId()) {
922  $new_page->setWikiRefId($this->getWikiRefId());
923  }
924  }
+ Here is the call graph for this function:

◆ setRating()

ilWikiPage::setRating ( bool  $a_val)

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

Referenced by read().

98  : void
99  {
100  $this->rating = $a_val;
101  }
+ Here is the caller graph for this function:

◆ setTitle()

ilWikiPage::setTitle ( string  $a_title)

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

References ilWikiUtil\makeDbTitle().

Referenced by read(), and rename().

58  : void
59  {
60  $this->title = ilWikiUtil::makeDbTitle($a_title);
61  }
static makeDbTitle(string $a_par)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTranslationProperties()

ilWikiPage::setTranslationProperties ( ilPageObject  $transl_page)
protected

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

References getWikiRefId().

912  : void
913  {
914  parent::setTranslationProperties($transl_page);
915  $transl_page->setWikiRefId($this->getWikiRefId());
916  }
+ Here is the call graph for this function:

◆ setWikiId()

ilWikiPage::setWikiId ( int  $a_wikiid)

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

References ilPageObject\setParentId().

Referenced by read().

68  : void
69  {
70  $this->setParentId($a_wikiid);
71  }
setParentId(int $a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWikiRefId()

ilWikiPage::setWikiRefId ( int  $a_wiki_ref_id)

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

78  : void
79  {
80  $this->parent_ref_id = $a_wiki_ref_id;
81  }

◆ update()

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

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

References ilPageObject\$db, $ilDB, getBlocked(), ilPageObject\getId(), ilPageObject\getLanguage(), getNotificationGUI(), getRating(), getTitle(), getWikiId(), getWikiRefId(), isAdvancedMetadataHidden(), null, ilObjectSearch\raiseContentChanged(), ilNotification\TYPE_WIKI_PAGE, and updateNews().

Referenced by rename().

232  {
233  $ilDB = $this->db;
234  $this->wiki_log->debug("start...");
235  // update wiki page data
236  $query = "UPDATE il_wiki_page SET " .
237  " title = " . $ilDB->quote($this->getTitle(), "text") .
238  ",wiki_id = " . $ilDB->quote($this->getWikiId(), "integer") .
239  ",blocked = " . $ilDB->quote((int) $this->getBlocked(), "integer") .
240  ",rating = " . $ilDB->quote((int) $this->getRating(), "integer") .
241  ",hide_adv_md = " . $ilDB->quote((int) $this->isAdvancedMetadataHidden(), "integer") .
242  " WHERE id = " . $ilDB->quote($this->getId(), "integer") .
243  " AND lang = " . $ilDB->quote($this->getLanguage(), "text");
244  $ilDB->manipulate($query);
245  $updated = parent::update($a_validate, $a_no_history);
246  if ($updated === true) {
247  $this->wiki_log->debug("send notification");
248  $this->getNotificationGUI()->send(
249  "update",
251  $this->getWikiRefId(),
252  $this->getId(),
253  null,
254  $this->getLanguage()
255  );
256 
257  $this->wiki_log->debug("update news");
259  $this->updateNews(true);
260  } else {
261  return $updated;
262  }
263 
264  return true;
265  }
getNotificationGUI()
This currently violates the layer model, since notifications render the abstracts with a GUI class...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static raiseContentChanged(int $obj_id)
updateNews(bool $a_update=false)
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateNews()

ilWikiPage::updateNews ( bool  $a_update = false)

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

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

Referenced by create(), and update().

784  : void {
785  $ilUser = $this->user;
786 
787  $news_set = new ilSetting("news");
788  $default_visibility = ($news_set->get("default_visibility") != "")
789  ? $news_set->get("default_visibility")
790  : "users";
791 
792  if (!$a_update) {
793  $news_item = new ilNewsItem();
794  $news_item->setContext(
795  $this->getWikiId(),
796  "wiki",
797  $this->getId(),
798  "wpg"
799  );
800  $news_item->setPriority(NEWS_NOTICE);
801  $news_item->setTitle($this->getTitle());
802  $news_item->setContentTextIsLangVar(true);
803  $news_item->setContent("wiki_news_page_created");
804  $news_item->setUserId($ilUser->getId());
805  $news_item->setVisibility($default_visibility);
806  $news_item->create();
807  } else {
808  // get last news item of the day (if existing)
810  $this->getWikiId(),
811  "wiki",
812  $this->getId(),
813  "wpg",
814  true
815  );
816 
817  if ($news_id > 0) {
818  $news_item = new ilNewsItem($news_id);
819  $news_item->setContent("wiki_news_page_changed");
820  $news_item->setUserId($ilUser->getId());
821  $news_item->setTitle($this->getTitle());
822  $news_item->setContentTextIsLangVar(true);
823  $news_item->update(true);
824  } else {
825  $news_item = new ilNewsItem();
826  $news_item->setContext(
827  $this->getWikiId(),
828  "wiki",
829  $this->getId(),
830  "wpg"
831  );
832  $news_item->setPriority(NEWS_NOTICE);
833  $news_item->setTitle($this->getTitle());
834  $news_item->setContentTextIsLangVar(true);
835  $news_item->setContent("wiki_news_page_changed");
836  $news_item->setUserId($ilUser->getId());
837  $news_item->setVisibility($default_visibility);
838  $news_item->create();
839  }
840  }
841  }
static getLastNewsIdForContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="", bool $a_only_today=false)
Get last news id of news set related to a certain context.
const NEWS_NOTICE
A news item can be created by different sources.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $blocked

bool ilWikiPage::$blocked = false
protected

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

Referenced by getBlocked().

◆ $hide_adv_md

bool ilWikiPage::$hide_adv_md = false
protected

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

Referenced by isAdvancedMetadataHidden().

◆ $parent_ref_id

int ilWikiPage::$parent_ref_id = 0
protected

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

Referenced by getWikiRefId().

◆ $rating

bool ilWikiPage::$rating = false
protected

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

Referenced by getRating().

◆ $repo

ILIAS Wiki Page PageDBRepository ilWikiPage::$repo
protected

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

◆ $service

ILIAS Wiki InternalService ilWikiPage::$service
protected

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

◆ $title

string ilWikiPage::$title = ""
protected

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

Referenced by getTitle().

◆ $wiki_log

ilLogger ilWikiPage::$wiki_log
protected

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


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