ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 578 of file class.ilWikiPage.php.

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

◆ _wikiPageExists()

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

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

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

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

523  : bool {
524  global $DIC;
525 
526  if ($lang === "") {
527  $lang = "-";
528  }
529 
530  $ilDB = $DIC->database();
531 
532  $a_title = ilWikiUtil::makeDbTitle($a_title);
533 
534  $query = "SELECT id FROM il_wiki_page" .
535  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
536  " AND title = " . $ilDB->quote($a_title, "text") .
537  " AND lang = " . $ilDB->quote($lang, "text");
538  $set = $ilDB->query($query);
539 
540  if ($ilDB->fetchAssoc($set)) {
541  return true;
542  }
543 
544  return false;
545  }
global $DIC
Definition: shib_login.php:22
$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:22
+ 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:63
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 607 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $r.

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

293  : void
294  {
295  $imp_pages = $this->service->domain()->importantPage($this->getWikiRefId());
296 
297  $ilDB = $this->db;
298 
299  // get other pages that link to this page
300  $linking_pages = self::getLinksToPage(
301  $this->getWikiId(),
302  $this->getId()
303  );
304 
305  // delete important page
306  // note: the wiki might be already deleted here
307  if (!$this->isTranslationPage()) {
308  if ($imp_pages->isImportantPage($this->getId())) {
309  $imp_pages->removeImportantPage($this->getId());
310  }
311  }
312 
313  // delete internal links information to this page
315 
317 
318  $this->getNotificationGUI()->send(
319  "delete",
321  $this->getWikiRefId(),
322  $this->getId(),
323  null,
324  $this->getLanguage()
325  );
326 
327  // remove all notifications
329 
330  // delete record of table il_wiki_data
331  $this->repo->delete($this->getId(), $this->getLanguage());
332 
333  // delete co page
334  parent::delete();
335 
336  // make links of other pages to this page a missing link
337  $missing_page_repo = $this->service->repo()->missingPage();
338  foreach ($linking_pages as $lp) {
339  $missing_page_repo->save(
340  $this->getWikiId(),
341  $lp["id"],
342  $this->getTitle(),
343  $this->getLanguage()
344  );
345  }
346  }
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 348 of file class.ilWikiPage.php.

References $DIC, and $ilDB.

Referenced by ilObjWiki\delete().

348  : void
349  {
350  global $DIC;
351 
352  $ilDB = $DIC->database();
353 
354  // delete record of table il_wiki_data
355  $query = "SELECT * FROM il_wiki_page" .
356  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
357  $set = $ilDB->query($query);
358 
359  while ($rec = $ilDB->fetchAssoc($set)) {
360  $wiki_page = new ilWikiPage($rec["id"], 0, $rec["lang"]);
361  $wiki_page->delete();
362  }
363  }
global $DIC
Definition: shib_login.php:22
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 368 of file class.ilWikiPage.php.

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

Referenced by ilObjWiki\update().

372  : bool {
373  global $DIC;
374 
375  $ilDB = $DIC->database();
376 
377  $a_title = ilWikiUtil::makeDbTitle($a_title);
378 
379  $query = "SELECT id FROM il_wiki_page" .
380  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
381  " AND title = " . $ilDB->quote($a_title, "text") .
382  " AND lang = " . $ilDB->quote($lang, "text");
383  $set = $ilDB->query($query);
384  if ($rec = $ilDB->fetchAssoc($set)) {
385  return true;
386  }
387 
388  return false;
389  }
global $DIC
Definition: shib_login.php:22
$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 455 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().

458  : array {
459  global $DIC;
460 
461  $ilDB = $DIC->database();
462 
463  $pages = parent::getAllPages("wpg", $a_wiki_id);
464 
465  $query = "SELECT * FROM il_wiki_page" .
466  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
467  " AND lang = " . $ilDB->quote($lang, "text") .
468  " ORDER BY title";
469  $set = $ilDB->query($query);
470 
471  $pg = array();
472  while ($rec = $ilDB->fetchAssoc($set)) {
473  if (isset($pages[$rec["id"]])) {
474  $pg[$rec["id"]] = $pages[$rec["id"]];
475  $pg[$rec["id"]]["title"] = $rec["title"];
476  }
477  }
478 
479  return $pg;
480  }
global $DIC
Definition: shib_login.php:22
$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 861 of file class.ilWikiPage.php.

References getWikiId(), and ilWikiPageTemplate\TYPE_ADD_TO_PAGE.

