ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilWorkspaceShareTableGUI.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 $handler; // [ilWorkspaceAccessHandler]
17 
27  function __construct($a_parent_obj, $a_parent_cmd, $a_handler, $a_user_id, $a_parent_node_id)
28  {
29  global $ilCtrl, $lng;
30 
31  $this->handler = $a_handler;
32  $this->parent_node_id = $a_parent_node_id;
33 
34  parent::__construct($a_parent_obj, $a_parent_cmd);
35 
36  $this->setId("il_tbl_wspsh");
37 
38  $this->setTitle($lng->txt("wsp_shared_resources"));
39 
40  $this->addColumn($this->lng->txt("content"));
41 
42  $this->setDefaultOrderField("content");
43  $this->setDefaultOrderDirection("asc");
44 
45  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
46  $this->setRowTemplate("tpl.list_row.html", "Modules/WorkspaceFolder");
47 
48  $this->setDisableFilterHiding(true);
49  $this->setResetCommand("resetsharefilter");
50  $this->setFilterCommand("applysharefilter");
51 
52  $this->importData($a_user_id);
53  }
54 
60  protected function importData($a_user_id)
61  {
62  global $ilUser;
63 
64  $data = array();
65 
66  $objects = $this->handler->getSharedObjects($a_user_id);
67  if($objects)
68  {
69  foreach($objects as $wsp_id => $obj_id)
70  {
71  // #9848: flag if current share access is password-protected
73  $is_password = (!in_array($ilUser->getId(), $perms) &&
75  !in_array(ilWorkspaceAccessGUI::PERMISSION_ALL, $perms) &&
77 
78  $data[] = array(
79  "wsp_id" => $wsp_id,
80  "obj_id" => $obj_id,
81  "type" => ilObject::_lookupType($obj_id),
82  "title" => ilObject::_lookupTitle($obj_id),
83  "password" => $is_password
84  );
85  }
86  }
87 
88  $this->setData($data);
89  }
90 
96  protected function fillRow($node)
97  {
98  global $objDefinition, $ilCtrl;
99 
100  $class = $objDefinition->getClassName($node["type"]);
101  $location = $objDefinition->getLocation($node["type"]);
102  $full_class = "ilObj".$class."ListGUI";
103 
104  include_once($location."/class.".$full_class.".php");
105  $item_list_gui = new $full_class();
106 
107  $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
108  $item_list_gui->enableDelete(false);
109  $item_list_gui->enableCut(false);
110  $item_list_gui->enableSubscribe(false);
111  $item_list_gui->enablePayment(false);
112  $item_list_gui->enableLink(false);
113  $item_list_gui->enablePath(false);
114  $item_list_gui->enableLinkedPath(false);
115  $item_list_gui->enableSearchFragments(false);
116  $item_list_gui->enableRelevance(false);
117  $item_list_gui->enableIcon(true);
118  $item_list_gui->restrictToGoto(true);
119  $item_list_gui->enableInfoScreen(true);
120 
121  // files may be copied to own workspace
122  if($node["type"] == "file")
123  {
124  $ilCtrl->setParameter($this->parent_obj, "wsp_id",
125  $this->parent_node_id);
126  $ilCtrl->setParameter($this->parent_obj, "item_ref_id",
127  $node["wsp_id"]);
128  $copy = $ilCtrl->getLinkTarget($this->parent_obj, "copyshared");
129  $item_list_gui->addCustomCommand($copy, "copy");
130  }
131 
132  $item_list_gui->setContainerObject($this->parent_obj);
133 
134  if($node["password"])
135  {
136  $item_list_gui->addCustomProperty($this->lng->txt("status"),
137  $this->lng->txt("wsp_password_protected_resource"), true, true);
138  }
139 
140  if($html = $item_list_gui->getListItemHTML($node["wsp_id"], $node["obj_id"],
141  $node["title"], $node["description"], false, false, "", ilObjectListGUI::CONTEXT_WORKSPACE_SHARING))
142  {
143  $this->tpl->setVariable("ITEM_LIST_NODE", $html);
144  }
145  }
146 }
147 
148 ?>