ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
PageTemplateTableBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Wiki\Page;
22
27
29{
30 protected PageManager $pm;
32
33 public function __construct(
34 protected \ILIAS\Wiki\InternalDomainService $domain,
35 protected \ILIAS\Wiki\InternalGUIService $gui,
36 protected int $wiki_id,
37 object $parent_gui,
38 string $parent_cmd
39 ) {
40 $ref_id = $this->gui->request()->getRefId();
41 $this->translations = $this->domain->wiki()->translation($ref_id);
42 $this->pm = $this->domain->page()->page($ref_id);
43
44 parent::__construct($parent_gui, $parent_cmd);
45 }
46
47 protected function getId(): string
48 {
49 return 'wiki_page_templates_' . $this->wiki_id;
50 }
51
52 protected function getTitle(): string
53 {
54 return '';
55 }
56
57 protected function getRetrieval(): RetrievalInterface
58 {
59 return $this->domain->page()->pageTemplateRetrieval($this->wiki_id);
60 }
61
62 protected function transformRow(array $data_row): array
63 {
64 $lng = $this->domain->lng();
65
66 return [
67 'id' => $data_row['id'],
68 'title' => $data_row['title'],
69 'translations' => $this->translations->getContentTranslationActivated()
70 ? implode(', ', $this->pm->getLanguages((int) $data_row['wpage_id']))
71 : '',
72 'new_pages' => $data_row['new_pages'] ? $lng->txt('yes') : $lng->txt('no'),
73 'add_to_page' => $data_row['add_to_page'] ? $lng->txt('yes') : $lng->txt('no')
74 ];
75 }
76
78 {
79 $lng = $this->domain->lng();
80
82 ->textColumn('title', $lng->txt('title'), true);
83
84 if ($this->translations->getContentTranslationActivated()) {
86 'translations',
87 $lng->txt('wiki_translations')
88 );
89 }
90
91 return $table
92 ->textColumn('new_pages', $lng->txt('wiki_templ_new_pages'))
93 ->textColumn('add_to_page', $lng->txt('wiki_templ_add_to_page'))
94 ->singleAction('toggleNewPages', $lng->txt('wiki_templ_new_pages'))
95 ->singleAction('toggleAddToPage', $lng->txt('wiki_templ_add_to_page'))
96 ->multiAction(
97 'confirmRemove',
98 $lng->txt('wiki_remove_template_status'),
99 true
100 );
101 }
102}
Class handles translation mode for an object.
textColumn(string $key, string $title, bool $sortable=false)
__construct(protected \ILIAS\Wiki\InternalDomainService $domain, protected \ILIAS\Wiki\InternalGUIService $gui, protected int $wiki_id, object $parent_gui, string $parent_cmd)
transformRow(array $data_row)
transform raw data array to table row data array
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:26