861  : array
862  {
863  $wt = new ilWikiPageTemplate($this->getWikiId());
864  $templates = array();
865  foreach ($wt->getAllInfo(ilWikiPageTemplate::TYPE_ADD_TO_PAGE, $this->getLanguage()) as $t) {
866  $templates[] = array("id" => $t["wpage_id"], "parent_type" => "wpg", "title" => $t["title"]);
867  }
868  return $templates;
869  }
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 844 of file class.ilWikiPage.php.

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

847  : string {
848  if (!$a_offline) {
849  $href = "./goto.php?target=wiki_wpage_" . $a_target;
850  } else {
851  $href = ILIAS_HTTP_PATH . "/goto.php?target=wiki_wpage_" . $a_target;
852  }
853  return $href;
854  }
+ 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 482 of file class.ilWikiPage.php.

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

Referenced by ilWikiPageGUI\deleteWikiPageConfirmationScreen().

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

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

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

399  : ?int {
400  global $DIC;
401 
402  if ($lang === "") {
403  $lang = "-";
404  }
405 
406  $ilDB = $DIC->database();
407 
408  $a_title = ilWikiUtil::makeDbTitle($a_title);
409 
410  $query = "SELECT * FROM il_wiki_page" .
411  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
412  " AND title = " . $ilDB->quote($a_title, "text") .
413  " AND lang = " . $ilDB->quote($lang, "text");
414  $set = $ilDB->query($query);
415  if ($rec = $ilDB->fetchAssoc($set)) {
416  return (int) $rec["id"];
417  }
418 
419  return null;
420  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
$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 871 of file class.ilWikiPage.php.

References $DIC, $ilDB, and $res.

Referenced by ilWikiPageGUI\insertWikiLinkAC().

874  : array {
875  global $DIC;
876 
877  $ilDB = $DIC->database();
878 
879  $set = $ilDB->query("SELECT DISTINCT title FROM il_wiki_page" .
880  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer") .
881  " AND " . $ilDB->like("title", "text", "%" . $a_term . "%") .
882  " ORDER by title");
883  $res = array();
884  while ($rec = $ilDB->fetchAssoc($set)) {
885  $res[] = $rec["title"];
886  }
887 
888  return $res;
889  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ 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 585 of file class.ilWikiPage.php.

References $DIC, and $ilDB.

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

◆ getRandomPage()

static ilWikiPage::getRandomPage ( int  $a_wiki_id)
static

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

References $DIC, $ilDB, and $r.

Referenced by ilObjWikiGUI\randomPageObject().

626  : string {
627  global $DIC;
628 
629  $ilDB = $DIC->database();
630 
631  $cnt = self::countPages($a_wiki_id);
632 
633  if ($cnt < 1) {
634  return "";
635  }
636 
637  $random = new \Random\Randomizer();
638  $rand = $random->getInt(1, $cnt);
639 
640  $ilDB->setLimit(1, $rand);
641  $query = "SELECT title FROM il_wiki_page" .
642  " WHERE wiki_id = " . $ilDB->quote($a_wiki_id, "integer");
643  $s = $ilDB->query($query);
644  $r = $ilDB->fetchAssoc($s);
645 
646  return $r["title"];
647  }
global $DIC
Definition: shib_login.php:22
$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 547 of file class.ilWikiPage.php.

Referenced by ilWikiContributorsTableGUI\getContributors().

549  : array {
550  return parent::getParentObjectContributors("wpg", $a_wiki_id);
551  }
+ 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(), 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 553 of file class.ilWikiPage.php.

Referenced by ilWikiPageGUI\deleteWikiPageConfirmationScreen().

555  : array {
556  return parent::getPageContributors("wpg", $a_page_id);
557  }
+ 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 891 of file class.ilWikiPage.php.

References $DIC, and $ilDB.

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

893  : bool {
894  global $DIC;
895 
896  $ilDB = $DIC->database();
897 
898  $query = "SELECT * FROM il_wiki_page" .
899  " WHERE id = " . $ilDB->quote($a_page_id, "integer");
900  $set = $ilDB->query($query);
901  if ($rec = $ilDB->fetchAssoc($set)) {
902  return (bool) $rec["hide_adv_md"];
903  }
904 
905  return false;
906  }
global $DIC
Definition: shib_login.php:22
+ 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 664 of file class.ilWikiPage.php.

References $DIC, $ilDB, and null.

Referenced by ilObjMediaObject\getParentObjectIdForUsage().

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

◆ lookupTitle()

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

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

422  : ?string
423  {
424  global $DIC;
425 
426  $ilDB = $DIC->database();
427 
428  $query = "SELECT * FROM il_wiki_page" .
429  " WHERE id = " . $ilDB->quote($a_page_id, "integer") .
430  " AND lang = " . $ilDB->quote($lang, "text");
431  $set = $ilDB->query($query);
432  if ($rec = $ilDB->fetchAssoc($set)) {
433  return (string) $rec["title"];
434  }
435  return null;
436  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
$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 438 of file class.ilWikiPage.php.

References $DIC, $ilDB, and null.

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

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

◆ preparePageForCompare()

ilWikiPage::preparePageForCompare ( ilPageObject  $page)

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

References getWikiRefId().

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

◆ read()

ilWikiPage::read ( bool  $a_omit_page_read = false)

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

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

270  : void {
271  $ilDB = $this->db;
272 
273  $query = "SELECT * FROM il_wiki_page WHERE id = " .
274  $ilDB->quote($this->getId(), "integer") .
275  " AND lang = " . $ilDB->quote($this->getLanguage(), "text");
276 
277  $set = $ilDB->query($query);
278  $rec = $ilDB->fetchAssoc($set);
279 
280  $this->setTitle($rec["title"]);
281  $this->setWikiId((int) $rec["wiki_id"]);
282  $this->setBlocked((bool) $rec["blocked"]);
283  $this->setRating((bool) $rec["rating"]);
284  $this->hideAdvancedMetadata((bool) $rec["hide_adv_md"]);
285 
286  // get co page
287  if (!$a_omit_page_read) {
288  parent::read();
289  }
290  }
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 684 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().

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

◆ saveInternalLinks()

ilWikiPage::saveInternalLinks ( DOMDocument  $a_domdoc)

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

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

Referenced by create().

561  : void {
562  parent::saveInternalLinks($a_domdoc);
563 
564  if ($this->getWikiRefId() > 0) {
565  $link_manager = $this->service->domain()->links($this->getWikiRefId());
566  $link_manager->saveInternalLinksForPage(
567  $a_domdoc,
568  $this->getId(),
569  $this->getTitle(),
570  $this->getLanguage()
571  );
572  }
573  }
+ 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 919 of file class.ilWikiPage.php.

References getWikiRefId().

919  : void
920  {
921  $new_page->setWikiRefId($this->getWikiRefId());
922  }
+ 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 913 of file class.ilWikiPage.php.

References getWikiRefId().

913  : void
914  {
915  parent::setTranslationProperties($transl_page);
916  $transl_page->setWikiRefId($this->getWikiRefId());
917  }
+ 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 
247  if ($updated === true) {
248  $this->wiki_log->debug("send notification");
249  $this->getNotificationGUI()->send(
250  "update",
252  $this->getWikiRefId(),
253  $this->getId(),
254  null,
255  $this->getLanguage()
256  );
257 
258  $this->wiki_log->debug("update news");
260  $this->updateNews(true);
261  } else {
262  return $updated;
263  }
264 
265  return true;
266  }
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 783 of file class.ilWikiPage.php.

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

Referenced by create(), and update().

785  : void {
786  $ilUser = $this->user;
787 
788  $news_set = new ilSetting("news");
789  $default_visibility = ($news_set->get("default_visibility") != "")
790  ? $news_set->get("default_visibility")
791  : "users";
792 
793  if (!$a_update) {
794  $news_item = new ilNewsItem();
795  $news_item->setContext(
796  $this->getWikiId(),
797  "wiki",
798  $this->getId(),
799  "wpg"
800  );
801  $news_item->setPriority(NEWS_NOTICE);
802  $news_item->setTitle($this->getTitle());
803  $news_item->setContentTextIsLangVar(true);
804  $news_item->setContent("wiki_news_page_created");
805  $news_item->setUserId($ilUser->getId());
806  $news_item->setVisibility($default_visibility);
807  $news_item->create();
808  } else {
809  // get last news item of the day (if existing)
811  $this->getWikiId(),
812  "wiki",
813  $this->getId(),
814  "wpg",
815  true
816  );
817 
818  if ($news_id > 0) {
819  $news_item = new ilNewsItem($news_id);
820  $news_item->setContent("wiki_news_page_changed");
821  $news_item->setUserId($ilUser->getId());
822  $news_item->setTitle($this->getTitle());
823  $news_item->setContentTextIsLangVar(true);
824  $news_item->update(true);
825  } else {
826  $news_item = new ilNewsItem();
827  $news_item->setContext(
828  $this->getWikiId(),
829  "wiki",
830  $this->getId(),
831  "wpg"
832  );
833  $news_item->setPriority(NEWS_NOTICE);
834  $news_item->setTitle($this->getTitle());
835  $news_item->setContentTextIsLangVar(true);
836  $news_item->setContent("wiki_news_page_changed");
837  $news_item->setUserId($ilUser->getId());
838  $news_item->setVisibility($default_visibility);
839  $news_item->create();
840  }
841  }
842  }
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: