ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ContributorTableBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28
30{
31 protected array $local_roles = [];
32 protected array $contributor_ids = [];
33
34 public function __construct(
35 protected InternalDomainService $domain,
36 protected InternalGUIService $gui,
37 protected array $roles,
38 object $parent_gui,
39 string $parent_cmd
40 ) {
41 $this->local_roles = $roles;
42 parent::__construct($parent_gui, $parent_cmd);
43 }
44
45 protected function getId(): string
46 {
47 return "contributor";
48 }
49
50 protected function getTitle(): string
51 {
52 if ($this->contributor_ids) {
53 return $this->domain->lng()->txt("blog_contributor_container_add");
54 } else {
55 return $this->domain->lng()->txt("blog_contributors");
56 }
57 }
58
59 protected function getRetrieval(): RetrievalInterface
60 {
61 return new ContributorRetrieval(
62 $this->domain->rbac()->review(),
63 $this->local_roles
64 );
65 }
66
67 protected function transformRow(array $data_row): array
68 {
69 return [
70 "id" => $data_row["id"],
71 "name" => $data_row["name"],
72 "role" => implode(", ", $data_row["role"])
73 ];
74 }
75
77 {
78 $lng = $this->domain->lng();
79
81 ->textColumn("name", $lng->txt("name"), true)
82 ->textColumn("role", $lng->txt("obj_role"));
83
84 if ($this->contributor_ids) {
86 "addContributorContainerAction",
87 $lng->txt("add")
88 );
89 } else {
91 "confirmRemoveContributor",
92 $lng->txt("remove")
93 );
94 }
95
96 return $table;
97 }
98}
transformRow(array $data_row)
transform raw data array to table row data array
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui, protected array $roles, object $parent_gui, string $parent_cmd)
textColumn(string $key, string $title, bool $sortable=false)
multiAction(string $action, string $title)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31