ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  } elseif ($field->getProperty(ilDclBaseFieldModel::PROP_ILIAS_REFERENCE_LINK)) {
28  $html = $this->getLinkHTML($title);
29  } else {
30  $html = $title;
31  }
32  return $html;
33  }
34 
35 
36  public function getSingleHTML(array $options = null, $link = true)
37  {
38  $value = $this->getRecordField()->getValue();
39  if (!$value) {
40  return '';
41  }
42  $id = ilObject::_lookupObjId($value);
43  $value = ilObject::_lookupTitle($id);
45  return $this->getLinkHTML($value);
46  }
47  return $value;
48  }
49 
50 
56  public function getLinkHTML($title, $show_action_menu=false)
57  {
58  global $DIC;
59  $lng = $DIC['lng'];
60  $this->getRecordField();
61  $link = ilLink::_getStaticLink($this->getRecordField()->getValue());
62  if ($show_action_menu) {
63  $field = $this->getRecordField()->getField();
64  $record = $this->getRecordField()->getRecord();
65 
67  $list->setId('adv_list_copy_link_' . $field->getId() . $record->getId());
68  $list->setListTitle($title);
69  if ($field->getProperty(ilDclBaseFieldModel::PROP_ILIAS_REFERENCE_LINK)) {
70  $list->addItem($lng->txt('view'), 'view', $link);
71  }
72  $list->addItem($lng->txt('copy'), 'copy', $this->getActionLink('copy'));
73  $list->addItem($lng->txt('link'), 'link', $this->getActionLink('link'));
74  return $list->getHTML();
75  } else {
76  return "<a href=\"$link\">$title</a>";
77  }
78  }
79 
84  protected function getActionLink($mode)
85  {
86  global $DIC;
87  $ilCtrl = $DIC['ilCtrl'];
88 
89  switch ($mode) {
90  case 'copy':
91  $ilCtrl->setParameterByClass('ilobjectcopygui', 'item_ref_id', $this->getRecordField()->getValue());
92  $ilCtrl->setParameterByClass('ilobjrootfoldergui', 'item_ref_id', $this->getRecordField()->getValue());
93  $ilCtrl->setParameterByClass('ilobjectcopygui', 'source_id', $this->getRecordField()->getValue());
94  return $ilCtrl->getLinkTargetByClass('ilobjectcopygui', 'initTargetSelection');
95  case 'link':
96  return $ilCtrl->getLinkTargetByClass(array('ilrepositorygui','ilobjrootfoldergui'), 'link');
97  default:
98  return '';
99  }
100  }
101 }
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)
Create styles array
The data for the language used.
Class ilDclBaseRecordRepresentation.
User interface class for advanced drop-down selection lists.
$html
Definition: example_001.php:87
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20