dbXapp
2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Toggle main menu visibility
Loading...
Searching...
No Matches
dbxContactContentProvision.class.php
Go to the documentation of this file.
1
<?php
2
namespace
dbx\dbxContact;
3
4
require_once dirname(__DIR__, 2) .
'/dbxContent/include/dbxContent_bootstrap_sync.php'
;
5
6
use dbx\dbxContent\dbxContentLng;
7
use dbx\dbxContent\dbxContentLngSync;
8
use dbx\dbxContent\dbxContentPageCache;
9
use dbx\dbxContent\dbxContentPermalinkIndex;
10
11
class
dbxContactContentProvision
{
12
13
public
static
function
run
(
$db
): int {
14
if
(!is_object(
$db
)) {
15
return
0;
16
}
17
18
$dd =
dbxContentLng::ddContent
(
'de'
);
19
$existing =
$db
->select1($dd, array(
'permalink'
=>
'meine-anfragen'
),
'id,content'
, 0);
20
if
(is_array($existing) && (
int
) ($existing[
'id'
] ?? 0) > 0) {
21
$id = (int) $existing[
'id'
];
22
$content = (string) ($existing[
'content'
] ??
''
);
23
if
(str_starts_with($content,
'<h1>Meine Anfragen</h1>'
) && str_contains($content,
'[modul=dbxContact]dbx_run1=tickets[/modul]'
)) {
24
$db
->update($dd, array(
'content'
=> self::pageContent()), $id, 0, 1, 0, 1);
25
dbxContentPageCache::invalidateAll
();
26
}
27
return
$id;
28
}
29
30
$folderId = self::folderId(
$db
);
31
$data = array(
32
'activ'
=> 1,
33
'folder'
=> $folderId,
34
'title'
=>
'Meine Anfragen'
,
35
'permalink'
=>
'meine-anfragen'
,
36
'description'
=>
'Eigene Kontaktanfragen, Antworten und aktuellen Bearbeitungsstatus anzeigen.'
,
37
'keywords'
=>
'Kontakt, Anfragen, Tickets, Antworten'
,
38
'group_read'
=>
'*'
,
39
'sorter'
=> self::nextSorter(
$db
, $dd, $folderId),
40
'template'
=>
'parent'
,
41
'hero_template'
=>
'parent'
,
42
'hero_image_id'
=>
'parent'
,
43
'hero_margin_top'
=>
'parent'
,
44
'hero_height'
=>
'parent'
,
45
'hero_variant'
=>
'parent'
,
46
'hero_sticky'
=>
'parent'
,
47
'hero_scroll_layer'
=>
'parent'
,
48
'gallery_template'
=>
'image-gallery'
,
49
'gallery_visible_count'
=>
'3'
,
50
'gallery_image_size'
=>
'original'
,
51
'gallery_lightbox_width'
=>
'100vw'
,
52
'gallery_overflow'
=>
'grid'
,
53
'gallery_click_behavior'
=>
'lightbox'
,
54
'content'
=> self::pageContent(),
55
);
56
57
if
(
$db
->insert($dd, $data, 0, 1, 0, 1) <= 0) {
58
return
0;
59
}
60
61
$id = (int)
$db
->get_insert_id();
62
if
($id <= 0) {
63
return
0;
64
}
65
66
dbxContentLngSync::afterPageSave
(
$db
, $id,
true
);
67
dbxContentPermalinkIndex::upsertPage
($id,
'meine-anfragen'
,
'*'
, 1,
'de'
);
68
dbxContentPageCache::invalidateAll
();
69
return
$id;
70
}
71
72
private
static
function
pageContent(): string {
73
return
'<p class="lead">Hier sehen Sie Ihre Kontaktanfragen, Antworten und den aktuellen Bearbeitungsstatus.</p>'
74
.
'[modul=dbxContact]dbx_run1=tickets[/modul]'
;
75
}
76
77
private
static
function
folderId(
$db
): int {
78
$dd = dbxContentLng::ddFolder(
'de'
);
79
$rows =
$db
->select($dd, array(
'name'
=>
'Fuer Kunden'
),
'id'
,
'id'
,
'ASC'
,
''
, 1, 0, 0);
80
if
(is_array($rows) && isset($rows[0][
'id'
])) {
81
return
(
int
) $rows[0][
'id'
];
82
}
83
return
0;
84
}
85
86
private
static
function
nextSorter(
$db
,
string
$dd,
int
$folderId): string {
87
$rows =
$db
->select($dd, array(
'folder'
=> $folderId),
'sorter'
,
'sorter,id'
,
'DESC'
,
''
, 1, 0, 0);
88
$max = 0;
89
if
(is_array($rows) && isset($rows[0][
'sorter'
])) {
90
$max = (int) $rows[0][
'sorter'
];
91
}
92
return
sprintf(
'%04d'
, $max + 10);
93
}
94
}
dbx\dbxContact\dbxContactContentProvision
Definition
dbxContactContentProvision.class.php:11
dbx\dbxContact\dbxContactContentProvision\run
static run($db)
Definition
dbxContactContentProvision.class.php:13
dbx\dbxContent\dbxContentLng\ddContent
static ddContent(string $lng='')
Definition
dbxContentLng.class.php:10
dbx\dbxContent\dbxContentLngSync\afterPageSave
static afterPageSave($db, int $id, bool $isNew=false)
Definition
dbxContentLngSync.class.php:126
dbx\dbxContent\dbxContentPageCache\invalidateAll
static invalidateAll()
Definition
dbxContentPageCache.class.php:372
dbx\dbxContent\dbxContentPermalinkIndex\upsertPage
static upsertPage(int $cid, string $permalink, string $rights, int $activ=1, string $lng='')
Definition
dbxContentPermalinkIndex.class.php:123
if
if( $syncRequest)
Definition
index.php:520
$db
$db
Definition
run_context_help_provision.php:38
dbx
modules
dbxContact
include
dbxContactContentProvision.class.php
Generated by
1.17.0