19 declare(strict_types=1);
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 = [];
59 if ($object_id ===
null 60 || $object_id === 0) {
64 if (!isset($this->data_cache[$object_id])) {
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.');
108 $properties->getPropertyTileImage()->withTileImage(
109 $properties->getPropertyTileImage()->getTileImage()->withRid(
null)
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: ' 176 . (
string) $object_id);
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);
retrieveDataForObjectId(int $object_id)
getPropertyTitleAndDescription()
const CORE_PROPERTIES_TABLE
storeLongDescription(string $long_description, array $where)
getDefaultCoreProperties(?string $type)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
deleteOldTileImage(TileImage\TileImage $tile_image)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
retrieveDataForWhereClause(string $where)
withPropertyTileImage(PropertyTileImage $property_tile_image)
__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)
preload(array $object_ids)
store(CoreProperties $properties)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
retrieveDataForObjectIds(array $object_ids)
getFor(?int $object_id, ?string $type=null)