ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilRoleDesktopItemsTableGUI.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 
16 {
17  public function __construct($a_parent_obj,$a_parent_cmd,$a_object)
18  {
19  global $ilCtrl,$tpl;
20 
21  $this->setId('objrolepd');
22 
23  parent::__construct($a_parent_obj,$a_parent_cmd);
24 
25  $this->setTitle($this->lng->txt('role_assigned_desk_items').' ('.$a_object->getTitle().')');
26 
27  $this->addColumn('', '', 1);
28  $this->addColumn($this->lng->txt('title'), 'title');
29  $this->addColumn($this->lng->txt('desc'));
30  $this->addColumn($this->lng->txt('path'));
31 
32  $this->setRowTemplate("tpl.role_desktop_item_list.html", "Services/AccessControl");
33  $this->setDefaultOrderField('title');
34 
35  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
36  $this->addMultiCommand('askDeleteDesktopItem', $this->lng->txt('delete'));
37  $this->setSelectAllCheckbox('del_desk_item');
38 
39  $this->getItems($a_object->getId());
40  }
41 
42  protected function getItems($a_obj_id)
43  {
44  global $tree;
45 
46  $data = array();
47 
48  include_once 'Services/AccessControl/classes/class.ilRoleDesktopItem.php';
49  $role_desk_item_obj = new ilRoleDesktopItem($a_obj_id);
50  foreach($role_desk_item_obj->getAll() as $role_item_id => $item)
51  {
52  $ref_id = $item['item_id'];
54 
55  $data[] = array(
56  "id" => $role_item_id,
57  "type" => $tmp_obj->getType(),
58  "title" => $tmp_obj->getTitle(),
59  "desc" => $tmp_obj->getDescription(),
60  "path" => $this->formatPath($tree->getPathFull($ref_id))
61  );
62  }
63 
64  $this->setData($data);
65  }
66 
67  protected function formatPath($a_path_arr)
68  {
69  $counter = 0;
70 
71  foreach ($a_path_arr as $data)
72  {
73  if ($counter++)
74  {
75  $path .= " &raquo; ";
76  }
77 
78  $path .= $data['title'];
79  }
80 
81  if (strlen($path) > 50)
82  {
83  return '...'.substr($path,-50);
84  }
85 
86  return $path;
87  }
88 
89  public function fillRow($a_set)
90  {
91  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
92  $this->tpl->setVariable("VAL_ICON_SRC", ilObject::_getIcon("", "big", $a_set["type"]));
93  $this->tpl->setVariable("VAL_ICON_ALT", $this->lng->txt("obj_".$a_set["type"]));
94  $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
95  $this->tpl->setVariable("VAL_DESC", $a_set["desc"]);
96  $this->tpl->setVariable("VAL_PATH", $a_set["path"]);
97  }
98 }
99 ?>
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
$path
Definition: aliased.php:25
Class ilObjRoleGUI.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setId($a_val)
Set id.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
$counter
Class ilTable2GUI.
__construct($a_parent_obj, $a_parent_cmd, $a_object)
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
$ref_id
Definition: sahs_server.php:39
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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.