ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLink.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 define('IL_INTERNAL_LINK_SCRIPT', 'goto.php');
5 
6 
15 class ilLink
16 {
17  public static function _getLink($a_ref_id, $a_type = '', $a_params = array(), $append = "")
18  {
19  global $DIC;
20 
21  $ilObjDataCache = $DIC["ilObjDataCache"];
22 
23  if (!strlen($a_type)) {
24  $a_type = $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id));
25  }
26  $param_string = '';
27  if (is_array($a_params) && count($a_params)) {
28  foreach ($a_params as $name => $value) {
29  $param_string .= ('&' . $name . '=' . $value);
30  }
31  }
32  switch ($a_type) {
33  case 'git':
34  //case 'pg':
35  return ILIAS_HTTP_PATH . '/' . IL_INTERNAL_LINK_SCRIPT . '?client_id=' . CLIENT_ID . $param_string . $append;
36 
37  default:
38  return ILIAS_HTTP_PATH . '/' . IL_INTERNAL_LINK_SCRIPT . '?target=' . $a_type . '_' . $a_ref_id . $append . '&client_id=' . CLIENT_ID . $param_string;
39  }
40  }
41 
53  public static function _getStaticLink(
54  $a_ref_id,
55  $a_type = '',
56  $a_fallback_goto = true,
57  $append = ""
58  ) {
59  global $DIC;
60 
61  $ilObjDataCache = $DIC["ilObjDataCache"];
62 
63  if (!strlen($a_type)) {
64  $a_type = $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id));
65  }
66 
67  include_once('Services/PrivacySecurity/classes/class.ilRobotSettings.php');
68  $robot_settings = ilRobotSettings::_getInstance();
69  if (!$robot_settings->robotSupportEnabled()) {
70  if ($a_fallback_goto) {
71  return ilLink::_getLink($a_ref_id, $a_type, array(), $append);
72  } else {
73  return false;
74  }
75  }
76 
77  // urlencode for append is needed e.g. to process "/" in wiki page names correctly
78  return ILIAS_HTTP_PATH . '/goto_' . urlencode(CLIENT_ID) . '_' . $a_type . '_' . $a_ref_id . urlencode($append) . '.html';
79  }
80 }
global $DIC
Definition: saml.php:7
static _getInstance()
Get instance.
$a_type
Definition: workflow.php:92
if($format !==null) $name
Definition: metadata.php:146
Create styles array
The data for the language used.