ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
4define('IL_INTERNAL_LINK_SCRIPT','goto.php');
5
6
15class 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 $param_string = '';
26 if(count($a_params))
27 {
28 foreach($a_params as $name => $value)
29 {
30 $param_string .= ('&'.$name.'='.$value);
31 }
32 }
33 switch($a_type)
34 {
35 case 'git':
36 //case 'pg':
37 return ILIAS_HTTP_PATH.'/'.IL_INTERNAL_LINK_SCRIPT.'?client_id='.CLIENT_ID.$param_string.$append;
38
39 default:
40 return ILIAS_HTTP_PATH.'/'.IL_INTERNAL_LINK_SCRIPT.'?target='.$a_type.'_'.$a_ref_id.$append.'&client_id='.CLIENT_ID.$param_string;
41 }
42 }
43
55 public static function _getStaticLink($a_ref_id,$a_type = '',$a_fallback_goto = true,
56 $append = "")
57 {
58 global $ilObjDataCache;
59
60 if(!strlen($a_type))
61 {
62 $a_type = $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id));
63 }
64
65 include_once('Services/PrivacySecurity/classes/class.ilRobotSettings.php');
66 $robot_settings = ilRobotSettings::_getInstance();
67 if(!$robot_settings->robotSupportEnabled())
68 {
69 if($a_fallback_goto)
70 {
71 return ilLink::_getLink($a_ref_id,$a_type,array(),$append);
72 }
73 else
74 {
75 return false;
76 }
77 }
78
79 // urlencode for append is needed e.g. to process "/" in wiki page names correctly
80 return ILIAS_HTTP_PATH.'/goto_'.urlencode(CLIENT_ID).'_'.$a_type.'_'.$a_ref_id.urlencode($append).'.html';
81 }
82}
83?>
An exception for terminatinating execution or to throw for unit testing.
static _getInstance()
Get instance.
$a_type
Definition: workflow.php:93