ILIAS
release_8 Revision v8.19
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
j
l
m
p
s
t
u
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
g
h
i
m
n
p
r
s
t
u
v
x
+
Variables
$
a
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
class.ilADTLocalizedTextDBBridge.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
25
class
ilADTLocalizedTextDBBridge
extends
ilADTDBBridge
26
{
27
public
function
getTable
(): ?string
28
{
29
return
'adv_md_values_ltext'
;
30
}
31
35
protected
function
isValidADT
(
ilADT
$adt
): bool
36
{
37
return
$adt instanceof
ilADTLocalizedText
;
38
}
39
43
public
function
readRecord
(array $a_row): void
44
{
45
$active_languages = $this->
getADT
()->getCopyOfDefinition()->getActiveLanguages();
46
$default_language = $this->
getADT
()->getCopyOfDefinition()->getDefaultLanguage();
47
$language = $a_row[$this->
getElementId
() .
'_language'
];
48
49
if
(strcmp($language, $default_language) === 0) {
50
$this->
getADT
()->setText($a_row[$this->
getElementId
() .
'_translation'
]);
51
} elseif (!strlen($default_language)) {
52
$this->
getADT
()->setText($a_row[$this->
getElementId
() .
'_translation'
]);
53
}
54
if
(in_array($language, $active_languages)) {
55
$this->
getADT
()->setTranslation(
56
$language,
57
(
string
) $a_row[$this->
getElementId
() .
'_translation'
]
58
);
59
}
60
}
61
65
public
function
prepareInsert
(array &$a_fields): void
66
{
67
$a_fields[$this->
getElementId
()] = [
ilDBConstants::T_TEXT
, $this->
getADT
()->getText()];
68
}
69
73
public
function
afterInsert
(): void
74
{
75
$this->
afterUpdate
();
76
}
77
78
public
function
getAdditionalPrimaryFields
(): array
79
{
80
return
[
81
'value_index'
=> [
ilDBConstants::T_TEXT
,
''
]
82
];
83
}
84
88
public
function
afterUpdate
(): void
89
{
90
if
(!$this->
getADT
()->getCopyOfDefinition()->supportsTranslations()) {
91
return
;
92
}
93
$this->
deleteTranslations
();
94
$this->
insertTranslations
();
95
}
96
100
protected
function
deleteTranslations
(): void
101
{
102
$this->db->manipulate(
103
$q =
104
'delete from '
. $this->
getTable
() .
' '
.
105
'where '
. $this->
buildPrimaryWhere
() .
' '
.
106
'and value_index != '
. $this->db->quote(
''
,
ilDBConstants::T_TEXT
)
107
);
108
}
109
115
protected
function
insertTranslations
(): void
116
{
117
foreach
($this->
getADT
()->getTranslations() as $language => $value) {
118
$fields = $this->
getPrimary
();
119
$fields[
'value_index'
] = [
ilDBConstants::T_TEXT
, $language];
120
$fields[
'value'
] = [
ilDBConstants::T_TEXT
, $value];
121
$this->db->insert($this->
getTable
(), $fields);
122
}
123
}
124
}
ilADTLocalizedTextDBBridge\getAdditionalPrimaryFields
getAdditionalPrimaryFields()
Definition:
class.ilADTLocalizedTextDBBridge.php:78
ilADTDBBridge\buildPrimaryWhere
buildPrimaryWhere()
Convert primary keys array to sql string.
Definition:
class.ilADTDBBridge.php:103
ilADTLocalizedTextDBBridge\afterInsert
afterInsert()
Definition:
class.ilADTLocalizedTextDBBridge.php:73
ilADTLocalizedTextDBBridge\isValidADT
isValidADT(ilADT $adt)
Definition:
class.ilADTLocalizedTextDBBridge.php:35
ilADTLocalizedTextDBBridge\readRecord
readRecord(array $a_row)
Definition:
class.ilADTLocalizedTextDBBridge.php:43
ilADTLocalizedTextDBBridge\deleteTranslations
deleteTranslations()
delete translations
Definition:
class.ilADTLocalizedTextDBBridge.php:100
ilADTDBBridge\getPrimary
getPrimary()
Get primary fields.
Definition:
class.ilADTDBBridge.php:93
ilADTLocalizedTextDBBridge\getTable
getTable()
Definition:
class.ilADTLocalizedTextDBBridge.php:27
ilADTDBBridge\getElementId
getElementId()
Get element id.
Definition:
class.ilADTDBBridge.php:70
ilADT
ADT base class.
Definition:
class.ilADT.php:11
ilADTLocalizedText
Class ilADTLocalizedText.
Definition:
class.ilADTLocalizedText.php:25
ilADTLocalizedTextDBBridge
Class ilADTLocalizedTextDBBridge.
Definition:
class.ilADTLocalizedTextDBBridge.php:25
ilADTDBBridge\$adt
ilADT $adt
Definition:
class.ilADTDBBridge.php:13
ilDBConstants\T_TEXT
const T_TEXT
Definition:
class.ilDBConstants.php:56
ilADTDBBridge
ADT DB bridge base class.
Definition:
class.ilADTDBBridge.php:11
ilADTLocalizedTextDBBridge\insertTranslations
insertTranslations()
Save all translations TODO: Translations are always persisted for all active languages, even if the translation is an empty string.
Definition:
class.ilADTLocalizedTextDBBridge.php:115
ilADTLocalizedTextDBBridge\prepareInsert
prepareInsert(array &$a_fields)
Definition:
class.ilADTLocalizedTextDBBridge.php:65
ilADTLocalizedTextDBBridge\afterUpdate
afterUpdate()
Definition:
class.ilADTLocalizedTextDBBridge.php:88
ilADTDBBridge\getADT
getADT()
Definition:
class.ilADTDBBridge.php:42
Services
ADT
classes
Types
LocalizedText
class.ilADTLocalizedTextDBBridge.php
Generated on Sun Apr 6 2025 22:01:56 for ILIAS by
1.8.13 (using
Doxyfile
)