ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilDclMobRecordRepresentation Class Reference

Class ilDclMobRecordRepresentation. More...

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

Public Member Functions

 getHTML ($link=true)
 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 ilDclFileuploadRecordRepresentation
 getHTML ($link=true)
 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 ($form)
 Fills the form with the value of a record. More...
 
 getHTML ($link=true)
 Outputs html of a certain field. More...
 
 getSingleHTML (array $options=null, $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
 $record_field
 
 $lng
 
 $access
 
 $ctrl
 

Detailed Description

Member Function Documentation

◆ getHTML()

ilDclMobRecordRepresentation::getHTML (   $link = true)

Outputs html of a certain field.

Parameters
mixed$value
bool | true$link
Returns
string

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

References $_GET, $_POST, $html, ilObjMediaObject\_getDirectory(), ilObjMediaObject\_getURL(), array, ilDclBaseRecordRepresentation\getField(), ilDclBaseRecordRepresentation\getRecord(), ilDclBaseRecordRepresentation\getRecordField(), ilUtil\img(), ilDclDetailedViewDefinition\isActive(), ilDclBaseFieldModel\PROP_HEIGHT, ilDclBaseFieldModel\PROP_LINK_DETAIL_PAGE_TEXT, ilDclBaseFieldModel\PROP_WIDTH, ilMediaPlayerGUI\setFile(), and ilWACSignedPath\signFile().

20  {
21  $value = $this->getRecordField()->getValue();
22 
23  // the file is only temporary uploaded. Still need to be confirmed before stored
24  if (is_array($value) && $_POST['ilfilehash']) {
25  $this->ctrl->setParameterByClass("ildclrecordlistgui", "ilfilehash", $_POST['ilfilehash']);
26  $this->ctrl->setParameterByClass("ildclrecordlistgui", "field_id", $this->getRecordField()->getField()->getId());
27 
28  return '<a href="' . $this->ctrl->getLinkTargetByClass("ildclrecordlistgui", "sendFile") . '">' . $value['name'] . '</a>';
29  }
30 
31  $mob = new ilObjMediaObject($value, false);
32  $med = $mob->getMediaItem('Standard');
33 
34  if (!$med || $med->getLocation() == null) {
35  return "";
36  }
37 
38  $field = $this->getRecordField()->getField();
39 
40  $is_linked_field = $field->getProperty(ilDclBaseFieldModel::PROP_LINK_DETAIL_PAGE_TEXT);
41  $has_view = ilDclDetailedViewDefinition::isActive($_GET['tableview_id']);
42 
43  if (in_array($med->getSuffix(), array('jpg', 'jpeg', 'png', 'gif'))) {
44  // Image
45  $dir = ilObjMediaObject::_getDirectory($mob->getId());
46  $width = (int) $field->getProperty(ilDclBaseFieldModel::PROP_WIDTH);
47  $height = (int) $field->getProperty(ilDclBaseFieldModel::PROP_HEIGHT);
48 
49  $html = ilUtil::img(ilWACSignedPath::signFile($dir . "/" . $med->getLocation()), '', $width, $height);
50 
51  if ($is_linked_field && $has_view && $link) {
52  $this->ctrl->setParameterByClass('ilDclDetailedViewGUI', 'record_id', $this->getRecordField()->getRecord()->getId());
53  $html = '<a href="' . $this->ctrl->getLinkTargetByClass("ilDclDetailedViewGUI", 'renderRecord') . '">' . $html . '</a>';
54  }
55  } else {
56  // Video/Audio
57  $mpl = new ilMediaPlayerGUI($med->getId(), '');
58  $mpl->setFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation());
59  $mpl->setMimeType($med->getFormat());
60  $mpl->setDisplayWidth((int) $field->getProperty(ilDclBaseFieldModel::PROP_WIDTH) . 'px');
61  $mpl->setDisplayHeight((int) $field->getProperty(ilDclBaseFieldModel::PROP_HEIGHT) . 'px');
62  $mpl->setVideoPreviewPic($mob->getVideoPreviewPic());
63  $html = $mpl->getPreviewHtml();
64 
65  if ($is_linked_field && $has_view) {
66  $this->ctrl->setParameterByClass('ilDclDetailedViewGUI', 'record_id', $this->getRecordField()->getRecord()->getId());
67  $html = $html . '<a href="' . $this->ctrl->getLinkTargetByClass("ilDclDetailedViewGUI", 'renderRecord') . '">' . $this->lng->txt('details') . '</a>';
68  }
69  }
70  return $html;
71  }
setFile($a_file)
Set File.
$_GET["client_id"]
static _getURL($a_mob_id)
get directory for files of media object (static)
static _getDirectory($a_mob_id)
get directory for files of media object (static)
Class ilObjMediaObject.
static signFile($path_to_file)
Create styles array
The data for the language used.
User interface for media player.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
$_POST["username"]
$html
Definition: example_001.php:87
+ 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
$value
Returns
mixed

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

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

82  {
83  if (is_array($value)) {
84  return $value;
85  }
86 
87  if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "mob") {
88  return "";
89  }
90 
91  return $value;
92  }
static _lookupType($a_id, $a_reference=false)
static _exists($a_id, $a_reference=false, $a_type=null)
+ Here is the call graph for this function:

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