ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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)
 
- Protected Member Functions inherited from ilTermsOfServiceTableDatabaseDataProvider
 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 (ilDBInterface $db)
 ilTermsOfServiceTableDatabaseDataProvider constructor. More...
 
 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

◆ getFromPart()

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

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

References array.

40  {
41  $joins = array(
42  'INNER JOIN tos_acceptance_track ON tos_acceptance_track.usr_id = ud.usr_id',
43  'INNER JOIN tos_versions ON tos_versions.id = tos_acceptance_track.tosv_id',
44  );
45 
46  return 'usr_data ud ' . implode(' ', $joins);
47  }
Create styles array
The data for the language used.

◆ getGroupByPart()

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

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

90  {
91  return '';
92  }

◆ getHavingPart()

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

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

100  {
101  return '';
102  }

◆ getOrderByPart()

ilTermsOfServiceAcceptanceHistoryProvider::getOrderByPart ( array  $params,
array  $filter 
)
protected
Parameters
array$params
array$filter
Returns
string
Exceptions
InvalidArgumentException

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

References array.

111  {
112  if(isset($params['order_field']))
113  {
114  if(!is_string($params['order_field']))
115  {
116  throw new InvalidArgumentException('Please provide a valid order field.');
117  }
118 
119  if(!in_array($params['order_field'], array('lng', 'login', 'firstname', 'lastname', 'src', 'ts')))
120  {
121  throw new InvalidArgumentException('Please provide a valid order field.');
122  }
123 
124  if($params['order_field'] == 'ts')
125  {
126  $params['order_field'] = 'tos_acceptance_track.ts';
127  }
128 
129  if(!isset($params['order_direction']))
130  {
131  $params['order_direction'] = 'ASC';
132  }
133  else if(!in_array(strtolower($params['order_direction']), array('asc', 'desc')))
134  {
135  throw new InvalidArgumentException('Please provide a valid order direction.');
136  }
137 
138  return $params['order_field'] . ' ' . $params['order_direction'];
139  }
140 
141  return '';
142  }
Create styles array
The data for the language used.
$params
Definition: example_049.php:96

◆ getSelectPart()

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

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

References array.

18  {
19  $fields = array(
20  'tos_acceptance_track.tosv_id',
21  'ud.usr_id',
22  'ud.login',
23  'ud.firstname',
24  'ud.lastname',
25  'tos_acceptance_track.ts',
26  'tos_versions.src',
27  'tos_versions.text',
28  'tos_versions.lng'
29  );
30 
31  return implode(', ', $fields);
32  }
Create styles array
The data for the language used.

◆ getWherePart()

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

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

References array.

55  {
56  $where = array();
57 
58  if(isset($filter['query']) && strlen($filter['query']))
59  {
60  $where[] = '(' . implode(' OR ', array(
61  $this->db->like('ud.login', 'text', '%'.$filter['query'].'%'),
62  $this->db->like('ud.firstname', 'text', '%'.$filter['query'].'%'),
63  $this->db->like('ud.lastname', 'text', '%'.$filter['query'].'%'),
64  $this->db->like('ud.email', 'text', '%'.$filter['query'].'%')
65  )) . ')';
66  }
67 
68  if(isset($filter['lng']) && strlen($filter['lng']))
69  {
70  $where[] = 'tos_versions.lng = ' . $this->db->quote($filter['lng'], 'text');
71  }
72 
73  if(isset($filter['period']) && is_array($filter['period']))
74  {
75  $where[] = '(' . implode(' AND ', array(
76  'tos_acceptance_track.ts >= ' . $this->db->quote($filter['period']['start'], 'integer'),
77  'tos_acceptance_track.ts <= ' . $this->db->quote($filter['period']['end'], 'integer')
78  )) . ')';
79  }
80 
81  return implode(' AND ', $where);
82  }
Create styles array
The data for the language used.

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