ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Context.php
Go to the documentation of this file.
1<?php
2
19namespace ILIAS\StaticURL;
20
24
28final class Context
29{
30 public function __construct(private Container $container)
31 {
32 }
33
34 public function getUserLanguage(): string
35 {
36 return $this->container->user()->getCurrentLanguage();
37 }
38
39 public function refinery(): Factory
40 {
41 return $this->container->refinery();
42 }
43
44 public function lng(): \ilLanguage
45 {
46 return $this->container->language();
47 }
48
50 {
51 return $this->container->ui()->mainTemplate();
52 }
53
54 public function http(): Services
55 {
56 return $this->container->http();
57 }
58
59 public function ctrl(): \ilCtrlInterface
60 {
61 return $this->container->ctrl();
62 }
63
64 public function checkPermission(string $permission, int $ref_id): bool
65 {
66 return $this->container->access()->checkAccess($permission, '', $ref_id);
67 }
68
69 public function getParentRefId(int $ref_id): ?int
70 {
71 return $this->container->repositoryTree()->getParentId($ref_id);
72 }
73
74 public function exists(int $ref_id): bool
75 {
76 return $this->container->repositoryTree()->isInTree($ref_id);
77 }
78
79 public function getUserId(): int
80 {
81 return $this->container->user()->getId();
82 }
83
84 public function isUserLoggedIn(): bool
85 {
86 return !$this->container->user()->isAnonymous() && $this->container->user()->getId() !== 0;
87 }
88
89 public function isPublicSectionActive(): bool
90 {
91 return (bool) ($this->container->settings()->get('pub_section') ?? false);
92 }
93}
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:30
exists(int $ref_id)
Definition: Context.php:74
checkPermission(string $permission, int $ref_id)
Definition: Context.php:64
getParentRefId(int $ref_id)
Definition: Context.php:69
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