ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
40  case self::CONTEXT_AGRREMENT_BY_LANGUAGE:
41  $this->validateConfiguration(array('lng'));
42  require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceAgreementByLanguageProvider.php';
43  return new ilTermsOfServiceAgreementByLanguageProvider($this->lng);
44 
45  case self::CONTEXT_ACCEPTANCE_HISTORY:
46  $this->validateConfiguration(array('db'));
47  require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceAcceptanceHistoryProvider.php';
49 
50  default:
51  throw new InvalidArgumentException('Provider not supported');
52  }
53  }
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 77 of file class.ilTermsOfServiceTableDataProviderFactory.php.

Referenced by validateConfiguration().

78  {
79  switch($member)
80  {
81  case 'lng':
82  require_once 'Services/TermsOfService/exceptions/class.ilTermsOfServiceMissingLanguageAdapterException.php';
83  return new ilTermsOfServiceMissingLanguageAdapterException('Incomplete factory configuration. Please inject a language adapter.');
84 
85  case 'db':
86  require_once 'Services/TermsOfService/exceptions/class.ilTermsOfServiceMissingDatabaseAdapterException.php';
87  return new ilTermsOfServiceMissingDatabaseAdapterException('Incomplete factory configuration. Please inject a database adapter.');
88 
89  default:
90  throw new InvalidArgumentException("Exveption for member {$member} not supported");
91  }
92  }
+ 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 60 of file class.ilTermsOfServiceTableDataProviderFactory.php.

References getExceptionByMember().

Referenced by getByContext().

61  {
62  foreach($mandatory_members as $member)
63  {
64  if(null == $this->{$member})
65  {
66  $exception = $this->getExceptionByMember($member);
67  throw $exception;
68  }
69  }
70  }
+ 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: