4use dbx\dbxContent\dbxContentLng;
6require_once dirname(__DIR__, 2) .
'/dbxContent/include/dbxContent_bootstrap_sync.php';
7require_once __DIR__ .
'/dbxKiCmsHelpProvision.class.php';
11 private function tpl() {
12 return dbx()->get_system_obj(
'dbxTPL');
15 private function h(
$value) {
16 return htmlspecialchars((
string)
$value, ENT_QUOTES,
'UTF-8');
22 'title' =>
'KI-Auftrag',
24 'icon' =>
'bi-ui-checks',
25 'subtitle' =>
'Formular, Download, Ablauf',
27 'briefing_page_create' => array(
28 'title' =>
'Neue Seite — Formular',
30 'icon' =>
'bi-file-earmark-plus',
31 'subtitle' =>
'Auftrag fuer neue Content-Seite',
33 'briefing_page_update' => array(
34 'title' =>
'Seite aendern — Formular',
36 'icon' =>
'bi-pencil-square',
37 'subtitle' =>
'Auftrag fuer Seiten-Update',
39 'briefing_page_translate' => array(
40 'title' =>
'Uebersetzung — Formular',
42 'icon' =>
'bi-translate',
43 'subtitle' =>
'Auftrag fuer Seiten-Uebersetzung',
45 'translation_sync_all' => array(
46 'title' =>
'Sprache komplett uebersetzen',
48 'icon' =>
'bi-translate',
49 'subtitle' =>
'CMS-Struktur in Zielsprachen uebertragen',
51 'briefing_module' => array(
52 'title' =>
'Modul-KI',
55 'subtitle' =>
'Auftrag fuer bestehendes Modul',
57 'briefing_styles' => array(
58 'title' =>
'Schreibstile',
61 'subtitle' =>
'Ton und Stil fuer KI-Auftraege',
63 'module_bundle' => array(
64 'title' =>
'Modul-Antwort importieren',
66 'icon' =>
'bi-upload',
67 'subtitle' =>
'Antwort-ZIP fuer Modul-KI',
69 'module_bundle_preview' => array(
70 'title' =>
'Modul-Import',
72 'icon' =>
'bi-check2-square',
73 'subtitle' =>
'Modul-Antwort ausfuehren',
76 'title' =>
'Bundle importieren',
78 'icon' =>
'bi-box-arrow-in-down',
79 'subtitle' =>
'KI-Antwort ZIP hochladen',
81 'bundle_preview' => array(
82 'title' =>
'KI-Import',
85 'subtitle' =>
'Vorschau und Ausfuehrung',
87 'bundle_process' => array(
88 'title' =>
'KI-Import',
90 'icon' =>
'bi-play-circle',
91 'subtitle' =>
'Bundle wird ausgefuehrt',
98 $run1 = (string)
dbx()->get_modul_var(
'dbx_run1',
'bundle',
'parameter');
100 $run1 = strtolower(trim($run1));
101 if ($run1 ===
'briefing' || $run1 ===
'briefing_page_create' || $run1 ===
'briefing_page_update'
102 || $run1 ===
'briefing_page_translate' || $run1 ===
'briefing_styles' || $run1 ===
'briefing_module'
103 || $run1 ===
'translation_sync_all') {
106 if ($run1 ===
'module_bundle') {
107 return 'module_bundle';
109 if ($run1 ===
'module_bundle_import') {
110 return 'module_bundle_preview';
112 if ($run1 ===
'bundle_import') {
113 return 'bundle_preview';
115 if ($run1 ===
'bundle_process') {
116 return 'bundle_process';
118 if ($run1 ===
'bundle' || $run1 ===
'start' || $run1 ===
'') {
124 public function helpUrl(
string $screen =
''): string {
125 $screen = trim($screen);
126 if ($screen ===
'') {
129 return '?dbx_modul=dbxKi&dbx_run1=help&screen=' . rawurlencode($screen);
132 public function button(
string $screen =
''): string {
133 $screen = trim($screen);
134 if ($screen ===
'') {
137 $screens = $this->screens();
138 if (!isset($screens[$screen])) {
141 $meta = $screens[$screen];
142 return $this->tpl()->get_tpl(
'dbxAdmin|admin-help-button', array(
143 'help_url' => $this->h($this->helpUrl($screen)),
144 'help_title' => $this->h(
'Hilfe: ' . ($meta[
'help_title'] ?? $meta[
'title'] ?? $screen)),
148 public function moduleBarTemplateData(
string $screen =
'',
string $actionsHtml =
'',
string $title =
'',
string $icon =
'',
string $subtitle =
''): array {
149 if ($screen ===
'') {
152 $screens = $this->screens();
153 if (!isset($screens[$screen])) {
156 $meta = $screens[$screen];
159 $title = (string) ($meta[
'title'] ?? $screen);
162 $icon = (string) ($meta[
'icon'] ??
'bi-grid');
164 if ($subtitle ===
'') {
165 $subtitle = (string) ($meta[
'subtitle'] ??
'');
169 'bar_class' =>
'dbx-module-bar',
170 'bar_title_class' =>
'dbx-module-bar-titleblock',
171 'bar_actions_class' =>
'dbx-module-bar-actions',
172 'bar_title' => $title,
174 'bar_subtitle' => $subtitle,
175 'bar_title_pre' =>
'',
176 'bar_title_heading_attrs' =>
'',
177 'bar_actions' => (
string) $actionsHtml,
178 'bar_extra' => $this->button($screen),
184 if ($screen ===
'') {
187 $screens = $this->screens();
188 if (!isset($screens[$screen])) {
191 $meta = $screens[$screen];
194 'bar_class' =>
'dbx-module-bar dbx-help-context-bar',
195 'bar_title_class' =>
'dbx-module-bar-titleblock',
196 'bar_actions_class' =>
'dbx-module-bar-actions',
197 'bar_title' => (
string) ($meta[
'help_title'] ?? $meta[
'title'] ?? $screen),
198 'bar_icon' =>
'bi-question-circle',
199 'bar_subtitle' =>
'Kontext-Hilfe',
200 'bar_title_pre' =>
'',
201 'bar_title_heading_attrs' =>
'',
212 $cid = $this->resolveHelpCid($permalink);
216 if (empty(
$result[
'errors'])) {
218 $cid = (int) (
$result[
'page_id'] ?? 0);
220 $cid = $this->resolveHelpCid($permalink);
226 return $this->tpl()->get_tpl(
'dbx|alert-info', array(
227 'msg' =>
'Hilfe-Seite noch nicht angelegt. Bitte '
228 .
'<a href="?dbx_modul=dbxKi&dbx_run1=provision_anleitung">Anleitung provisionieren</a>.',
232 $contentObj =
dbx()->get_include_obj(
'dbxContent_content',
'dbxContent');
233 if (!is_object($contentObj) || !method_exists($contentObj,
'renderPage')) {
237 return $contentObj->renderPage($cid, array(
238 'admin_help' =>
true,
240 'skip_cache' =>
true,
244 private function resolveHelpCid(
string $permalink): int {
245 $permalink = trim($permalink);
246 if ($permalink ===
'') {
250 $contextHelp =
dbx()->get_include_obj(
'dbxContentContextHelp',
'dbxContent');
251 if (is_object($contextHelp) && method_exists($contextHelp,
'resolveCidByPermalink')) {
252 $cid = (int) $contextHelp->resolveCidByPermalink($permalink);
258 $db =
dbx()->get_system_obj(
'dbxDB');
259 if (!is_object(
$db)) {
263 $dd = dbxContentLng::ddContent();
264 $rec =
$db->select1(
$dd, array(
'permalink' => $permalink),
'id', 0);
265 if (is_array($rec) && (
int) ($rec[
'id'] ?? 0) > 0) {
266 return (
int) $rec[
'id'];
273 dbx()->set_system_var(
'dbx_page',
'window');
275 if ($screen ===
'') {
276 $screen = trim((
string)
dbx()->get_modul_var(
'screen',
'',
'parameter'));
278 if ($screen ===
'') {
279 $screen = $this->resolveScreen();
282 $content = $this->renderCmsHelpContent();
283 if (trim(strip_tags((
string)
$content)) ===
'') {
284 $content = $this->tpl()->get_tpl(
'dbx|alert-info', array(
285 'msg' =>
'Fuer diesen Bereich ist noch keine Hilfe hinterlegt.',
289 return $this->tpl()->get_tpl(
'dbxAdmin|admin-help-shell', array_merge(
290 $this->helpWindowBarTemplateData($screen),
292 'frame_id' =>
'dbx_ki_help_' . preg_replace(
'/[^a-z0-9_-]+/i',
'_', $screen),
293 'frame_panel_class' =>
'dbx-admin-help py-3 dbx-context-help-preview',
294 'frame_form_open' =>
'',
295 'frame_form_close' =>
'',
296 'frame_subbar' =>
'',
297 'frame_body_class' =>
'dbx-admin-help-body dbx-context-help-body',
298 'frame_body_head' =>
'',
299 'frame_body_tail' =>
'',
300 'frame_panel_attrs' =>
'',
moduleBarTemplateData(string $screen='', string $actionsHtml='', string $title='', string $icon='', string $subtitle='')
resolveScreen(string $run1='')
helpUrl(string $screen='')
renderHelpWindow(string $screen='')
button(string $screen='')
helpWindowBarTemplateData(string $screen='')
if(!defined( 'IMG_WEBP')) define( 'IMG_WEBP'
DBX schema administration.