19declare(strict_types=1);
40 private readonly ResourceStorageService $storage_services,
41 private readonly TileImage\
Stakeholder $storage_stakeholder,
43 private readonly ObjectTypeSpecificPropertiesFactory $object_type_specific_properties_factory
47 public function preload(array $object_ids): void
54 $this->data_cache = [];
70 $object_type_specific_properties = $this->object_type_specific_properties_factory->getForObjectTypeString(
$data[
'type']);
72 $modifications =
null;
73 if ($object_type_specific_properties !==
null) {
74 $providers = $object_type_specific_properties->getProviders();
75 $modifications = $object_type_specific_properties->getModifications();
85 new TileImage\TileImage(
89 $this->storage_services,
90 $this->storage_stakeholder,
91 $this->flavour_definition,
102 throw new \Exception(
'The current configuration cannot be saved.');
124 'last_update' => [
\ilDBConstants::T_DATETIME, (new \DateTimeImmutable(
'now',
new \DateTimeZone(
'UTC')))->format(
'Y-m-d H:i:s')],
129 $this->
database->update(self::CORE_PROPERTIES_TABLE, $storage_array, $where);
131 if ($this->obj_definition->isRBACObject($properties->
getType())) {
135 unset($this->data_cache[$properties->
getObjectId()]);
142 if ($tile_image->getRid() ===
null) {
146 $i = $this->storage_services->manage()->find($tile_image->getRid());
151 $this->storage_services->manage()->remove(
153 $this->storage_stakeholder
171 $where =
'WHERE obj.obj_id=' . $this->
database->quote($object_id,
'integer');
175 throw new \Exception(
'The object with the following id does not exist: '
194 .
'obj.obj_id, obj.type, obj.title, obj.description, obj.owner,' . PHP_EOL
195 .
'obj.create_date, obj.last_update, obj.import_id, obj.offline,' . PHP_EOL
196 .
'obj.tile_image_rid, descr.description' . PHP_EOL
197 .
'FROM ' . self::CORE_PROPERTIES_TABLE .
' AS obj' . PHP_EOL
198 .
'LEFT JOIN ' . self::DESCRIPTION_TABLE .
' AS descr' . PHP_EOL
199 .
'ON obj.obj_id = descr.obj_id' . PHP_EOL
202 $statement = $this->
database->query($query);
203 $num_rows = $this->
database->numRows($statement);
205 if ($num_rows === 0) {
210 while ($row = $this->
database->fetchAssoc($statement)) {
211 $data[$row[
'obj_id']] = [
212 'title' => $row[
'title'],
213 'long_description' => $row[
'description'] ??
'',
214 'is_online' => !((bool) $row[
'offline']),
215 'tile_image_rid' => $row[
'tile_image_rid'],
216 'object_id' => $row[
'obj_id'],
217 'type' => $row[
'type'],
218 'owner' => $row[
'owner'],
219 'import_id' => $row[
'import_id'],
220 'create_date' => $row[
'create_date'] !==
null ? new \DateTimeImmutable($row[
'create_date']) :
null,
221 'update_date' => $row[
'last_update'] !==
null ? new \DateTimeImmutable($row[
'last_update']) : null
230 $description_array = [
233 $this->
database->update(self::DESCRIPTION_TABLE, $description_array, $where);
Builds a Color from either hex- or rgb values.
const CORE_PROPERTIES_TABLE
retrieveDataForWhereClause(string $where)
getFor(?int $object_id, ?string $type=null)
store(CoreProperties $properties)
retrieveDataForObjectId(int $object_id)
deleteOldTileImage(TileImage\TileImage $tile_image)
getDefaultCoreProperties(?string $type)
preload(array $object_ids)
storeLongDescription(string $long_description, array $where)
retrieveDataForObjectIds(array $object_ids)
__construct(private readonly \ilDBInterface $database, private readonly \ilObjectDefinition $obj_definition, private readonly ResourceStorageService $storage_services, private readonly TileImage\Stakeholder $storage_stakeholder, private readonly TileImage\FlavourDefinition $flavour_definition, private readonly ObjectTypeSpecificPropertiesFactory $object_type_specific_properties_factory)
getPropertyTitleAndDescription()
withPropertyTileImage(PropertyTileImage $property_tile_image)
parses the objects.xml it handles the xml-description of all ilias objects
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...