dbXapp
2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Toggle main menu visibility
Loading...
Searching...
No Matches
dbxKiHelp.class.php
Go to the documentation of this file.
1
<?php
2
namespace
dbx\dbxKi;
3
4
use dbx\dbxContent\dbxContentLng;
5
6
require_once dirname(__DIR__, 2) .
'/dbxContent/include/dbxContent_bootstrap_sync.php'
;
7
require_once __DIR__ .
'/dbxKiCmsHelpProvision.class.php'
;
8
9
class
dbxKiHelp
{
10
11
private
function
tpl() {
12
return
dbx
()->get_system_obj(
'dbxTPL'
);
13
}
14
15
private
function
h($value) {
16
return
htmlspecialchars((
string
) $value, ENT_QUOTES,
'UTF-8'
);
17
}
18
19
public
function
screens
(): array {
20
return array(
21
'briefing'
=> array(
22
'title'
=>
'KI-Auftrag'
,
23
'help_title'
=>
dbxKiCmsHelpProvision
::TITLE,
24
'icon'
=>
'bi-ui-checks'
,
25
'subtitle'
=>
'Formular, Download, Ablauf'
,
26
),
27
'briefing_page_create'
=> array(
28
'title'
=>
'Neue Seite — Formular'
,
29
'help_title'
=>
dbxKiCmsHelpProvision
::TITLE,
30
'icon'
=>
'bi-file-earmark-plus'
,
31
'subtitle'
=>
'Auftrag fuer neue Content-Seite'
,
32
),
33
'briefing_page_update'
=> array(
34
'title'
=>
'Seite aendern — Formular'
,
35
'help_title'
=>
dbxKiCmsHelpProvision
::TITLE,
36
'icon'
=>
'bi-pencil-square'
,
37
'subtitle'
=>
'Auftrag fuer Seiten-Update'
,
38
),
39
'briefing_page_translate'
=> array(
40
'title'
=>
'Uebersetzung — Formular'
,
41
'help_title'
=>
dbxKiCmsHelpProvision
::TITLE,
42
'icon'
=>
'bi-translate'
,
43
'subtitle'
=>
'Auftrag fuer Seiten-Uebersetzung'
,
44
),
45
'briefing_module'
=> array(
46
'title'
=>
'Modul-KI'
,
47
'help_title'
=>
dbxKiCmsHelpProvision
::TITLE,
48
'icon'
=>
'bi-stars'
,
49
'subtitle'
=>
'Auftrag fuer bestehendes Modul'
,
50
),
51
'briefing_styles'
=> array(
52
'title'
=>
'Schreibstile'
,
53
'help_title'
=>
dbxKiCmsHelpProvision
::TITLE,
54
'icon'
=>
'bi-type'
,
55
'subtitle'
=>
'Ton und Stil fuer KI-Auftraege'
,
56
),
57
'module_bundle'
=> array(
58
'title'
=>
'Modul-Antwort importieren'
,
59
'help_title'
=>
dbxKiCmsHelpProvision
::TITLE,
60
'icon'
=>
'bi-upload'
,
61
'subtitle'
=>
'Antwort-ZIP fuer Modul-KI'
,
62
),
63
'module_bundle_preview'
=> array(
64
'title'
=>
'Modul-Import'
,
65
'help_title'
=>
dbxKiCmsHelpProvision
::TITLE,
66
'icon'
=>
'bi-check2-square'
,
67
'subtitle'
=>
'Modul-Antwort ausfuehren'
,
68
),
69
'bundle'
=> array(
70
'title'
=>
'Bundle importieren'
,
71
'help_title'
=>
dbxKiCmsHelpProvision
::TITLE,
72
'icon'
=>
'bi-box-arrow-in-down'
,
73
'subtitle'
=>
'KI-Antwort ZIP hochladen'
,
74
),
75
'bundle_preview'
=> array(
76
'title'
=>
'KI-Import'
,
77
'help_title'
=>
dbxKiCmsHelpProvision
::TITLE,
78
'icon'
=>
'bi-eye'
,
79
'subtitle'
=>
'Vorschau und Ausfuehrung'
,
80
),
81
'bundle_process'
=> array(
82
'title'
=>
'KI-Import'
,
83
'help_title'
=>
dbxKiCmsHelpProvision
::TITLE,
84
'icon'
=>
'bi-play-circle'
,
85
'subtitle'
=>
'Bundle wird ausgefuehrt'
,
86
),
87
);
88
}
89
90
public
function
resolveScreen
(
string
$run1 =
''
): string {
91
if
($run1 ===
''
) {
92
$run1 = (string)
dbx
()->get_modul_var(
'dbx_run1'
,
'bundle'
,
'parameter'
);
93
}
94
$run1 = strtolower(trim($run1));
95
if
($run1 ===
'briefing'
|| $run1 ===
'briefing_page_create'
|| $run1 ===
'briefing_page_update'
96
|| $run1 ===
'briefing_page_translate'
|| $run1 ===
'briefing_styles'
|| $run1 ===
'briefing_module'
) {
97
return
$run1;
98
}
99
if
($run1 ===
'module_bundle'
) {
100
return
'module_bundle'
;
101
}
102
if
($run1 ===
'module_bundle_import'
) {
103
return
'module_bundle_preview'
;
104
}
105
if
($run1 ===
'bundle_import'
) {
106
return
'bundle_preview'
;
107
}
108
if
($run1 ===
'bundle_process'
) {
109
return
'bundle_process'
;
110
}
111
if
($run1 ===
'bundle'
|| $run1 ===
'start'
|| $run1 ===
''
) {
112
return
'bundle'
;
113
}
114
return
'bundle'
;
115
}
116
117
public
function
helpUrl
(
string
$screen =
''
): string {
118
$screen = trim($screen);
119
if
($screen ===
''
) {
120
$screen = $this->
resolveScreen
();
121
}
122
return
'?dbx_modul=dbxKi&dbx_run1=help&screen='
. rawurlencode($screen);
123
}
124
125
public
function
button
(
string
$screen =
''
): string {
126
$screen = trim($screen);
127
if
($screen ===
''
) {
128
$screen = $this->
resolveScreen
();
129
}
130
$screens = $this->screens();
131
if
(!isset($screens[$screen])) {
132
$screen =
'bundle'
;
133
}
134
$meta = $screens[$screen];
135
return
$this->tpl()->get_tpl(
'dbxAdmin|admin-help-button'
, array(
136
'help_url'
=> $this->h($this->helpUrl($screen)),
137
'help_title'
=> $this->h(
'Hilfe: '
. ($meta[
'help_title'
] ?? $meta[
'title'
] ?? $screen)),
138
));
139
}
140
141
public
function
moduleBarTemplateData
(
string
$screen =
''
,
string
$actionsHtml =
''
,
string
$title =
''
,
string
$icon =
''
,
string
$subtitle =
''
): array {
142
if
($screen ===
''
) {
143
$screen = $this->
resolveScreen
();
144
}
145
$screens = $this->screens();
146
if
(!isset($screens[$screen])) {
147
$screen =
'bundle'
;
148
}
149
$meta = $screens[$screen];
150
151
if
($title ===
''
) {
152
$title = (string) ($meta[
'title'
] ?? $screen);
153
}
154
if
($icon ===
''
) {
155
$icon = (string) ($meta[
'icon'
] ??
'bi-grid'
);
156
}
157
if
($subtitle ===
''
) {
158
$subtitle = (string) ($meta[
'subtitle'
] ??
''
);
159
}
160
161
return
array(
162
'bar_class'
=>
'dbx-module-bar'
,
163
'bar_title_class'
=>
'dbx-module-bar-titleblock'
,
164
'bar_actions_class'
=>
'dbx-module-bar-actions'
,
165
'bar_title'
=> $title,
166
'bar_icon'
=> $icon,
167
'bar_subtitle'
=> $subtitle,
168
'bar_title_pre'
=>
''
,
169
'bar_title_heading_attrs'
=>
''
,
170
'bar_actions'
=> (
string
) $actionsHtml,
171
'bar_extra'
=> $this->button($screen),
172
'bar_middle'
=>
''
,
173
);
174
}
175
176
public
function
helpWindowBarTemplateData
(
string
$screen =
''
): array {
177
if
($screen ===
''
) {
178
$screen = $this->
resolveScreen
();
179
}
180
$screens = $this->screens();
181
if
(!isset($screens[$screen])) {
182
$screen =
'bundle'
;
183
}
184
$meta = $screens[$screen];
185
186
return
array(
187
'bar_class'
=>
'dbx-module-bar dbx-help-context-bar'
,
188
'bar_title_class'
=>
'dbx-module-bar-titleblock'
,
189
'bar_actions_class'
=>
'dbx-module-bar-actions'
,
190
'bar_title'
=> (
string
) ($meta[
'help_title'
] ?? $meta[
'title'
] ?? $screen),
191
'bar_icon'
=>
'bi-question-circle'
,
192
'bar_subtitle'
=>
'Kontext-Hilfe'
,
193
'bar_title_pre'
=>
''
,
194
'bar_title_heading_attrs'
=>
''
,
195
'bar_actions'
=>
''
,
196
'bar_extra'
=>
''
,
197
'bar_middle'
=>
''
,
198
);
199
}
200
201
public
function
renderCmsHelpContent
(): string {
202
dbxKiCmsHelpProvision
::run();
203
204
$permalink =
dbxKiCmsHelpProvision::PERMALINK
;
205
$cid = $this->resolveHelpCid($permalink);
206
207
if
($cid <= 0) {
208
$result
=
dbxKiCmsHelpProvision::provision
();
209
if
(empty(
$result
[
'errors'
])) {
210
dbxKiCmsHelpProvision::run
();
211
$cid = (int) (
$result
[
'page_id'
] ?? 0);
212
if
($cid <= 0) {
213
$cid = $this->resolveHelpCid($permalink);
214
}
215
}
216
}
217
218
if
($cid <= 0) {
219
return
$this->tpl()->get_tpl(
'dbx|alert-info'
, array(
220
'msg'
=>
'Hilfe-Seite noch nicht angelegt. Bitte '
221
.
'<a href="?dbx_modul=dbxKi&dbx_run1=provision_anleitung">Anleitung provisionieren</a>.'
,
222
));
223
}
224
225
$contentObj =
dbx
()->get_include_obj(
'dbxContent_content'
,
'dbxContent'
);
226
if
(!is_object($contentObj) || !method_exists($contentObj,
'renderPage'
)) {
227
return
''
;
228
}
229
230
return
$contentObj->renderPage($cid, array(
231
'admin_help'
=>
true
,
232
'skip_hits'
=>
true
,
233
'skip_cache'
=>
true
,
234
));
235
}
236
237
private
function
resolveHelpCid(
string
$permalink): int {
238
$permalink = trim($permalink);
239
if
($permalink ===
''
) {
240
return
0;
241
}
242
243
$contextHelp =
dbx
()->get_include_obj(
'dbxContentContextHelp'
,
'dbxContent'
);
244
if
(is_object($contextHelp) && method_exists($contextHelp,
'resolveCidByPermalink'
)) {
245
$cid = (int) $contextHelp->resolveCidByPermalink($permalink);
246
if
($cid > 0) {
247
return
$cid;
248
}
249
}
250
251
$db
=
dbx
()->get_system_obj(
'dbxDB'
);
252
if
(!is_object(
$db
)) {
253
return
0;
254
}
255
256
$dd = dbxContentLng::ddContent();
257
$rec =
$db
->select1($dd, array(
'permalink'
=> $permalink),
'id'
, 0);
258
if
(is_array($rec) && (
int
) ($rec[
'id'
] ?? 0) > 0) {
259
return
(
int
) $rec[
'id'
];
260
}
261
262
return
0;
263
}
264
265
public
function
renderHelpWindow
(
string
$screen =
''
): string {
266
dbx
()->set_system_var(
'dbx_page'
,
'window'
);
267
268
if
($screen ===
''
) {
269
$screen = trim((
string
)
dbx
()->get_modul_var(
'screen'
,
''
,
'parameter'
));
270
}
271
if
($screen ===
''
) {
272
$screen = $this->resolveScreen();
273
}
274
275
$content = $this->renderCmsHelpContent();
276
if
(trim(strip_tags((
string
) $content)) ===
''
) {
277
$content = $this->tpl()->get_tpl(
'dbx|alert-info'
, array(
278
'msg'
=>
'Fuer diesen Bereich ist noch keine Hilfe hinterlegt.'
,
279
));
280
}
281
282
return
$this->tpl()->get_tpl(
'dbxAdmin|admin-help-shell'
, array_merge(
283
$this->helpWindowBarTemplateData($screen),
284
array(
285
'frame_id'
=>
'dbx_ki_help_'
. preg_replace(
'/[^a-z0-9_-]+/i'
,
'_'
, $screen),
286
'frame_panel_class'
=>
'dbx-admin-help py-3 dbx-context-help-preview'
,
287
'frame_form_open'
=>
''
,
288
'frame_form_close'
=>
''
,
289
'frame_subbar'
=>
''
,
290
'frame_body_class'
=>
'dbx-admin-help-body dbx-context-help-body'
,
291
'frame_body_head'
=>
''
,
292
'frame_body_tail'
=>
''
,
293
'frame_panel_attrs'
=>
''
,
294
'content'
=> $content,
295
)
296
));
297
}
298
}
dbx\dbxKi\dbxKiCmsHelpProvision
Definition
dbxKiCmsHelpProvision.class.php:11
dbx\dbxKi\dbxKiCmsHelpProvision\provision
static provision()
Definition
dbxKiCmsHelpProvision.class.php:30
dbx\dbxKi\dbxKiCmsHelpProvision\PERMALINK
const PERMALINK
Definition
dbxKiCmsHelpProvision.class.php:13
dbx\dbxKi\dbxKiCmsHelpProvision\run
static run()
Definition
dbxKiCmsHelpProvision.class.php:19
dbx\dbxKi\dbxKiHelp
Definition
dbxKiHelp.class.php:9
dbx\dbxKi\dbxKiHelp\moduleBarTemplateData
moduleBarTemplateData(string $screen='', string $actionsHtml='', string $title='', string $icon='', string $subtitle='')
Definition
dbxKiHelp.class.php:141
dbx\dbxKi\dbxKiHelp\resolveScreen
resolveScreen(string $run1='')
Definition
dbxKiHelp.class.php:90
dbx\dbxKi\dbxKiHelp\helpUrl
helpUrl(string $screen='')
Definition
dbxKiHelp.class.php:117
dbx\dbxKi\dbxKiHelp\renderHelpWindow
renderHelpWindow(string $screen='')
Definition
dbxKiHelp.class.php:265
dbx\dbxKi\dbxKiHelp\button
button(string $screen='')
Definition
dbxKiHelp.class.php:125
dbx\dbxKi\dbxKiHelp\renderCmsHelpContent
renderCmsHelpContent()
Definition
dbxKiHelp.class.php:201
dbx\dbxKi\dbxKiHelp\screens
screens()
Definition
dbxKiHelp.class.php:19
dbx\dbxKi\dbxKiHelp\helpWindowBarTemplateData
helpWindowBarTemplateData(string $screen='')
Definition
dbxKiHelp.class.php:176
if
if( $syncRequest)
Definition
index.php:520
dbx
DBX schema administration.
$db
$db
Definition
run_context_help_provision.php:38
$result
if(! $db->connect_db_server($server)) $result
Definition
run_context_help_provision.php:45
dbx
modules
dbxKi
include
dbxKiHelp.class.php
Generated by
1.17.0