ILIAS  release_8 Revision v8.24
ilDclMobRecordRepresentation Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilDclMobRecordRepresentation:
+ Collaboration diagram for ilDclMobRecordRepresentation:

Public Member Functions

 getHTML (bool $link=true, array $options=[])
 Outputs html of a certain field. More...
 
 parseFormInput ($value)
 function parses stored value to the variable needed to fill into the form for editing. More...
 
 getHTML (bool $link=true, array $options=[])
 Outputs html of a certain field. More...
 
 parseFormInput ($value)
 function parses stored value to the variable needed to fill into the form for editing. More...
 
- Public Member Functions inherited from ilDclBaseRecordRepresentation
 __construct (ilDclBaseRecordFieldModel $record_field)
 
 getFormGUI (ilPropertyFormGUI $formGUI)
 
 parseFormInput ($value)
 function parses stored value to the variable needed to fill into the form for editing. More...
 
 fillFormInput (ilPropertyFormGUI $form)
 Fills the form with the value of a record. More...
 
 getHTML (bool $link=true, array $options=[])
 Outputs html of a certain field. More...
 
 getSingleHTML (?array $options=null, bool $link=true)
 Returns data for single record view. More...
 
 getConfirmationHTML ()
 Returns data for confirmation list When returning false, attribute is ignored in list. More...
 
 fillRow (ilTemplate $tpl)
 Fills row with record data. More...
 
 getRecordField ()
 Get Record Field. More...
 
 getField ()
 Getter shortcut for field. More...
 
 getRecord ()
 Getter shortcut for record. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ilDclBaseRecordRepresentation
 getFormInput ()
 Gets the value from from the record field. More...
 
- Protected Attributes inherited from ilDclBaseRecordRepresentation
ilDclBaseRecordFieldModel $record_field
 
ilLanguage $lng
 
ilAccess $access
 
ilCtrl $ctrl
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ILIAS UI Renderer $renderer
 
ilObjUser $user
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 19 of file class.ilDclMobRecordRepresentation.php.

Member Function Documentation

◆ getHTML()

ilDclMobRecordRepresentation::getHTML ( bool  $link = true,
array  $options = [] 
)

Outputs html of a certain field.

Reimplemented from ilDclFileuploadRecordRepresentation.

Definition at line 24 of file class.ilDclMobRecordRepresentation.php.

