ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTermsOfServiceHelper Class Reference
+ Collaboration diagram for ilTermsOfServiceHelper:

Static Public Member Functions

static deleteAcceptanceHistoryByUser ($usr_id)
static getCurrentAcceptanceForUser (ilObjUser $user)
static getById ($id)
static trackAcceptance (ilObjUser $user, ilTermsOfServiceSignableDocument $document)

Static Private Member Functions

static getEntityFactory ()

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 8 of file class.ilTermsOfServiceHelper.php.

Member Function Documentation

static ilTermsOfServiceHelper::deleteAcceptanceHistoryByUser (   $usr_id)
static
Parameters
int$usr_id

Definition at line 39 of file class.ilTermsOfServiceHelper.php.

References $usr_id, and getEntityFactory().

Referenced by ilTermsOfServiceAppEventListener\handleEvent().

{
$entity = self::getEntityFactory()->getByName('ilTermsOfServiceAcceptanceEntity');
$data_gateway = self::getDataGatewayFactory()->getByName('ilTermsOfServiceAcceptanceDatabaseGateway');
$entity->setUserId($usr_id);
$data_gateway->deleteAcceptanceHistoryByUser($entity);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilTermsOfServiceHelper::getById (   $id)
static
Parameters
integer$id
Returns
ilTermsOfServiceAcceptanceEntity

Definition at line 63 of file class.ilTermsOfServiceHelper.php.

References getEntityFactory().

Referenced by ilObjTermsOfServiceGUI\getAcceptedContentAsynch().

{
$entity = self::getEntityFactory()->getByName('ilTermsOfServiceAcceptanceEntity');
$data_gateway = self::getDataGatewayFactory()->getByName('ilTermsOfServiceAcceptanceDatabaseGateway');
$entity->setId($id);
return $data_gateway->loadById($entity);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilTermsOfServiceHelper::getCurrentAcceptanceForUser ( ilObjUser  $user)
static
Parameters
ilObjUser$user
Returns
ilTermsOfServiceAcceptanceEntity

Definition at line 51 of file class.ilTermsOfServiceHelper.php.

References getEntityFactory(), and ilObject\getId().

{
$entity = self::getEntityFactory()->getByName('ilTermsOfServiceAcceptanceEntity');
$data_gateway = self::getDataGatewayFactory()->getByName('ilTermsOfServiceAcceptanceDatabaseGateway');
$entity->setUserId($user->getId());
return $data_gateway->loadCurrentAcceptanceOfUser($entity);
}

+ Here is the call graph for this function:

static ilTermsOfServiceHelper::getEntityFactory ( )
staticprivate
Returns
ilTermsOfServiceEntityFactory

Definition at line 99 of file class.ilTermsOfServiceHelper.php.

Referenced by deleteAcceptanceHistoryByUser(), getById(), getCurrentAcceptanceForUser(), and trackAcceptance().

{
require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceEntityFactory.php';
}

+ Here is the caller graph for this function:

static ilTermsOfServiceHelper::trackAcceptance ( ilObjUser  $user,
ilTermsOfServiceSignableDocument  $document 
)
static
Parameters
ilObjUser$user
ilTermsOfServiceSignableDocument$document

Definition at line 75 of file class.ilTermsOfServiceHelper.php.

References ilTermsOfServiceSignableDocument\getContent(), getEntityFactory(), ilObject\getId(), ilTermsOfServiceSignableDocument\getIso2LanguageCode(), ilTermsOfServiceSignableDocument\getSource(), ilTermsOfServiceSignableDocument\getSourceType(), ilObjUser\hasToAcceptTermsOfServiceInSession(), and ilObjUser\writeAccepted().

{
if(self::isEnabled())
{
$entity = self::getEntityFactory()->getByName('ilTermsOfServiceAcceptanceEntity');
$data_gateway = self::getDataGatewayFactory()->getByName('ilTermsOfServiceAcceptanceDatabaseGateway');
$entity->setUserId($user->getId());
$entity->setTimestamp(time());
$entity->setIso2LanguageCode($document->getIso2LanguageCode());
$entity->setSource($document->getSource());
$entity->setSourceType($document->getSourceType());
$entity->setText($document->getContent());
$entity->setHash(md5($document->getContent()));
$data_gateway->trackAcceptance($entity);
$user->writeAccepted(); // <- Has to be refactored in future releases
}
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: