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

Class ilDclFileuploadRecordRepresentation. More...

+ Inheritance diagram for ilDclFileuploadRecordRepresentation:
+ Collaboration diagram for ilDclFileuploadRecordRepresentation:

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

ilDclFileuploadRecordRepresentation::getHTML (   $link = true)

Outputs html of a certain field.

Parameters
mixed$value
bool | true$link
Returns
string

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

References $_GET, $_POST, ilDclBaseRecordRepresentation\$access, $html, $preview, ilObject2\_exists(), ilObject2\_lookupType(), ilPreviewGUI\CONTEXT_REPOSITORY, ilPreview\createPreview(), ilDclBaseRecordRepresentation\getField(), ilUtil\getImagePath(), ilDclBaseRecordRepresentation\getRecord(), ilDclBaseRecordRepresentation\getRecordField(), ilPreview\hasPreview(), ilPreview\lookupRenderStatus(), and ilPreview\RENDER_STATUS_NONE.

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  return '<a href="' . $this->ctrl->getLinkTargetByClass("ildclrecordlistgui", "sendFile") . '">' . $value['name'] . '</a>';
28  } elseif (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
29  return "";
30  }
31 
32  $file_obj = new ilObjFile($value, false);
33  $this->ctrl->setParameterByClass("ildclrecordlistgui", "record_id", $this->getRecordField()->getRecord()->getId());
34  $this->ctrl->setParameterByClass("ildclrecordlistgui", "field_id", $this->getRecordField()->getField()->getId());
35 
36  $html = '<a href="' . $this->ctrl->getLinkTargetByClass("ildclrecordlistgui", "sendFile") . '">' . $file_obj->getFileName() . '</a>';
37  if (ilPreview::hasPreview($file_obj->getId())) {
38  ilPreview::createPreview($file_obj); // Create preview if not already existing
39  $preview = new ilPreviewGUI((int) $_GET['ref_id'], ilPreviewGUI::CONTEXT_REPOSITORY, $file_obj->getId(), $this->access);
40  $preview_status = ilPreview::lookupRenderStatus($file_obj->getId());
41  $preview_status_class = "";
42  $preview_text_topic = "preview_show";
43  if ($preview_status == ilPreview::RENDER_STATUS_NONE) {
44  $preview_status_class = "ilPreviewStatusNone";
45  $preview_text_topic = "preview_none";
46  }
47  $wrapper_html_id = 'record_field_' . $this->getRecordField()->getId();
48  $script_preview_click = $preview->getJSCall($wrapper_html_id);
49  $preview_title = $this->lng->txt($preview_text_topic);
50  $preview_icon = ilUtil::getImagePath("preview.png", "Services/Preview");
51  $html = '<div id="' . $wrapper_html_id . '">' . $html;
52  $html .= '<span class="il_ContainerItemPreview ' . $preview_status_class . '"><a href="javascript:void(0);" onclick="'
53  . $script_preview_click . '" title="' . $preview_title . '"><img src="' . $preview_icon
54  . '" height="16" width="16"></a></span></div>';
55  }
56 
57  return $html;
58  }
$_GET["client_id"]
$preview
const RENDER_STATUS_NONE
static lookupRenderStatus($a_obj_id)
Gets the render status for the object with the specified id.
static hasPreview($a_obj_id, $a_type="")
Determines whether the object with the specified reference id has a preview.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static createPreview($a_obj, $a_force=false)
Creates the preview for the object with the specified id.
static _lookupType($a_id, $a_reference=false)
static _exists($a_id, $a_reference=false, $a_type=null)
$_POST["username"]
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ parseFormInput()

ilDclFileuploadRecordRepresentation::parseFormInput (   $value)

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

Parameters
$value
Returns
mixed

Definition at line 68 of file class.ilDclFileuploadRecordRepresentation.php.

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

69  {
70  if (is_array($value)) {
71  return $value;
72  }
73 
74  if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
75  return "";
76  }
77 
78  $file_obj = new ilObjFile($value, false);
79  //$input = ilObjFile::_lookupAbsolutePath($value);
80  return $file_obj->getFileName();
81  }
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: