ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDclReferenceRecordRepresentation Class Reference

Class ilDclReferenceRecordRepresentation. More...

+ Inheritance diagram for ilDclReferenceRecordRepresentation:
+ Collaboration diagram for ilDclReferenceRecordRepresentation:

Public Member Functions

 getHTML ($link=true)
 
- 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...
 

Protected Member Functions

 getLinkHTML ($link_name=null, $value)
 
- Protected Member Functions inherited from ilDclBaseRecordRepresentation
 getFormInput ()
 Gets the value from from the record field. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilDclBaseRecordRepresentation
 $record_field
 
 $lng
 
 $access
 
 $ctrl
 

Detailed Description

Member Function Documentation

◆ getHTML()

ilDclReferenceRecordRepresentation::getHTML (   $link = true)
Returns
array|mixed|string

Reimplemented from ilDclBaseRecordRepresentation.

Definition at line 15 of file class.ilDclReferenceRecordRepresentation.php.

16 {
17 $value = $this->getRecordField()->getValue();
19
20 if (!$value || $value == "-") {
21 return "";
22 }
23
24 if (!is_array($value)) {
25 $value = array($value);
26 }
27
28 $html = "";
29
30 foreach ($value as $k => $v) {
31 $ref_record = ilDclCache::getRecordCache($v);
32 if (!$ref_record->getTableId() || !$record_field->getField() || !$record_field->getField()->getTableId()) {
33 //the referenced record_field does not seem to exist.
34 unset($value[$k]);
35 $value = array_values($value); // resets the keys
36 $record_field->setValue($value);
37 $record_field->doUpdate();
38 continue;
39 } else {
40 $field = $this->getRecordField()->getField();
41 if ($field->getProperty(ilDclBaseFieldModel::PROP_REFERENCE_LINK)) {
42 $ref_record = ilDclCache::getRecordCache($v);
43 $ref_table = $ref_record->getTable();
44
45 if ($ref_table->getVisibleTableViews($_GET['ref_id'], true)) {
46 $html .= $this->getLinkHTML(null, $v);
47 } else {
48 $html .= $ref_record->getRecordFieldHTML($field->getProperty(ilDclBaseFieldModel::PROP_REFERENCE));
49 }
50 } else {
51 $html .= $ref_record->getRecordFieldHTML($field->getProperty(ilDclBaseFieldModel::PROP_REFERENCE));
52 }
53 }
54 $html .= '<br>';
55 }
56
57 $html = substr($html, 0, -4); // cut away last <br>
58
59 return $html;
60 }
$_GET["client_id"]
static getRecordCache($record_id=0)
$html
Definition: example_001.php:87

References $_GET, $html, ilDclBaseRecordRepresentation\$record_field, getLinkHTML(), ilDclCache\getRecordCache(), ilDclBaseRecordRepresentation\getRecordField(), ilDclBaseFieldModel\PROP_REFERENCE, and ilDclBaseFieldModel\PROP_REFERENCE_LINK.

+ Here is the call graph for this function:

◆ getLinkHTML()

ilDclReferenceRecordRepresentation::getLinkHTML (   $link_name = null,
  $value 
)
protected
Parameters
null$link_name
$value
Returns
string

Definition at line 69 of file class.ilDclReferenceRecordRepresentation.php.

70 {
71 global $DIC;
72 $ilCtrl = $DIC['ilCtrl'];
73
74 if (!$value || $value == "-") {
75 return "";
76 }
77 $record_field = $this;
78 $ref_record = ilDclCache::getRecordCache($value);
79 if (!$link_name) {
80 $link_name = $ref_record->getRecordFieldHTML($record_field->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE));
81 }
82 $ilCtrl->clearParametersByClass(ilDclDetailedViewGUI::class);
83 $ilCtrl->setParameterByClass(ilDclDetailedViewGUI::class, "record_id", $ref_record->getId());
84 $ilDCLTableView = ilDCLTableView::createOrGetStandardView($ref_record->getTableId());
85 $ilCtrl->setParameterByClass(ilDclDetailedViewGUI::class, "tableview_id", $ilDCLTableView->getId());
86 $ilCtrl->setParameterByClass(ilDclDetailedViewGUI::class, "back_tableview_id", $_GET['tableview_id']);
87 $html = "<a href='" . $ilCtrl->getLinkTargetByClass(ilDclDetailedViewGUI::class, "renderRecord") . "&disable_paging=1'>" . $link_name . "</a>";
88
89 return $html;
90 }
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7

References $_GET, $DIC, $html, $ilCtrl, ilDclBaseRecordRepresentation\$record_field, ilDclCache\getRecordCache(), and ilDclBaseFieldModel\PROP_REFERENCE.

Referenced by getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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