ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.ilWorkspaceAccessTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected int $node_id;
28
37 public function __construct(
38 object $a_parent_obj,
39 string $a_parent_cmd,
40 int $a_node_id,
41 $a_handler
42 ) {
43 global $DIC;
44
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $DIC->language();
47 $ilCtrl = $DIC->ctrl();
48 $lng = $DIC->language();
49
50 $this->node_id = $a_node_id;
51 $this->handler = $a_handler;
52
53 parent::__construct($a_parent_obj, $a_parent_cmd);
54
55 $this->setId("il_tbl_wsacl");
56
57 $this->setTitle($lng->txt("wsp_shared_table_title"));
58
59 $this->addColumn($this->lng->txt("wsp_shared_with"), "title");
60 $this->addColumn($this->lng->txt("details"), "type");
61 $this->addColumn($this->lng->txt("actions"));
62
63 $this->setDefaultOrderField("title");
64 $this->setDefaultOrderDirection("asc");
65
66 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
67 $this->setRowTemplate("tpl.access_row.html", "components/ILIAS/PersonalWorkspace");
68
69 $this->importData();
70 }
71
75 protected function importData(): void
76 {
77 $data = array();
78 $caption = "";
79 $type_txt = "";
80 foreach ($this->handler->getPermissions($this->node_id) as $obj_id) {
81 // title is needed for proper sorting
82 // special modes should always be on top!
83 $title = null;
84
85 switch ($obj_id) {
87 $caption = $this->lng->txt("wsp_set_permission_registered");
88 $title = "0" . $caption;
89 break;
90
92 $caption = $this->lng->txt("wsp_set_permission_all_password");
93 $title = "0" . $caption;
94 break;
95
97 $caption = $this->lng->txt("wsp_set_permission_all");
98 $title = "0" . $caption;
99 break;
100
101 default:
102 $type = ilObject::_lookupType($obj_id);
103 $type_txt = $this->lng->txt("obj_" . $type);
104
105 if ($type == "") {
106 // invalid object/user
107 } elseif ($type !== "usr") {
108 $title = $caption = ilObject::_lookupTitle($obj_id);
109 } else {
110 $caption = ilUserUtil::getNamePresentation($obj_id, false, true);
111 $title = strip_tags($caption);
112 }
113 break;
114 }
115
116 if ($title) {
117 $data[] = array("id" => $obj_id,
118 "title" => $title,
119 "caption" => $caption,
120 "type" => $type_txt);
121 }
122 }
123
124 $this->setData($data);
125 }
126
131 protected function fillRow(array $a_set): void
132 {
133 $ilCtrl = $this->ctrl;
134
135 // properties
136 $this->tpl->setVariable("TITLE", $a_set["caption"]);
137 $this->tpl->setVariable("TYPE", $a_set["type"]);
138
139 $ilCtrl->setParameter($this->parent_obj, "obj_id", $a_set["id"]);
140 $this->tpl->setVariable(
141 "HREF_CMD",
142 $ilCtrl->getLinkTarget($this->parent_obj, "removePermission")
143 );
144 $this->tpl->setVariable("TXT_CMD", $this->lng->txt("remove"));
145 }
146}
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)
Access handler for portfolio NOTE: This file needs to stay in the classes directory,...
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...
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.
ilPortfolioAccessHandler ilWorkspaceAccessHandler $handler
fillRow(array $a_set)
Fill table row.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26