ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 86 of file class.ilTermsOfServiceAcceptanceHistoryProvider.php.

87  {
88  return '';
89  }

◆ getHavingPart()

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

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

97  {
98  return '';
99  }

◆ getOrderByPart()

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

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

References array.

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

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

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