ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclReferenceRecordRepresentation.php
Go to the documentation of this file.
1 <?php
2 require_once('./Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordRepresentation.php');
3 
11 
15  public function getHTML($link = true) {
16  $value = $this->getRecordField()->getValue();
17  $record_field = $this->getRecordField();
18 
19  if (!$value || $value == "-") {
20  return "";
21  }
22 
23  if (!is_array($value)) {
24  $value = array($value);
25  }
26 
27  $html = "";
28 
29  foreach ($value as $v) {
30  $ref_record = ilDclCache::getRecordCache($v);
31  if (!$ref_record->getTableId() || !$record_field->getField() || !$record_field->getField()->getTableId()) {
32  //the referenced record_field does not seem to exist.
33  $record_field->setValue(NULL);
34  $record_field->doUpdate();
35  } else {
36  $field = $this->getRecordField()->getField();
37  if ($field->getProperty(ilDclBaseFieldModel::PROP_REFERENCE_LINK)) {
38  $ref_record = ilDclCache::getRecordCache($v);
39  $ref_table = $ref_record->getTable();
40 
41  if ($ref_table->getVisibleTableViews($_GET['ref_id'], true)) {
42  $html .= $this->getLinkHTML(NULL, $v);
43  } else {
44  $html .= $ref_record->getRecordFieldHTML($field->getProperty(ilDclBaseFieldModel::PROP_REFERENCE));
45  }
46  } else {
47  $html .= $ref_record->getRecordFieldHTML($field->getProperty(ilDclBaseFieldModel::PROP_REFERENCE));
48  }
49  }
50  $html .= '<br>';
51  }
52 
53  $html = substr($html, 0, -4); // cut away last <br>
54 
55  return $html;
56  }
57 
58 
65  protected function getLinkHTML($link_name = NULL, $value) {
66  global $DIC;
67  $ilCtrl = $DIC['ilCtrl'];
68 
69  if (!$value || $value == "-") {
70  return "";
71  }
72  $record_field = $this;
73  $ref_record = ilDclCache::getRecordCache($value);
74  if (!$link_name) {
75  $link_name = $ref_record->getRecordFieldHTML($record_field->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE));
76  }
77  $ilCtrl->clearParametersByClass("ilDclDetailedViewGUI");
78  $ilCtrl->setParameterByClass("ilDclDetailedViewGUI", "record_id", $ref_record->getId());
79  $ilCtrl->setParameterByClass("ilDclDetailedViewGUI", "back_tableview_id", $_GET['tableview_id']);
80  $html = "<a href='" . $ilCtrl->getLinkTargetByClass("ilDclDetailedViewGUI", "renderRecord") . "&disable_paging=1'>" . $link_name . "</a>";
81 
82  return $html;
83  }
84 
85 }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
Class ilDclReferenceRecordRepresentation.
static getRecordCache($record_id=0)
Create styles array
The data for the language used.
Class ilDclBaseRecordRepresentation.
global $DIC
$html
Definition: example_001.php:87