ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ContributorTableBuilder.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Blog\Contributor;
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(),
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 
80  $table = $table
81  ->textColumn("name", $lng->txt("name"), true)
82  ->textColumn("role", $lng->txt("obj_role"));
83 
84  if ($this->contributor_ids) {
85  $table = $table->multiAction(
86  "addContributorContainerAction",
87  $lng->txt("add")
88  );
89  } else {
90  $table = $table->multiAction(
91  "confirmRemoveContributor",
92  $lng->txt("remove")
93  );
94  }
95 
96  return $table;
97  }
98 }
__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)
global $lng
Definition: privfeed.php:31