ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Routing.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use Closure;
25
27{
32 public function __construct(
33 private readonly ilCtrlInterface $ctrl,
34 private readonly SelectSetting $session,
35 private readonly Closure $redirect_to_starting_page,
36 private readonly Closure $logout_url
37 ) {
38 }
39
40 public function ctrl(): ilCtrlInterface
41 {
42 return $this->ctrl;
43 }
44
45 public function logoutUrl(): string
46 {
47 return ($this->logout_url)();
48 }
49
50 public function redirectToOriginalTarget(): void
51 {
52 if ($this->originalTarget()->value() === null) {
53 ($this->redirect_to_starting_page)();
54 return;
55 }
56
57 $target = $this->originalTarget()->value();
58 $this->originalTarget()->update(null);
59 $this->ctrl()->redirectToURL($target);
60 }
61
62 private function originalTarget(): Setting
63 {
64 return $this->session->typed('orig_request_target', fn(Marshal $m) => $m->nullable($m->string()));
65 }
66}
__construct(private readonly ilCtrlInterface $ctrl, private readonly SelectSetting $session, private readonly Closure $redirect_to_starting_page, private readonly Closure $logout_url)
Definition: Routing.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...