ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDclIliasReferenceRecordRepresentation.php
Go to the documentation of this file.
1 <?php
2 
10 {
11 
17  public function getHTML($link = true)
18  {
19  $title = $this->getRecordField()->getValueForRepresentation();
20  if (!$title) {
21  return '';
22  }
23  $field = $this->getRecordField()->getField();
24 
26  $html = $this->getLinkHTML($title, true);
27  } else {
28  if ($field->getProperty(ilDclBaseFieldModel::PROP_ILIAS_REFERENCE_LINK)) {
29  $html = $this->getLinkHTML($title);
30  } else {
31  $html = $title;
32  }
33  }
34 
35  return $html;
36  }
37 
38 
39  public function getSingleHTML(array $options = null, $link = true)
40  {
41  $value = $this->getRecordField()->getValue();
42  if (!$value) {
43  return '';
44  }
45  $id = ilObject::_lookupObjId($value);
46  $value = ilObject::_lookupTitle($id);
48  return $this->getLinkHTML($value);
49  }
50 
51  return $value;
52  }
53 
54 
61  public function getLinkHTML($title, $show_action_menu = false)
62  {
63  global $DIC;
64  $lng = $DIC['lng'];
65  $this->getRecordField();
66  $link = ilLink::_getStaticLink($this->getRecordField()->getValue());
67  if ($show_action_menu) {
68  $field = $this->getRecordField()->getField();
69  $record = $this->getRecordField()->getRecord();
70 
72  $list->setId('adv_list_copy_link_' . $field->getId() . $record->getId());
73  $list->setListTitle($title);
74  if ($field->getProperty(ilDclBaseFieldModel::PROP_ILIAS_REFERENCE_LINK)) {
75  $list->addItem($lng->txt('view'), 'view', $link);
76  }
77  $list->addItem($lng->txt('copy'), 'copy', $this->getActionLink('copy'));
78  $list->addItem($lng->txt('link'), 'link', $this->getActionLink('link'));
79 
80  return $list->getHTML();
81  } else {
82  return "<a href=\"$link\">$title</a>";
83  }
84  }
85 
86 
92  protected function getActionLink($mode)
93  {
94  global $DIC;
95  $ilCtrl = $DIC['ilCtrl'];
96 
97  switch ($mode) {
98  case 'copy':
99  $ilCtrl->setParameterByClass('ilobjectcopygui', 'item_ref_id', $this->getRecordField()->getValue());
100  $ilCtrl->setParameterByClass('ilobjrootfoldergui', 'item_ref_id', $this->getRecordField()->getValue());
101  $ilCtrl->setParameterByClass('ilobjectcopygui', 'source_id', $this->getRecordField()->getValue());
102 
103  return $ilCtrl->getLinkTargetByClass('ilobjectcopygui', 'initTargetSelection');
104  case 'link':
105  return $ilCtrl->getLinkTargetByClass(array('ilrepositorygui', 'ilobjrootfoldergui'), 'link');
106  default:
107  return '';
108  }
109  }
110 }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
static _lookupObjId($a_id)
Class ilDclBaseRecordRepresentation.
User interface class for advanced drop-down selection lists.
$html
Definition: example_001.php:87