ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Aggregator.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\ILIASObject\Properties\AdditionalProperties\Repository as AdditionalPropertiesRepository;
24use ILIAS\ILIASObject\Properties\CoreProperties\Repository as CorePropertiesRepository;
25use ILIAS\ILIASObject\Properties\ObjectTypeSpecificProperties\Factory as ObjectTypeSpecificPropertiesFactory;
28
35{
36 public function __construct(
37 private readonly CorePropertiesRepository $core_properties_repository,
38 private readonly AdditionalPropertiesRepository $additional_properties_repository,
39 private readonly TranslationsRepository $translations_repository,
40 private readonly ObjectTypeSpecificPropertiesFactory $object_type_specific_properties_factory,
41 private readonly LOMServices $lom_services
42 ) {
43 }
44
45 public function getFor(int $object_id, ?string $type = null): Properties
46 {
47 $core_properties = $this->core_properties_repository->getFor($object_id, $type);
48
49 return new Properties(
50 $core_properties,
51 $this->core_properties_repository,
52 $this->additional_properties_repository->getFor($object_id),
53 $this->additional_properties_repository,
54 $this->translations_repository->getFor($object_id),
55 $this->translations_repository,
56 $this->lom_services
57 );
58 }
59
60 public function preload(array $object_ids): void
61 {
62 $this->core_properties_repository->preload($object_ids);
63 $objects_by_type = [];
64 foreach ($object_ids as $obj_id) {
65 $type = \ilObject::_lookupType($obj_id);
66
67 if (!array_key_exists($type, $objects_by_type)) {
68 $objects_by_type[$type] = [];
69 }
70 $objects_by_type[$type][] = $obj_id;
71 }
72
73 foreach ($objects_by_type as $type => $obj_ids) {
74 $this->object_type_specific_properties_factory->getForObjectTypeString($type)?->preload($obj_ids);
75 }
76 }
77}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
__construct(private readonly CorePropertiesRepository $core_properties_repository, private readonly AdditionalPropertiesRepository $additional_properties_repository, private readonly TranslationsRepository $translations_repository, private readonly ObjectTypeSpecificPropertiesFactory $object_type_specific_properties_factory, private readonly LOMServices $lom_services)
Definition: Aggregator.php:36
getFor(int $object_id, ?string $type=null)
Definition: Aggregator.php:45
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...