ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 34 of file FileObjectPropertyProviders.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ getImageFromIRSS()

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

Definition at line 77 of file FileObjectPropertyProviders.php.

References null.

Referenced by getObjectTypeSpecificTileImage().

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

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

114  : ?CustomIcon {
115  $info = $this->info->getByObjectId($obj_id);
116  $path = $this->icons->getIconFilePathBySuffix($info->getSuffix());
117  if (($path !== '' && $path !== '0')) {
118  return $icon_factory->custom($path, $info->getSuffix());
119  }
120 
121  return null;
122  }
$path
Definition: ltiservices.php:29
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
info()
description: > Example for rendering a info message box.
Definition: info.php:34
+ 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 51 of file FileObjectPropertyProviders.php.

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

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

◆ $extract_definition

FlavourDefinition FileObjectPropertyProviders::$extract_definition
private

Definition at line 37 of file FileObjectPropertyProviders.php.

◆ $icons

IconDatabaseRepository FileObjectPropertyProviders::$icons
private

Definition at line 39 of file FileObjectPropertyProviders.php.

◆ $info

ilObjFileInfoRepository FileObjectPropertyProviders::$info
private

Definition at line 40 of file FileObjectPropertyProviders.php.

◆ $settings

Settings FileObjectPropertyProviders::$settings
private

Definition at line 38 of file FileObjectPropertyProviders.php.


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