19 declare(strict_types=1);
36 $res = $this->db->queryF(
37 'SELECT id FROM tos_versions WHERE hash = %s AND doc_id = %s',
42 if ($this->db->numRows(
$res)) {
43 $row = $this->db->fetchAssoc(
$res);
44 $versionId = $row[
'id'];
46 $versionId = $this->db->nextId(
'tos_versions');
50 'id' => [
'integer', $versionId],
51 'text' => [
'clob', $entity->
getText()],
52 'hash' => [
'text', $entity->
getHash()],
54 'title' => [
'text', $entity->
getTitle()],
61 'tos_acceptance_track',
63 'tosv_id' => [
'integer', $versionId],
64 'usr_id' => [
'integer', $entity->
getUserId()],
74 $this->db->setLimit(1, 0);
76 $res = $this->db->queryF(
78 SELECT tos_versions.*, 79 tos_acceptance_track.ts accepted_ts, 80 tos_acceptance_track.criteria, 81 tos_acceptance_track.usr_id 82 FROM tos_acceptance_track 83 INNER JOIN tos_versions ON id = tosv_id 85 ORDER BY tos_acceptance_track.ts DESC 90 $row = $this->db->fetchAssoc(
$res);
98 ->withUserId((
int) $row[
'usr_id'])
99 ->withText((
string) $row[
'text'])
100 ->withTimestamp((
int) $row[
'accepted_ts'])
101 ->withHash((
string) $row[
'hash'])
102 ->withDocumentId((
int) $row[
'doc_id'])
103 ->withTitle((
string) $row[
'title'])
104 ->withSerializedCriteria((
string) $row[
'criteria']);
111 $res = $this->db->queryF(
120 $row = $this->db->fetchAssoc(
$res);
124 ->withText($row[
'text'])
125 ->withHash($row[
'hash'])
126 ->withDocumentId($row[
'doc_id'])
127 ->withTitle($row[
'title']);
134 $this->db->manipulate(
135 'DELETE FROM tos_acceptance_track WHERE usr_id = ' . $this->db->quote($entity->
getUserId(),
'integer')
__construct(ilDBInterface $db)
Class ilTermsOfServiceAcceptanceDatabaseGateway.
loadById(ilTermsOfServiceAcceptanceEntity $entity)
trackAcceptance(ilTermsOfServiceAcceptanceEntity $entity)
loadCurrentAcceptanceOfUser(ilTermsOfServiceAcceptanceEntity $entity)
Class ilTermsOfServiceAcceptanceEntity.
deleteAcceptanceHistoryByUser(ilTermsOfServiceAcceptanceEntity $entity)
Interface ilTermsOfServiceAcceptanceDataGateway.