ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLink.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 define('IL_INTERNAL_LINK_SCRIPT','goto.php');
25 
26 
35 class ilLink
36 {
37  public function _getLink($a_ref_id,$a_type = '',$a_params = array(), $append = "")
38  {
39  global $ilObjDataCache;
40 
41  if(!strlen($a_type))
42  {
43  $a_type = $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id));
44  }
45  if(count($a_params))
46  {
47  $param_string = '&';
48  foreach($a_params as $name => $value)
49  {
50  $param_string = '&'.$name.'='.$value;
51  }
52  }
53  else
54  {
55  $param_string = '';
56  }
57 
58  switch($a_type)
59  {
60  case 'git':
61 
62  default:
63  return ILIAS_HTTP_PATH.'/'.IL_INTERNAL_LINK_SCRIPT.'?target='.$a_type.'_'.$a_ref_id.$append.'&client_id='.CLIENT_ID.$param_string;
64  }
65  }
66 
78  public static function _getStaticLink($a_ref_id,$a_type = '',$a_fallback_goto = true,
79  $append = "")
80  {
81  global $ilObjDataCache;
82 
83  if(!strlen($a_type))
84  {
85  $a_type = $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id));
86  }
87 
88  include_once('Services/PrivacySecurity/classes/class.ilRobotSettings.php');
89  $robot_settings = ilRobotSettings::_getInstance();
90  if(!$robot_settings->robotSupportEnabled())
91  {
92  if($a_fallback_goto)
93  {
94  return ilLink::_getLink($a_ref_id,$a_type,array(),$append);
95  }
96  else
97  {
98  return false;
99  }
100  }
101 
102  // urlencode for append is needed e.g. to process "/" in wiki page names correctly
103  return ILIAS_HTTP_PATH.'/goto_'.urlencode(CLIENT_ID).'_'.$a_type.'_'.$a_ref_id.urlencode($append).'.html';
104  }
105 }
106 ?>