ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilWorkspaceAccessTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2010 Leifos, GPL, see docs/LICENSE */
3
4include_once("./Services/Table/classes/class.ilTable2GUI.php");
5
15{
16 protected $node_id; // [int]
17 protected $handler; // [ilWorkspaceAccessHandler]
18
27 function __construct($a_parent_obj, $a_parent_cmd, $a_node_id, $a_handler)
28 {
29 global $ilCtrl, $lng;
30
31 $this->node_id = $a_node_id;
32 $this->handler = $a_handler;
33
34 parent::__construct($a_parent_obj, $a_parent_cmd);
35
36 $this->setId("il_tbl_wsacl");
37
38 $this->setTitle($lng->txt("wsp_shared_table_title"));
39
40 $this->addColumn($this->lng->txt("wsp_shared_with"), "title");
41 $this->addColumn($this->lng->txt("details"), "type");
42 $this->addColumn($this->lng->txt("actions"));
43
44 $this->setDefaultOrderField("title");
45 $this->setDefaultOrderDirection("asc");
46
47 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
48 $this->setRowTemplate("tpl.access_row.html", "Services/PersonalWorkspace");
49
50 $this->importData();
51 }
52
56 protected function importData()
57 {
58 include_once("./Services/User/classes/class.ilUserUtil.php");
59
60 $data = array();
61 foreach($this->handler->getPermissions($this->node_id) as $obj_id)
62 {
63 // title is needed for proper sorting
64 // special modes should always be on top!
65 $title = null;
66
67 switch($obj_id)
68 {
70 $caption = $this->lng->txt("wsp_set_permission_registered");
71 $title = "0".$caption;
72 break;
73
75 $caption = $this->lng->txt("wsp_set_permission_all_password");
76 $title = "0".$caption;
77 break;
78
80 $caption = $this->lng->txt("wsp_set_permission_all");
81 $title = "0".$caption;
82 break;
83
84 default:
85 $type = ilObject::_lookupType($obj_id);
86 $type_txt = $this->lng->txt("obj_".$type);
87
88 if($type === null)
89 {
90 // invalid object/user
91 }
92 else if($type != "usr")
93 {
94 $title = $caption = ilObject::_lookupTitle($obj_id);
95 }
96 else
97 {
98 $caption = ilUserUtil::getNamePresentation($obj_id, false, true);
99 $title = strip_tags($caption);
100 }
101 break;
102 }
103
104 if($title)
105 {
106 $data[] = array("id" => $obj_id,
107 "title" => $title,
108 "caption" => $caption,
109 "type" => $type_txt);
110 }
111 }
112
113 $this->setData($data);
114 }
115
121 protected function fillRow($a_set)
122 {
123 global $ilCtrl;
124
125 // properties
126 $this->tpl->setVariable("TITLE", $a_set["caption"]);
127 $this->tpl->setVariable("TYPE", $a_set["type"]);
128
129 $ilCtrl->setParameter($this->parent_obj, "obj_id", $a_set["id"]);
130 $this->tpl->setVariable("HREF_CMD",
131 $ilCtrl->getLinkTarget($this->parent_obj, "removePermission"));
132 $this->tpl->setVariable("TXT_CMD", $this->lng->txt("remove"));
133 }
134}
135
136?>
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilTable2GUI.
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.
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.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false)
Default behaviour is:
Workspace access handler table GUI class.
__construct($a_parent_obj, $a_parent_cmd, $a_node_id, $a_handler)
Constructor.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40