ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilDclMobRecordRepresentation Class Reference
+ 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)
 
- Public Member Functions inherited from ilDclFileRecordRepresentation
 __construct (ilDclBaseRecordFieldModel $record_field)
 
 getSingleHTML (?array $options=null, bool $link=true)
 
 getHTML (bool $link=true, array $options=[])
 
 parseFormInput ($value)
 
- 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
ILIAS UI Factory $factory
 
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

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

Member Function Documentation

◆ getHTML()

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

Outputs html of a certain field.

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

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().

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

◆ parseFormInput()

ilDclMobRecordRepresentation::parseFormInput (   $value)

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

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

125  {
126  if (is_array($value)) {
127  return $value;
128  }
129 
130  if ($value === null || !ilObject2::_exists((int) $value) || ilObject2::_lookupType((int) $value) != 'mob') {
131  return '';
132  }
133 
134  return $value;
135  }
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

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