ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilDataCollectionILIASRefField.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once 'class.ilDataCollectionRecordField.php';
6require_once("./Services/Rating/classes/class.ilRatingGUI.php");
7require_once("./Services/Link/classes/class.ilLink.php");
8require_once('./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php');
9
22
26 protected $dcl_obj_id;
27
31 protected $properties = array();
32
34 parent::__construct($record, $field);
35 $dclTable = ilDataCollectionCache::getTableCache($this->getField()->getTableId());
36 $this->dcl_obj_id = $dclTable->getCollectionObject()->getId();
37 $this->properties = $field->getProperties();
38 }
39
40
45 public function getHTML(array $options = array()){
46 $value = $this->getValue();
47 if (!$value) {
48 return '';
49 }
53 $html = $this->getLinkHTML($title, true);
54 } else if ($this->properties[ilDataCollectionField::PROPERTYID_ILIAS_REFERENCE_LINK]) {
55 $html = $this->getLinkHTML($title);
56 } else {
57 $html = $title;
58 }
59 return $html;
60 }
61
62
63 public function getSingleHTML(array $options=array())
64 {
65 $value = $this->getValue();
66 if (!$value) {
67 return '';
68 }
72 return $this->getLinkHTML($title);
73 }
74 return $title;
75 }
76
77
83 public function getLinkHTML($title, $show_action_menu=false) {
84 global $lng;
85 $link = ilLink::_getStaticLink($this->getValue());
86 if ($show_action_menu) {
87 $list = new ilAdvancedSelectionListGUI();
88 $list->setId('adv_list_copy_link_' . $this->field->getId() . $this->record->getId());
89 $list->setListTitle($title);
91 $list->addItem($lng->txt('view'), 'view', $link);
92 }
93 $list->addItem($lng->txt('copy'), 'copy', $this->getActionLink('copy'));
94 $list->addItem($lng->txt('link'), 'link', $this->getActionLink('link'));
95 return $list->getHTML();
96 } else {
97 return "<a href=\"$link\">$title</a>";
98 }
99 }
100
101 public function getExportValue(){
102 $value = $this->getValue();
104 return $link;
105 }
106
107 public function getStatus(){
108 global $ilDB, $ilUser;
109 $usr_id = $ilUser->getId();
110 $obj_ref = $this->getValue();
111 $obj_id = ilObject2::_lookupObjectId($obj_ref);
112 $query = " SELECT status_changed, status
113 FROM ut_lp_marks
114 WHERE usr_id = ".$usr_id." AND obj_id = ".$obj_id."
115";
116 $result = $ilDB->query($query);
117 return ($result->numRows() == 0)? false:$result->fetchRow(DB_FETCHMODE_OBJECT);
118 }
119
120
125 protected function getActionLink($mode)
126 {
127 global $ilCtrl;
128 switch ($mode) {
129 case 'copy':
130 $ilCtrl->setParameterByClass('ilobjectcopygui', 'item_ref_id', $this->getValue());
131 $ilCtrl->setParameterByClass('ilobjrootfoldergui', 'item_ref_id', $this->getValue());
132 $ilCtrl->setParameterByClass('ilobjectcopygui', 'source_id', $this->getValue());
133 return $ilCtrl->getLinkTargetByClass('ilobjectcopygui', 'initTargetSelection');
134 case 'link':
135 return $ilCtrl->getLinkTargetByClass(array('ilrepositorygui','ilobjrootfoldergui'), 'link');
136 default:
137 return '';
138 }
139 }
140
141}
142?>
$result
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
User interface class for advanced drop-down selection lists.
Class ilDataCollectionField.
getLinkHTML($title, $show_action_menu=false)
__construct(ilDataCollectionRecord $record, ilDataCollectionField $field)
Class ilDataCollectionRecord.
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
$html
Definition: example_001.php:87
global $ilCtrl
Definition: ilias.php:18
global $ilDB
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15