ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 {
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_with"));
39 
40  $this->addColumn($this->lng->txt("type"), "type");
41  $this->addColumn($this->lng->txt("title"), "title");
42  $this->addColumn($this->lng->txt("actions"));
43 
44  $this->setDefaultOrderField("type");
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  switch($obj_id)
64  {
66  $title = $icon_alt = $this->lng->txt("wsp_set_permission_registered");
67  $type = "registered";
68  $icon = "";
69  break;
70 
72  $title = $icon_alt = $this->lng->txt("wsp_set_permission_all_password");
73  $type = "all_password";
74  $icon = "";
75  break;
76 
78  $title = $icon_alt = $this->lng->txt("wsp_set_permission_all");
79  $type = "all_password";
80  $icon = "";
81  break;
82 
83  default:
84  $type = ilObject::_lookupType($obj_id);
85  $icon = ilUtil::getTypeIconPath($type, null, "tiny");
86  $icon_alt = $this->lng->txt("obj_".$type);
87 
88  if($type != "usr")
89  {
90  $title = ilObject::_lookupTitle($obj_id);
91  }
92  else
93  {
94  $title = ilUserUtil::getNamePresentation($obj_id, true, true);
95  }
96  break;
97  }
98 
99  $data[] = array("id" => $obj_id,
100  "title" => $title,
101  "type" => $type,
102  "icon" => $icon,
103  "icon_alt" => $icon_alt);
104  }
105 
106  $this->setData($data);
107  }
108 
114  protected function fillRow($a_set)
115  {
116  global $ilCtrl;
117 
118  // properties
119  $this->tpl->setVariable("TITLE", $a_set["title"]);
120  $this->tpl->setVariable("ICON", $a_set["icon"]);
121  $this->tpl->setVariable("ICON_ALT", $a_set["icon_alt"]);
122 
123  $ilCtrl->setParameter($this->parent_obj, "obj_id", $a_set["id"]);
124  $this->tpl->setVariable("HREF_CMD",
125  $ilCtrl->getLinkTarget($this->parent_obj, "removePermission"));
126  $this->tpl->setVariable("TXT_CMD", $this->lng->txt("remove"));
127  }
128 }
129 
130 ?>