1<?
php declare(strict_types=1);
46 return (
bool)
$DIC[
'ilSetting']->get(
'tos_status',
false);
52 public static function setStatus(
bool $status) : void
56 $DIC[
'ilSetting']->set(
'tos_status', (
int) $status);
65 $entity = $this->
getEntityFactory()->getByName(
'ilTermsOfServiceAcceptanceEntity');
66 $databaseGateway = $this->
getDataGatewayFactory()->getByName(
'ilTermsOfServiceAcceptanceDatabaseGateway');
68 $databaseGateway->deleteAcceptanceHistoryByUser($entity->withUserId($userId));
78 $entity = $this->
getEntityFactory()->getByName(
'ilTermsOfServiceAcceptanceEntity');
79 $databaseGateway = $this->
getDataGatewayFactory()->getByName(
'ilTermsOfServiceAcceptanceDatabaseGateway');
81 return $databaseGateway->loadCurrentAcceptanceOfUser($entity->withUserId((
int) $user->
getId()));
91 $entity = $this->
getEntityFactory()->getByName(
'ilTermsOfServiceAcceptanceEntity');
92 $databaseGateway = $this->
getDataGatewayFactory()->getByName(
'ilTermsOfServiceAcceptanceDatabaseGateway');
94 return $databaseGateway->loadById($entity->withId($id));
105 $entity = $this->
getEntityFactory()->getByName(
'ilTermsOfServiceAcceptanceEntity');
106 $databaseGateway = $this->
getDataGatewayFactory()->getByName(
'ilTermsOfServiceAcceptanceDatabaseGateway');
109 ->withUserId((
int) $user->
getId())
110 ->withTimestamp(time())
111 ->withText((
string) $document->
content())
112 ->withHash(md5($document->
content()))
113 ->withDocumentId((
int) $document->
id())
114 ->withTitle((
string) $document->
title());
117 $entity = $entity->withSerializedCriteria($criteriaBag->toJson());
119 $databaseGateway->trackAcceptance($entity);
An exception for terminatinating execution or to throw for unit testing.
writeAccepted()
write accept date of user agreement to db
hasToAcceptTermsOfServiceInSession($status=null)
getId()
get object id @access public
Class ilTermsOfServiceAcceptanceEntity.
Class ilTermsOfServiceAcceptanceHistoryCriteriaBag.
Class ilTermsOfServiceDataGatewayFactory.
Class ilTermsOfServiceEntityFactory.
Class ilTermsOfServiceHelper.
getCurrentAcceptanceForUser(ilObjUser $user)
__construct(ilDBInterface $database=null, ilTermsOfServiceDataGatewayFactory $dataGatewayFactory=null)
ilTermsOfServiceHelper constructor.
static setStatus(bool $status)
deleteAcceptanceHistoryByUser(int $userId)
trackAcceptance(ilObjUser $user, ilTermsOfServiceSignableDocument $document)
Interface ilTermsOfServiceSignableDocument.