ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTermsOfServiceTableDataProviderFactory Class Reference

Class ilTermsOfServiceTableDataProviderFactory. More...

+ Collaboration diagram for ilTermsOfServiceTableDataProviderFactory:

Public Member Functions

 getByContext (string $context)
 
 setDatabaseAdapter ($db)
 
 getDatabaseAdapter ()
 

Data Fields

const CONTEXT_ACCEPTANCE_HISTORY = 'acceptance_history'
 
const CONTEXT_DOCUMENTS = 'documents'
 

Protected Member Functions

 validateConfiguration (array $mandatoryMemberVariables)
 
 getExceptionByMember ($member)
 

Protected Attributes

 $db
 

Detailed Description

Member Function Documentation

◆ getByContext()

ilTermsOfServiceTableDataProviderFactory::getByContext ( string  $context)
Parameters
string$context
Returns
\ilTermsOfServiceAcceptanceHistoryProvider
Exceptions

ilTermsOfServiceMissingDatabaseAdapterException

Exceptions

InvalidArgumentException

Definition at line 22 of file class.ilTermsOfServiceTableDataProviderFactory.php.

23 {
24 switch ($context) {
26 $this->validateConfiguration(array('db'));
27 return new \ilTermsOfServiceAcceptanceHistoryProvider($this->getDatabaseAdapter());
28
30 return new \ilTermsOfServiceDocumentTableDataProvider();
31
32 default:
33 throw new \InvalidArgumentException('Provider not supported');
34 }
35 }
Interface ilTermsOfServiceTableDataProvider.
$context
Definition: webdav.php:25

References $context, CONTEXT_ACCEPTANCE_HISTORY, CONTEXT_DOCUMENTS, getDatabaseAdapter(), and validateConfiguration().

+ Here is the call graph for this function:

◆ getDatabaseAdapter()

ilTermsOfServiceTableDataProviderFactory::getDatabaseAdapter ( )
Returns
\ilDBInterface|null

Definition at line 80 of file class.ilTermsOfServiceTableDataProviderFactory.php.

References $db.

Referenced by getByContext().

+ Here is the caller graph for this function:

◆ getExceptionByMember()

ilTermsOfServiceTableDataProviderFactory::getExceptionByMember (   $member)
protected
Parameters
string$member
Returns
\ilTermsOfServiceMissingDatabaseAdapterException
Exceptions

InvalidArgumentException

Definition at line 56 of file class.ilTermsOfServiceTableDataProviderFactory.php.

57 {
58 switch ($member) {
59 case 'db':
60 return new \ilTermsOfServiceMissingDatabaseAdapterException(
61 'Incomplete factory configuration. Please inject a database adapter.'
62 );
63
64 default:
65 throw new \InvalidArgumentException("Exception for member {$member} not supported");
66 }
67 }

Referenced by validateConfiguration().

+ Here is the caller graph for this function:

◆ setDatabaseAdapter()

ilTermsOfServiceTableDataProviderFactory::setDatabaseAdapter (   $db)
Parameters
\ilDBInterface | null$db

Definition at line 72 of file class.ilTermsOfServiceTableDataProviderFactory.php.

73 {
74 $this->db = $db;
75 }

References $db.

◆ validateConfiguration()

ilTermsOfServiceTableDataProviderFactory::validateConfiguration ( array  $mandatoryMemberVariables)
protected
Parameters
array$mandatoryMemberVariables
Exceptions

ilTermsOfServiceMissingDatabaseAdapterException

Definition at line 41 of file class.ilTermsOfServiceTableDataProviderFactory.php.

42 {
43 foreach ($mandatoryMemberVariables as $member) {
44 if (null == $this->{$member}) {
45 $exception = $this->getExceptionByMember($member);
46 throw $exception;
47 }
48 }
49 }

References getExceptionByMember().

Referenced by getByContext().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilTermsOfServiceTableDataProviderFactory::$db
protected

◆ CONTEXT_ACCEPTANCE_HISTORY

◆ CONTEXT_DOCUMENTS

const ilTermsOfServiceTableDataProviderFactory::CONTEXT_DOCUMENTS = 'documents'

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