ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ImportantPagesTableBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Wiki\Page;
22
28
30{
31 public function __construct(
32 protected InternalDomainService $domain,
33 protected InternalGUIService $gui,
34 protected int $ref_id,
35 protected int $wiki_id,
36 protected string $start_page,
37 object $parent_gui,
38 string $parent_cmd
39 ) {
40 parent::__construct($parent_gui, $parent_cmd);
41 }
42
43 protected function getId(): string
44 {
45 return "wiki_important_pages";
46 }
47
48 protected function getTitle(): string
49 {
50 return "";
51 }
52
53 protected function getRetrieval(): RetrievalInterface
54 {
55 return $this->domain->page()->importantPagesRetrieval(
56 $this->ref_id,
57 $this->wiki_id,
58 $this->start_page
59 );
60 }
61
62 protected function getOrderingCommand(): string
63 {
64 return "saveOrderingAndIndent";
65 }
66
67 protected function transformRow(array $data_row): array
68 {
69 return [
70 "id" => $data_row["id"],
71 "title" => $data_row["title"],
72 "indentation" => (string) $data_row["indentation"],
73 "purpose" => $data_row["purpose"]
74 ];
75 }
76
77 protected function activeAction(string $action, array $data_row): bool
78 {
79 if ((int) $data_row["id"] === 0 && in_array(
80 $action,
81 ["confirmRemoveImportantPages", "setAsStartPage", "editIndentation"],
82 true
83 )) {
84 return false;
85 }
86
87 return true;
88 }
89
91 {
92 $lng = $this->domain->lng();
93
94 return $table
95 ->textColumn("indentation", $lng->txt("wiki_indentation"))
96 ->textColumn("title", $lng->txt("wiki_page"))
97 ->textColumn("purpose", $lng->txt("wiki_purpose"))
98 ->singleAction("editIndentation", $lng->txt("wiki_indentation"), true)
99 ->multiAction("confirmRemoveImportantPages", $lng->txt("remove"), true)
100 ->multiAction("setAsStartPage", $lng->txt("wiki_set_as_start_page"));
101 }
102}
textColumn(string $key, string $title, bool $sortable=false)
transformRow(array $data_row)
transform raw data array to table row data array
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui, protected int $ref_id, protected int $wiki_id, protected string $start_page, object $parent_gui, string $parent_cmd)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:26