ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LocalDIC.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\User;
22
23use ILIAS\User\Settings\Settings as UserSettings;
24use ILIAS\User\Settings\SettingsImplementation as UserSettingsImplementation;
25use ILIAS\User\Settings\NewAccountMail\Repository as NewAccountMailRepository;
26use ILIAS\User\Settings\Repository as UserSettingsRepository;
27use ILIAS\User\Settings\StartingPoint\Repository as StartingPointRepository;
31use ILIAS\User\Profile\Fields\ConfigurationRepository as ProfileFieldsConfigurationRepository;
32use ILIAS\User\Profile\DataRepository as ProfileDataRepository;
36use Pimple\Container as PimpleContainer;
37use ILIAS\DI\Container as ILIASContainer;
38use ILIAS\Data\UUID\Factory as UUIDFactory;
39
40class LocalDIC extends PimpleContainer
41{
42 private static ?LocalDIC $dic = null;
43
44 public static function dic(): self
45 {
46 if (self::$dic === null) {
47 global $DIC;
48 self::$dic = new LocalDIC();
49 self::$dic->init($DIC);
50 }
51
52 return self::$dic;
53 }
54
55 private function init(ILIASContainer $DIC): void
56 {
57 $this[UserSettingsRepository::class] = fn($c): UserSettingsRepository =>
58 new UserSettingsRepository(
59 $DIC['ilSetting'],
62 : []
63 );
64 $this[UserSettings::class] = fn($c): UserSettings =>
65 new UserSettingsImplementation(
66 $DIC['lng'],
67 $DIC['ilSetting'],
68 $DIC['tpl'],
69 $DIC['ui.factory'],
70 $DIC['refinery'],
71 $c[UserSettingsRepository::class]
72 );
73 $this[StartingPointRepository::class] = fn($c): StartingPointRepository =>
74 new StartingPointRepository(
75 $DIC['ilUser'],
76 $DIC['ilDB'],
77 $DIC->logger(),
78 $DIC['tree'],
79 $DIC['rbacreview'],
80 $DIC['rbacsystem'],
81 $DIC['ilSetting'],
82 $c[UserSettingsRepository::class]
83 );
84 $this[ProfileDataRepository::class] = fn($c): ProfileDataRepository =>
85 new ProfileDataRepository(
86 $DIC['ilDB'],
87 $DIC['resource_storage'],
88 $c[ProfileFieldsConfigurationRepository::class]
89 );
90 $this[ProfileFieldsConfigurationRepository::class] = fn($c): ProfileFieldsConfigurationRepository =>
91 new ProfileFieldsConfigurationRepository(
92 $DIC['ilDB'],
93 new UUIDFactory(),
94 is_readable(CollectTypesObjective::PATH())
96 : [],
97 array_filter([
98 new Standard\Alias(),
99 new Standard\FirstName(),
100 new Standard\LastName(),
101 new Standard\Title(),
102 new Standard\Birthday(),
103 new Standard\Gender(),
104 new Standard\Avatar(
105 $DIC['resource_storage'],
106 $DIC['upload'],
107 $DIC['http']->wrapper()->post(),
108 $DIC['ui.renderer'],
109 $DIC['refinery']
110 ),
111 new Standard\Roles(),
112 new Standard\OrganisationalUnits(),
113 new Standard\Interests(
114 $DIC['ilCtrl']
115 ),
116 new Standard\HelpOffered(
117 $DIC['ilCtrl']
118 ),
119 new Standard\HelpLookedFor(
120 $DIC['ilCtrl']
121 ),
122 new Standard\Institution(),
123 new Standard\Department(),
124 new Standard\Street(),
125 new Standard\ZipCode(),
126 new Standard\City(),
127 new Standard\Country(),
128 new Standard\PhoneOffice(),
129 new Standard\PhoneHome(),
130 new Standard\PhoneMobile(),
131 new Standard\Fax(),
132 new Standard\Email(),
133 new Standard\SecondEmail(),
134 new Standard\Hobby(),
135 new Standard\ReferralComment(),
136 new Standard\Matriculation(),
137 \ilMapUtil::isActivated() ? new Standard\Location() : null
138 ])
139 );
140 $this['profile.fields.changelisteners'] = fn($c): array =>
143 : [];
144 $this[Profile::class] = fn($c): Profile =>
146 $DIC['lng'],
147 $c[ProfileFieldsConfigurationRepository::class],
148 $c[ProfileDataRepository::class]
149 );
150 $this[NewAccountMailRepository::class] = fn($c): NewAccountMailRepository =>
151 new NewAccountMailRepository($DIC['ilDB']);
152 }
153}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
init(ILIASContainer $DIC)
Definition: LocalDIC.php:55
static LocalDIC $dic
Definition: LocalDIC.php:42
static isActivated()
Checks whether Map feature is activated.
$c
Definition: deliver.php:25
$dic
Definition: ltiresult.php:33
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: UserEvent.php:21
global $DIC
Definition: shib_login.php:26