dbXapp
2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Toggle main menu visibility
Loading...
Searching...
No Matches
dbxContentHome.class.php
Go to the documentation of this file.
1
<?php
2
namespace
dbx\dbxContent;
3
4
require_once __DIR__ .
'/dbxContent_bootstrap_sync.php'
;
5
6
class
dbxContentHome
{
7
8
private
static
function
db() {
9
return
dbx
()->get_system_obj(
'dbxDB'
);
10
}
11
12
public
static
function
masterCid
(): int {
13
$cid =
dbx
()->get_config(
'dbxHome'
,
'cid'
);
14
if
($cid ===
'undef'
|| $cid ===
''
|| $cid ===
null
) {
15
return
0;
16
}
17
18
return
(
int
) $cid;
19
}
20
21
public
static
function
currentLng
(): string {
22
if
(function_exists(
'dbx_lng_current'
)) {
23
return
dbx_lng_current();
24
}
25
26
$lng = strtolower(trim((
string
)
dbx
()->get_system_var(
'dbx_lng'
,
dbxContentLngSync::masterLng
())));
27
return
$lng !==
''
? $lng :
dbxContentLngSync::masterLng
();
28
}
29
34
public
static
function
resolveCid
(
string
$lng =
''
): int {
35
$masterCid = self::
masterCid
();
36
if
($masterCid <= 0) {
37
return
0;
38
}
39
40
if
($lng ===
''
) {
41
$lng = self::currentLng();
42
}
43
$lng = strtolower(trim($lng));
44
$masterLng = dbxContentLngSync::masterLng();
45
46
if
($lng === $masterLng) {
47
return
$masterCid;
48
}
49
50
$db
= self::db();
51
if
(!is_object(
$db
)) {
52
return
0;
53
}
54
55
$masterDd = dbxContentLng::ddContent($masterLng);
56
$masterRow =
$db
->select1($masterDd, $masterCid,
'lng_uid'
, 0);
57
if
(!is_array($masterRow)) {
58
return
0;
59
}
60
61
$lngUid = trim((
string
) ($masterRow[
'lng_uid'
] ??
''
));
62
if
($lngUid ===
''
) {
63
$lngUid = dbxContentLngSync::ensureRecordUid(
$db
, $masterDd, $masterCid,
'p'
);
64
}
65
if
($lngUid ===
''
) {
66
return
0;
67
}
68
69
$slaveId = dbxContentLngSync::resolveIdByUid(
$db
, dbxContentLng::ddContent(), $lngUid, $lng);
70
if
($slaveId <= 0) {
71
return
0;
72
}
73
74
return
$slaveId;
75
}
76
80
public
static
function
isHomePage
(
$db
,
int
$cid,
string
$lng =
''
): bool {
81
$cid = (int) $cid;
82
if
($cid <= 0) {
83
return
false
;
84
}
85
86
if
($lng ===
''
) {
87
$lng = self::currentLng();
88
}
89
$lng = strtolower(trim($lng));
90
91
return
self::resolveCid($lng) === $cid;
92
}
93
97
public
static
function
refreshHomeCache
(
$db
,
int
$cid,
string
$lng =
''
): void {
98
return;
99
}
100
}
dbx\dbxContent\dbxContentHome
Definition
dbxContentHome.class.php:6
dbx\dbxContent\dbxContentHome\currentLng
static currentLng()
Definition
dbxContentHome.class.php:21
dbx\dbxContent\dbxContentHome\masterCid
static masterCid()
Definition
dbxContentHome.class.php:12
dbx\dbxContent\dbxContentHome\refreshHomeCache
static refreshHomeCache($db, int $cid, string $lng='')
Kompatibilitaetsmethode: Ein separater Home-Cache existiert nicht mehr.
Definition
dbxContentHome.class.php:97
dbx\dbxContent\dbxContentHome\isHomePage
static isHomePage($db, int $cid, string $lng='')
Prueft, ob eine Seite die Startseite der angegebenen Sprache ist.
Definition
dbxContentHome.class.php:80
dbx\dbxContent\dbxContentHome\resolveCid
static resolveCid(string $lng='')
Startseiten-CID fuer die aktive (oder uebergebene) Sprache.
Definition
dbxContentHome.class.php:34
dbx\dbxContent\dbxContentLngSync\masterLng
static masterLng()
Definition
dbxContentLngSync.class.php:10
if
if( $syncRequest)
Definition
index.php:520
dbx
DBX schema administration.
$db
$db
Definition
run_context_help_provision.php:38
dbx
modules
dbxContent
include
dbxContentHome.class.php
Generated by
1.17.0