ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
WorkspaceShareTableBuilder.php
Go to the documentation of this file.
1<?php
2
14declare(strict_types=1);
15
17
21
23{
24 public function __construct(
25 protected InternalDomainService $domain,
26 protected InternalGUIService $gui,
28 protected bool $portfolio_mode,
29 protected int $parent_node_id,
30 protected array $crs_ids,
31 protected array $grp_ids,
32 object $parent_gui,
33 string $parent_cmd
34 ) {
35 parent::__construct($parent_gui, $parent_cmd, $portfolio_mode ? false : true);
36 }
37
38 protected function getId(): string
39 {
40 return "workspace_share_" . (int) $this->portfolio_mode;
41 }
42
43 protected function getTitle(): string
44 {
45 return $this->domain->lng()->txt("wsp_shared_resources");
46 }
47
48 protected function getRetrieval(): RetrievalInterface
49 {
50 return $this->domain->workspaceShareRetrieval(
51 $this->handler,
52 $this->portfolio_mode,
53 $this->crs_ids,
54 $this->grp_ids
55 );
56 }
57
58 protected function transformRow(array $data_row): array
59 {
60 $ui_factory = $this->gui->ui()->factory();
61 $row = [
62 "id" => $data_row["id"],
63 "lastname" => $data_row["lastname"],
64 "firstname" => $data_row["firstname"],
65 "login" => $data_row["login"],
66 "acl_date" => new \DateTimeImmutable("@" . $data_row["acl_date"]),
67 "title" => $ui_factory->link()->standard(
68 $data_row["title"],
69 $this->getTitleLink($data_row)
70 ),
71 "acl_type" => implode(", ", $this->getAclTitles($data_row["acl_type"]))
72 ];
73
74 if (!$this->portfolio_mode) {
75 $row["obj_type"] = $data_row["obj_type"];
76 $row["type_icon"] = $ui_factory->symbol()->icon()->standard($data_row["type"], "");
77 }
78
79 return $row;
80 }
81
83 {
84 $lng = $this->domain->lng();
86 ->textColumn("lastname", $lng->txt("lastname"), true)
87 ->textColumn("firstname", $lng->txt("firstname"), true)
88 ->textColumn("login", $lng->txt("login"), true);
89
90 if (!$this->portfolio_mode) {
92 ->iconColumn("type_icon", $lng->txt("wsp_shared_object_type"))
93 ->textColumn("obj_type", $lng->txt("wsp_shared_object_type"), true);
94 }
95
97 ->dateColumn("acl_date", $lng->txt("wsp_shared_date"), true)
98 ->linkColumn("title", $lng->txt("wsp_shared_title"), true)
99 ->textColumn("acl_type", $lng->txt("wsp_shared_type"));
100
101 if ($this->portfolio_mode) {
102 return $table->singleAction(
103 "redirectSendMailToSharer",
104 $lng->txt("wsp_send_mail")
105 );
106 }
107
109 "copyShared",
110 $lng->txt("copy"),
111 [get_class($this->parent_gui)],
112 "copyShared",
113 "item_ref_id"
114 );
115 }
116
117 protected function activeAction(string $action, array $data_row): bool
118 {
119 return $this->portfolio_mode || ($action === "copyShared" && $data_row["type"] === "file");
120 }
121
122 protected function getTitleLink(array $data_row): string
123 {
124 if ($this->portfolio_mode) {
125 return \ilLink::_getStaticLink($data_row["obj_id"], "prtf", true);
126 }
127
128 return $this->handler->getGotoLink($data_row["wsp_id"], $data_row["obj_id"]);
129 }
130
131 protected function getAclTitles(array $acl_types): array
132 {
133 $titles = [];
134 asort($acl_types);
135 foreach ($acl_types as $obj_id) {
136 switch ($obj_id) {
137 case \ilWorkspaceAccessGUI::PERMISSION_REGISTERED:
138 $titles[] = $this->domain->lng()->txt("wsp_set_permission_registered");
139 break;
140 case \ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD:
141 $titles[] = $this->domain->lng()->txt("wsp_set_permission_all_password");
142 break;
143 case \ilWorkspaceAccessGUI::PERMISSION_ALL:
144 $titles[] = $this->domain->lng()->txt("wsp_set_permission_all");
145 break;
146 default:
147 $type = \ilObject::_lookupType($obj_id);
148 $titles[] = $type === "usr"
149 ? \ilUserUtil::getNamePresentation($obj_id, false, true)
150 : \ilObject::_lookupTitle($obj_id);
151 break;
152 }
153 }
154
155 return $titles;
156 }
157}
PersonalWorkspace internal domain service.
PersonalWorkspace internal ui service.
transformRow(array $data_row)
transform raw data array to table row data array
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui, protected \ilWorkspaceAccessHandler|\ilPortfolioAccessHandler $handler, protected bool $portfolio_mode, protected int $parent_node_id, protected array $crs_ids, protected array $grp_ids, object $parent_gui, string $parent_cmd)
textColumn(string $key, string $title, bool $sortable=false)
singleAction(string $action, string $title, bool $async=false)
dateColumn(string $key, string $title, bool $sortable=false)
singleRedirectAction(string $action, string $title, array $class_path, string $cmd="", string $id_param="", bool $async=false)
iconColumn(string $key, string $title, bool $sortable=false)
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,...
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(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$handler
Definition: oai.php:31
global $lng
Definition: privfeed.php:26