ILIAS  trunk Revision v12.0_alpha-1338-g8f7e531aa3c
ilPageLinker Class Reference

Page linker. More...

+ Inheritance diagram for ilPageLinker:
+ Collaboration diagram for ilPageLinker:

Public Member Functions

 __construct (string $cmd_gui_class, bool $offline=false, string $profile_back_url="", ?ilCtrl $ctrl=null)
 
 setOffline (bool $offline=true)
 
 setProfileBackUrl (string $url)
 
 getLayoutLinkTargets ()
 
 getLinkTargetsXML ()
 
 getLinkXML (array $int_links)
 
 getFullscreenLink ()
 
 setOffline (bool $offline=true)
 
 getLayoutLinkTargets ()
 
 setProfileBackUrl (string $url)
 
 getLinkXML (array $int_links)
 
 getFullscreenLink ()
 

Protected Attributes

bool $offline
 
string $profile_back_url = ""
 
ilCtrl $ctrl
 
string $cmd_gui
 
ILIAS StaticURL Services $static_url
 

Detailed Description

Page linker.

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

Definition at line 25 of file class.ilPageLinker.php.

Constructor & Destructor Documentation

◆ __construct()

ilPageLinker::__construct ( string  $cmd_gui_class,
bool  $offline = false,
string  $profile_back_url = "",
?ilCtrl  $ctrl = null 
)

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

38 {
39 global $DIC;
40
41 $this->offline = $offline;
42 $this->profile_back_url = $profile_back_url;
43 $this->cmd_gui = $cmd_gui_class;
44
45 $this->ctrl = (is_null($ctrl))
46 ? $DIC->ctrl()
47 : $ctrl;
48 $this->static_url = $DIC["static_url"];
49 }
global $DIC
Definition: shib_login.php:26

References $ctrl, $DIC, $offline, $profile_back_url, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

Member Function Documentation

◆ getFullscreenLink()

ilPageLinker::getFullscreenLink ( )

Implements ILIAS\COPage\PageLinker.

Definition at line 234 of file class.ilPageLinker.php.

