ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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

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

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

References getDatabaseAdapter(), and validateConfiguration().

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

{
switch($context)
{
case self::CONTEXT_AGRREMENT_BY_LANGUAGE:
$this->validateConfiguration(array('lng'));
require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceAgreementByLanguageProvider.php';
case self::CONTEXT_ACCEPTANCE_HISTORY:
$this->validateConfiguration(array('db'));
require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceAcceptanceHistoryProvider.php';
default:
throw new InvalidArgumentException('Provider not supported');
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTermsOfServiceTableDataProviderFactory::getDatabaseAdapter ( )
Returns
ilDB|null

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

References $db.

Referenced by getByContext(), and ilTermsOfServiceTableDataProviderFactoryTest\testFactoryShouldReturnDatabaseAdapterWhenDatabaseAdapterIsSet().

{
return $this->db;
}

+ Here is the caller graph for this function:

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

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

Referenced by validateConfiguration().

{
switch($member)
{
case 'lng':
require_once 'Services/TermsOfService/exceptions/class.ilTermsOfServiceMissingLanguageAdapterException.php';
return new ilTermsOfServiceMissingLanguageAdapterException('Incomplete factory configuration. Please inject a language adapter.');
case 'db':
require_once 'Services/TermsOfService/exceptions/class.ilTermsOfServiceMissingDatabaseAdapterException.php';
return new ilTermsOfServiceMissingDatabaseAdapterException('Incomplete factory configuration. Please inject a database adapter.');
default:
throw new InvalidArgumentException("Exveption for member {$member} not supported");
}
}

+ Here is the caller graph for this function:

ilTermsOfServiceTableDataProviderFactory::getLanguageAdapter ( )
Returns
ilLanguage

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

References $lng.

Referenced by ilTermsOfServiceTableDataProviderFactoryTest\testFactoryShouldReturnLanguageAdapterWhenLanguageAdapterIsSet().

{
return $this->lng;
}

+ Here is the caller graph for this function:

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().

{
foreach($mandatory_members as $member)
{
if(null == $this->{$member})
{
$exception = $this->getExceptionByMember($member);
throw $exception;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilTermsOfServiceTableDataProviderFactory::$db
protected
ilTermsOfServiceTableDataProviderFactory::$lng
protected

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