ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
LocalDIC.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\User;
22
25use ILIAS\User\Settings\Settings as UserSettings;
26use ILIAS\User\Settings\SettingsImplementation as UserSettingsImplementation;
27use ILIAS\User\Settings\NewAccountMail\Repository as NewAccountMailRepository;
28use ILIAS\User\Settings\ConfigurationRepository as UserSettingsConfigurationRepository;
29use ILIAS\User\Settings\DatabaseConfigurationRepository as DatatabaseUserSettingsConfigurationRepository;
30use ILIAS\User\Settings\DataRepository as UserSettingsDataRepository;
31use ILIAS\User\Settings\DatabaseDataRepository as DatatabaseUserSettingsDataRepository;
32use ILIAS\User\Settings\StartingPoint\Repository as StartingPointRepository;
36use ILIAS\User\Profile\Fields\CachedConfigurationRepository as DatabaseProfileFieldsConfigurationRepository;
37use ILIAS\User\Profile\Fields\ConfigurationRepository as ProfileFieldsConfigurationRepository;
38use ILIAS\User\Profile\DataRepository as ProfileDataRepository;
39use ILIAS\User\Profile\DatabaseDataRepository as DatabaseProfileDataRepository;
43use Pimple\Container as PimpleContainer;
44use ILIAS\DI\Container as ILIASContainer;
45use ILIAS\Data\Factory as DataFactory;
46use ILIAS\Data\UUID\Factory as UUIDFactory;
47
48class LocalDIC extends PimpleContainer
49{
50 private static ?LocalDIC $dic = null;
51
52 public static function dic(): self
53 {
54 if (self::$dic === null) {
55 global $DIC;
56 self::$dic = new LocalDIC();
57 self::$dic->init($DIC);
58 }
59
60 return self::$dic;
61 }
62
63 private function init(ILIASContainer $DIC): void
64 {
65 $this[UserSettingsConfigurationRepository::class] = fn($c): UserSettingsConfigurationRepository =>
66 new DatatabaseUserSettingsConfigurationRepository(
67 $DIC['ilSetting'],
70 : []
71 );
72 $this[UserSettings::class] = fn($c): UserSettings =>
73 new UserSettingsImplementation(
74 $DIC['lng'],
75 $DIC['ilSetting'],
76 $DIC['tpl'],
77 $DIC['ui.factory'],
78 $DIC['refinery'],
79 $c[UserSettingsConfigurationRepository::class],
80 $c[UserSettingsDataRepository::class]
81 );
82 $this[StartingPointRepository::class] = fn($c): StartingPointRepository =>
83 new StartingPointRepository(
84 $DIC['ilUser'],
85 $DIC['ilDB'],
86 $DIC->logger(),
87 $DIC['tree'],
88 $DIC['rbacreview'],
89 $DIC['rbacsystem'],
90 $DIC['ilSetting'],
91 $c[UserSettingsConfigurationRepository::class]
92 );
93 $this[UserSettingsDataRepository::class] = fn($c): UserSettingsDataRepository =>
94 new DatatabaseUserSettingsDataRepository(
95 $DIC['ilDB']
96 );
97 $this[ProfileDataRepository::class] = fn($c): ProfileDataRepository =>
98 new DatabaseProfileDataRepository(
99 $DIC['ilDB'],
100 $DIC['resource_storage'],
101 $c[ProfileFieldsConfigurationRepository::class]
102 );
103 $this[ProfileFieldsConfigurationRepository::class] = fn($c): ProfileFieldsConfigurationRepository =>
104 new DatabaseProfileFieldsConfigurationRepository(
105 $DIC['ilDB'],
106 new UUIDFactory(),
107 is_readable(CollectTypesObjective::PATH())
109 : [],
110 array_filter([
111 new Standard\Alias(),
112 new Standard\FirstName(),
113 new Standard\LastName(),
114 new Standard\Title(),
115 new Standard\Birthday(),
116 new Standard\Gender(),
117 new Standard\Avatar(
118 $DIC['resource_storage'],
119 $DIC['upload'],
120 $DIC['http']->wrapper()->post(),
121 $DIC['ui.renderer'],
122 $DIC['refinery']
123 ),
124 new Standard\Roles(
125 $DIC['ilObjDataCache']
126 ),
127 new Standard\OrganisationalUnits(),
128 new Standard\Interests(
129 $DIC['ilCtrl']
130 ),
131 new Standard\HelpOffered(
132 $DIC['ilCtrl']
133 ),
134 new Standard\HelpLookedFor(
135 $DIC['ilCtrl']
136 ),
137 new Standard\Institution(),
138 new Standard\Department(),
139 new Standard\Street(),
140 new Standard\ZipCode(),
141 new Standard\City(),
142 new Standard\Country(),
143 new Standard\PhoneOffice(),
144 new Standard\PhoneHome(),
145 new Standard\PhoneMobile(),
146 new Standard\Fax(),
147 new Standard\Email(),
148 new Standard\SecondEmail(),
149 new Standard\Hobby(),
150 new Standard\ReferralComment(),
151 new Standard\Matriculation(),
152 new Standard\ClientIP(),
153 \ilMapUtil::isActivated() ? new Standard\Location() : null
154 ])
155 );
156 $this['profile.fields.changelisteners'] = fn($c): array =>
159 : [];
160 $this[Profile::class] = fn($c): Profile =>
162 $DIC['lng'],
163 $c[ProfileFieldsConfigurationRepository::class],
164 $c[ProfileDataRepository::class]
165 );
166 $this[EndpointFactory::class] = fn($c): EndpointFactory =>
167 new EndpointFactory(
168 $c[ProfileFieldsConfigurationRepository::class],
169 $c[ProfileDataRepository::class],
170 $c[UserSettingsDataRepository::class],
171 $DIC['user']->getLoggedInUser(),
172 $DIC['http'],
173 $DIC['refinery'],
174 $DIC['ilCtrl'],
175 new DataFactory()
176 );
177 $this[Search::class] = fn($c): Search => new Search(
178 $DIC['ui.factory'],
179 $c[EndpointFactory::class]
180 );
181 $this[NewAccountMailRepository::class] = fn($c): NewAccountMailRepository =>
182 new NewAccountMailRepository($DIC['ilDB']);
183 }
184}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Builds data types.
Definition: Factory.php:36
init(ILIASContainer $DIC)
Definition: LocalDIC.php:63
static LocalDIC $dic
Definition: LocalDIC.php:50
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