dbXapp 2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Loading...
Searching...
No Matches
dbxAdminHelp.class.php
Go to the documentation of this file.
1<?php
2namespace dbx\dbxAdmin;
3
5
6 private function tpl() {
7 return dbx()->get_system_obj('dbxTPL');
8 }
9
10 private function h($value) {
11 return htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
12 }
13
14 public function topics() {
15 return array(
16 'dashboard' => array('title' => 'Admin Dashboard', 'tpl' => 'admin-help-dashboard'),
17 'cache' => array('title' => 'Page-Cache', 'tpl' => 'admin-help-cache'),
18 'dd_list' => array('title' => 'DataDic Sync', 'tpl' => 'admin-help-dd-list'),
19 'dd_fields' => array('title' => 'DD Feldvergleich', 'tpl' => 'admin-help-dd-fields'),
20 'dd_backup' => array('title' => 'DB Backup & Restore', 'tpl' => 'admin-help-dd-backup'),
21 'db_list' => array('title' => 'DB Sync', 'tpl' => 'admin-help-db-list'),
22 'edit_dd' => array('title' => 'DD Editor', 'tpl' => 'admin-help-edit-dd'),
23 'edit_fd' => array('title' => 'FD Editor', 'tpl' => 'admin-help-edit-fd'),
24 'server' => array('title' => 'Datenbank-Server', 'tpl' => 'admin-help-server'),
25 'server_tables' => array('title' => 'Server-Tabellen', 'tpl' => 'admin-help-server-tables'),
26 'modules_list' => array('title' => 'Module verwalten', 'tpl' => 'admin-help-modules-list'),
27 'modules_new' => array('title' => 'Neues Modul', 'tpl' => 'admin-help-modules-new'),
28 'modules_access' => array('title' => 'Modul-Zugriff', 'tpl' => 'admin-help-modules-access'),
29 'config' => array('title' => 'System-Konfiguration', 'tpl' => 'admin-help-config'),
30 'session' => array('title' => 'Sessions', 'tpl' => 'admin-help-session'),
31 'trace' => array('title' => 'Trace / Historie', 'tpl' => 'admin-help-trace'),
32 'sysmsg' => array('title' => 'System-Meldungen', 'tpl' => 'admin-help-sysmsg'),
33 'missing' => array('title' => 'Missing Files', 'tpl' => 'admin-help-missing'),
34 'contact' => array('title' => 'Kontaktanfragen', 'tpl' => 'admin-help-contact'),
35 'user' => array('title' => 'Benutzer & Gruppen', 'tpl' => 'admin-help-user'),
36 'export_sql' => array('title' => 'SQL Export', 'tpl' => 'admin-help-export-sql'),
37 'datadic' => array('title' => 'DataDic Uebersicht', 'tpl' => 'admin-help-datadic'),
38 'workflow_list' => array('title' => 'Workflow Definitionen', 'tpl' => 'admin-help-workflow-list'),
39 'workflow_edit' => array('title' => 'Workflow bearbeiten', 'tpl' => 'admin-help-workflow-edit'),
40 'workflow_binds' => array('title' => 'Modul-Bindings', 'tpl' => 'admin-help-workflow-binds'),
41 'workflow_bind_edit' => array('title' => 'Binding bearbeiten', 'tpl' => 'admin-help-workflow-bind-edit'),
42 'workflow_instances' => array('title' => 'Workflow Instanzen', 'tpl' => 'admin-help-workflow-instances'),
43 'workflow_install' => array('title' => 'Workflow Install', 'tpl' => 'admin-help-workflow-install'),
44 'content' => array('title' => 'Content CMS — Benutzerhandbuch', 'tpl' => 'admin-help-content'),
45 'content_lng' => array('title' => 'Sprachen & Uebersetzung — Benutzerhandbuch', 'tpl' => 'admin-help-content-lng'),
46 'user_admin' => array('title' => 'Benutzer-Administration', 'tpl' => 'admin-help-user-admin'),
47 'user_profil' => array('title' => 'Mein Profil', 'tpl' => 'admin-help-user-profil'),
48 'user_group_form' => array('title' => 'Benutzergruppe', 'tpl' => 'admin-help-user-group'),
49 'consent_privacy' => array('title' => 'Datenschutz-Einstellungen', 'tpl' => 'admin-help-consent-privacy'),
50 'impressum' => array('title' => 'Impressum', 'tpl' => 'admin-help-impressum'),
51 );
52 }
53
54 public function barMeta($topic = '') {
55 if ($topic === '') {
56 $topic = $this->resolveTopic();
57 }
58 $topic = trim((string)$topic);
59 $topics = $this->topics();
60 if ($topic === '' || !isset($topics[$topic])) {
61 return null;
62 }
63
64 $icons = array(
65 'dashboard' => array('icon' => 'bi-speedometer2', 'subtitle' => 'Systemstatus, Datenbanken und Aktivitaeten'),
66 'cache' => array('icon' => 'bi-lightning-charge', 'subtitle' => 'Statische Content-Seiten beschleunigen'),
67 'dd_list' => array('icon' => 'bi-journal-code', 'subtitle' => 'DD-Dateien mit Datenbankstruktur abgleichen'),
68 'dd_fields' => array('icon' => 'bi-list-columns', 'subtitle' => 'Felddefinitionen vergleichen'),
69 'dd_backup' => array('icon' => 'bi-archive', 'subtitle' => 'Datenbank sichern und wiederherstellen'),
70 'db_list' => array('icon' => 'bi-database', 'subtitle' => 'Tabellen und Datensaetze verwalten'),
71 'edit_dd' => array('icon' => 'bi-journal-code', 'subtitle' => 'Tabellen-Metadaten und Felder pflegen'),
72 'edit_fd' => array('icon' => 'bi-input-cursor-text', 'subtitle' => 'Formularfelddefinitionen bearbeiten'),
73 'server' => array('icon' => 'bi-hdd-network', 'subtitle' => 'Datenbank-Server verwalten'),
74 'server_tables' => array('icon' => 'bi-table', 'subtitle' => 'Tabellen des Servers'),
75 'modules_list' => array('icon' => 'bi-boxes', 'subtitle' => 'Installierte Module verwalten'),
76 'modules_new' => array('icon' => 'bi-plus-square', 'subtitle' => 'Neues Modul anlegen'),
77 'modules_access' => array('icon' => 'bi-shield-lock', 'subtitle' => 'Zugriffsrechte pro Modul'),
78 'config' => array('icon' => 'bi-gear', 'subtitle' => 'System-Konfiguration'),
79 'session' => array('icon' => 'bi-person-badge', 'subtitle' => 'Aktive Benutzer-Sessions'),
80 'trace' => array('icon' => 'bi-clock-history', 'subtitle' => 'Aenderungshistorie'),
81 'sysmsg' => array('icon' => 'bi-bell', 'subtitle' => 'System-Meldungen'),
82 'missing' => array('icon' => 'bi-file-earmark-x', 'subtitle' => 'Fehlende Dateien'),
83 'contact' => array('icon' => 'bi-envelope-check', 'subtitle' => 'Kontaktanfragen verwalten'),
84 'user' => array('icon' => 'bi-people', 'subtitle' => 'Benutzer und Gruppen'),
85 'export_sql' => array('icon' => 'bi-filetype-sql', 'subtitle' => 'SQL-Dump exportieren'),
86 'datadic' => array('icon' => 'bi-journal-code', 'subtitle' => 'DataDic Uebersicht'),
87 'workflow_list' => array('icon' => 'bi-diagram-3', 'subtitle' => 'Workflow-Definitionen'),
88 'workflow_edit' => array('icon' => 'bi-diagram-3', 'subtitle' => 'Workflow bearbeiten'),
89 'workflow_binds' => array('icon' => 'bi-plug', 'subtitle' => 'Modul-Bindings verwalten'),
90 'workflow_bind_edit' => array('icon' => 'bi-plug', 'subtitle' => 'Binding JSON bearbeiten'),
91 'workflow_instances' => array('icon' => 'bi-collection', 'subtitle' => 'Laufende Workflow-Durchlaeufe'),
92 'workflow_install' => array('icon' => 'bi-database-gear', 'subtitle' => 'Workflow-Tabellen installieren'),
93 'content' => array('icon' => 'bi-file-earmark-richtext', 'subtitle' => 'Seiten, Ordner, Medien und Mehrsprachigkeit'),
94 'content_lng' => array('icon' => 'bi-translate', 'subtitle' => 'Master-Sprache, CMS-Sync, Provider und Startseite'),
95 'user_admin' => array('icon' => 'bi-person-lines-fill', 'subtitle' => 'Benutzer, Rollen und Gruppen'),
96 'user_profil' => array('icon' => 'bi-person-circle', 'subtitle' => 'Eigene Stammdaten und Oberflaeche'),
97 'user_group_form' => array('icon' => 'bi-people', 'subtitle' => 'Rollenname, Beschreibung und Aktivstatus'),
98 'consent_privacy' => array('icon' => 'bi-shield-check', 'subtitle' => 'Cookies und externe Medien'),
99 'impressum' => array('icon' => 'bi-building', 'subtitle' => 'Anbieterkennzeichnung'),
100 );
101
102 $extra = $icons[$topic] ?? array('icon' => 'bi-grid', 'subtitle' => '');
103 return array(
104 'title' => (string)($topics[$topic]['title'] ?? $topic),
105 'icon' => (string)($extra['icon'] ?? 'bi-grid'),
106 'subtitle' => (string)($extra['subtitle'] ?? ''),
107 );
108 }
109
110 public function url($topic) {
111 return '?dbx_modul=dbxContent&dbx_run1=help&topic=' . rawurlencode((string)$topic);
112 }
113
114 public function topicPermalink(string $topic): string {
115 $obj = dbx()->get_include_obj('dbxContentContextHelp', 'dbxContent');
116 if (is_object($obj) && method_exists($obj, 'permalinkForTopic')) {
117 return (string) $obj->permalinkForTopic($topic);
118 }
119 $slug = str_replace('_', '-', strtolower(trim($topic)));
120 return 'outside/help/' . $slug;
121 }
122
123 public function button($topic) {
124 $topic = trim((string)$topic);
125 $topics = $this->topics();
126 if ($topic === '' || !isset($topics[$topic])) {
127 return '';
128 }
129
130 $meta = $topics[$topic];
131 return $this->tpl()->get_tpl('dbxAdmin|admin-help-button', array(
132 'help_url' => $this->h($this->url($topic)),
133 'help_title' => $this->h('Hilfe: ' . ($meta['title'] ?? $topic)),
134 ));
135 }
136
137 public function renderModuleBar($topic = '', $actionsHtml = '', $title = '', $icon = '', $subtitle = '') {
138 $data = $this->moduleBarTemplateData($topic, $actionsHtml, $title, $icon, $subtitle);
139 if (!$data) {
140 return '';
141 }
142
143 return trim($this->tpl()->get_tpl('dbx|module-bar', $data));
144 }
145
146 public function moduleBarTemplateData($topic = '', $actionsHtml = '', $title = '', $icon = '', $subtitle = '') {
147 if ($topic === '') {
148 $topic = $this->resolveTopic();
149 }
150 $topic = trim((string)$topic);
151 if ($topic === '') {
152 return array();
153 }
154
155 $meta = $this->barMeta($topic);
156 if (!is_array($meta)) {
157 return array();
158 }
159
160 if ($title === '') {
161 $title = (string)($meta['title'] ?? $topic);
162 }
163 if ($icon === '') {
164 $icon = (string)($meta['icon'] ?? 'bi-grid');
165 }
166 if ($subtitle === '') {
167 $subtitle = (string)($meta['subtitle'] ?? '');
168 }
169
170 return array(
171 'bar_class' => 'dbx-module-bar',
172 'bar_title_class' => 'dbx-module-bar-titleblock',
173 'bar_actions_class' => 'dbx-module-bar-actions',
174 'bar_title' => (string)$title,
175 'bar_icon' => (string)$icon,
176 'bar_subtitle' => (string)$subtitle,
177 'bar_title_pre' => '',
178 'bar_title_heading_attrs' => '',
179 'bar_actions' => (string)$actionsHtml,
180 'bar_extra' => $this->button($topic),
181 );
182 }
183
187 public function helpWindowBarTemplateData($topic = '') {
188 $topic = trim((string)$topic);
189 if ($topic === '') {
190 return array();
191 }
192
193 $meta = $this->barMeta($topic);
194 if (!is_array($meta)) {
195 return array();
196 }
197
198 return array(
199 'bar_class' => 'dbx-module-bar dbx-help-context-bar',
200 'bar_title_class' => 'dbx-module-bar-titleblock',
201 'bar_actions_class' => 'dbx-module-bar-actions',
202 'bar_title' => (string)($meta['title'] ?? $topic),
203 'bar_icon' => (string)($meta['icon'] ?? 'bi-question-circle'),
204 'bar_subtitle' => 'Kontext-Hilfe',
205 'bar_title_pre' => '',
206 'bar_title_heading_attrs' => '',
207 'bar_actions' => '',
208 'bar_extra' => '',
209 'bar_middle' => '',
210 );
211 }
212
213 public function vars($topic) {
214 $data = $this->moduleBarTemplateData($topic);
215 if (!$data) {
216 return array(
217 'help_button' => '',
218 'bar_title' => '',
219 'bar_icon' => 'bi-grid',
220 'bar_subtitle' => '',
221 'bar_title_pre' => '',
222 'bar_title_heading_attrs' => '',
223 'bar_class' => 'dbx-module-bar',
224 'bar_title_class' => 'dbx-module-bar-titleblock',
225 'bar_actions_class' => 'dbx-module-bar-actions',
226 'bar_actions' => '',
227 'bar_extra' => '',
228 );
229 }
230
231 return array_merge($data, array(
232 'help_button' => (string)($data['bar_extra'] ?? ''),
233 ));
234 }
235
236 public function attachForm($oForm, $topic = '') {
237 if (!is_object($oForm) || !method_exists($oForm, 'add_obj')) {
238 return;
239 }
240 if ($topic === '') {
241 $topic = $this->resolveTopic();
242 }
243 if ($topic === '') {
244 return;
245 }
246 $oForm->add_obj('help_button', $this->button($topic));
247 if (method_exists($oForm, 'add_module_bar')) {
248 $barMeta = $this->barMeta($topic);
249 if (is_array($barMeta) && $barMeta) {
250 $oForm->add_module_bar(
251 (string)($barMeta['title'] ?? ''),
252 (string)($barMeta['icon'] ?? 'bi-grid'),
253 (string)($barMeta['subtitle'] ?? '')
254 );
255 }
256 }
257 }
258
259 public function resolveTopic($modul = '', $run1 = '', $run2 = '') {
260 if ($modul === '') {
261 $modul = (string)dbx()->get_system_var('dbx_modul', '');
262 }
263 if ($run1 === '') {
264 $run1 = (string)dbx()->get_modul_var('dbx_run1', '', 'parameter');
265 }
266 if ($run2 === '') {
267 $run2 = (string)dbx()->get_modul_var('dbx_run2', '', 'parameter');
268 }
269
270 $run1 = strtolower(trim($run1));
271 $run2 = strtolower(trim($run2));
272
273 if ($modul === 'dbxAdmin') {
274 if ($run1 === 'run' || $run1 === 'dashboard' || $run1 === '') {
275 return 'dashboard';
276 }
277 if ($run1 === 'cache') {
278 return 'cache';
279 }
280 if ($run1 === 'dd') {
281 if (strpos($run2, 'field') !== false) {
282 return 'dd_fields';
283 }
284 if ($run2 === 'backup_db' || $run2 === 'restore_db') {
285 return 'dd_backup';
286 }
287 return 'dd_list';
288 }
289 if ($run1 === 'db') {
290 return 'db_list';
291 }
292 if ($run1 === 'edit_dd') {
293 return 'edit_dd';
294 }
295 if ($run1 === 'edit_fd') {
296 return 'edit_fd';
297 }
298 if ($run1 === 'server') {
299 return ($run2 === 'list_tables') ? 'server_tables' : 'server';
300 }
301 if ($run1 === 'modules') {
302 if ($run2 === 'modul_new') {
303 return 'modules_new';
304 }
305 if ($run2 === 'modul_access') {
306 return 'modules_access';
307 }
308 return 'modules_list';
309 }
310 if ($run1 === 'config') {
311 $xmodul = strtolower(trim((string)dbx()->get_modul_var('xmodul', '', 'parameter')));
312 if ($xmodul === 'dbxcontent') {
313 return 'content_lng';
314 }
315 return 'config';
316 }
317 if ($run1 === 'session') {
318 return 'session';
319 }
320 if ($run1 === 'trace') {
321 return 'trace';
322 }
323 if ($run1 === 'sysmsg') {
324 return 'sysmsg';
325 }
326 if ($run1 === 'missing') {
327 return 'missing';
328 }
329 if ($run1 === 'contact') {
330 return 'contact';
331 }
332 if ($run1 === 'user') {
333 return 'user';
334 }
335 if ($run1 === 'export_sql') {
336 return 'export_sql';
337 }
338 if ($run1 === 'datadic') {
339 return 'datadic';
340 }
341 }
342
343 if ($modul === 'dbxWorkflow_admin') {
344 if ($run1 === 'edit') {
345 return 'workflow_edit';
346 }
347 if ($run1 === 'edit_bind') {
348 return 'workflow_bind_edit';
349 }
350 if ($run1 === 'binds') {
351 return 'workflow_binds';
352 }
353 if ($run1 === 'instances') {
354 return 'workflow_instances';
355 }
356 if ($run1 === 'install') {
357 return 'workflow_install';
358 }
359 return 'workflow_list';
360 }
361
362 if ($modul === 'dbxContent_admin') {
363 if ($run1 === 'content' && $run2 === 'config') {
364 return 'content_lng';
365 }
366 return 'content';
367 }
368
369 if ($modul === 'dbxUser_admin') {
370 if ($run1 === 'user' && ($run2 === 'new_group' || $run2 === 'edit_group')) {
371 return 'user_group_form';
372 }
373 return 'user_admin';
374 }
375
376 if ($modul === 'dbxUser') {
377 if ($run1 === 'user' && ($run2 === 'edit_profil' || $run2 === 'profil')) {
378 return 'user_profil';
379 }
380 }
381
382 return '';
383 }
384
385 public function run() {
386 $obj = dbx()->get_include_obj('dbxContentContextHelp', 'dbxContent');
387 if (is_object($obj) && method_exists($obj, 'run')) {
388 return $obj->run();
389 }
390 return '';
391 }
392}
moduleBarTemplateData($topic='', $actionsHtml='', $title='', $icon='', $subtitle='')
helpWindowBarTemplateData($topic='')
Bar-Daten fuer Kontext-Hilfe im Hilfe-Fenster (ohne Help-Button, ohne bar_middle).
renderModuleBar($topic='', $actionsHtml='', $title='', $icon='', $subtitle='')
resolveTopic($modul='', $run1='', $run2='')
DBX schema administration.