ILIAS  release_7 Revision v7.30-3-g800a261c036
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 $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 return ILIAS_HTTP_PATH . '/' . IL_INTERNAL_LINK_SCRIPT . '?target=' . $a_type . '_' . $a_ref_id .
33 $append . '&client_id=' . CLIENT_ID . $param_string;
34 }
35
47 public static function _getStaticLink(
48 $a_ref_id,
49 $a_type = '',
50 $a_fallback_goto = true,
51 $append = ""
52 ) {
53 global $DIC;
54
55 $ilObjDataCache = $DIC["ilObjDataCache"];
56
57 if (!strlen($a_type)) {
58 $a_type = $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id));
59 }
60
61 include_once('Services/PrivacySecurity/classes/class.ilRobotSettings.php');
62 $robot_settings = ilRobotSettings::_getInstance();
63 if (!$robot_settings->robotSupportEnabled()) {
64 if ($a_fallback_goto) {
65 return ilLink::_getLink($a_ref_id, $a_type, array(), $append);
66 } else {
67 return false;
68 }
69 }
70
71 // urlencode for append is needed e.g. to process "/" in wiki page names correctly
72 return ILIAS_HTTP_PATH . '/goto_' . urlencode(CLIENT_ID) . '_' . $a_type . '_' . $a_ref_id . urlencode($append) . '.html';
73 }
74}
An exception for terminatinating execution or to throw for unit testing.
static _getInstance()
Get instance.
const CLIENT_ID
Definition: constants.php:39
global $DIC
Definition: goto.php:24
if($format !==null) $name
Definition: metadata.php:230