ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 = $this->getStaticLink(0, 'wiki');
46  $link = $this->appendParameter($link, 'target', 'wiki_wpage_' . $ref_id);
47  break;
48 
49  case 'term':
50  // #16894
51  $link = $this->getStaticLink(0, "git");
52  $link = $this->appendParameter($link, 'target', 'git_' . $ref_id);
53  break;
54 
55  case 'page':
56  $type = "pg";
57  $link = $this->getStaticLink($ref_id, $type);
58  break;
59 
60  default:
61  $link = $this->getStaticLink($ref_id, $type);
62  }
63 
64  if (!$with_parameters) {
65  return $link;
66  }
67 
68  foreach ($this->getParameters() as $parameter) {
69  $link = $parameter->appendToLink($link);
70  }
71 
72  return $link;
73  }
74 
75  protected function getStaticLink(int $ref_id, string $type): string
76  {
77  return ilLink::_getStaticLink($ref_id, $type);
78  }
79 
80  protected function appendParameter(string $link, string $key, string $value): string
81  {
82  $uri = new URI($link);
83  return (string) $uri->withParameter($key, $value);
84  }
85 }
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:61
$ref_id
Definition: ltiauth.php:65
getResolvedLink(bool $with_parameters=true)
TODO: should be refactored to use URI data object everywhere.
getStaticLink(int $ref_id, string $type)
Immutable class for internal Web Link items.
Immutable class for Web Link items.