ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPageLinker 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 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 ()
 

Protected Attributes

bool $offline
 
string $profile_back_url = ""
 
ilCtrl $ctrl
 
string $cmd_gui
 

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 Page linker

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

Definition at line 23 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 30 of file class.ilPageLinker.php.

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

35  {
36  global $DIC;
37 
38  $this->offline = $offline;
39  $this->profile_back_url = $profile_back_url;
40  $this->cmd_gui = $cmd_gui_class;
41 
42  $this->ctrl = (is_null($ctrl))
43  ? $DIC->ctrl()
44  : $ctrl;
45  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ getFullscreenLink()

ilPageLinker::getFullscreenLink ( )

Implements ILIAS\COPage\PageLinker.

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

References ILIAS\Repository\ctrl().

212  : string
213  {
214  if ($this->offline) {
215  return "fullscreen.html";
216  }
217 
218  return $this->ctrl->getLinkTargetByClass($this->cmd_gui, "fullscreen", "", false, false);
219  }
+ Here is the call graph for this function:

◆ getLayoutLinkTargets()

ilPageLinker::getLayoutLinkTargets ( )

Implements ILIAS\COPage\PageLinker.

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

Referenced by getLinkTargetsXML().

58  : array
59  {
60  $targets = [];
61  return $targets;
62  }
+ Here is the caller graph for this function:

◆ getLinkTargetsXML()

ilPageLinker::getLinkTargetsXML ( )

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

References getLayoutLinkTargets().

Referenced by getLinkXML().

64  : string
65  {
66  $layoutLinkTargets = $this->getLayoutLinkTargets();
67 
68  if (0 === count($layoutLinkTargets)) {
69  return '';
70  }
71 
72  $link_info = "<LinkTargets>";
73  foreach ($layoutLinkTargets as $k => $t) {
74  $link_info .= "<LinkTarget TargetFrame=\"" . $t["Type"] . "\" LinkTarget=\"" . $t["Frame"] . "\" OnClick=\"" . $t["OnClick"] . "\" />";
75  }
76  $link_info .= "</LinkTargets>";
77  return $link_info;
78  }
+ 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 80 of file class.ilPageLinker.php.

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

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

◆ setOffline()

ilPageLinker::setOffline ( bool  $offline = true)

Implements ILIAS\COPage\PageLinker.

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

References $offline.

47  : void
48  {
49  $this->offline = $offline;
50  }

◆ setProfileBackUrl()

ilPageLinker::setProfileBackUrl ( string  $url)

Implements ILIAS\COPage\PageLinker.

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

References $url.

52  : void
53  {
54  $this->profile_back_url = $url;
55  }
$url

Field Documentation

◆ $cmd_gui

string ilPageLinker::$cmd_gui
protected

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

◆ $ctrl

ilCtrl ilPageLinker::$ctrl
protected

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

Referenced by __construct(), and getLinkXML().

◆ $offline

bool ilPageLinker::$offline
protected

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

Referenced by __construct(), and setOffline().

◆ $profile_back_url

string ilPageLinker::$profile_back_url = ""
protected

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

Referenced by __construct(), and getLinkXML().


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