ILIAS  Release_4_1_x_branch Revision 61804
 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 
38  switch($a_type)
39  {
40  case 'git':
41  return ILIAS_HTTP_PATH.'/'.IL_INTERNAL_LINK_SCRIPT.'?client_id='.CLIENT_ID.$param_string;
42 
43  default:
44  return ILIAS_HTTP_PATH.'/'.IL_INTERNAL_LINK_SCRIPT.'?target='.$a_type.'_'.$a_ref_id.$append.'&client_id='.CLIENT_ID.$param_string;
45  }
46  }
47 
59  public static function _getStaticLink($a_ref_id,$a_type = '',$a_fallback_goto = true,
60  $append = "")
61  {
62  global $ilObjDataCache;
63 
64  if(!strlen($a_type))
65  {
66  $a_type = $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id));
67  }
68 
69  include_once('Services/PrivacySecurity/classes/class.ilRobotSettings.php');
70  $robot_settings = ilRobotSettings::_getInstance();
71  if(!$robot_settings->robotSupportEnabled())
72  {
73  if($a_fallback_goto)
74  {
75  return ilLink::_getLink($a_ref_id,$a_type,array(),$append);
76  }
77  else
78  {
79  return false;
80  }
81  }
82 
83  // urlencode for append is needed e.g. to process "/" in wiki page names correctly
84  return ILIAS_HTTP_PATH.'/goto_'.urlencode(CLIENT_ID).'_'.$a_type.'_'.$a_ref_id.urlencode($append).'.html';
85  }
86 }
87 ?>