ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclMobRecordRepresentation.php
Go to the documentation of this file.
1<?php
2require_once ('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
3require_once('./Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordRepresentation.php');
4require_once('./Modules/DataCollection/classes/Fields/Fileupload/class.ilDclFileuploadRecordRepresentation.php');
5
13
21 public function getHTML($link = true) {
22 $value = $this->getRecordField()->getValue();
23
24 // the file is only temporary uploaded. Still need to be confirmed before stored
25 if(is_array($value) && $_POST['ilfilehash']) {
26 $this->ctrl->setParameterByClass("ildclrecordlistgui", "ilfilehash", $_POST['ilfilehash']);
27 $this->ctrl->setParameterByClass("ildclrecordlistgui", "field_id", $this->getRecordField()->getField()->getId());
28
29 return '<a href="' . $this->ctrl->getLinkTargetByClass("ildclrecordlistgui", "sendFile") . '">' . $value['name'] . '</a>';
30 }
31
32 $mob = new ilObjMediaObject($value, false);
33 $med = $mob->getMediaItem('Standard');
34
35 if (!$med || $med->getLocation() == null) {
36 return "";
37 }
38
39 $field = $this->getRecordField()->getField();
40
41 $is_linked_field = $field->getProperty(ilDclBaseFieldModel::PROP_LINK_DETAIL_PAGE_TEXT);
42 $has_view = ilDclDetailedViewDefinition::isActive($_GET['tableview_id']);
43
44 if (in_array($med->getSuffix(), array('jpg', 'jpeg', 'png', 'gif'))) {
45 // Image
46 $dir = ilObjMediaObject::_getDirectory($mob->getId());
47 $width = (int)$field->getProperty(ilDclBaseFieldModel::PROP_WIDTH);
48 $height = (int)$field->getProperty(ilDclBaseFieldModel::PROP_HEIGHT);
49
50 $html = ilUtil::img(ilWACSignedPath::signFile($dir . "/" . $med->getLocation()), '', $width, $height);
51
52 if ($is_linked_field && $has_view && $link) {
53 $this->ctrl->setParameterByClass('ilDclDetailedViewGUI', 'record_id', $this->getRecordField()->getRecord()->getId());
54 $html = '<a href="' . $this->ctrl->getLinkTargetByClass("ilDclDetailedViewGUI", 'renderRecord') . '">' . $html . '</a>';
55 }
56
57 } else {
58 // Video/Audio
59 $mpl = new ilMediaPlayerGUI($med->getId(), '');
60 $mpl->setFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation());
61 $mpl->setMimeType($med->getFormat());
62 $mpl->setDisplayWidth((int)$field->getProperty(ilDclBaseFieldModel::PROP_WIDTH) . 'px');
63 $mpl->setDisplayHeight((int)$field->getProperty(ilDclBaseFieldModel::PROP_HEIGHT) . 'px');
64 $mpl->setVideoPreviewPic($mob->getVideoPreviewPic());
65 $html = $mpl->getPreviewHtml();
66
67 if ($is_linked_field && $has_view) {
68 $this->ctrl->setParameterByClass('ilDclDetailedViewGUI', 'record_id', $this->getRecordField()->getRecord()->getId());
69 $html = $html . '<a href="' . $this->ctrl->getLinkTargetByClass("ilDclDetailedViewGUI", 'renderRecord') . '">' . $this->lng->txt('details') . '</a>';
70 }
71 }
72 return $html;
73 }
74
75
83 public function parseFormInput($value) {
84 if(is_array($value)) {
85 return $value;
86 }
87
88 if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "mob") {
89 return "";
90 }
91
92 return $value;
93 }
94}
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
Class ilDclMobRecordRepresentation.
getHTML($link=true)
Outputs html of a certain field.
parseFormInput($value)
function parses stored value to the variable needed to fill into the form for editing.
User interface for media player.
Class ilObjMediaObject.
static _getDirectory($a_mob_id)
get directory for files of media object (static)
static _getURL($a_mob_id)
get directory for files of media object (static)
static _lookupType($a_id, $a_reference=false)
lookup object type
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static signFile($path_to_file)
$html
Definition: example_001.php:87