19declare(strict_types=1);
44 public function redirect(
string $command, ?
string $target_class =
null): never
48 $this->
ctrl->redirectByClass($target_class, $command);
53 $call_history = $this->
ctrl->getCallHistory();
54 return array_map(
static fn(array
$c):
string =>
$c[
'cmdClass'], $call_history);
59 $this->
ctrl->getCallHistory();
62 array_pop($command_classes);
69 $uri =
new URI((
string) $this->
http->request()->getUri());
71 return $uri->withParameter(
'cmd', $cmd);
78 $classes = array_map(
static fn(array
$c):
string =>
$c[
'cmdClass'], $this->
ctrl->getCallHistory());
80 $classes[] = MultiLanguageGUI::class;
82 return $this->
getTargetURI(MultiLanguageGUI::class, $command);
87 $request = $this->
http->request()->getUri();
88 return new URI($request->getScheme() .
'://' . $request->getHost() .
'/' . ltrim($with_path,
'/'));
94 public function getLinkTarget(
object $target_class, ?
string $command =
null): string
96 return $this->
ctrl->getLinkTarget($target_class, $command);
101 return $this->
ctrl->getCmdClass();
108 public function getTargetByClass(array|
string $target_class, ?
string $command =
null): string
110 return $this->
ctrl->getLinkTargetByClass($target_class, $command);
113 public function getTargetURI(
object|array|
string $target_class, ?
string $command =
null):
URI
115 if (is_object($target_class)) {
116 $target_class = $target_class::class;
124 $cmd = $this->
ctrl->getCmd($fallback);
125 return empty($cmd) ? ($fallback ??
'') : $cmd;
The scope of this class is split ilias-conform URI's into components.
getCommand(?string $fallback=null)
getTargetByClass(array|string $target_class, ?string $command=null)
getHereAsURI(?string $cmd=null)
getLinkTarget(object $target_class, ?string $command=null)
getTranslationAsURI(?string $command=null)
getURI(string $with_path)
redirect(string $command, ?string $target_class=null)
getTargetURI(object|array|string $target_class, ?string $command=null)
getParentAsURI(?string $cmd=null)
__construct(private Services $http, private \ilCtrlInterface $ctrl)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.