46 return (
bool) $DIC[
'ilSetting']->get(
'tos_status',
false);
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));
104 $entity = $this->
getEntityFactory()->getByName(
'ilTermsOfServiceAcceptanceEntity');
105 $databaseGateway = $this->
getDataGatewayFactory()->getByName(
'ilTermsOfServiceAcceptanceDatabaseGateway');
108 ->withUserId((
int) $user->
getId())
109 ->withTimestamp(time())
110 ->withText((
string) $document->
content())
111 ->withHash(md5($document->
content()))
112 ->withDocumentId((
int) $document->
id())
113 ->withTitle((
string) $document->
title());
115 $criteriaBag = new \ilTermsOfServiceAcceptanceHistoryCriteriaBag($document->
criteria());
116 $entity = $entity->withSerializedCriteria($criteriaBag->toJson());
118 $databaseGateway->trackAcceptance($entity);
130 return new \ilTermsOfServiceEntityFactory();
Class ilTermsOfServiceEntityFactory.
deleteAcceptanceHistoryByUser(int $userId)
if(!array_key_exists('StateId', $_REQUEST)) $id
writeAccepted()
write accept date of user agreement to db
Class ilTermsOfServiceDataGatewayFactory.
getId()
get object id public
trackAcceptance(\ilObjUser $user, \ilTermsOfServiceSignableDocument $document)
static setStatus(bool $status)
getCurrentAcceptanceForUser(\ilObjUser $user)
__construct(\ilDBInterface $database=null, \ilTermsOfServiceDataGatewayFactory $dataGatewayFactory=null)
ilTermsOfServiceHelper constructor.
Class ilTermsOfServiceHelper.
Class ilTermsOfServiceAcceptanceEntity.
Interface ilTermsOfServiceSignableDocument.
hasToAcceptTermsOfServiceInSession($status=null)