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

Protected Member Functions

 getSelectPart (array $params, array $filter)
 getFromPart (array $params, array $filter)
 getWherePart (array $params, array $filter)
 getGroupByPart (array $params, array $filter)
 getHavingPart (array $params, array $filter)
 getOrderByPart (array $params, array $filter)

Additional Inherited Members

- Public Member Functions inherited from ilTermsOfServiceTableDatabaseDataProvider
 __construct (ilDB $db)
 getList (array $params, array $filter)
- Protected Attributes inherited from ilTermsOfServiceTableDatabaseDataProvider
 $db

Detailed Description

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

Definition at line 10 of file class.ilTermsOfServiceAcceptanceHistoryProvider.php.

Member Function Documentation

ilTermsOfServiceAcceptanceHistoryProvider::getFromPart ( array  $params,
array  $filter 
)
protected
Parameters
array$params
array$filter
Returns
string

Reimplemented from ilTermsOfServiceTableDatabaseDataProvider.

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

{
$joins = array(
'INNER JOIN tos_acceptance_track ON tos_acceptance_track.usr_id = ud.usr_id',
'INNER JOIN tos_versions ON tos_versions.id = tos_acceptance_track.tosv_id',
);
return 'usr_data ud ' . implode(' ', $joins);
}
ilTermsOfServiceAcceptanceHistoryProvider::getGroupByPart ( array  $params,
array  $filter 
)
protected
Parameters
array$params
array$filter
Returns
string

Reimplemented from ilTermsOfServiceTableDatabaseDataProvider.

Definition at line 89 of file class.ilTermsOfServiceAcceptanceHistoryProvider.php.

{
return '';
}
ilTermsOfServiceAcceptanceHistoryProvider::getHavingPart ( array  $params,
array  $filter 
)
protected
Parameters
array$params
array$filter
Returns
string

Reimplemented from ilTermsOfServiceTableDatabaseDataProvider.

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

{
return '';
}
ilTermsOfServiceAcceptanceHistoryProvider::getOrderByPart ( array  $params,
array  $filter 
)
protected
Parameters
array$params
array$filter
Returns
string
Exceptions
InvalidArgumentException

Reimplemented from ilTermsOfServiceTableDatabaseDataProvider.

Definition at line 110 of file class.ilTermsOfServiceAcceptanceHistoryProvider.php.

{
if(isset($params['order_field']))
{
if(!is_string($params['order_field']))
{
throw new InvalidArgumentException('Please provide a valid order field.');
}
if(!in_array($params['order_field'], array('lng', 'login', 'firstname', 'lastname', 'src', 'ts')))
{
throw new InvalidArgumentException('Please provide a valid order field.');
}
if($params['order_field'] == 'ts')
{
$params['order_field'] = 'tos_acceptance_track.ts';
}
if(!isset($params['order_direction']))
{
$params['order_direction'] = 'ASC';
}
else if(!in_array(strtolower($params['order_direction']), array('asc', 'desc')))
{
throw new InvalidArgumentException('Please provide a valid order direction.');
}
return $params['order_field'] . ' ' . $params['order_direction'];
}
return '';
}
ilTermsOfServiceAcceptanceHistoryProvider::getSelectPart ( array  $params,
array  $filter 
)
protected
Parameters
array$params
array$filter
Returns
string

Reimplemented from ilTermsOfServiceTableDatabaseDataProvider.

Definition at line 17 of file class.ilTermsOfServiceAcceptanceHistoryProvider.php.

{
$fields = array(
'tos_acceptance_track.tosv_id',
'ud.usr_id',
'ud.login',
'ud.firstname',
'ud.lastname',
'tos_acceptance_track.ts',
'tos_versions.src',
'tos_versions.text',
'tos_versions.lng'
);
return implode(', ', $fields);
}
ilTermsOfServiceAcceptanceHistoryProvider::getWherePart ( array  $params,
array  $filter 
)
protected
Parameters
array$params
array$filter
Returns
string

Reimplemented from ilTermsOfServiceTableDatabaseDataProvider.

Definition at line 54 of file class.ilTermsOfServiceAcceptanceHistoryProvider.php.

{
$where = array();
if(isset($filter['query']) && strlen($filter['query']))
{
$where[] = '(' . implode(' OR ', array(
$this->db->like('ud.login', 'text', '%'.$filter['query'].'%'),
$this->db->like('ud.firstname', 'text', '%'.$filter['query'].'%'),
$this->db->like('ud.lastname', 'text', '%'.$filter['query'].'%'),
$this->db->like('ud.email', 'text', '%'.$filter['query'].'%')
)) . ')';
}
if(isset($filter['lng']) && strlen($filter['lng']))
{
$where[] = 'tos_versions.lng = ' . $this->db->quote($filter['lng'], 'text');
}
if(isset($filter['period']) && is_array($filter['period']))
{
$where[] = '(' . implode(' AND ', array(
'tos_acceptance_track.ts >= ' . $this->db->quote($filter['period']['start'], 'integer'),
'tos_acceptance_track.ts <= ' . $this->db->quote($filter['period']['end'], 'integer')
)) . ')';
}
return implode(' AND ', $where);
}

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