ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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['ui.factory'],
77 $DIC['refinery'],
78 $c[UserSettingsConfigurationRepository::class],
79 $c[UserSettingsDataRepository::class]
80 );
81 $this[StartingPointRepository::class] = fn($c): StartingPointRepository =>
82 new StartingPointRepository(
83 $DIC['ilUser'],
84 $DIC['ilDB'],
85 $DIC->logger(),
86 $DIC['tree'],
87 $DIC['rbacreview'],
88 $DIC['rbacsystem'],
89 $DIC['ilSetting'],
90 $c[UserSettingsConfigurationRepository::class]
91 );
92 $this[UserSettingsDataRepository::class] = fn($c): UserSettingsDataRepository =>
93 new DatatabaseUserSettingsDataRepository(
94 $DIC['ilDB']
95 );
96 $this[ProfileDataRepository::class] = fn($c): ProfileDataRepository =>
97 new DatabaseProfileDataRepository(
98 $DIC['ilDB'],
99 $DIC['resource_storage'],
100 $c[ProfileFieldsConfigurationRepository::class]
101 );
102 $this[ProfileFieldsConfigurationRepository::class] = fn($c): ProfileFieldsConfigurationRepository =>
103 new DatabaseProfileFieldsConfigurationRepository(
104 $DIC['ilDB'],
105 new UUIDFactory(),
106 is_readable(CollectTypesObjective::PATH())
108 : [],
109 array_filter([
110 new Standard\Alias(),
111 new Standard\FirstName(),
112 new Standard\LastName(),
113 new Standard\Title(),
114 new Standard\Birthday(),
115 new Standard\Gender(),
116 new Standard\Avatar(
117 $DIC['resource_storage'],
118 $DIC['upload'],
119 $DIC['http']->wrapper()->post(),
120 $DIC['ui.renderer'],
121 $DIC['refinery']
122 ),
123 new Standard\Roles(
124 $DIC['ilObjDataCache']
125 ),
126 new Standard\OrganisationalUnits(),
127 new Standard\Interests(
128 $DIC['ilCtrl']
129 ),
130 new Standard\HelpOffered(
131 $DIC['ilCtrl']
132 ),
133 new Standard\HelpLookedFor(
134 $DIC['ilCtrl']
135 ),
136 new Standard\Institution(),
137 new Standard\Department(),
138 new Standard\Street(),
139 new Standard\ZipCode(),
140 new Standard\City(),
141 new Standard\Country(),
142 new Standard\PhoneOffice(),
143 new Standard\PhoneHome(),
144 new Standard\PhoneMobile(),
145 new Standard\Fax(),
146 new Standard\Email(),
147 new Standard\SecondEmail(),
148 new Standard\Hobby(),
149 new Standard\ReferralComment(),
150 new Standard\Matriculation(),
151 new Standard\ClientIP(),
152 \ilMapUtil::isActivated() ? new Standard\Location() : null
153 ])
154 );
155 $this['profile.fields.changelisteners'] = fn($c): array =>
158 : [];
159 $this[Profile::class] = fn($c): Profile =>
161 $DIC['lng'],
162 $c[ProfileFieldsConfigurationRepository::class],
163 $c[ProfileDataRepository::class]
164 );
165 $this[EndpointFactory::class] = fn($c): EndpointFactory =>
166 new EndpointFactory(
167 $c[ProfileFieldsConfigurationRepository::class],
168 $c[ProfileDataRepository::class],
169 $c[UserSettingsDataRepository::class],
170 $DIC['user']->getLoggedInUser(),
171 $DIC['http'],
172 $DIC['refinery'],
173 $DIC['ilCtrl'],
174 new DataFactory()
175 );
176 $this[Search::class] = fn($c): Search => new Search(
177 $DIC['ui.factory'],
178 $c[EndpointFactory::class]
179 );
180 $this[NewAccountMailRepository::class] = fn($c): NewAccountMailRepository =>
181 new NewAccountMailRepository($DIC['ilDB']);
182 }
183}
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