24 : string
25 {
26 $value = $this->getRecordField()->getValue();
27
28 if (is_null($value)) {
29 return "";
30 }
31
32 // the file is only temporary uploaded. Still need to be confirmed before stored
33 $has_ilfilehash = $this->http->wrapper()->post()->has('ilfilehash');
34 if (is_array($value) && $has_ilfilehash) {
35 $ilfilehash = $this->http->wrapper()->post()->retrieve('ilfilehash', $this->refinery->kindlyTo()->string());
36
37 $this->ctrl->setParameterByClass("ildclrecordlistgui", "ilfilehash", $ilfilehash);
38 $this->ctrl->setParameterByClass(
39 "ildclrecordlistgui",
40 "field_id",
41 $this->getRecordField()->getField()->getId()
42 );
43
44 return '<a href="' . $this->ctrl->getLinkTargetByClass(
45 "ildclrecordlistgui",
46 "sendFile"
47 ) . '">' . $value['name'] . '</a>';
48 }
49
50 $mob = new ilObjMediaObject($value);
51 $med = $mob->getMediaItem('Standard');
52
53 if (!$med || $med->getLocation() === "") {
54 return "";
55 }
56
57 $field = $this->getRecordField()->getField();
58
59 $is_linked_field = $field->getProperty(ilDclBaseFieldModel::PROP_LINK_DETAIL_PAGE_MOB);
60 $has_view = false;
61 if ($this->http->wrapper()->query()->has("tableview_id")) {
62 $tableview_id = $this->http->wrapper()->query()->retrieve(
63 'tableview_id',
64 $this->refinery->kindlyTo()->int()
65 );
66 $has_view = ilDclDetailedViewDefinition::isActive($tableview_id);
67 }
68
69 $components = [];
70
71 if (in_array($med->getSuffix(), ['jpg', 'jpeg', 'png', 'gif'])) {
72 // Image
73 $dir = ilObjMediaObject::_getDirectory($mob->getId());
74
75 $image = $this->factory->image()->responsive(ilWACSignedPath::signFile($dir . "/" . $med->getLocation()), "");
76
77 if ($is_linked_field && $has_view && $link) {
78 $this->ctrl->setParameterByClass(
79 'ilDclDetailedViewGUI',
80 'record_id',
81 $this->getRecordField()->getRecord()->getId()
82 );
83 $image = $image->withAction($this->ctrl->getLinkTargetByClass("ilDclDetailedViewGUI", 'renderRecord'));
84 }
85 $components[] = $image;
86 } else {
87 $location = ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation();
88 if (in_array($med->getSuffix(), ['mp3'])) {
89 $components[] = $this->factory->player()->audio($location);
90 } else {
91 $components[] = $this->factory->player()->video($location);
92 }
93
94 if ($is_linked_field && $has_view) {
95 $this->ctrl->setParameterByClass(
96 'ilDclDetailedViewGUI',
97 'record_id',
98 $this->getRecordField()->getRecord()->getId()
99 );
100 $components[] = $this->factory->link()->standard(
101 $this->lng->txt('details'),
102 $this->ctrl->getLinkTargetByClass(
103 "ilDclDetailedViewGUI",
104 'renderRecord'
105 )
106 );
107 }
108 }
109
110 $width = "200px";
111 $height = "auto";
112 if ($field->getProperty(ilDclBaseFieldModel::PROP_WIDTH) > 0) {
113 $width = $field->getProperty(ilDclBaseFieldModel::PROP_WIDTH) . "px";
114 }
115 if ($field->getProperty(ilDclBaseFieldModel::PROP_HEIGHT) > 0) {
116 $height = $field->getProperty(ilDclBaseFieldModel::PROP_HEIGHT) . "px";
117 }
118 $content = $this->renderer->render($components);
119 $fixed_size_div = "<div style='width:$width; height:$height;'>$content</div>";
120 return $fixed_size_div;
121 }
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static _getURL(int $a_mob_id)
get directory for files of media object
static _getDirectory(int $a_mob_id)
Get absolute directory.
static signFile(string $path_to_file)
static http()
Fetches the global http state from ILIAS.

References $location, ilObjMediaObject\_getDirectory(), ilObjMediaObject\_getURL(), ILIAS\Repository\ctrl(), ilDclBaseRecordRepresentation\getField(), ILIAS\Survey\Mode\getId(), ilDclBaseRecordRepresentation\getRecord(), ilDclBaseRecordRepresentation\getRecordField(), ILIAS\FileDelivery\http(), ilDclDetailedViewDefinition\isActive(), ILIAS\Repository\lng(), ilDclBaseFieldModel\PROP_HEIGHT, ilDclBaseFieldModel\PROP_LINK_DETAIL_PAGE_MOB, ilDclBaseFieldModel\PROP_WIDTH, ILIAS\Repository\refinery(), and ilWACSignedPath\signFile().

+ Here is the call graph for this function:

◆ parseFormInput()

ilDclMobRecordRepresentation::parseFormInput (   $value)

function parses stored value to the variable needed to fill into the form for editing.

Parameters
array | int$value
Returns
array|int|string

Reimplemented from ilDclFileuploadRecordRepresentation.

Definition at line 128 of file class.ilDclMobRecordRepresentation.php.

129 {
130 if (is_null($value)) {
131 return "";
132 }
133 if (is_array($value)) {
134 return $value;
135 }
136
137 if (!ilObject2::_exists($value) || ilObject2::_lookupType($value) != "mob") {
138 return "";
139 }
140
141 return $value;
142 }
static _lookupType(int $id, bool $reference=false)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data

References ilObject\_exists(), and ilObject\_lookupType().

+ Here is the call graph for this function:

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