PluginProbe
404 Solution / 4.3.3
404 Solution v4.3.3
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.3, at includes/view/View_Logs.php

165 lines 5.5 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 /**
38 * @param string $sub
39 * @param array<string, mixed> $tableOptionOverrides Internal per-request read options.
40 */
41 function getAdminLogsPageTable($sub, array $tableOptionOverrides = array()): string {
42 $tableOptions = $this->logic->settingsUpdate()->getTableOptions((string)$sub);
43 $tableOptions = array_replace($tableOptions, $tableOptionOverrides);
44 return $this->logsTable()->render((string)$sub, $tableOptions);
45 }
46
47 /**
48 * @param string $text
49 * @return string
50 */
51 public function translateTraceLabel(string $text): string {
52 return $this->traceLabels()->translate($text);
53 }
54
55 /**
56 * @param string $outcome
57 * @return string
58 */
59 public function traceOutcomeClass(string $outcome): string {
60 return $this->traceLabels()->outcomeClass($outcome);
61 }
62
63 /**
64 * @param string $sub
65 * @param array<string, array<string, string>> $columns
66 * @return string
67 */
68 function getTableColumns($sub, $columns): string {
69 return $this->columnHeaders()->render((string)$sub, $columns);
70 }
71
72 /**
73 * The pagination strip for one subpage.
74 *
75 * There is deliberately no top/bottom or show-filter argument: the strip
76 * renders the same markup wherever it is placed, and an argument that
77 * cannot change the output invites callers to render it once per
78 * placement and pay the row-count read each time.
79 *
80 * @param string $sub
81 * @param array<string, mixed> $tableOptionOverrides Internal per-request read options.
82 * @return string
83 */
84 function getPaginationLinks($sub, array $tableOptionOverrides = array()): string {
85 return $this->paginationLinks()->render((string)$sub, $tableOptionOverrides);
86 }
87
88 /**
89 * @param string $sub
90 * @param array<string, mixed> $tableOptions
91 * @return string
92 */
93 function getTabFilters($sub, $tableOptions): string {
94 return $this->statusFilterTabs()->render((string)$sub, is_array($tableOptions) ? $tableOptions : array());
95 }
96
97 /**
98 * @param string $sub
99 * @return string
100 */
101 function getSubSubSub($sub): string {
102 return $this->statusFilterTabs()->renderList((string)$sub);
103 }
104
105 private function traceLabels(): ABJ_404_Solution_AdminTraceLabels {
106 if ($this->traceLabels === null) {
107 $this->traceLabels = new ABJ_404_Solution_AdminTraceLabels();
108 }
109 return $this->traceLabels;
110 }
111
112 private function pageShell(): ABJ_404_Solution_AdminLogsPageShell {
113 if ($this->pageShell === null) {
114 $this->pageShell = new ABJ_404_Solution_AdminLogsPageShell($this->f, $this->logic, $this->shared);
115 }
116 return $this->pageShell;
117 }
118
119 private function logsTable(): ABJ_404_Solution_AdminLogsTable {
120 if ($this->logsTable === null) {
121 $this->logsTable = new ABJ_404_Solution_AdminLogsTable(
122 $this->f,
123 $this->shared,
124 $this->logger,
125 $this->logsRepository,
126 $this->traceLabels()
127 );
128 }
129 return $this->logsTable;
130 }
131
132 private function columnHeaders(): ABJ_404_Solution_AdminTableColumnHeaders {
133 if ($this->columnHeaders === null) {
134 $this->columnHeaders = new ABJ_404_Solution_AdminTableColumnHeaders(
135 $this->f, $this->logic, $this->shared, $this->viewReadService);
136 }
137 return $this->columnHeaders;
138 }
139
140 private function paginationLinks(): ABJ_404_Solution_AdminPaginationLinks {
141 if ($this->paginationLinks === null) {
142 $this->paginationLinks = new ABJ_404_Solution_AdminPaginationLinks(
143 $this->f,
144 $this->logic,
145 $this->shared,
146 $this->viewReadService
147 );
148 }
149 return $this->paginationLinks;
150 }
151
152 private function statusFilterTabs(): ABJ_404_Solution_AdminStatusFilterTabs {
153 if ($this->statusFilterTabs === null) {
154 $this->statusFilterTabs = new ABJ_404_Solution_AdminStatusFilterTabs(
155 $this->f,
156 $this->logic,
157 $this->logger,
158 $this->viewReadService,
159 $this->listTableChrome
160 );
161 }
162 return $this->statusFilterTabs;
163 }
164 }
165