ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 35 of file FileObjectPropertyProviders.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ getImageFromIRSS()

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

Definition at line 78 of file FileObjectPropertyProviders.php.

Referenced by getObjectTypeSpecificTileImage().

82  : ?Image {
83  $urls = $irss->consume()->flavourUrls($flavour)->getURLsAsArray();
84 
85  if ($urls === []) {
86  return null;
87  }
88 
89  $available_widths = $this->crop_definition->getWidths();
90  array_pop($available_widths);
91 
92  if (!isset($urls[count($available_widths)])) {
93  return null;
94  }
95 
96  $image = $factory->responsive($urls[count($available_widths)], '');
97  return array_reduce(
98  $available_widths,
99  function ($carry, $size) use ($urls) {
100  $image = $carry['image']->withAdditionalHighResSource($urls[$carry['counter']], $size / 2);
101  $counter = ++$carry['counter'];
102  return [
103  'image' => $image,
104  'counter' => $counter
105  ];
106  },
107  ['image' => $image, 'counter' => 0]
108  )['image'];
109  }
+ 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 111 of file FileObjectPropertyProviders.php.

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

115  : ?CustomIcon {
116  $info = $this->info->getByObjectId($obj_id);
117  if (($path = $this->icons->getIconFilePathBySuffix($info->getSuffix()))) {
118  return $icon_factory->custom($path, $info->getSuffix());
119  }
120 
121  return null;
122  }
$path
Definition: ltiservices.php:30
info()
description: > Example for rendering a info message box.
Definition: info.php:18
+ 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 52 of file FileObjectPropertyProviders.php.

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

56  : ?Image {
57  if (!$this->settings->hasTilePreviews()) {
58  return null;
59  }
60 
61  $rid = (new ilObjFileInfoRepository())->getByObjectId($obj_id)->getRID();
62 
63  if ($rid === null) {
64  return null;
65  }
66  if ($irss->flavours()->possible($rid, $this->crop_definition)) {
67  $flavour = $irss->flavours()->get($rid, $this->crop_definition);
68  return $this->getImageFromIRSS($irss, $factory, $flavour);
69  }
70  if ($irss->flavours()->possible($rid, $this->extract_definition)) {
71  $flavour = $irss->flavours()->get($rid, $this->extract_definition);
72  return $this->getImageFromIRSS($irss, $factory, $flavour);
73  }
74 
75  return null;
76  }
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 37 of file FileObjectPropertyProviders.php.

◆ $extract_definition

FlavourDefinition FileObjectPropertyProviders::$extract_definition
private

Definition at line 38 of file FileObjectPropertyProviders.php.

◆ $icons

IconDatabaseRepository FileObjectPropertyProviders::$icons
private

Definition at line 40 of file FileObjectPropertyProviders.php.

◆ $info

ilObjFileInfoRepository FileObjectPropertyProviders::$info
private

Definition at line 41 of file FileObjectPropertyProviders.php.

◆ $settings

Settings FileObjectPropertyProviders::$settings
private

Definition at line 39 of file FileObjectPropertyProviders.php.


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