ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MetaData\Presentation\Data Class Reference
+ Inheritance diagram for ILIAS\MetaData\Presentation\Data:
+ Collaboration diagram for ILIAS\MetaData\Presentation\Data:

Public Member Functions

 __construct (UtilitiesInterface $utilities, DataHelperInterface $data_helper, VocabulariesPresentation $vocab_presentation)
 
 dataValue (ElementsDataInterface $data)
 
 vocabularyValue (string $value, SlotIdentifier $vocabulary_slot)
 
 language (string $language)
 
 datetime (string $datetime)
 
 duration (string $duration)
 
 dataValue (ElementsDataInterface $data)
 
 vocabularyValue (string $value, SlotIdentifier $vocabulary_slot)
 
 language (string $language)
 
 datetime (string $datetime)
 
 duration (string $duration)
 

Protected Attributes

UtilitiesInterface $utilities
 
DataHelperInterface $data_helper
 
VocabulariesPresentation $vocab_presentation
 

Detailed Description

Definition at line 29 of file Data.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\Presentation\Data::__construct ( UtilitiesInterface  $utilities,
DataHelperInterface  $data_helper,
VocabulariesPresentation  $vocab_presentation 
)

Definition at line 35 of file Data.php.

39 {
40 $this->utilities = $utilities;
41 $this->data_helper = $data_helper;
42 $this->vocab_presentation = $vocab_presentation;
43 }
DataHelperInterface $data_helper
Definition: Data.php:32
VocabulariesPresentation $vocab_presentation
Definition: Data.php:33
UtilitiesInterface $utilities
Definition: Data.php:31

References ILIAS\MetaData\Presentation\Data\$data_helper, ILIAS\MetaData\Presentation\Data\$utilities, and ILIAS\MetaData\Presentation\Data\$vocab_presentation.

Member Function Documentation

◆ dataValue()

ILIAS\MetaData\Presentation\Data::dataValue ( ElementsDataInterface  $data)

Implements ILIAS\MetaData\Presentation\DataInterface.

Definition at line 45 of file Data.php.

45 : string
46 {
47 switch ($data->type()) {
48 case Type::VOCAB_VALUE:
49 case Type::STRING:
50 return $this->vocabularyValue($data->value(), $data->vocabularySlot());
51
52 case Type::LANG:
53 return $this->language($data->value());
54
55 case Type::DATETIME:
56 return $this->datetime($data->value());
57
58 case Type::DURATION:
59 return $this->duration($data->value());
60
61 default:
62 return $data->value();
63 }
64 }
language(string $language)
Definition: Data.php:78
datetime(string $datetime)
Definition: Data.php:83
duration(string $duration)
Definition: Data.php:89
vocabularyValue(string $value, SlotIdentifier $vocabulary_slot)
Definition: Data.php:66

References $data, ILIAS\MetaData\Presentation\Data\datetime(), ILIAS\MetaData\Elements\Data\DURATION, ILIAS\MetaData\Presentation\Data\duration(), ILIAS\MetaData\Presentation\Data\language(), and ILIAS\MetaData\Presentation\Data\vocabularyValue().

+ Here is the call graph for this function:

◆ datetime()

ILIAS\MetaData\Presentation\Data::datetime ( string  $datetime)

Implements ILIAS\MetaData\Presentation\DataInterface.

Definition at line 83 of file Data.php.

83 : string
84 {
85 $date = $this->data_helper->datetimeToObject($datetime);
86 return $this->utilities->getUserDateFormat()->applyTo($date);
87 }
$datetime

References $datetime.

Referenced by ILIAS\MetaData\Presentation\Data\dataValue().

+ Here is the caller graph for this function:

◆ duration()

ILIAS\MetaData\Presentation\Data::duration ( string  $duration)

Implements ILIAS\MetaData\Presentation\DataInterface.

Definition at line 89 of file Data.php.

89 : string
90 {
91 $labels = [
92 ['years', 'year'],
93 ['months', 'month'],
94 ['days', 'day'],
95 ['hours', 'hour'],
96 ['minutes', 'minute'],
97 ['seconds', 'second'],
98 ];
99 $res_array = [];
100 foreach ($this->data_helper->durationToIterator($duration) as $key => $match) {
101 if (!is_null($match)) {
102 $res_array[] =
103 $match . ' ' .
104 ($match === '1' ?
105 $this->utilities->txt($labels[$key][1]) :
106 $this->utilities->txt($labels[$key][0]));
107 }
108 }
109 return implode(', ', $res_array);
110 }
$duration

References $duration.

Referenced by ILIAS\MetaData\Presentation\Data\dataValue().

+ Here is the caller graph for this function:

◆ language()

ILIAS\MetaData\Presentation\Data::language ( string  $language)

Implements ILIAS\MetaData\Presentation\DataInterface.

Definition at line 78 of file Data.php.

78 : string
79 {
80 return $this->utilities->txt('meta_l_' . $language);
81 }

Referenced by ILIAS\MetaData\Presentation\Data\dataValue().

+ Here is the caller graph for this function:

◆ vocabularyValue()

ILIAS\MetaData\Presentation\Data::vocabularyValue ( string  $value,
SlotIdentifier  $vocabulary_slot 
)

Implements ILIAS\MetaData\Presentation\DataInterface.

Definition at line 66 of file Data.php.

69 : string {
70 return $this->vocab_presentation->presentableLabels(
71 $this->utilities,
72 $vocabulary_slot,
73 false,
74 $value
75 )->current()->label();
76 }

Referenced by ILIAS\MetaData\Presentation\Data\dataValue().

+ Here is the caller graph for this function:

Field Documentation

◆ $data_helper

DataHelperInterface ILIAS\MetaData\Presentation\Data::$data_helper
protected

Definition at line 32 of file Data.php.

Referenced by ILIAS\MetaData\Presentation\Data\__construct().

◆ $utilities

UtilitiesInterface ILIAS\MetaData\Presentation\Data::$utilities
protected

Definition at line 31 of file Data.php.

Referenced by ILIAS\MetaData\Presentation\Data\__construct().

◆ $vocab_presentation

VocabulariesPresentation ILIAS\MetaData\Presentation\Data::$vocab_presentation
protected

Definition at line 33 of file Data.php.

Referenced by ILIAS\MetaData\Presentation\Data\__construct().


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