ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
StaticUrlHandler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Certificate;
22
32use ilObjUser;
33use ilSetting;
35
36class StaticUrlHandler extends BaseHandler implements Handler
37{
38 private readonly ilCtrlInterface $ctrl;
40 private readonly ilObjUser $user;
41
42 public function __construct(
43 ?ilCtrlInterface $ctrl = null,
45 ?ilObjUser $user = null
46 ) {
47 global $DIC;
48
49 $this->ctrl = $ctrl ?? $DIC->ctrl();
50 $this->certificate_settings = $certificate_settings ?? new ilSetting('certificate');
51 $this->user = $user ?? $DIC->user();
52
54 }
55
56 public function getNamespace(): string
57 {
58 return 'cert';
59 }
60
61 public function handle(Request $request, Context $context, Factory $response_factory): Response
62 {
63 if ($this->user->isAnonymous() || !$this->user->getId()) {
64 return $response_factory->loginFirst();
65 }
66
67 if (!$this->certificate_settings->get('active', '0')) {
68 return $response_factory->cannot();
69 }
70
71 $additional_params = implode('/', $request->getAdditionalParameters() ?? []);
72
73 return match ($additional_params) {
74 'list' => $response_factory->can($this->ctrl->getLinkTargetByClass(
75 [
76 ilDashboardGUI::class,
77 ilAchievementsGUI::class,
78 ilUserCertificateGUI::class,
79 ],
80 "listCertificates",
81 )),
82 default => $response_factory->cannot(),
83 };
84 }
85}
__construct(?ilCtrlInterface $ctrl=null, ?ilSetting $certificate_settings=null, ?ilObjUser $user=null)
handle(Request $request, Context $context, Factory $response_factory)
readonly ilCtrlInterface $ctrl
@ilCtrl_Calls ilAchievementsGUI: ilPersonalSkillsGUI, ilBadgeProfileGUI, ilLearningHistoryGUI,...
@ilCtrl_Calls ilDashboardGUI: ILIAS\User\Profile\PersonalProfileGUI @ilCtrl_Calls ilDashboardGUI: ilO...
User class.
ILIAS Setting Class.
@ilCtrl_IsCalledBy ilUserCertificateGUI: ilAchievementsGUI
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26
$context
Definition: webdav.php:31