ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjectPropertyIcon Class Reference
+ Inheritance diagram for ilObjectPropertyIcon:
+ Collaboration diagram for ilObjectPropertyIcon:

Public Member Functions

 __construct (private bool $custom_icons_enabled, private ?ilObjectCustomIcon $custom_icon=null, private ?ilObjectTypeSpecificPropertyProviders $object_type_specific_property_providers=null)
 
 getObjectTypeSpecificIcon (int $object_id, IconFactory $factory, StorageService $irss)
 
 getCustomIcon ()
 
 getDeletedFlag ()
 
 withDeletedFlag ()
 
 getTempFileName ()
 
 withTempFileName (string $name)
 
 toForm (\ilLanguage $language, FieldFactory $field_factory, Refinery $refinery)
 
 toLegacyForm (\ilLanguage $language)
 
- Public Member Functions inherited from ilObjectProperty
 toForm (ilLanguage $language, FieldFactory $field_factory, Refinery $refinery)
 

Data Fields

const SUPPORTED_MIME_TYPES = [MimeType::IMAGE__SVG_XML]
 

Private Attributes

const INPUT_LABEL = 'custom_icon'
 
bool $deleted_flag = false
 
string $temp_file_name = null
 

Detailed Description

Author
Stephan Kergomard

Definition at line 33 of file ilObjectPropertyIcon.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectPropertyIcon::__construct ( private bool  $custom_icons_enabled,
private ?ilObjectCustomIcon  $custom_icon = null,
private ?ilObjectTypeSpecificPropertyProviders  $object_type_specific_property_providers = null 
)

Definition at line 41 of file ilObjectPropertyIcon.php.

45  {
46  }

Member Function Documentation

◆ getCustomIcon()

ilObjectPropertyIcon::getCustomIcon ( )

Definition at line 59 of file ilObjectPropertyIcon.php.

References ILIAS\UI\examples\Symbol\Icon\Custom\custom_icon(), and null.

Referenced by ilObjectAdditionalPropertiesLegacyRepository\storeIcon().

60  {
61  return $this->custom_icons_enabled ? $this->custom_icon : null;
62  }
Class ilObjectCustomIconImpl TODO: Inject database persistence in future instead of using ...
custom_icon()
description: > Example for rendering custom icons.
Definition: custom_icon.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDeletedFlag()

ilObjectPropertyIcon::getDeletedFlag ( )

Definition at line 64 of file ilObjectPropertyIcon.php.

References $deleted_flag.

Referenced by ilObjectAdditionalPropertiesLegacyRepository\storeIcon().

64  : bool
65  {
66  return $this->deleted_flag;
67  }
+ Here is the caller graph for this function:

◆ getObjectTypeSpecificIcon()

ilObjectPropertyIcon::getObjectTypeSpecificIcon ( int  $object_id,
IconFactory  $factory,
StorageService  $irss 
)

Definition at line 48 of file ilObjectPropertyIcon.php.

References null.

52  : ?CustomIcon {
53  if ($this->object_type_specific_property_providers === null) {
54  return null;
55  }
56  return $this->object_type_specific_property_providers->getObjectTypeSpecificIcon($object_id, $factory, $irss);
57  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getTempFileName()

ilObjectPropertyIcon::getTempFileName ( )

Definition at line 76 of file ilObjectPropertyIcon.php.

References $temp_file_name.

Referenced by ilObjectAdditionalPropertiesLegacyRepository\storeIcon().

76  : ?string
77  {
78  return $this->temp_file_name;
79  }
+ Here is the caller graph for this function:

◆ toForm()

ilObjectPropertyIcon::toForm ( \ilLanguage  $language,
FieldFactory  $field_factory,
Refinery  $refinery 
)

Definition at line 88 of file ilObjectPropertyIcon.php.

References ILIAS\UI\examples\Symbol\Icon\Custom\custom_icon(), null, and ilLanguage\txt().

92  : ?File {
93  if (!$this->custom_icons_enabled) {
94  return null;
95  }
96  $trafo = $refinery->custom()->transformation(
97  function ($v): ?ilObjectProperty {
98  $property_icon = new ilObjectPropertyIcon(
99  $this->custom_icons_enabled,
100  $this->custom_icon
101  );
102 
103  if (count($v) > 0 && $v[0] !== 'custom_icon') {
104  return $property_icon
105  ->withTempFileName($v[0]);
106  }
107 
108  if (count($v) === 0 && $this->custom_icon->exists()) {
109  return $property_icon
110  ->withDeletedFlag();
111  }
112 
113  return $property_icon;
114  }
115  );
116  $custom_icon = $field_factory
117  ->file(new ilObjectCustomIconUploadHandlerGUI($this->custom_icon), $language->txt(self::INPUT_LABEL))
118  ->withAcceptedMimeTypes(self::SUPPORTED_MIME_TYPES)
119  ->withAdditionalTransformation($trafo);
120 
121  if (!$this->custom_icon->exists()) {
122  return $custom_icon;
123  }
124 
125  return $custom_icon->withValue(['custom_icon']);
126  }
custom_icon()
description: > Example for rendering custom icons.
Definition: custom_icon.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This describes file field.
Definition: File.php:26
+ Here is the call graph for this function:

◆ toLegacyForm()

ilObjectPropertyIcon::toLegacyForm ( \ilLanguage  $language)

Definition at line 128 of file ilObjectPropertyIcon.php.

References ILIAS\UI\examples\Symbol\Icon\Custom\custom_icon(), null, ilFileInputGUI\setSuffixes(), and ilLanguage\txt().

131  if (!$this->custom_icons_enabled) {
132  return null;
133  }
134  $custom_icon_input = new ilImageFileInputGUI($language->txt(self::INPUT_LABEL), 'icon');
135  $custom_icon_input->setSuffixes($this->custom_icon->getSupportedFileExtensions());
136  $custom_icon_input->setUseCache(false);
137  if ($this->custom_icon->exists()) {
138  $custom_icon_input->setImage($this->custom_icon->getFullPath());
139  } else {
140  $custom_icon_input->setImage('');
141  }
142 
143  return $custom_icon_input;
144  }
setSuffixes(array $a_suffixes)
custom_icon()
description: > Example for rendering custom icons.
Definition: custom_icon.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This class represents an image file property in a property form.
+ Here is the call graph for this function:

◆ withDeletedFlag()

ilObjectPropertyIcon::withDeletedFlag ( )

Definition at line 69 of file ilObjectPropertyIcon.php.

69  : self
70  {
71  $clone = clone $this;
72  $clone->deleted_flag = true;
73  return $clone;
74  }

◆ withTempFileName()

ilObjectPropertyIcon::withTempFileName ( string  $name)

Definition at line 81 of file ilObjectPropertyIcon.php.

81  : self
82  {
83  $clone = $this;
84  $clone->temp_file_name = $name;
85  return $clone;
86  }

Field Documentation

◆ $deleted_flag

bool ilObjectPropertyIcon::$deleted_flag = false
private

Definition at line 38 of file ilObjectPropertyIcon.php.

Referenced by getDeletedFlag().

◆ $temp_file_name

string ilObjectPropertyIcon::$temp_file_name = null
private

Definition at line 39 of file ilObjectPropertyIcon.php.

Referenced by getTempFileName().

◆ INPUT_LABEL

const ilObjectPropertyIcon::INPUT_LABEL = 'custom_icon'
private

Definition at line 36 of file ilObjectPropertyIcon.php.

◆ SUPPORTED_MIME_TYPES

const ilObjectPropertyIcon::SUPPORTED_MIME_TYPES = [MimeType::IMAGE__SVG_XML]

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