ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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 $components, $location, ilObjMediaObject\_getDirectory(), ilObjMediaObject\_getURL(), ILIAS\Repository\ctrl(), factory(), ilDclBaseRecordRepresentation\getField(), ILIAS\Survey\Mode\getId(), ilDclBaseRecordRepresentation\getRecord(), ilDclBaseRecordRepresentation\getRecordField(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilDclBaseFieldModel\PROP_HEIGHT, ilDclBaseFieldModel\PROP_LINK_DETAIL_PAGE_MOB, ilDclBaseFieldModel\PROP_WIDTH, ILIAS\Repository\refinery(), renderer(), 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  $page = new ilDclDetailedViewDefinitionGUI($tableview_id);
69  $has_view = $page->getPageObject()->isActive();
70  }
71 
72  $components = [];
73 
74  if (in_array($med->getSuffix(), ['jpg', 'jpeg', 'png', 'gif'])) {
75  // Image
76  $dir = ilObjMediaObject::_getDirectory($mob->getId());
77 
78  $image = $this->factory->image()->responsive(ilWACSignedPath::signFile($dir . "/" . $med->getLocation()), "");
79 
80  if ($is_linked_field && $has_view && $link) {
81  $this->ctrl->setParameterByClass(
82  'ilDclDetailedViewGUI',
83  'record_id',
84  $this->getRecordField()->getRecord()->getId()
85  );
86  $image = $image->withAction($this->ctrl->getLinkTargetByClass("ilDclDetailedViewGUI", 'renderRecord'));
87  }
88  $components[] = $image;
89  } else {
90  $location = ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation();
91  if ($med->getSuffix() == 'mp3') {
92  $components[] = $this->factory->player()->audio($location);
93  } else {
94  $components[] = $this->factory->player()->video($location);
95  }
96 
97  if ($is_linked_field && $has_view) {
98  $this->ctrl->setParameterByClass(
99  'ilDclDetailedViewGUI',
100  'record_id',
101  $this->getRecordField()->getRecord()->getId()
102  );
103  $components[] = $this->factory->link()->standard(
104  $this->lng->txt('details'),
105  $this->ctrl->getLinkTargetByClass(
106  "ilDclDetailedViewGUI",
107  'renderRecord'
108  )
109  );
110  }
111  }
112 
113  $width = "200px";
114  $height = "auto";
115  if ($field->getProperty(ilDclBaseFieldModel::PROP_WIDTH) > 0) {
116  $width = $field->getProperty(ilDclBaseFieldModel::PROP_WIDTH) . "px";
117  }
118  if ($field->getProperty(ilDclBaseFieldModel::PROP_HEIGHT) > 0) {
119  $height = $field->getProperty(ilDclBaseFieldModel::PROP_HEIGHT) . "px";
120  }
121  $content = $this->renderer->render($components);
122  return "<div style='width:$width; height:$height;'>$content</div>";
123  }
$location
Definition: buildRTE.php:22
factory()
renderer()
ilDclDetailedViewDefinitionGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector ilDcl...
$components
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 125 of file class.ilDclMobRecordRepresentation.php.

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

126  {
127  if (is_array($value)) {
128  return $value;
129  }
130 
131  if ($value === null || !ilObject2::_exists((int) $value) || ilObject2::_lookupType((int) $value) != 'mob') {
132  return '';
133  }
134 
135  return $value;
136  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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: