ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 $ilObjDataCache;
20 
21  if(!strlen($a_type))
22  {
23  $a_type = $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id));
24  }
25  if(count($a_params))
26  {
27  $param_string;
28  foreach($a_params as $name => $value)
29  {
30  $param_string .= ('&'.$name.'='.$value);
31  }
32  }
33  else
34  {
35  $param_string = '';
36  }
37  switch($a_type)
38  {
39  case 'git':
40  return ILIAS_HTTP_PATH.'/'.IL_INTERNAL_LINK_SCRIPT.'?client_id='.CLIENT_ID.$param_string.$append;
41 
42  default:
43  return ILIAS_HTTP_PATH.'/'.IL_INTERNAL_LINK_SCRIPT.'?target='.$a_type.'_'.$a_ref_id.$append.'&client_id='.CLIENT_ID.$param_string;
44  }
45  }
46 
58  public static function _getStaticLink($a_ref_id,$a_type = '',$a_fallback_goto = true,
59  $append = "")
60  {
61  global $ilObjDataCache;
62 
63  if(!strlen($a_type))
64  {
65  $a_type = $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id));
66  }
67 
68  include_once('Services/PrivacySecurity/classes/class.ilRobotSettings.php');
69  $robot_settings = ilRobotSettings::_getInstance();
70  if(!$robot_settings->robotSupportEnabled())
71  {
72  if($a_fallback_goto)
73  {
74  return ilLink::_getLink($a_ref_id,$a_type,array(),$append);
75  }
76  else
77  {
78  return false;
79  }
80  }
81 
82  // urlencode for append is needed e.g. to process "/" in wiki page names correctly
83  return ILIAS_HTTP_PATH.'/goto_'.urlencode(CLIENT_ID).'_'.$a_type.'_'.$a_ref_id.urlencode($append).'.html';
84  }
85 }
86 ?>