ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilADTMultiEnumDBBridge.php
Go to the documentation of this file.
1
<?
php
2
3
require_once
"Services/ADT/classes/Bridges/class.ilADTMultiDBBridge.php"
;
4
5
class
ilADTMultiEnumDBBridge
extends
ilADTMultiDBBridge
6
{
7
protected
$fake_single
;
8
9
const
SEPARATOR
=
"~|~"
;
10
11
protected
function
isValidADT
(
ilADT
$a_adt)
12
{
13
return
($a_adt instanceof
ilADTMultiEnum
);
14
}
15
16
public
function
setFakeSingle
($a_status)
17
{
18
$this->fake_single = (bool) $a_status;
19
}
20
21
protected
function
doSingleFake
()
22
{
23
return
$this->fake_single
;
24
}
25
26
public
function
readRecord
(array $a_row)
27
{
28
global
$DIC
;
29
30
$ilDB
= $DIC[
'ilDB'
];
31
32
if
(!$this->
doSingleFake
()) {
33
$sql =
"SELECT "
. $this->
getElementId
() .
34
" FROM "
. $this->
getSubTableName
() .
35
" WHERE "
. $this->
buildPrimaryWhere
();
36
$set =
$ilDB
->query($sql);
37
38
$this->
readMultiRecord
($set);
39
}
else
{
40
if
(trim($a_row[$this->
getElementId
()])) {
41
$value = explode(self::SEPARATOR, $a_row[$this->
getElementId
()]);
42
array_pop($value);
43
array_shift($value);
44
$this->
getADT
()->setSelections($value);
45
}
46
}
47
}
48
49
protected
function
readMultiRecord
($a_set)
50
{
51
global
$DIC
;
52
53
$ilDB
= $DIC[
'ilDB'
];
54
55
$elements = array();
56
57
while
(
$row
=
$ilDB
->fetchAssoc($a_set)) {
58
$elements[] =
$row
[$this->
getElementId
()];
59
}
60
61
$this->
getADT
()->setSelections($elements);
62
}
63
64
public
function
prepareInsert
(array &$a_fields)
65
{
66
if
($this->
doSingleFake
()) {
67
$values
= (array) $this->
getADT
()->getSelections();
68
if
(
sizeof
(
$values
)) {
69
$values
= self::SEPARATOR . implode(self::SEPARATOR,
$values
) . self::SEPARATOR;
70
}
71
$a_fields[$this->
getElementId
()] = array(
"text"
,
$values
);
72
}
73
}
74
75
protected
function
prepareMultiInsert
()
76
{
77
$res
= array();
78
79
$type
= ($this->
getADT
() instanceof
ilADTMultiEnumNumeric
)
80
?
"integer"
81
:
"text"
;
82
83
foreach
((array) $this->
getADT
()->getSelections() as $element) {
84
$res
[] = array($this->
getElementId
() => array(
$type
, $element));
85
}
86
87
return
$res
;
88
}
89
}
ilADTMultiEnumDBBridge\$fake_single
$fake_single
Definition:
class.ilADTMultiEnumDBBridge.php:7
ilADTDBBridge\buildPrimaryWhere
buildPrimaryWhere()
Convert primary keys array to sql string.
Definition:
class.ilADTDBBridge.php:134
ilADTMultiDBBridge\getSubTableName
getSubTableName()
Build sub-table name.
Definition:
class.ilADTMultiDBBridge.php:14
$type
$type
Definition:
proxy_ylocal.php:10
$DIC
global $DIC
Definition:
saml.php:7
ilADTMultiEnumDBBridge\prepareMultiInsert
prepareMultiInsert()
Definition:
class.ilADTMultiEnumDBBridge.php:75
ilADTMultiEnumDBBridge\isValidADT
isValidADT(ilADT $a_adt)
Definition:
class.ilADTMultiEnumDBBridge.php:11
ilADTMultiEnumDBBridge\SEPARATOR
const SEPARATOR
Definition:
class.ilADTMultiEnumDBBridge.php:9
ilADTMultiEnumDBBridge\prepareInsert
prepareInsert(array &$a_fields)
Definition:
class.ilADTMultiEnumDBBridge.php:64
ilADTDBBridge\getElementId
getElementId()
Get element id.
Definition:
class.ilADTDBBridge.php:103
ilADT
ADT base class.
Definition:
class.ilADT.php:11
ilADTMultiEnumDBBridge
Definition:
class.ilADTMultiEnumDBBridge.php:5
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilADTMultiDBBridge
Definition:
class.ilADTMultiDBBridge.php:5
$values
$values
Definition:
testOperations.php:7
ilADTMultiEnumDBBridge\doSingleFake
doSingleFake()
Definition:
class.ilADTMultiEnumDBBridge.php:21
ilADTMultiEnum
Definition:
class.ilADTMultiEnum.php:3
ilADTMultiEnumNumeric
Definition:
class.ilADTMultiEnumNumeric.php:3
$row
$row
Definition:
migrateto20.php:360
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
php
ilADTMultiEnumDBBridge\readMultiRecord
readMultiRecord($a_set)
Definition:
class.ilADTMultiEnumDBBridge.php:49
ilADTDBBridge\getADT
getADT()
Get ADT.
Definition:
class.ilADTDBBridge.php:63
ilADTMultiEnumDBBridge\setFakeSingle
setFakeSingle($a_status)
Definition:
class.ilADTMultiEnumDBBridge.php:16
ilADTMultiEnumDBBridge\readRecord
readRecord(array $a_row)
Definition:
class.ilADTMultiEnumDBBridge.php:26
Services
ADT
classes
Types
MultiEnum
class.ilADTMultiEnumDBBridge.php
Generated on Thu Jan 30 2025 19:01:51 for ILIAS by
1.8.13 (using
Doxyfile
)