ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_once './Services/Table/classes/class.ilTable2GUI.php';
5 
13 {
14  protected $objects = array();
15  protected $show_path = FALSE;
16  protected $row_selection_input = FALSE;
17 
24  public function __construct($a_parent_obj, $a_parent_cmd, $a_id)
25  {
26  $this->setId('obj_table_'.$a_id);
27  parent::__construct($a_parent_obj, $a_parent_cmd, '');
28 
29  }
30 
35  public function enableObjectPath($a_status)
36  {
37  $this->show_path = $a_status;
38  }
39 
44  public function enabledObjectPath()
45  {
46  return $this->show_path;
47  }
48 
54  public function customizePath(ilPathGUI $path)
55  {
56  return $path;
57  }
58 
59  public function enableRowSelectionInput($a_stat)
60  {
61  $this->row_selection_input = $a_stat;
62  }
63 
67  public function enabledRowSelectionInput()
68  {
70  }
71 
76  public function fillRowSelectionInput($set)
77  {
78  $this->tpl->setCurrentBlock('row_selection_input');
79  $this->tpl->setVariable('OBJ_INPUT_TYPE','checkbox');
80  $this->tpl->setVariable('OBJ_INPUT_NAME','id[]');
81  $this->tpl->setVariable('OBJ_INPUT_VALUE',$set['ref_id']);
82  }
83 
84 
85 
90  public function setObjects($a_ref_ids)
91  {
92  $this->objects = $a_ref_ids;
93  }
94 
99  public function getObjects()
100  {
101  return $this->objects;
102  }
103 
107  public function init()
108  {
109  if($this->enabledRowSelectionInput())
110  {
111  $this->addColumn('','id','5px');
112  }
113 
114  $this->addColumn($this->lng->txt('type'), 'type','30px');
115  $this->addColumn($this->lng->txt('title'),'title');
116 
117  $this->setOrderColumn('title');
118  $this->setRowTemplate('tpl.object_table_row.html', 'Services/Object');
119 
120  }
121 
126  public function fillRow($set)
127  {
128  include_once './Services/Link/classes/class.ilLink.php';
129 
130  if($this->enabledRowSelectionInput())
131  {
132  $this->fillRowSelectionInput($set);
133  }
134 
135  $this->tpl->setVariable('OBJ_LINK',ilLink::_getLink($set['ref_id'], $set['type']));
136  $this->tpl->setVariable('OBJ_LINKED_TITLE',$set['title']);
137  $this->tpl->setVariable('TYPE_IMG',ilUtil::getTypeIconPath($set['type'], $set['obj_id']));
138  $this->tpl->setVariable('TYPE_STR',$this->lng->txt('obj_'.$set['type']));
139 
140 
141  if($this->enabledObjectPath())
142  {
143  include_once './Services/Tree/classes/class.ilPathGUI.php';
144  $path_gui = new ilPathGUI();
145  $path_gui = $this->customizePath($path_gui);
146 
147  $this->tpl->setCurrentBlock('path');
148  $this->tpl->setVariable('OBJ_PATH',$path_gui->getPath(ROOT_FOLDER_ID, $set['ref_id']));
149  $this->tpl->parseCurrentBlock();
150  }
151  }
152 
156  public function parse()
157  {
158  $counter = 0;
159  $set = array();
160  foreach($this->getObjects() as $ref_id)
161  {
163  if($type == 'rolf')
164  {
165  continue;
166  }
167 
168  $set[$counter]['ref_id'] = $ref_id;
169  $set[$counter]['obj_id'] = ilObject::_lookupObjId($ref_id);
170  $set[$counter]['type'] = ilObject::_lookupType(ilObject::_lookupObjId($ref_id));
171  $set[$counter]['title'] = ilObject::_lookupTitle(ilObject::_lookupObjId($ref_id));
172  $counter++;
173  }
174  $GLOBALS['ilLog']->write(__METHOD__.': '.print_r($set,TRUE));
175 
176  $this->setData($set);
177  }
178 }
Creates a path for a start and endnode.
$path
Definition: aliased.php:25
fillRow($set)
fill table rows
__construct($a_parent_obj, $a_parent_cmd, $a_id)
Constructor.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
$counter
Class ilTable2GUI.
static _lookupObjId($a_id)
getObjects()
get object ref_ids
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
customizePath(ilPathGUI $path)
Customize path instance.
fillRowSelectionInput($set)
Fill row selection input.
$ref_id
Definition: sahs_server.php:39
Settings for LO courses.
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.
setOrderColumn($a_order_column=0, $a_default_column=0)
set order column public