ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ 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
p
s
t
w
+
Functions
_
a
b
c
f
g
h
i
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
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
q
r
s
t
u
v
w
x
z
+
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
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
class.ilTermsOfServiceAcceptanceDatabaseGateway.php
Go to the documentation of this file.
1
<?php declare(strict_types=1);
2
/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8
class
ilTermsOfServiceAcceptanceDatabaseGateway
implements
ilTermsOfServiceAcceptanceDataGateway
9
{
11
protected
$db
;
12
17
public
function
__construct
(
ilDBInterface
$db
)
18
{
19
$this->db =
$db
;
20
}
21
25
public
function
trackAcceptance
(
ilTermsOfServiceAcceptanceEntity
$entity) : void
26
{
27
$res
= $this->db->queryF(
28
'SELECT id FROM tos_versions WHERE hash = %s AND doc_id = %s'
,
29
[
'text'
,
'integer'
],
30
[$entity->
getHash
(), $entity->
getDocumentId
()]
31
);
32
33
if
($this->db->numRows(
$res
)) {
34
$row = $this->db->fetchAssoc(
$res
);
35
$versionId = $row[
'id'
];
36
}
else
{
37
$versionId = $this->db->nextId(
'tos_versions'
);
38
$this->db->insert(
39
'tos_versions'
,
40
[
41
'id'
=> [
'integer'
, $versionId],
42
'text'
=> [
'clob'
, $entity->
getText
()],
43
'hash'
=> [
'text'
, $entity->
getHash
()],
44
'doc_id'
=> [
'integer'
, $entity->
getDocumentId
()],
45
'title'
=> [
'text'
, $entity->
getTitle
()],
46
'ts'
=> [
'integer'
, $entity->
getTimestamp
()]
47
]
48
);
49
}
50
51
$this->db->insert(
52
'tos_acceptance_track'
,
53
[
54
'tosv_id'
=> [
'integer'
, $versionId],
55
'usr_id'
=> [
'integer'
, $entity->
getUserId
()],
56
'criteria'
=> [
'clob'
, $entity->
getSerializedCriteria
()],
57
'ts'
=> [
'integer'
, $entity->
getTimestamp
()]
58
]
59
);
60
}
61
65
public
function
loadCurrentAcceptanceOfUser
(
66
ilTermsOfServiceAcceptanceEntity
$entity
67
) :
ilTermsOfServiceAcceptanceEntity
{
68
$this->db->setLimit(1, 0);
69
70
$res
= $this->db->queryF(
71
'
72
SELECT tos_versions.*,
73
tos_acceptance_track.ts accepted_ts,
74
tos_acceptance_track.criteria,
75
tos_acceptance_track.usr_id
76
FROM tos_acceptance_track
77
INNER JOIN tos_versions ON id = tosv_id
78
WHERE usr_id = %s
79
ORDER BY tos_acceptance_track.ts DESC
80
'
,
81
[
'integer'
],
82
[$entity->
getUserId
()]
83
);
84
$row = $this->db->fetchAssoc(
$res
);
85
86
$entity = $entity
87
->
withId
((
int
) $row[
'id'
])
88
->withUserId((
int
) $row[
'usr_id'
])
89
->withText((
string
) $row[
'text'
])
90
->withTimestamp((
int
) $row[
'accepted_ts'
])
91
->withHash((
string
) $row[
'hash'
])
92
->withDocumentId((
int
) $row[
'doc_id'
])
93
->withTitle((
string
) $row[
'title'
])
94
->withSerializedCriteria((
string
) $row[
'criteria'
]);
95
96
return
$entity;
97
}
98
102
public
function
loadById
(
ilTermsOfServiceAcceptanceEntity
$entity) :
ilTermsOfServiceAcceptanceEntity
103
{
104
$res
= $this->db->queryF(
105
'
106
SELECT *
107
FROM tos_versions
108
WHERE id = %s
109
'
,
110
[
'integer'
],
111
[$entity->
getId
()]
112
);
113
$row = $this->db->fetchAssoc(
$res
);
114
115
$entity = $entity
116
->
withId
($row[
'id'
])
117
->withText($row[
'text'
])
118
->withHash($row[
'hash'
])
119
->withDocumentId($row[
'doc_id'
])
120
->withTitle($row[
'title'
]);
121
122
return
$entity;
123
}
124
128
public
function
deleteAcceptanceHistoryByUser
(
ilTermsOfServiceAcceptanceEntity
$entity) : void
129
{
130
$this->db->manipulate(
131
'DELETE FROM tos_acceptance_track WHERE usr_id = '
. $this->db->quote($entity->
getUserId
(),
'integer'
)
132
);
133
}
134
}
ilTermsOfServiceAcceptanceEntity\getDocumentId
getDocumentId()
Definition:
class.ilTermsOfServiceAcceptanceEntity.php:163
ilTermsOfServiceAcceptanceEntity\getId
getId()
Definition:
class.ilTermsOfServiceAcceptanceEntity.php:121
ilTermsOfServiceAcceptanceEntity\getTimestamp
getTimestamp()
Definition:
class.ilTermsOfServiceAcceptanceEntity.php:79
ilTermsOfServiceAcceptanceEntity\getText
getText()
Definition:
class.ilTermsOfServiceAcceptanceEntity.php:58
ilTermsOfServiceAcceptanceDatabaseGateway\__construct
__construct(ilDBInterface $db)
ilTermsOfServiceAcceptanceDatabaseGateway constructor.
Definition:
class.ilTermsOfServiceAcceptanceDatabaseGateway.php:17
ilTermsOfServiceAcceptanceDatabaseGateway
Class ilTermsOfServiceAcceptanceDatabaseGateway.
Definition:
class.ilTermsOfServiceAcceptanceDatabaseGateway.php:8
ilTermsOfServiceAcceptanceEntity\getUserId
getUserId()
Definition:
class.ilTermsOfServiceAcceptanceEntity.php:100
ilTermsOfServiceAcceptanceDatabaseGateway\loadById
loadById(ilTermsOfServiceAcceptanceEntity $entity)
ilTermsOfServiceAcceptanceEntity
Definition:
class.ilTermsOfServiceAcceptanceDatabaseGateway.php:102
ilDBInterface
Interface ilDBInterface.
Definition:
interface.ilDBInterface.php:9
ilTermsOfServiceAcceptanceDatabaseGateway\trackAcceptance
trackAcceptance(ilTermsOfServiceAcceptanceEntity $entity)
Definition:
class.ilTermsOfServiceAcceptanceDatabaseGateway.php:25
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilTermsOfServiceAcceptanceEntity\getTitle
getTitle()
Definition:
class.ilTermsOfServiceAcceptanceEntity.php:142
ilTermsOfServiceAcceptanceDatabaseGateway\loadCurrentAcceptanceOfUser
loadCurrentAcceptanceOfUser(ilTermsOfServiceAcceptanceEntity $entity)
ilTermsOfServiceAcceptanceEntity
Definition:
class.ilTermsOfServiceAcceptanceDatabaseGateway.php:65
ilTermsOfServiceAcceptanceEntity\getSerializedCriteria
getSerializedCriteria()
Definition:
class.ilTermsOfServiceAcceptanceEntity.php:184
ilTermsOfServiceAcceptanceEntity
Class ilTermsOfServiceAcceptanceEntity.
Definition:
class.ilTermsOfServiceAcceptanceEntity.php:8
ilTermsOfServiceAcceptanceDatabaseGateway\$db
$db
Definition:
class.ilTermsOfServiceAcceptanceDatabaseGateway.php:11
ilTermsOfServiceAcceptanceDatabaseGateway\deleteAcceptanceHistoryByUser
deleteAcceptanceHistoryByUser(ilTermsOfServiceAcceptanceEntity $entity)
Definition:
class.ilTermsOfServiceAcceptanceDatabaseGateway.php:128
ilTermsOfServiceAcceptanceEntity\getHash
getHash()
Definition:
class.ilTermsOfServiceAcceptanceEntity.php:37
ilTermsOfServiceAcceptanceEntity\withId
withId(int $id)
Definition:
class.ilTermsOfServiceAcceptanceEntity.php:130
ilTermsOfServiceAcceptanceDataGateway
Interface ilTermsOfServiceAcceptanceDataGateway.
Definition:
interface.ilTermsOfServiceAcceptanceDataGateway.php:8
Services
TermsOfService
classes
History
class.ilTermsOfServiceAcceptanceDatabaseGateway.php
Generated on Thu Apr 3 2025 20:01:14 for ILIAS by
1.8.13 (using
Doxyfile
)