234 : string
235 {
236 if ($this->offline) {
237 return "fullscreen.html";
238 }
239
240 return $this->ctrl->getLinkTargetByClass($this->cmd_gui, "fullscreen", "", false, false);
241 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getLayoutLinkTargets()

ilPageLinker::getLayoutLinkTargets ( )

Implements ILIAS\COPage\PageLinker.

Definition at line 62 of file class.ilPageLinker.php.

62 : array
63 {
64 $targets = [];
65 return $targets;
66 }

Referenced by getLinkTargetsXML().

+ Here is the caller graph for this function:

◆ getLinkTargetsXML()

ilPageLinker::getLinkTargetsXML ( )

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

68 : string
69 {
70 $layoutLinkTargets = $this->getLayoutLinkTargets();
71
72 if (0 === count($layoutLinkTargets)) {
73 return '';
74 }
75
76 $link_info = "<LinkTargets>";
77 foreach ($layoutLinkTargets as $k => $t) {
78 $link_info .= "<LinkTarget TargetFrame=\"" . $t["Type"] . "\" LinkTarget=\"" . $t["Frame"] . "\" OnClick=\"" . $t["OnClick"] . "\" />";
79 }
80 $link_info .= "</LinkTargets>";
81 return $link_info;
82 }

References getLayoutLinkTargets().

Referenced by getLinkXML().

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

◆ getLinkXML()

ilPageLinker::getLinkXML ( array  $int_links)

Implements ILIAS\COPage\PageLinker.

Definition at line 84 of file class.ilPageLinker.php.

84 : string
85 {
86 $ilCtrl = $this->ctrl;
87 $link_info = "<IntLinkInfos>";
88 foreach ($int_links as $int_link) {
89 $target = $int_link["Target"];
90 if (substr($target, 0, 4) == "il__") {
91 $target_arr = explode("_", $target);
92 $target_id = $target_arr[count($target_arr) - 1];
93 $type = $int_link["Type"];
94
95 $targetframe = ($int_link["TargetFrame"] != "")
96 ? $int_link["TargetFrame"]
97 : "None";
98
99 $ltarget = "_top";
100 if ($targetframe != "None") {
101 $ltarget = "_blank";
102 }
103
104 // anchor
105 $anc = $anc_add = "";
106 if (($int_link["Anchor"] ?? "") != "") {
107 $anc = $int_link["Anchor"];
108 $anc_add = "_" . rawurlencode($int_link["Anchor"]);
109 }
110
111 $href = "";
112 $lcontent = "";
113 switch ($type) {
114 case "PageObject":
115 case "StructureObject":
116 $lm_id = ilLMObject::_lookupContObjID($target_id);
117 if ($type === "PageObject") {
118 $href = (string) $this->static_url->builder()->build(
119 "pg",
120 null,
121 [$target_id]
122 ) . $anc_add;
123 } else {
124 $href = (string) $this->static_url->builder()->build(
125 "st",
126 null,
127 [$target_id]
128 ) . $anc_add;
129 }
130 if ($lm_id == "") {
131 $href = "";
132 }
133 break;
134
135 case "GlossaryItem":
136 if ($targetframe == "Glossary") {
137 $ltarget = "";
138 }
139 if ($this->offline) {
140 $href = "term_" . $target_id . ".html";
141 } else {
142 $href = "./goto.php?target=git_" . $target_id;
143 }
144 break;
145
146 case "MediaObject":
147 if ($this->offline) {
148 $href = "media_" . $target_id . ".html";
149 } else {
150 $this->ctrl->setParameterByClass($this->cmd_gui, "mob_id", $target_id);
151 $href = $this->ctrl->getLinkTargetByClass(
152 $this->cmd_gui,
153 "displayMedia",
154 "",
155 false,
156 true
157 );
158 $this->ctrl->setParameterByClass($this->cmd_gui, "mob_id", "");
159 }
160 break;
161
162 case "WikiPage":
163 $wiki_anc = "";
164 if (($int_link["Anchor"] ?? "") != "") {
165 $wiki_anc = "#" . rawurlencode("copganc_" . $int_link["Anchor"]);
166 }
167 $href = ilWikiPage::getGotoForWikiPageTarget($target_id) . $wiki_anc;
168 break;
169
170 case "PortfolioPage":
171 $href = ilPortfolioPage::getGotoForPortfolioPageTarget($target_id, $this->offline);
172 break;
173
174 case "RepositoryItem":
175 $obj_type = ilObject::_lookupType((int) $target_id, true);
176 if ((int) $target_id > 0) {
177 $href = (string) $this->static_url->builder()->build(
178 $obj_type,
179 new \ILIAS\Data\ReferenceId($target_id)
180 );
181 } else {
182 $href = "#";
183 }
184 break;
185
186 case "File":
187 if (!$this->offline) {
188 $href = "#";
189 }
190 break;
191
192 case "User":
193 // target = il__user_329
194 $obj_type = ilObject::_lookupType((int) $target_id);
195 if ($obj_type == "usr") {
197 //var_dump($back); exit;
198 $this->ctrl->setParameterByClass(PublicProfileGUI::class, "user_id", $target_id);
199 if (strlen($back)) {
200 $this->ctrl->setParameterByClass(
201 PublicProfileGUI::class,
202 "back_url",
203 rawurlencode($back)
204 );
205 }
206 $href = "";
207 if (ilUserUtil::hasPublicProfile($target_id)) {
208 $href = $this->ctrl->getLinkTargetByClass(
209 [ilPublicProfileBaseClassGUI::class, PublicProfileGUI::class],
210 "getHTML",
211 "",
212 false,
213 true
214 );
215 }
216 $this->ctrl->setParameterByClass(PublicProfileGUI::class, "user_id", "");
217 $lcontent = ilUserUtil::getNamePresentation($target_id, false, false);
218 $lcontent = str_replace("&", "&amp;", htmlentities($lcontent));
219 }
220 break;
221 }
222 if ($href != "" || $type === "User") {
223 $anc_par = 'Anchor="' . $anc . '"';
224 $link_info .= "<IntLinkInfo Target=\"$target\" Type=\"$type\" " . $anc_par . " " .
225 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" LinkContent=\"$lcontent\" />";
226 }
227 }
228 }
229 $link_info .= "</IntLinkInfos>";
230 $link_info .= $this->getLinkTargetsXML();
231 return $link_info;
232 }
static _lookupContObjID(int $a_id)
get learning module id for lm object
static _lookupType(int $id, bool $reference=false)
static getGotoForPortfolioPageTarget(int $a_target, bool $a_offline=false)
Get goto href for portfolio page id.
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
static hasPublicProfile(int $a_user_id)
static getGotoForWikiPageTarget(string $a_target, bool $a_offline=false)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References $ctrl, $profile_back_url, ilLMObject\_lookupContObjID(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ilPortfolioPage\getGotoForPortfolioPageTarget(), ilWikiPage\getGotoForWikiPageTarget(), getLinkTargetsXML(), ilUserUtil\getNamePresentation(), and ilUserUtil\hasPublicProfile().

+ Here is the call graph for this function:

◆ setOffline()

ilPageLinker::setOffline ( bool  $offline = true)

Implements ILIAS\COPage\PageLinker.

Definition at line 51 of file class.ilPageLinker.php.

51 : void
52 {
53 $this->offline = $offline;
54 }

References $offline.

◆ setProfileBackUrl()

ilPageLinker::setProfileBackUrl ( string  $url)

Implements ILIAS\COPage\PageLinker.

Definition at line 56 of file class.ilPageLinker.php.

56 : void
57 {
58 $this->profile_back_url = $url;
59 }
$url
Definition: shib_logout.php:70

References $url.

Field Documentation

◆ $cmd_gui

string ilPageLinker::$cmd_gui
protected

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

◆ $ctrl

ilCtrl ilPageLinker::$ctrl
protected

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

Referenced by __construct(), and getLinkXML().

◆ $offline

bool ilPageLinker::$offline
protected

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

Referenced by __construct(), and setOffline().

◆ $profile_back_url

string ilPageLinker::$profile_back_url = ""
protected

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

Referenced by __construct(), and getLinkXML().

◆ $static_url

ILIAS StaticURL Services ilPageLinker::$static_url
protected

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


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