PluginProbe
404 Solution / 4.3.0
404 Solution v4.3.0
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / view / View_Logs.php

View_Logs.php in 404 Solution 4.3.0, at includes/view/View_Logs.php

154 lines 4.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 require_once __DIR__ . '/../admin/AdminTraceLabels.php';
8 require_once __DIR__ . '/../admin/AdminLogsPageShell.php';
9 require_once __DIR__ . '/../admin/AdminLogsTable.php';
10 require_once __DIR__ . '/../admin/AdminTableColumnHeaders.php';
11 require_once __DIR__ . '/../admin/AdminPaginationLinks.php';
12 require_once __DIR__ . '/../admin/AdminStatusFilterTabs.php';
13
14 /**
15 * Public View facade methods for logs, pagination, and status filters.
16 */
17 class ABJ_404_Solution_View_Logs extends ABJ_404_Solution_ViewComponent {
18
19 /** @var ABJ_404_Solution_AdminTraceLabels|null */
20 private $traceLabels = null;
21 /** @var ABJ_404_Solution_AdminLogsPageShell|null */
22 private $pageShell = null;
23 /** @var ABJ_404_Solution_AdminLogsTable|null */
24 private $logsTable = null;
25 /** @var ABJ_404_Solution_AdminTableColumnHeaders|null */
26 private $columnHeaders = null;
27 /** @var ABJ_404_Solution_AdminPaginationLinks|null */
28 private $paginationLinks = null;
29 /** @var ABJ_404_Solution_AdminStatusFilterTabs|null */
30 private $statusFilterTabs = null;
31
32 /** @return void */
33 function echoAdminLogsPage() {
34 echo $this->pageShell()->render();
35 }
36
37 /** @param string $sub */
38 function getAdminLogsPageTable($sub): string {
39 $tableOptions = $this->logic->settingsUpdate()->getTableOptions((string)$sub);
40 return $this->logsTable()->render((string)$sub, $tableOptions);
41 }
42
43 /**
44 * @param string $text
45 * @return string
46 */
47 public function translateTraceLabel(string $text): string {
48 return $this->traceLabels()->translate($text);
49 }
50
51 /**
52 * @param string $outcome
53 * @return string
54 */
55 public function traceOutcomeClass(string $outcome): string {
56 return $this->traceLabels()->outcomeClass($outcome);
57 }
58
59 /**
60 * @param string $sub
61 * @param array<string, array<string, string>> $columns
62 * @return string
63 */
64 function getTableColumns($sub, $columns): string {
65 return $this->columnHeaders()->render((string)$sub, $columns);
66 }
67
68 /**
69 * @param string $sub
70 * @param bool $showSearchFilter Preserved for backward compatibility; pagination strips no longer render filters.
71 * @return string
72 */
73 function getPaginationLinks($sub, $showSearchFilter = true): string {
74 return $this->paginationLinks()->render((string)$sub);
75 }
76
77 /**
78 * @param string $sub
79 * @param array<string, mixed> $tableOptions
80 * @return string
81 */
82 function getTabFilters($sub, $tableOptions): string {
83 return $this->statusFilterTabs()->render((string)$sub, is_array($tableOptions) ? $tableOptions : array());
84 }
85
86 /**
87 * @param string $sub
88 * @return string
89 */
90 function getSubSubSub($sub): string {
91 return $this->statusFilterTabs()->renderList((string)$sub);
92 }
93
94 private function traceLabels(): ABJ_404_Solution_AdminTraceLabels {
95 if ($this->traceLabels === null) {
96 $this->traceLabels = new ABJ_404_Solution_AdminTraceLabels();
97 }
98 return $this->traceLabels;
99 }
100
101 private function pageShell(): ABJ_404_Solution_AdminLogsPageShell {
102 if ($this->pageShell === null) {
103 $this->pageShell = new ABJ_404_Solution_AdminLogsPageShell($this->f, $this->logic, $this->shared);
104 }
105 return $this->pageShell;
106 }
107
108 private function logsTable(): ABJ_404_Solution_AdminLogsTable {
109 if ($this->logsTable === null) {
110 $this->logsTable = new ABJ_404_Solution_AdminLogsTable(
111 $this->f,
112 $this->shared,
113 $this->logger,
114 $this->logsRepository,
115 $this->traceLabels()
116 );
117 }
118 return $this->logsTable;
119 }
120
121 private function columnHeaders(): ABJ_404_Solution_AdminTableColumnHeaders {
122 if ($this->columnHeaders === null) {
123 $this->columnHeaders = new ABJ_404_Solution_AdminTableColumnHeaders(
124 $this->f, $this->logic, $this->shared, $this->viewReadService);
125 }
126 return $this->columnHeaders;
127 }
128
129 private function paginationLinks(): ABJ_404_Solution_AdminPaginationLinks {
130 if ($this->paginationLinks === null) {
131 $this->paginationLinks = new ABJ_404_Solution_AdminPaginationLinks(
132 $this->f,
133 $this->logic,
134 $this->shared,
135 $this->viewReadService
136 );
137 }
138 return $this->paginationLinks;
139 }
140
141 private function statusFilterTabs(): ABJ_404_Solution_AdminStatusFilterTabs {
142 if ($this->statusFilterTabs === null) {
143 $this->statusFilterTabs = new ABJ_404_Solution_AdminStatusFilterTabs(
144 $this->f,
145 $this->logic,
146 $this->logger,
147 $this->viewReadService,
148 $this->listTableChrome
149 );
150 }
151 return $this->statusFilterTabs;
152 }
153 }
154