ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjectTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
11 {
12  protected $objects = array();
13  protected $show_path = false;
14  protected $row_selection_input = false;
15 
22  public function __construct($a_parent_obj, $a_parent_cmd, $a_id)
23  {
24  $this->setId('obj_table_' . $a_id);
25  parent::__construct($a_parent_obj, $a_parent_cmd, '');
26  }
27 
32  public function enableObjectPath($a_status)
33  {
34  $this->show_path = $a_status;
35  }
36 
41  public function enabledObjectPath()
42  {
43  return $this->show_path;
44  }
45 
51  public function customizePath(ilPathGUI $path)
52  {
53  return $path;
54  }
55 
56  public function enableRowSelectionInput($a_stat)
57  {
58  $this->row_selection_input = $a_stat;
59  }
60 
64  public function enabledRowSelectionInput()
65  {
67  }
68 
73  public function fillRowSelectionInput($set)
74  {
75  $this->tpl->setCurrentBlock('row_selection_input');
76  $this->tpl->setVariable('OBJ_INPUT_TYPE', 'checkbox');
77  $this->tpl->setVariable('OBJ_INPUT_NAME', 'id[]');
78  $this->tpl->setVariable('OBJ_INPUT_VALUE', $set['ref_id']);
79  }
80 
81 
82 
87  public function setObjects($a_ref_ids)
88  {
89  $this->objects = $a_ref_ids;
90  }
91 
96  public function getObjects()
97  {
98  return $this->objects;
99  }
100 
104  public function init()
105  {
106  if ($this->enabledRowSelectionInput()) {
107  $this->addColumn('', 'id', '5px');
108  }
109 
110  $this->addColumn($this->lng->txt('type'), 'type', '30px');
111  $this->addColumn($this->lng->txt('title'), 'title');
112 
113  $this->setOrderColumn('title');
114  $this->setRowTemplate('tpl.object_table_row.html', 'Services/Object');
115  }
116 
121  public function fillRow($set)
122  {
123  include_once './Services/Link/classes/class.ilLink.php';
124 
125  if ($this->enabledRowSelectionInput()) {
126  $this->fillRowSelectionInput($set);
127  }
128 
129  $this->tpl->setVariable('OBJ_LINK', ilLink::_getLink($set['ref_id'], $set['type']));
130  $this->tpl->setVariable('OBJ_LINKED_TITLE', $set['title']);
131  $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($set['type'], $set['obj_id']));
132  $this->tpl->setVariable('TYPE_STR', $this->lng->txt('obj_' . $set['type']));
133 
134 
135  if ($this->enabledObjectPath()) {
136  include_once './Services/Tree/classes/class.ilPathGUI.php';
137  $path_gui = new ilPathGUI();
138  $path_gui = $this->customizePath($path_gui);
139 
140  $this->tpl->setCurrentBlock('path');
141  $this->tpl->setVariable('OBJ_PATH', $path_gui->getPath(ROOT_FOLDER_ID, $set['ref_id']));
142  $this->tpl->parseCurrentBlock();
143  }
144  }
145 
149  public function parse()
150  {
151  $counter = 0;
152  $set = array();
153  foreach ($this->getObjects() as $ref_id) {
155  if ($type == 'rolf') {
156  continue;
157  }
158 
159  $set[$counter]['ref_id'] = $ref_id;
160  $set[$counter]['obj_id'] = ilObject::_lookupObjId($ref_id);
161  $set[$counter]['type'] = ilObject::_lookupType(ilObject::_lookupObjId($ref_id));
162  $set[$counter]['title'] = ilObject::_lookupTitle(ilObject::_lookupObjId($ref_id));
163  $counter++;
164  }
165  $this->setData($set);
166  }
167 }
Creates a path for a start and endnode.
$path
Definition: aliased.php:25
fillRow($set)
fill table rows
$type
__construct($a_parent_obj, $a_parent_cmd, $a_id)
Constructor.
static _lookupTitle($a_id)
lookup object title
setObjects($a_ref_ids)
set table content objects
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
setId($a_val)
Set id.
Class ilTable2GUI.
static _lookupObjId($a_id)
getObjects()
get object ref_ids
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookupType($a_id, $a_reference=false)
lookup object type
customizePath(ilPathGUI $path)
Customize path instance.
fillRowSelectionInput($set)
Fill row selection input.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
Settings for LO courses.
setOrderColumn($a_order_column=0, $a_default_column=0)
set order column public