ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTermsOfServiceTableDataProviderFactory Class Reference
+ Collaboration diagram for ilTermsOfServiceTableDataProviderFactory:

Public Member Functions

 getByContext ($context)
 
 setLanguageAdapter ($lng)
 
 getLanguageAdapter ()
 
 setDatabaseAdapter ($db)
 
 getDatabaseAdapter ()
 

Data Fields

const CONTEXT_AGRREMENT_BY_LANGUAGE = 'agreements_by_language'
 
const CONTEXT_ACCEPTANCE_HISTORY = 'acceptance_history'
 

Protected Member Functions

 validateConfiguration (array $mandatory_members)
 
 getExceptionByMember ($member)
 

Protected Attributes

 $lng
 
 $db
 

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.ilTermsOfServiceTableDataProviderFactory.php.

Member Function Documentation

◆ getByContext()

ilTermsOfServiceTableDataProviderFactory::getByContext (   $context)
Parameters
string$context
Returns
ilTermsOfServiceAgreementByLanguageProvider|ilTermsOfServiceAgreementByLanguageProvider|ilTermsOfServiceAcceptanceHistoryProvider
Exceptions
ilTermsOfServiceMissingLanguageAdapterException
InvalidArgumentException

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

References array, getDatabaseAdapter(), and validateConfiguration().

Referenced by ilTermsOfServiceTableDataProviderFactoryTest\testExceptionIsRaisedWhenAcceptanceHistoryProviderIsRequestedWithoutCompleteFactoryConfiguration(), ilTermsOfServiceTableDataProviderFactoryTest\testExceptionIsRaisedWhenAgreementByLanguageProviderIsRequestedWithoutCompleteFactoryConfiguration(), ilTermsOfServiceTableDataProviderFactoryTest\testExceptionIsRaisedWhenUnsupportedProviderIsRequested(), ilTermsOfServiceTableDataProviderFactoryTest\testFactoryShouldReturnAcceptanceHistoryProviderWhenRequested(), and ilTermsOfServiceTableDataProviderFactoryTest\testFactoryShouldReturnAgreementByLanguageProviderWhenRequested().

37  {
38  switch ($context) {
39  case self::CONTEXT_AGRREMENT_BY_LANGUAGE:
40  $this->validateConfiguration(array('lng'));
41  require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceAgreementByLanguageProvider.php';
42  return new ilTermsOfServiceAgreementByLanguageProvider($this->lng);
43 
44  case self::CONTEXT_ACCEPTANCE_HISTORY:
45  $this->validateConfiguration(array('db'));
46  require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceAcceptanceHistoryProvider.php';
48 
49  default:
50  throw new InvalidArgumentException('Provider not supported');
51  }
52  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDatabaseAdapter()

ilTermsOfServiceTableDataProviderFactory::getDatabaseAdapter ( )

◆ getExceptionByMember()

ilTermsOfServiceTableDataProviderFactory::getExceptionByMember (   $member)
protected
Parameters
string$member
Returns
ilTermsOfServiceMissingDatabaseAdapterException|ilTermsOfServiceMissingLanguageAdapterException
Exceptions
InvalidArgumentException

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

Referenced by validateConfiguration().

75  {
76  switch ($member) {
77  case 'lng':
78  require_once 'Services/TermsOfService/exceptions/class.ilTermsOfServiceMissingLanguageAdapterException.php';
79  return new ilTermsOfServiceMissingLanguageAdapterException('Incomplete factory configuration. Please inject a language adapter.');
80 
81  case 'db':
82  require_once 'Services/TermsOfService/exceptions/class.ilTermsOfServiceMissingDatabaseAdapterException.php';
83  return new ilTermsOfServiceMissingDatabaseAdapterException('Incomplete factory configuration. Please inject a database adapter.');
84 
85  default:
86  throw new InvalidArgumentException("Exveption for member {$member} not supported");
87  }
88  }
+ Here is the caller graph for this function:

◆ getLanguageAdapter()

ilTermsOfServiceTableDataProviderFactory::getLanguageAdapter ( )

◆ setDatabaseAdapter()

◆ setLanguageAdapter()

◆ validateConfiguration()

ilTermsOfServiceTableDataProviderFactory::validateConfiguration ( array  $mandatory_members)
protected
Parameters
array$mandatory_members
Exceptions
ilTermsOfServiceMissingLanguageAdapterException
ilTermsOfServiceMissingDatabaseAdapterException

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

References getExceptionByMember().

Referenced by getByContext().

60  {
61  foreach ($mandatory_members as $member) {
62  if (null == $this->{$member}) {
63  $exception = $this->getExceptionByMember($member);
64  throw $exception;
65  }
66  }
67  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilTermsOfServiceTableDataProviderFactory::$db
protected

◆ $lng

ilTermsOfServiceTableDataProviderFactory::$lng
protected

◆ CONTEXT_ACCEPTANCE_HISTORY

◆ CONTEXT_AGRREMENT_BY_LANGUAGE


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