ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $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 $ref_id = $item['item_id'];
52 $tmp_obj = ilObjectFactory::getInstanceByRefId($ref_id);
53
54 $data[] = array(
55 "id" => $role_item_id,
56 "type" => $tmp_obj->getType(),
57 "title" => $tmp_obj->getTitle(),
58 "desc" => $tmp_obj->getDescription(),
59 "path" => $this->formatPath($tree->getPathFull($ref_id))
60 );
61 }
62
63 $this->setData($data);
64 }
65
66 protected function formatPath($a_path_arr)
67 {
68 $counter = 0;
69
70 foreach ($a_path_arr as $data) {
71 if ($counter++) {
72 $path .= " &raquo; ";
73 }
74
75 $path .= $data['title'];
76 }
77
78 if (strlen($path) > 50) {
79 return '...' . substr($path, -50);
80 }
81
82 return $path;
83 }
84
85 public function fillRow($a_set)
86 {
87 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
88 $this->tpl->setVariable("VAL_ICON_SRC", ilObject::_getIcon("", "big", $a_set["type"]));
89 $this->tpl->setVariable("VAL_ICON_ALT", $this->lng->txt("obj_" . $a_set["type"]));
90 $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
91 $this->tpl->setVariable("VAL_DESC", $a_set["desc"]);
92 $this->tpl->setVariable("VAL_PATH", $a_set["path"]);
93 }
94}
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
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
__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.
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.
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.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
$counter
global $ilCtrl
Definition: ilias.php:18