ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Wiki\Links\LinkManager Class Reference

Page manager. More...

+ Collaboration diagram for ILIAS\Wiki\Links\LinkManager:

Public Member Functions

 __construct (InternalDataService $data_service, MissingPageDBRepository $missing_page_repo, InternalDomainService $domain, int $ref_id)
 
 saveInternalLinksForPage (\DOMDocument $domdoc, int $page_id, string $title, string $lang)
 
 getLinksToPage (int $a_page_id, string $lang="-")
 

Protected Attributes

int $wiki_id
 
PageManager $pm
 
ilLogger $log
 
InternalDomainService $domain
 
MissingPageDBRepository $missing_page_repo
 
InternalDataService $data_service
 

Detailed Description

Page manager.

Definition at line 34 of file LinkManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Wiki\Links\LinkManager::__construct ( InternalDataService  $data_service,
MissingPageDBRepository  $missing_page_repo,
InternalDomainService  $domain,
int  $ref_id 
)

Definition at line 43 of file LinkManager.php.

48 {
49 $this->missing_page_repo = $missing_page_repo;
50 $this->data_service = $data_service;
51 $this->domain = $domain;
52 $this->log = $this->domain->log();
53 $this->pm = $domain->page()->page($ref_id);
54 $this->wiki_id = $this->pm->getWikiId();
55 }
$ref_id
Definition: ltiauth.php:66

References ILIAS\Wiki\Links\LinkManager\$data_service, ILIAS\Wiki\Links\LinkManager\$domain, ILIAS\Wiki\Links\LinkManager\$missing_page_repo, $ref_id, ILIAS\Wiki\InternalDomainService\log(), and ILIAS\Wiki\InternalDomainService\page().

+ Here is the call graph for this function:

Member Function Documentation

◆ getLinksToPage()

ILIAS\Wiki\Links\LinkManager::getLinksToPage ( int  $a_page_id,
string  $lang = "-" 
)
Returns
iterable<PageInfo>

Definition at line 115 of file LinkManager.php.

118 : \Iterator {
119
121 if ($lang === "") {
122 $lang = "-";
123 }
124 $sources = \ilInternalLink::_getSourcesOfTarget("wpg", $a_page_id, 0);
125 $ids = array();
126 foreach ($sources as $source) {
127 if ($source["type"] === "wpg:pg" && $source["lang"] === $lang) {
128 $ids[] = (int) $source["id"];
129 }
130 }
131
132 // get wiki page record
133 foreach ($this->pm->getInfoOfSelected($ids, $lang) as $p) {
134 yield $p;
135 }
136 }
$lang
Definition: xapiexit.php:25

References $lang.

◆ saveInternalLinksForPage()

ILIAS\Wiki\Links\LinkManager::saveInternalLinksForPage ( \DOMDocument  $domdoc,
int  $page_id,
string  $title,
string  $lang 
)

Definition at line 57 of file LinkManager.php.

62 : void {
63
65
66 // Check, whether ANOTHER page links to this page as a "missing" page
67 // (this is the case, when this page is created newly)
68 foreach($this->missing_page_repo->getSourcesOfMissingTarget($wiki_id, $title, $lang) as $i) { // insert internal links instead
69 //echo "adding link";
71 "wpg:pg",
72 $i,
73 "wpg",
74 $page_id,
75 0,
76 $lang
77 );
78 }
79
80 // now remove the missing page entries for our $title (since it exists now)
81 $this->missing_page_repo->deleteForTarget($wiki_id, $title, $lang);
82
83 // remove the existing "missing page" links for THIS page (they will be re-inserted below)
84 $this->missing_page_repo->deleteForSourceId($wiki_id, $page_id, $lang);
85
86 // collect the wiki links of the page
87 $xml = $domdoc->saveXML();
88 $int_wiki_links = \ilWikiUtil::collectInternalLinks($xml, $wiki_id, true);
89 foreach ($int_wiki_links as $wlink) {
90 $target_page_id = (int) $this->pm->getPageIdForTitle($wlink, $lang);
91
92 if ($target_page_id > 0) { // save internal link for existing page
94 "wpg:pg",
95 $page_id,
96 "wpg",
97 $target_page_id,
98 0,
99 $lang
100 );
101 } else { // save missing link for non-existing page
102 $this->missing_page_repo->save(
103 $wiki_id,
104 $page_id,
105 $wlink,
106 $lang
107 );
108 }
109 }
110 }
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.

References $lang, and ilInternalLink\_saveLink().

+ Here is the call graph for this function:

Field Documentation

◆ $data_service

InternalDataService ILIAS\Wiki\Links\LinkManager::$data_service
protected

Definition at line 41 of file LinkManager.php.

Referenced by ILIAS\Wiki\Links\LinkManager\__construct().

◆ $domain

InternalDomainService ILIAS\Wiki\Links\LinkManager::$domain
protected

Definition at line 39 of file LinkManager.php.

Referenced by ILIAS\Wiki\Links\LinkManager\__construct().

◆ $log

ilLogger ILIAS\Wiki\Links\LinkManager::$log
protected

Definition at line 38 of file LinkManager.php.

◆ $missing_page_repo

MissingPageDBRepository ILIAS\Wiki\Links\LinkManager::$missing_page_repo
protected

Definition at line 40 of file LinkManager.php.

Referenced by ILIAS\Wiki\Links\LinkManager\__construct().

◆ $pm

PageManager ILIAS\Wiki\Links\LinkManager::$pm
protected

Definition at line 37 of file LinkManager.php.

◆ $wiki_id

int ILIAS\Wiki\Links\LinkManager::$wiki_id
protected

Definition at line 36 of file LinkManager.php.


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