1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Framework; |
8
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Component\Editor\CkEditor\CkEditor; |
10
|
|
|
use Chamilo\CoreBundle\Component\Editor\Editor; |
11
|
|
|
use Chamilo\CoreBundle\Repository\AssetRepository; |
12
|
|
|
use Chamilo\CoreBundle\Repository\CareerRepository; |
13
|
|
|
use Chamilo\CoreBundle\Repository\CourseCategoryRepository; |
14
|
|
|
use Chamilo\CoreBundle\Repository\ExtraFieldOptionsRepository; |
15
|
|
|
use Chamilo\CoreBundle\Repository\ExtraFieldRepository; |
16
|
|
|
use Chamilo\CoreBundle\Repository\GradeBookCategoryRepository; |
17
|
|
|
use Chamilo\CoreBundle\Repository\GradebookCertificateRepository; |
18
|
|
|
use Chamilo\CoreBundle\Repository\LanguageRepository; |
19
|
|
|
use Chamilo\CoreBundle\Repository\LegalRepository; |
20
|
|
|
use Chamilo\CoreBundle\Repository\MessageRepository; |
21
|
|
|
use Chamilo\CoreBundle\Repository\Node\AccessUrlRepository; |
22
|
|
|
use Chamilo\CoreBundle\Repository\Node\CourseRepository; |
23
|
|
|
use Chamilo\CoreBundle\Repository\Node\IllustrationRepository; |
24
|
|
|
use Chamilo\CoreBundle\Repository\Node\MessageAttachmentRepository; |
25
|
|
|
use Chamilo\CoreBundle\Repository\Node\PersonalFileRepository; |
26
|
|
|
use Chamilo\CoreBundle\Repository\Node\SocialPostAttachmentRepository; |
27
|
|
|
use Chamilo\CoreBundle\Repository\Node\TicketMessageAttachmentRepository; |
28
|
|
|
use Chamilo\CoreBundle\Repository\Node\UsergroupRepository; |
29
|
|
|
use Chamilo\CoreBundle\Repository\Node\UserRepository; |
30
|
|
|
use Chamilo\CoreBundle\Repository\PromotionRepository; |
31
|
|
|
use Chamilo\CoreBundle\Repository\ResourceNodeRepository; |
32
|
|
|
use Chamilo\CoreBundle\Repository\SequenceRepository; |
33
|
|
|
use Chamilo\CoreBundle\Repository\SequenceResourceRepository; |
34
|
|
|
use Chamilo\CoreBundle\Repository\SessionRepository; |
35
|
|
|
use Chamilo\CoreBundle\Repository\SkillRepository; |
36
|
|
|
use Chamilo\CoreBundle\Repository\SocialPostRepository; |
37
|
|
|
use Chamilo\CoreBundle\Repository\SysAnnouncementRepository; |
38
|
|
|
use Chamilo\CoreBundle\Repository\TagRepository; |
39
|
|
|
use Chamilo\CoreBundle\Repository\TrackEDownloadsRepository; |
40
|
|
|
use Chamilo\CoreBundle\Repository\TrackEExerciseRepository; |
41
|
|
|
use Chamilo\CoreBundle\Repository\TrackELoginRecordRepository; |
42
|
|
|
use Chamilo\CoreBundle\Repository\TrackELoginRepository; |
43
|
|
|
use Chamilo\CoreBundle\Serializer\UserToJsonNormalizer; |
44
|
|
|
use Chamilo\CoreBundle\ServiceHelper\AccessUrlHelper; |
45
|
|
|
use Chamilo\CoreBundle\ServiceHelper\ContainerHelper; |
46
|
|
|
use Chamilo\CoreBundle\ServiceHelper\ThemeHelper; |
47
|
|
|
use Chamilo\CoreBundle\Settings\SettingsManager; |
48
|
|
|
use Chamilo\CoreBundle\Tool\ToolChain; |
49
|
|
|
use Chamilo\CourseBundle\Repository\CAnnouncementAttachmentRepository; |
50
|
|
|
use Chamilo\CourseBundle\Repository\CAnnouncementRepository; |
51
|
|
|
use Chamilo\CourseBundle\Repository\CAttendanceRepository; |
52
|
|
|
use Chamilo\CourseBundle\Repository\CCalendarEventAttachmentRepository; |
53
|
|
|
use Chamilo\CourseBundle\Repository\CCalendarEventRepository; |
54
|
|
|
use Chamilo\CourseBundle\Repository\CCourseDescriptionRepository; |
55
|
|
|
use Chamilo\CourseBundle\Repository\CDocumentRepository; |
56
|
|
|
use Chamilo\CourseBundle\Repository\CForumAttachmentRepository; |
57
|
|
|
use Chamilo\CourseBundle\Repository\CForumCategoryRepository; |
58
|
|
|
use Chamilo\CourseBundle\Repository\CForumPostRepository; |
59
|
|
|
use Chamilo\CourseBundle\Repository\CForumRepository; |
60
|
|
|
use Chamilo\CourseBundle\Repository\CForumThreadRepository; |
61
|
|
|
use Chamilo\CourseBundle\Repository\CGlossaryRepository; |
62
|
|
|
use Chamilo\CourseBundle\Repository\CGroupCategoryRepository; |
63
|
|
|
use Chamilo\CourseBundle\Repository\CGroupRepository; |
64
|
|
|
use Chamilo\CourseBundle\Repository\CLinkCategoryRepository; |
65
|
|
|
use Chamilo\CourseBundle\Repository\CLinkRepository; |
66
|
|
|
use Chamilo\CourseBundle\Repository\CLpCategoryRepository; |
67
|
|
|
use Chamilo\CourseBundle\Repository\CLpItemRepository; |
68
|
|
|
use Chamilo\CourseBundle\Repository\CLpRepository; |
69
|
|
|
use Chamilo\CourseBundle\Repository\CNotebookRepository; |
70
|
|
|
use Chamilo\CourseBundle\Repository\CQuizCategoryRepository; |
71
|
|
|
use Chamilo\CourseBundle\Repository\CQuizQuestionCategoryRepository; |
72
|
|
|
use Chamilo\CourseBundle\Repository\CQuizQuestionRepository; |
73
|
|
|
use Chamilo\CourseBundle\Repository\CQuizRepository; |
74
|
|
|
use Chamilo\CourseBundle\Repository\CShortcutRepository; |
75
|
|
|
use Chamilo\CourseBundle\Repository\CStudentPublicationAssignmentRepository; |
76
|
|
|
use Chamilo\CourseBundle\Repository\CStudentPublicationCommentRepository; |
77
|
|
|
use Chamilo\CourseBundle\Repository\CStudentPublicationCorrectionRepository; |
78
|
|
|
use Chamilo\CourseBundle\Repository\CStudentPublicationRepository; |
79
|
|
|
use Chamilo\CourseBundle\Repository\CSurveyInvitationRepository; |
80
|
|
|
use Chamilo\CourseBundle\Repository\CSurveyQuestionRepository; |
81
|
|
|
use Chamilo\CourseBundle\Repository\CSurveyRepository; |
82
|
|
|
use Chamilo\CourseBundle\Repository\CThematicAdvanceRepository; |
83
|
|
|
use Chamilo\CourseBundle\Repository\CThematicPlanRepository; |
84
|
|
|
use Chamilo\CourseBundle\Repository\CThematicRepository; |
85
|
|
|
use Chamilo\CourseBundle\Repository\CToolIntroRepository; |
86
|
|
|
use Chamilo\CourseBundle\Repository\CWikiRepository; |
87
|
|
|
use Chamilo\CourseBundle\Settings\SettingsCourseManager; |
88
|
|
|
use Chamilo\LtiBundle\Repository\ExternalToolRepository; |
89
|
|
|
use Database; |
90
|
|
|
use Doctrine\ORM\EntityManager; |
91
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface; |
92
|
|
|
use Symfony\Component\Form\FormFactory; |
93
|
|
|
use Symfony\Component\HttpFoundation\Request; |
94
|
|
|
use Symfony\Component\HttpFoundation\Session\Session; |
95
|
|
|
use Symfony\Component\HttpFoundation\Session\SessionInterface as HttpSessionInterface; |
96
|
|
|
use Symfony\Component\Mailer\Mailer; |
97
|
|
|
use Symfony\Component\Messenger\MessageBusInterface; |
98
|
|
|
use Symfony\Component\Routing\Router; |
99
|
|
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; |
100
|
|
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
101
|
|
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; |
102
|
|
|
use Symfony\Component\Translation\Translator; |
103
|
|
|
use Twig\Environment; |
104
|
|
|
use UnitEnum; |
105
|
|
|
|
106
|
|
|
use function Symfony\Component\String\s; |
|
|
|
|
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Symfony services for the legacy Chamilo code. |
110
|
|
|
*/ |
111
|
|
|
class Container |
112
|
|
|
{ |
113
|
|
|
public static ?ContainerInterface $container = null; |
114
|
|
|
public static ?Request $request = null; |
115
|
|
|
// For legacy, to get the translator service is necessary get it by Container::$container->get('translator') |
116
|
|
|
public static ?Translator $translator = null; |
117
|
|
|
public static Environment $twig; |
118
|
|
|
public static ?Session $session = null; |
119
|
|
|
public static string $legacyTemplate = '@ChamiloCore/Layout/layout_one_col.html.twig'; |
120
|
|
|
|
121
|
|
|
public static function setContainer(ContainerInterface $container): void |
122
|
|
|
{ |
123
|
|
|
self::$container = $container; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
public static function getParameter(string $parameter): array|bool|float|int|string|UnitEnum|null |
127
|
|
|
{ |
128
|
|
|
if (self::$container->hasParameter($parameter)) { |
|
|
|
|
129
|
|
|
return self::$container->getParameter($parameter); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
return false; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
public static function getLegacyHelper(): ContainerHelper |
136
|
|
|
{ |
137
|
|
|
return self::$container->get(ContainerHelper::class); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
public static function getEnvironment(): string |
141
|
|
|
{ |
142
|
|
|
return self::getLegacyHelper()->getKernel()->getEnvironment(); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
public static function getLogDir(): string |
146
|
|
|
{ |
147
|
|
|
return self::getLegacyHelper()->getKernel()->getLogDir(); |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
public static function getCacheDir(): string |
151
|
|
|
{ |
152
|
|
|
return self::getLegacyHelper()->getKernel()->getCacheDir().'/'; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
public static function getProjectDir(): string |
156
|
|
|
{ |
157
|
|
|
if (null !== self::$container) { |
158
|
|
|
return self::getLegacyHelper()->getKernel()->getProjectDir().'/'; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
return str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/'; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
public static function isInstalled(): bool |
165
|
|
|
{ |
166
|
|
|
return self::getLegacyHelper()->getKernel()->isInstalled(); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
public static function getMessengerBus(): MessageBusInterface |
170
|
|
|
{ |
171
|
|
|
return self::getLegacyHelper()->getMessengerBus(); |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
public static function getTwig(): Environment |
175
|
|
|
{ |
176
|
|
|
return self::$twig; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @return Editor |
181
|
|
|
*/ |
182
|
|
|
public static function getHtmlEditor() |
183
|
|
|
{ |
184
|
|
|
return self::$container->get(CkEditor::class); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @return null|Request |
189
|
|
|
*/ |
190
|
|
|
public static function getRequest() |
191
|
|
|
{ |
192
|
|
|
if (null === self::$container) { |
193
|
|
|
return null; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
if (!empty(self::$request)) { |
197
|
|
|
return self::$request; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
return self::$container->get('request_stack')->getCurrentRequest(); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
public static function setRequest(Request $request): void |
204
|
|
|
{ |
205
|
|
|
self::$request = $request; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
public static function getSession(): bool|HttpSessionInterface|Session|null |
209
|
|
|
{ |
210
|
|
|
if (null !== self::$session) { |
211
|
|
|
return self::$session; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
if (null !== self::$container) { |
215
|
|
|
return self::$container->get('request_stack')->getSession(); |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
return false; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
public static function setSession(Session $session): void |
222
|
|
|
{ |
223
|
|
|
self::$session = $session; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
public static function getAuthorizationChecker(): AuthorizationCheckerInterface |
227
|
|
|
{ |
228
|
|
|
return self::getLegacyHelper()->getAuthorizationChecker(); |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
public static function getTokenStorage(): TokenStorageInterface|TokenStorage |
232
|
|
|
{ |
233
|
|
|
return self::getLegacyHelper()->getTokenStorage(); |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
public static function getMailer(): Mailer |
237
|
|
|
{ |
238
|
|
|
return self::$container->get(Mailer::class); |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
public static function getSettingsManager(): SettingsManager |
242
|
|
|
{ |
243
|
|
|
return self::$container->get(SettingsManager::class); |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
public static function getCourseSettingsManager(): SettingsCourseManager |
247
|
|
|
{ |
248
|
|
|
return self::$container->get(SettingsCourseManager::class); |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* @return EntityManager |
253
|
|
|
*/ |
254
|
|
|
public static function getEntityManager() |
255
|
|
|
{ |
256
|
|
|
return Database::getManager(); |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
public static function getAssetRepository(): AssetRepository |
260
|
|
|
{ |
261
|
|
|
return self::$container->get(AssetRepository::class); |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
public static function getResourceNodeRepository(): ResourceNodeRepository |
265
|
|
|
{ |
266
|
|
|
return self::$container->get(ResourceNodeRepository::class); |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
public static function getAttendanceRepository(): CAttendanceRepository |
270
|
|
|
{ |
271
|
|
|
return self::$container->get(CAttendanceRepository::class); |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
public static function getAnnouncementRepository(): CAnnouncementRepository |
275
|
|
|
{ |
276
|
|
|
return self::$container->get(CAnnouncementRepository::class); |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
public static function getAccessUrlRepository(): AccessUrlRepository |
280
|
|
|
{ |
281
|
|
|
return self::$container->get(AccessUrlRepository::class); |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
public static function getAnnouncementAttachmentRepository(): CAnnouncementAttachmentRepository |
285
|
|
|
{ |
286
|
|
|
return self::$container->get(CAnnouncementAttachmentRepository::class); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
public static function getTicketMessageAttachmentRepository(): TicketMessageAttachmentRepository |
290
|
|
|
{ |
291
|
|
|
return self::$container->get(TicketMessageAttachmentRepository::class); |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
public static function getSocialPostAttachmentRepository(): SocialPostAttachmentRepository |
295
|
|
|
{ |
296
|
|
|
return self::$container->get(SocialPostAttachmentRepository::class); |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
public static function getCourseRepository(): CourseRepository |
300
|
|
|
{ |
301
|
|
|
return self::$container->get(CourseRepository::class); |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
public static function getCareerRepository(): CareerRepository |
305
|
|
|
{ |
306
|
|
|
return self::$container->get(CareerRepository::class); |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
public static function getCourseCategoryRepository(): CourseCategoryRepository |
310
|
|
|
{ |
311
|
|
|
return self::$container->get(CourseCategoryRepository::class); |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
public static function getCourseDescriptionRepository(): CCourseDescriptionRepository |
315
|
|
|
{ |
316
|
|
|
return self::$container->get(CCourseDescriptionRepository::class); |
317
|
|
|
} |
318
|
|
|
|
319
|
|
|
public static function getCalendarEventRepository(): CCalendarEventRepository |
320
|
|
|
{ |
321
|
|
|
return self::$container->get(CCalendarEventRepository::class); |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
public static function getCalendarEventAttachmentRepository(): CCalendarEventAttachmentRepository |
325
|
|
|
{ |
326
|
|
|
return self::$container->get(CCalendarEventAttachmentRepository::class); |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
public static function getDocumentRepository(): CDocumentRepository |
330
|
|
|
{ |
331
|
|
|
return self::$container->get(CDocumentRepository::class); |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
public static function getQuizCategoryRepository(): CQuizCategoryRepository |
335
|
|
|
{ |
336
|
|
|
return self::$container->get(CQuizCategoryRepository::class); |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
public static function getExternalToolRepository(): ExternalToolRepository |
340
|
|
|
{ |
341
|
|
|
return self::$container->get(ExternalToolRepository::class); |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
public static function getExtraFieldRepository(): ExtraFieldRepository |
345
|
|
|
{ |
346
|
|
|
return self::$container->get(ExtraFieldRepository::class); |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
public static function getExtraFieldOptionsRepository(): ExtraFieldOptionsRepository |
350
|
|
|
{ |
351
|
|
|
return self::$container->get(ExtraFieldOptionsRepository::class); |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
public static function getGlossaryRepository(): CGlossaryRepository |
355
|
|
|
{ |
356
|
|
|
return self::$container->get(CGlossaryRepository::class); |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
public static function getGradeBookCategoryRepository(): GradeBookCategoryRepository |
360
|
|
|
{ |
361
|
|
|
return self::$container->get(GradeBookCategoryRepository::class); |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
public static function getGradeBookCertificateRepository(): GradebookCertificateRepository |
365
|
|
|
{ |
366
|
|
|
return self::$container->get(GradebookCertificateRepository::class); |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
public static function getGroupRepository(): CGroupRepository |
370
|
|
|
{ |
371
|
|
|
return self::$container->get(CGroupRepository::class); |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
public static function getGroupCategoryRepository(): CGroupCategoryRepository |
375
|
|
|
{ |
376
|
|
|
return self::$container->get(CGroupCategoryRepository::class); |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
public static function getForumRepository(): CForumRepository |
380
|
|
|
{ |
381
|
|
|
return self::$container->get(CForumRepository::class); |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
public static function getForumCategoryRepository(): CForumCategoryRepository |
385
|
|
|
{ |
386
|
|
|
return self::$container->get(CForumCategoryRepository::class); |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
public static function getForumPostRepository(): CForumPostRepository |
390
|
|
|
{ |
391
|
|
|
return self::$container->get(CForumPostRepository::class); |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
public static function getForumAttachmentRepository(): CForumAttachmentRepository |
395
|
|
|
{ |
396
|
|
|
return self::$container->get(CForumAttachmentRepository::class); |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
public static function getForumThreadRepository(): CForumThreadRepository |
400
|
|
|
{ |
401
|
|
|
return self::$container->get(CForumThreadRepository::class); |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
public static function getIllustrationRepository(): IllustrationRepository |
405
|
|
|
{ |
406
|
|
|
return self::$container->get(IllustrationRepository::class); |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
public static function getQuizRepository(): CQuizRepository |
410
|
|
|
{ |
411
|
|
|
return self::$container->get(CQuizRepository::class); |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
public static function getQuestionRepository(): CQuizQuestionRepository |
415
|
|
|
{ |
416
|
|
|
return self::$container->get(CQuizQuestionRepository::class); |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
public static function getQuestionCategoryRepository(): CQuizQuestionCategoryRepository |
420
|
|
|
{ |
421
|
|
|
return self::$container->get(CQuizQuestionCategoryRepository::class); |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
public static function getLanguageRepository(): LanguageRepository |
425
|
|
|
{ |
426
|
|
|
return self::$container->get(LanguageRepository::class); |
427
|
|
|
} |
428
|
|
|
|
429
|
|
|
public static function getLinkRepository(): CLinkRepository |
430
|
|
|
{ |
431
|
|
|
return self::$container->get(CLinkRepository::class); |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
public static function getLinkCategoryRepository(): CLinkCategoryRepository |
435
|
|
|
{ |
436
|
|
|
return self::$container->get(CLinkCategoryRepository::class); |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
public static function getLpRepository(): CLpRepository |
440
|
|
|
{ |
441
|
|
|
return self::$container->get(CLpRepository::class); |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
public static function getLpItemRepository(): CLpItemRepository |
445
|
|
|
{ |
446
|
|
|
return self::$container->get(CLpItemRepository::class); |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
public static function getLpCategoryRepository(): CLpCategoryRepository |
450
|
|
|
{ |
451
|
|
|
return self::$container->get(CLpCategoryRepository::class); |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
public static function getMessageRepository(): MessageRepository |
455
|
|
|
{ |
456
|
|
|
return self::$container->get(MessageRepository::class); |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
public static function getMessageAttachmentRepository(): MessageAttachmentRepository |
460
|
|
|
{ |
461
|
|
|
return self::$container->get(MessageAttachmentRepository::class); |
462
|
|
|
} |
463
|
|
|
|
464
|
|
|
public static function getNotebookRepository(): CNotebookRepository |
465
|
|
|
{ |
466
|
|
|
return self::$container->get(CNotebookRepository::class); |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
public static function getPersonalFileRepository(): PersonalFileRepository |
470
|
|
|
{ |
471
|
|
|
return self::$container->get(PersonalFileRepository::class); |
472
|
|
|
} |
473
|
|
|
|
474
|
|
|
public static function getPromotionRepository(): PromotionRepository |
475
|
|
|
{ |
476
|
|
|
return self::$container->get(PromotionRepository::class); |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
public static function getUserRepository(): UserRepository |
480
|
|
|
{ |
481
|
|
|
return self::$container->get(UserRepository::class); |
482
|
|
|
} |
483
|
|
|
|
484
|
|
|
public static function getUsergroupRepository(): UsergroupRepository |
485
|
|
|
{ |
486
|
|
|
return self::$container->get(UsergroupRepository::class); |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
public static function getUserToJsonNormalizer(): UserToJsonNormalizer |
490
|
|
|
{ |
491
|
|
|
return self::$container->get(UserToJsonNormalizer::class); |
492
|
|
|
} |
493
|
|
|
|
494
|
|
|
public static function getShortcutRepository(): CShortcutRepository |
495
|
|
|
{ |
496
|
|
|
return self::$container->get(CShortcutRepository::class); |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
public static function getStudentPublicationRepository(): CStudentPublicationRepository |
500
|
|
|
{ |
501
|
|
|
return self::$container->get(CStudentPublicationRepository::class); |
502
|
|
|
} |
503
|
|
|
|
504
|
|
|
public static function getStudentPublicationAssignmentRepository(): CStudentPublicationAssignmentRepository |
505
|
|
|
{ |
506
|
|
|
return self::$container->get(CStudentPublicationAssignmentRepository::class); |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
public static function getStudentPublicationCommentRepository(): CStudentPublicationCommentRepository |
510
|
|
|
{ |
511
|
|
|
return self::$container->get(CStudentPublicationCommentRepository::class); |
512
|
|
|
} |
513
|
|
|
|
514
|
|
|
public static function getStudentPublicationCorrectionRepository(): CStudentPublicationCorrectionRepository |
515
|
|
|
{ |
516
|
|
|
return self::$container->get(CStudentPublicationCorrectionRepository::class); |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
public static function getSequenceResourceRepository(): SequenceResourceRepository |
520
|
|
|
{ |
521
|
|
|
return self::$container->get(SequenceResourceRepository::class); |
522
|
|
|
} |
523
|
|
|
|
524
|
|
|
public static function getSequenceRepository(): SequenceRepository |
525
|
|
|
{ |
526
|
|
|
return self::$container->get(SequenceRepository::class); |
527
|
|
|
} |
528
|
|
|
|
529
|
|
|
public static function getSessionRepository(): SessionRepository |
530
|
|
|
{ |
531
|
|
|
return self::$container->get(SessionRepository::class); |
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
public static function getSkillRepository(): SkillRepository |
535
|
|
|
{ |
536
|
|
|
return self::$container->get(SkillRepository::class); |
537
|
|
|
} |
538
|
|
|
|
539
|
|
|
public static function getSurveyRepository(): CSurveyRepository |
540
|
|
|
{ |
541
|
|
|
return self::$container->get(CSurveyRepository::class); |
542
|
|
|
} |
543
|
|
|
|
544
|
|
|
public static function getSurveyInvitationRepository(): CSurveyInvitationRepository |
545
|
|
|
{ |
546
|
|
|
return self::$container->get(CSurveyInvitationRepository::class); |
547
|
|
|
} |
548
|
|
|
|
549
|
|
|
public static function getSurveyQuestionRepository(): CSurveyQuestionRepository |
550
|
|
|
{ |
551
|
|
|
return self::$container->get(CSurveyQuestionRepository::class); |
552
|
|
|
} |
553
|
|
|
|
554
|
|
|
public static function getSysAnnouncementRepository(): SysAnnouncementRepository |
555
|
|
|
{ |
556
|
|
|
return self::$container->get(SysAnnouncementRepository::class); |
557
|
|
|
} |
558
|
|
|
|
559
|
|
|
public static function getTagRepository(): TagRepository |
560
|
|
|
{ |
561
|
|
|
return self::$container->get(TagRepository::class); |
562
|
|
|
} |
563
|
|
|
|
564
|
|
|
public static function getThematicRepository(): CThematicRepository |
565
|
|
|
{ |
566
|
|
|
return self::$container->get(CThematicRepository::class); |
567
|
|
|
} |
568
|
|
|
|
569
|
|
|
public static function getThematicPlanRepository(): CThematicPlanRepository |
570
|
|
|
{ |
571
|
|
|
return self::$container->get(CThematicPlanRepository::class); |
572
|
|
|
} |
573
|
|
|
|
574
|
|
|
public static function getThematicAdvanceRepository(): CThematicAdvanceRepository |
575
|
|
|
{ |
576
|
|
|
return self::$container->get(CThematicAdvanceRepository::class); |
577
|
|
|
} |
578
|
|
|
|
579
|
|
|
public static function getTrackEExerciseRepository(): TrackEExerciseRepository |
580
|
|
|
{ |
581
|
|
|
return self::$container->get(TrackEExerciseRepository::class); |
582
|
|
|
} |
583
|
|
|
|
584
|
|
|
public static function getTrackEDownloadsRepository(): TrackEDownloadsRepository |
585
|
|
|
{ |
586
|
|
|
return self::$container->get(TrackEDownloadsRepository::class); |
587
|
|
|
} |
588
|
|
|
|
589
|
|
|
public static function getWikiRepository(): CWikiRepository |
590
|
|
|
{ |
591
|
|
|
return self::$container->get(CWikiRepository::class); |
592
|
|
|
} |
593
|
|
|
|
594
|
|
|
public static function getToolIntroRepository(): CToolIntroRepository |
595
|
|
|
{ |
596
|
|
|
return self::$container->get(CToolIntroRepository::class); |
597
|
|
|
} |
598
|
|
|
|
599
|
|
|
public static function getLegalRepository(): LegalRepository |
600
|
|
|
{ |
601
|
|
|
return self::$container->get(LegalRepository::class); |
602
|
|
|
} |
603
|
|
|
|
604
|
|
|
public static function getFormFactory(): FormFactory |
605
|
|
|
{ |
606
|
|
|
return self::$container->get('form.factory'); |
607
|
|
|
} |
608
|
|
|
|
609
|
|
|
public static function addFlash(string $message, string $type = 'success'): void |
610
|
|
|
{ |
611
|
|
|
$type = match ($type) { |
612
|
|
|
'confirmation', 'confirm' => 'success', |
613
|
|
|
default => 'info', |
614
|
|
|
}; |
615
|
|
|
|
616
|
|
|
$session = self::getSession(); |
617
|
|
|
|
618
|
|
|
if ($session instanceof Session) { |
619
|
|
|
$session->getFlashBag()->add($type, $message); |
620
|
|
|
} |
621
|
|
|
} |
622
|
|
|
|
623
|
|
|
public static function getRouter(): Router |
624
|
|
|
{ |
625
|
|
|
return self::$container->get('router'); |
626
|
|
|
} |
627
|
|
|
|
628
|
|
|
public static function getToolChain(): ToolChain |
629
|
|
|
{ |
630
|
|
|
return self::$container->get(ToolChain::class); |
631
|
|
|
} |
632
|
|
|
|
633
|
|
|
public static function setLegacyServices(ContainerInterface $container): void |
634
|
|
|
{ |
635
|
|
|
$doctrine = $container->get('doctrine'); |
636
|
|
|
Database::setConnection($doctrine->getConnection()); |
637
|
|
|
|
638
|
|
|
/** @var EntityManager $em */ |
639
|
|
|
$em = $doctrine->getManager(); |
640
|
|
|
Database::setManager($em); |
641
|
|
|
} |
642
|
|
|
|
643
|
|
|
public static function getSocialPostRepository(): SocialPostRepository |
644
|
|
|
{ |
645
|
|
|
return self::$container->get(SocialPostRepository::class); |
646
|
|
|
} |
647
|
|
|
|
648
|
|
|
public static function getTrackELoginRepository(): TrackELoginRepository |
649
|
|
|
{ |
650
|
|
|
return self::$container->get(TrackELoginRepository::class); |
651
|
|
|
} |
652
|
|
|
|
653
|
|
|
public static function getTrackELoginRecordRepository(): TrackELoginRecordRepository |
654
|
|
|
{ |
655
|
|
|
return self::$container->get(TrackELoginRecordRepository::class); |
656
|
|
|
} |
657
|
|
|
|
658
|
|
|
public static function getThemeHelper(): ThemeHelper |
659
|
|
|
{ |
660
|
|
|
return self::$container->get(ThemeHelper::class); |
661
|
|
|
} |
662
|
|
|
|
663
|
|
|
public static function getAccessUrlHelper(): AccessUrlHelper |
664
|
|
|
{ |
665
|
|
|
/** @var AccessUrlHelper $helper */ |
666
|
|
|
$helper = self::$container->get(AccessUrlHelper::class); |
667
|
|
|
|
668
|
|
|
return $helper; |
669
|
|
|
} |
670
|
|
|
} |
671
|
|
|
|