ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
FileObjectPropertyProviders Class Reference
+ Inheritance diagram for FileObjectPropertyProviders:
+ Collaboration diagram for FileObjectPropertyProviders:

Public Member Functions

 __construct ()
 
 getObjectTypeSpecificTileImage (int $obj_id, ImageFactory $factory, StorageService $irss)
 
 getObjectTypeSpecificIcon (int $obj_id, IconFactory $icon_factory, StorageService $irss)
 

Private Member Functions

 getImageFromIRSS (StorageService $irss, ImageFactory $factory, Flavour $flavour)
 

Private Attributes

FlavourDefinition $crop_definition
 
FlavourDefinition $extract_definition
 
Settings $settings
 
IconDatabaseRepository $icons
 
ilObjFileInfoRepository $info
 

Detailed Description

Definition at line 33 of file FileObjectPropertyProviders.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ getImageFromIRSS()

FileObjectPropertyProviders::getImageFromIRSS ( StorageService  $irss,
ImageFactory  $factory,
Flavour  $flavour 
)
private

Definition at line 76 of file FileObjectPropertyProviders.php.

Referenced by getObjectTypeSpecificTileImage().

80  : ?Image {
81  $urls = $irss->consume()->flavourUrls($flavour)->getURLsAsArray();
82 
83  if ($urls === []) {
84  return null;
85  }
86 
87  $available_widths = $this->crop_definition->getWidths();
88  array_pop($available_widths);
89 
90  if (!isset($urls[count($available_widths)])) {
91  return null;
92  }
93 
94  $image = $factory->responsive($urls[count($available_widths)], '');
95  return array_reduce(
96  $available_widths,
97  function ($carry, $size) use ($urls) {
98  $image = $carry['image']->withAdditionalHighResSource($urls[$carry['counter']], $size / 2);
99  $counter = ++$carry['counter'];
100  return [
101  'image' => $image,
102  'counter' => $counter
103  ];
104  },
105  ['image' => $image, 'counter' => 0]
106  )['image'];
107  }
+ Here is the caller graph for this function:

◆ getObjectTypeSpecificIcon()

FileObjectPropertyProviders::getObjectTypeSpecificIcon ( int  $obj_id,
IconFactory  $icon_factory,
StorageService  $irss 
)

Implements ILIAS\Object\Properties\ObjectTypeSpecificProperties\ilObjectTypeSpecificPropertyProviders.

Definition at line 109 of file FileObjectPropertyProviders.php.

References $path, and ILIAS\UI\examples\MessageBox\Info\info().

113  : ?CustomIcon {
114  $info = $this->info->getByObjectId($obj_id);
115  $path = $this->icons->getIconFilePathBySuffix($info->getSuffix());
116  if (($path !== '' && $path !== '0')) {
117  return $icon_factory->custom($path, $info->getSuffix());
118  }
119 
120  return null;
121  }
$path
Definition: ltiservices.php:32
+ Here is the call graph for this function:

◆ getObjectTypeSpecificTileImage()

FileObjectPropertyProviders::getObjectTypeSpecificTileImage ( int  $object_id,
ImageFactory  $factory,
StorageService  $irss 
)
Parameters
int$card_sizeSpecifies what CardSize this will be displayed as, thus allowing for responsive images.

Implements ILIAS\Object\Properties\ObjectTypeSpecificProperties\ilObjectTypeSpecificPropertyProviders.

Definition at line 50 of file FileObjectPropertyProviders.php.

References getImageFromIRSS(), and ILIAS\Repository\settings().

54  : ?Image {
55  if (!$this->settings->hasTilePreviews()) {
56  return null;
57  }
58 
59  $rid = (new ilObjFileInfoRepository())->getByObjectId($obj_id)->getRID();
60 
61  if ($rid === null) {
62  return null;
63  }
64  if ($irss->flavours()->possible($rid, $this->crop_definition)) {
65  $flavour = $irss->flavours()->get($rid, $this->crop_definition);
66  return $this->getImageFromIRSS($irss, $factory, $flavour);
67  }
68  if ($irss->flavours()->possible($rid, $this->extract_definition)) {
69  $flavour = $irss->flavours()->get($rid, $this->extract_definition);
70  return $this->getImageFromIRSS($irss, $factory, $flavour);
71  }
72 
73  return null;
74  }
getImageFromIRSS(StorageService $irss, ImageFactory $factory, Flavour $flavour)
+ Here is the call graph for this function:

Field Documentation

◆ $crop_definition

FlavourDefinition FileObjectPropertyProviders::$crop_definition
private

Definition at line 35 of file FileObjectPropertyProviders.php.

◆ $extract_definition

FlavourDefinition FileObjectPropertyProviders::$extract_definition
private

Definition at line 36 of file FileObjectPropertyProviders.php.

◆ $icons

IconDatabaseRepository FileObjectPropertyProviders::$icons
private

Definition at line 38 of file FileObjectPropertyProviders.php.

◆ $info

ilObjFileInfoRepository FileObjectPropertyProviders::$info
private

Definition at line 39 of file FileObjectPropertyProviders.php.

◆ $settings

Settings FileObjectPropertyProviders::$settings
private

Definition at line 37 of file FileObjectPropertyProviders.php.


The documentation for this class was generated from the following file: