ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
Context.php
Go to the documentation of this file.
1<?php
2
19namespace ILIAS\StaticURL;
20
25
29final class Context
30{
31 public function __construct(private Container $container)
32 {
33 }
34
35 public function getUserLanguage(): string
36 {
37 return $this->container->user()->getCurrentLanguage();
38 }
39
40 public function refinery(): Factory
41 {
42 return $this->container->refinery();
43 }
44
45 public function lng(): \ilLanguage
46 {
47 return $this->container->language();
48 }
49
51 {
52 return $this->container->ui()->mainTemplate();
53 }
54
55 public function http(): Services
56 {
57 return $this->container->http();
58 }
59
60 public function ctrl(): \ilCtrlInterface
61 {
62 return $this->container->ctrl();
63 }
64
65 public function checkPermission(string $permission, int $ref_id): bool
66 {
67 return $this->container->access()->checkAccess($permission, '', $ref_id);
68 }
69
70 public function getParentRefId(int $ref_id): ?int
71 {
72 return $this->container->repositoryTree()->getParentId($ref_id);
73 }
74
75 public function exists(int $ref_id): bool
76 {
77 return $this->container->repositoryTree()->isInTree($ref_id);
78 }
79
80 public function getUserId(): int
81 {
82 return $this->container->user()->getId();
83 }
84
85 public function isUserLoggedIn(): bool
86 {
87 return !$this->container->user()->isAnonymous() && $this->container->user()->getId() !== 0;
88 }
89
90 public function isPublicSectionActive(): bool
91 {
92 return (bool) ($this->container->settings()->get('pub_section') ?? false);
93 }
94
95 public function builder(): URIBuilder
96 {
97 return $this->container['static_url']->builder();
98 }
99}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Builds data types.
Definition: Factory.php:36
Class Services.
Definition: Services.php:38
__construct(private Container $container)
Definition: Context.php:31
exists(int $ref_id)
Definition: Context.php:75
checkPermission(string $permission, int $ref_id)
Definition: Context.php:65
getParentRefId(int $ref_id)
Definition: Context.php:70
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$container
@noRector
Definition: wac.php:37