ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ 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
$ilDB
;
29
30
if
(!$this->
doSingleFake
()) {
31
$sql =
"SELECT "
. $this->
getElementId
() .
32
" FROM "
. $this->
getSubTableName
() .
33
" WHERE "
. $this->
buildPrimaryWhere
();
34
$set = $ilDB->query($sql);
35
36
$this->
readMultiRecord
($set);
37
}
else
{
38
if
(trim($a_row[$this->
getElementId
()])) {
39
$value = explode(self::SEPARATOR, $a_row[$this->
getElementId
()]);
40
array_pop($value);
41
array_shift($value);
42
$this->
getADT
()->setSelections($value);
43
}
44
}
45
}
46
47
protected
function
readMultiRecord
($a_set)
48
{
49
global
$ilDB
;
50
51
$elements =
array
();
52
53
while
(
$row
= $ilDB->fetchAssoc($a_set)) {
54
$elements[] =
$row
[$this->
getElementId
()];
55
}
56
57
$this->
getADT
()->setSelections($elements);
58
}
59
60
public
function
prepareInsert
(
array
&$a_fields)
61
{
62
if
($this->
doSingleFake
()) {
63
$values = (
array
) $this->
getADT
()->getSelections();
64
if
(
sizeof
($values)) {
65
$values = self::SEPARATOR . implode(self::SEPARATOR, $values) . self::SEPARATOR;
66
}
67
$a_fields[$this->
getElementId
()] =
array
(
"text"
, $values);
68
}
69
}
70
71
protected
function
prepareMultiInsert
()
72
{
73
$res
=
array
();
74
75
$type
= ($this->
getADT
() instanceof
ilADTMultiEnumNumeric
)
76
?
"integer"
77
:
"text"
;
78
79
foreach
((
array
) $this->
getADT
()->getSelections() as $element) {
80
$res
[] =
array
($this->
getElementId
() =>
array
(
$type
, $element));
81
}
82
83
return
$res
;
84
}
85
}
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
ilADTMultiEnumDBBridge\prepareMultiInsert
prepareMultiInsert()
Definition:
class.ilADTMultiEnumDBBridge.php:71
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:60
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
ilADTMultiEnumDBBridge\doSingleFake
doSingleFake()
Definition:
class.ilADTMultiEnumDBBridge.php:21
ilADTMultiEnum
Definition:
class.ilADTMultiEnum.php:3
ilADTMultiEnumNumeric
Definition:
class.ilADTMultiEnumNumeric.php:3
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
$row
$row
Definition:
10autofilter-selection-1.php:74
ilADTMultiEnumDBBridge\readMultiRecord
readMultiRecord($a_set)
Definition:
class.ilADTMultiEnumDBBridge.php:47
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 Sat Jan 18 2025 19:01:26 for ILIAS by
1.8.13 (using
Doxyfile
)