ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilWebLinkItemInternal.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 use ILIAS\Data\URI;
22 
28 {
29  public function isInternal(): bool
30  {
31  return true;
32  }
33 
37  public function getResolvedLink(bool $with_parameters = true): string
38  {
39  $parts = explode("|", $this->getTarget());
40  $type = (string) ($parts[0] ?? '');
41  $ref_id = (int) ($parts[1] ?? 0);
42 
43  switch ($type) {
44  case 'wpage':
45  $link = ilLink::_getStaticLink(
46  0,
47  'wiki',
48  true
49  );
50  $link = $this->appendParameter($link, 'target', 'wiki_wpage_' . $ref_id);
51  break;
52 
53  case 'term':
54  // #16894
55  $link = ilLink::_getStaticLink(
56  0,
57  "git",
58  true
59  );
60  $link = $this->appendParameter($link, 'target', 'git_' . $ref_id);
61  break;
62 
63  case 'page':
64  $type = "pg";
65  $link = ilLink::_getStaticLink($ref_id, $type);
66  break;
67 
68  default:
69  $link = ilLink::_getStaticLink($ref_id, $type);
70  }
71 
72  if (!$with_parameters) {
73  return $link;
74  }
75 
76  foreach ($this->getParameters() as $parameter) {
77  $link = $parameter->appendToLink($link);
78  }
79 
80  return $link;
81  }
82 
83  protected function appendParameter(string $link, string $key, string $value): string
84  {
85  $uri = new URI($link);
86  return (string) $uri->withParameter($key, $value);
87  }
88 }
appendParameter(string $link, string $key, string $value)
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64
$ref_id
Definition: ltiauth.php:67
string $key
Consumer key/client ID value.
Definition: System.php:193
The scope of this class is split ilias-conform URI&#39;s into components.
Definition: URI.php:18
getResolvedLink(bool $with_parameters=true)
TODO: should be refactored to use URI data object everywhere.
Immutable class for internal Web Link items.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...