ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 230 of file class.ilPageLinker.php.

230 : string
231 {
232 if ($this->offline) {
233 return "fullscreen.html";
234 }
235
236 return $this->ctrl->getLinkTargetByClass($this->cmd_gui, "fullscreen", "", false, false);
237 }

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 $href = "./goto.php?target=git_" . $target_id;
140 break;
141
142 case "MediaObject":
143 if ($this->offline) {
144 $href = "media_" . $target_id . ".html";
145 } else {
146 $this->ctrl->setParameterByClass($this->cmd_gui, "mob_id", $target_id);
147 $href = $this->ctrl->getLinkTargetByClass(
148 $this->cmd_gui,
149 "displayMedia",
150 "",
151 false,
152 true
153 );
154 $this->ctrl->setParameterByClass($this->cmd_gui, "mob_id", "");
155 }
156 break;
157
158 case "WikiPage":
159 $wiki_anc = "";
160 if (($int_link["Anchor"] ?? "") != "") {
161 $wiki_anc = "#" . rawurlencode("copganc_" . $int_link["Anchor"]);
162 }
163 $href = ilWikiPage::getGotoForWikiPageTarget($target_id) . $wiki_anc;
164 break;
165
166 case "PortfolioPage":
167 $href = ilPortfolioPage::getGotoForPortfolioPageTarget($target_id, $this->offline);
168 break;
169
170 case "RepositoryItem":
171 $obj_type = ilObject::_lookupType((int) $target_id, true);
172 if ((int) $target_id > 0) {
173 $href = (string) $this->static_url->builder()->build(
174 $obj_type,
175 new \ILIAS\Data\ReferenceId($target_id)
176 );
177 } else {
178 $href = "#";
179 }
180 break;
181
182 case "File":
183 if (!$this->offline) {
184 $href = "#";
185 }
186 break;
187
188 case "User":
189 // target = il__user_329
190 $obj_type = ilObject::_lookupType((int) $target_id);
191 if ($obj_type == "usr") {
193 //var_dump($back); exit;
194 $this->ctrl->setParameterByClass(PublicProfileGUI::class, "user_id", $target_id);
195 if (strlen($back)) {
196 $this->ctrl->setParameterByClass(
197 PublicProfileGUI::class,
198 "back_url",
199 rawurlencode($back)
200 );
201 }
202 $href = "";
203 if (ilUserUtil::hasPublicProfile($target_id)) {
204 $href = $this->ctrl->getLinkTargetByClass(
205 [ilPublicProfileBaseClassGUI::class, PublicProfileGUI::class],
206 "getHTML",
207 "",
208 false,
209 true
210 );
211 }
212 $this->ctrl->setParameterByClass(PublicProfileGUI::class, "user_id", "");
213 $lcontent = ilUserUtil::getNamePresentation($target_id, false, false);
214 $lcontent = str_replace("&", "&amp;", htmlentities($lcontent));
215 }
216 break;
217 }
218 if ($href != "" || $type === "User") {
219 $anc_par = 'Anchor="' . $anc . '"';
220 $link_info .= "<IntLinkInfo Target=\"$target\" Type=\"$type\" " . $anc_par . " " .
221 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" LinkContent=\"$lcontent\" />";
222 }
223 }
224 }
225 $link_info .= "</IntLinkInfos>";
226 $link_info .= $this->getLinkTargetsXML();
227 return $link_info;
228 }
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: