ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
 

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 32 of file class.ilPageLinker.php.

37 {
38 global $DIC;
39
40 $this->offline = $offline;
41 $this->profile_back_url = $profile_back_url;
42 $this->cmd_gui = $cmd_gui_class;
43
44 $this->ctrl = (is_null($ctrl))
45 ? $DIC->ctrl()
46 : $ctrl;
47 }
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 214 of file class.ilPageLinker.php.

214 : string
215 {
216 if ($this->offline) {
217 return "fullscreen.html";
218 }
219
220 return $this->ctrl->getLinkTargetByClass($this->cmd_gui, "fullscreen", "", false, false);
221 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getLayoutLinkTargets()

ilPageLinker::getLayoutLinkTargets ( )

Implements ILIAS\COPage\PageLinker.

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

60 : array
61 {
62 $targets = [];
63 return $targets;
64 }

Referenced by getLinkTargetsXML().

+ Here is the caller graph for this function:

◆ getLinkTargetsXML()

ilPageLinker::getLinkTargetsXML ( )

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

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

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 82 of file class.ilPageLinker.php.

82 : string
83 {
84 $ilCtrl = $this->ctrl;
85 $link_info = "<IntLinkInfos>";
86 foreach ($int_links as $int_link) {
87 $target = $int_link["Target"];
88 if (substr($target, 0, 4) == "il__") {
89 $target_arr = explode("_", $target);
90 $target_id = $target_arr[count($target_arr) - 1];
91 $type = $int_link["Type"];
92
93 $targetframe = ($int_link["TargetFrame"] != "")
94 ? $int_link["TargetFrame"]
95 : "None";
96
97 $ltarget = "_top";
98 if ($targetframe != "None") {
99 $ltarget = "_blank";
100 }
101
102 // anchor
103 $anc = $anc_add = "";
104 if (($int_link["Anchor"] ?? "") != "") {
105 $anc = $int_link["Anchor"];
106 $anc_add = "_" . rawurlencode($int_link["Anchor"]);
107 }
108
109 $href = "";
110 $lcontent = "";
111 switch ($type) {
112 case "PageObject":
113 case "StructureObject":
114 $lm_id = ilLMObject::_lookupContObjID($target_id);
115 if ($type == "PageObject") {
116 $href = "./goto.php?target=pg_" . $target_id . $anc_add;
117 } else {
118 $href = "./goto.php?target=st_" . $target_id;
119 }
120 if ($lm_id == "") {
121 $href = "";
122 }
123 break;
124
125 case "GlossaryItem":
126 if ($targetframe == "Glossary") {
127 $ltarget = "";
128 }
129 $href = "./goto.php?target=git_" . $target_id;
130 break;
131
132 case "MediaObject":
133 if ($this->offline) {
134 $href = "media_" . $target_id . ".html";
135 } else {
136 $this->ctrl->setParameterByClass($this->cmd_gui, "mob_id", $target_id);
137 $href = $this->ctrl->getLinkTargetByClass(
138 $this->cmd_gui,
139 "displayMedia",
140 "",
141 false,
142 true
143 );
144 $this->ctrl->setParameterByClass($this->cmd_gui, "mob_id", "");
145 }
146 break;
147
148 case "WikiPage":
149 $wiki_anc = "";
150 if (($int_link["Anchor"] ?? "") != "") {
151 $wiki_anc = "#" . rawurlencode("copganc_" . $int_link["Anchor"]);
152 }
153 $href = ilWikiPage::getGotoForWikiPageTarget($target_id) . $wiki_anc;
154 break;
155
156 case "PortfolioPage":
157 $href = ilPortfolioPage::getGotoForPortfolioPageTarget($target_id, $this->offline);
158 break;
159
160 case "RepositoryItem":
161 $obj_type = ilObject::_lookupType((int) $target_id, true);
162 $obj_id = ilObject::_lookupObjId((int) $target_id);
163 $href = "./goto.php?target=" . $obj_type . "_" . $target_id;
164 break;
165
166 case "File":
167 if (!$this->offline) {
168 $href = "#";
169 }
170 break;
171
172 case "User":
173 // target = il__user_329
174 $obj_type = ilObject::_lookupType((int) $target_id);
175 if ($obj_type == "usr") {
177 //var_dump($back); exit;
178 $this->ctrl->setParameterByClass(PublicProfileGUI::class, "user_id", $target_id);
179 if (strlen($back)) {
180 $this->ctrl->setParameterByClass(
181 PublicProfileGUI::class,
182 "back_url",
183 rawurlencode($back)
184 );
185 }
186 $href = "";
187 if (ilUserUtil::hasPublicProfile($target_id)) {
188 $href = $this->ctrl->getLinkTargetByClass(
189 [PublicProfileGUI::class],
190 "getHTML",
191 "",
192 false,
193 true
194 );
195 }
196 $this->ctrl->setParameterByClass(PublicProfileGUI::class, "user_id", "");
197 $lcontent = ilUserUtil::getNamePresentation($target_id, false, false);
198 $lcontent = str_replace("&", "&amp;", htmlentities($lcontent));
199 }
200 break;
201 }
202 if ($href != "" || $type === "User") {
203 $anc_par = 'Anchor="' . $anc . '"';
204 $link_info .= "<IntLinkInfo Target=\"$target\" Type=\"$type\" " . $anc_par . " " .
205 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" LinkContent=\"$lcontent\" />";
206 }
207 }
208 }
209 $link_info .= "</IntLinkInfos>";
210 $link_info .= $this->getLinkTargetsXML();
211 return $link_info;
212 }
static _lookupContObjID(int $a_id)
get learning module id for lm object
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
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)

References $ctrl, $profile_back_url, ilLMObject\_lookupContObjID(), ilObject\_lookupObjId(), 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 49 of file class.ilPageLinker.php.

49 : void
50 {
51 $this->offline = $offline;
52 }

References $offline.

◆ setProfileBackUrl()

ilPageLinker::setProfileBackUrl ( string  $url)

Implements ILIAS\COPage\PageLinker.

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

54 : void
55 {
56 $this->profile_back_url = $url;
57 }
$url
Definition: shib_logout.php:68

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


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