ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWorkspaceAccessTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected int $node_id;
30 protected $handler;
31
40 public function __construct(
41 object $a_parent_obj,
42 string $a_parent_cmd,
43 int $a_node_id,
44 $a_handler
45 ) {
46 global $DIC;
47
48 $this->ctrl = $DIC->ctrl();
49 $this->lng = $DIC->language();
50 $ilCtrl = $DIC->ctrl();
51 $lng = $DIC->language();
52
53 $this->node_id = $a_node_id;
54 $this->handler = $a_handler;
55
56 parent::__construct($a_parent_obj, $a_parent_cmd);
57
58 $this->setId("il_tbl_wsacl");
59
60 $this->setTitle($lng->txt("wsp_shared_table_title"));
61
62 $this->addColumn($this->lng->txt("wsp_shared_with"), "title");
63 $this->addColumn($this->lng->txt("details"), "type");
64 $this->addColumn($this->lng->txt("actions"));
65
66 $this->setDefaultOrderField("title");
67 $this->setDefaultOrderDirection("asc");
68
69 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
70 $this->setRowTemplate("tpl.access_row.html", "components/ILIAS/PersonalWorkspace");
71
72 $this->importData();
73 }
74
78 protected function importData(): void
79 {
80 $data = array();
81 $caption = "";
82 $type_txt = "";
83 foreach ($this->handler->getPermissions($this->node_id) as $obj_id) {
84 // title is needed for proper sorting
85 // special modes should always be on top!
86 $title = null;
87
88 switch ($obj_id) {
90 $caption = $this->lng->txt("wsp_set_permission_registered");
91 $title = "0" . $caption;
92 break;
93
95 $caption = $this->lng->txt("wsp_set_permission_all_password");
96 $title = "0" . $caption;
97 break;
98
100 $caption = $this->lng->txt("wsp_set_permission_all");
101 $title = "0" . $caption;
102 break;
103
104 default:
105 $type = ilObject::_lookupType($obj_id);
106 $type_txt = $this->lng->txt("obj_" . $type);
107
108 if ($type == "") {
109 // invalid object/user
110 } elseif ($type !== "usr") {
111 $title = $caption = ilObject::_lookupTitle($obj_id);
112 } else {
113 $caption = ilUserUtil::getNamePresentation($obj_id, false, true);
114 $title = strip_tags($caption);
115 }
116 break;
117 }
118
119 if ($title) {
120 $data[] = array("id" => $obj_id,
121 "title" => $title,
122 "caption" => $caption,
123 "type" => $type_txt);
124 }
125 }
126
127 $this->setData($data);
128 }
129
134 protected function fillRow(array $a_set): void
135 {
136 $ilCtrl = $this->ctrl;
137
138 // properties
139 $this->tpl->setVariable("TITLE", $a_set["caption"]);
140 $this->tpl->setVariable("TYPE", $a_set["type"]);
141
142 $ilCtrl->setParameter($this->parent_obj, "obj_id", $a_set["id"]);
143 $this->tpl->setVariable(
144 "HREF_CMD",
145 $ilCtrl->getLinkTarget($this->parent_obj, "removePermission")
146 );
147 $this->tpl->setVariable("TXT_CMD", $this->lng->txt("remove"));
148 }
149}
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupType(int $id, bool $reference=false)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
ilLanguage $lng
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_node_id, $a_handler)
Constructor.
fillRow(array $a_set)
Fill table row.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26