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