ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilLink.php
Go to the documentation of this file.
1 <?php
2 
21 
25 class ilLink
26 {
30  public static function _getLink(
31  ?int $a_ref_id,
32  string $a_type = '',
33  array $a_params = [],
34  string $append = ""
35  ): string {
36  global $DIC;
38  $static_url = $DIC["static_url"];
39 
40  $ilObjDataCache = $DIC["ilObjDataCache"];
41 
42  if ($a_type === '' && $a_ref_id) {
43  $a_type = $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id));
44  }
45 
46  $target = urlencode(CLIENT_ID) . '_' . $a_type . '_' . $a_ref_id . urlencode($append);
47 
48  $a_params = array_merge($a_params, [$append]);
49  $a_params = array_filter($a_params, static function ($value): bool {
50  return $value !== "";
51  });
52 
53  if (!empty($a_type)) {
54  return (string) $static_url->builder()->build(
55  $a_type,
56  $a_ref_id !== null ? new ReferenceId($a_ref_id) : null,
57  $a_params
58  );
59  }
60  return '';
61  }
62 
66  public static function _getStaticLink(
67  ?int $a_ref_id,
68  string $a_type = '',
69  bool $a_fallback_goto = true,
70  string $append = ""
71  ): string {
72  return self::_getLink($a_ref_id, $a_type, [], $append);
73  }
74 }
global $DIC
Definition: feed.php:28
$static_url
Definition: goto.php:29
const CLIENT_ID
Definition: constants.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...