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