ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTermsOfServiceAcceptanceHistoryProvider Class Reference

Class ilTermsOfServiceAcceptanceHistoryProvider. More...

+ 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

Member Function Documentation

◆ getFromPart()

ilTermsOfServiceAcceptanceHistoryProvider::getFromPart ( array  $params,
array  $filter 
)
protected

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

33  : string
34  {
35  $joins = [
36  'INNER JOIN tos_acceptance_track ON tos_acceptance_track.usr_id = ud.usr_id',
37  'INNER JOIN tos_versions ON tos_versions.id = tos_acceptance_track.tosv_id',
38  'LEFT JOIN tos_documents ON tos_documents.id = tos_versions.doc_id',
39  ];
40 
41  return 'usr_data ud ' . implode(' ', $joins);
42  }

◆ getGroupByPart()

ilTermsOfServiceAcceptanceHistoryProvider::getGroupByPart ( array  $params,
array  $filter 
)
protected

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

88  : string
89  {
90  return '';
91  }

◆ getHavingPart()

ilTermsOfServiceAcceptanceHistoryProvider::getHavingPart ( array  $params,
array  $filter 
)
protected

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

96  : string
97  {
98  return '';
99  }

◆ getOrderByPart()

ilTermsOfServiceAcceptanceHistoryProvider::getOrderByPart ( array  $params,
array  $filter 
)
protected

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

104  : string
105  {
106  if (isset($params['order_field'])) {
107  if (!is_string($params['order_field'])) {
108  throw new InvalidArgumentException('Please provide a valid order field.');
109  }
110 
111  if (in_array($params['order_field'], ['lng', 'src'])) {
112  // Maybe necessary because of of migrated (from < 5.4.x) ILIAS installations
113  $params['order_field'] = 'ts';
114  }
115 
116  if (!in_array($params['order_field'], ['login', 'firstname', 'lastname', 'title', 'ts'])) {
117  throw new InvalidArgumentException('Please provide a valid order field.');
118  }
119 
120  if ($params['order_field'] == 'ts') {
121  $params['order_field'] = 'tos_acceptance_track.ts';
122  }
123 
124  if (!isset($params['order_direction'])) {
125  $params['order_direction'] = 'ASC';
126  } else {
127  if (!in_array(strtolower($params['order_direction']), ['asc', 'desc'])) {
128  throw new InvalidArgumentException('Please provide a valid order direction.');
129  }
130  }
131 
132  return $params['order_field'] . ' ' . $params['order_direction'];
133  }
134 
135  return '';
136  }

◆ getSelectPart()

ilTermsOfServiceAcceptanceHistoryProvider::getSelectPart ( array  $params,
array  $filter 
)
protected

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

13  : string
14  {
15  $fields = [
16  'tos_acceptance_track.tosv_id',
17  'tos_acceptance_track.criteria',
18  'tos_acceptance_track.ts',
19  'ud.usr_id',
20  'ud.login',
21  'ud.firstname',
22  'ud.lastname',
23  '(CASE WHEN tos_documents.title IS NOT NULL THEN tos_documents.title ELSE tos_versions.title END) title',
24  'tos_versions.text',
25  ];
26 
27  return implode(', ', $fields);
28  }

◆ getWherePart()

ilTermsOfServiceAcceptanceHistoryProvider::getWherePart ( array  $params,
array  $filter 
)
protected

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

47  : string
48  {
49  $where = [];
50 
51  if (isset($filter['query']) && strlen($filter['query'])) {
52  $where[] = '(' . implode(' OR ', [
53  $this->db->like('ud.login', 'text', '%' . $filter['query'] . '%'),
54  $this->db->like('ud.firstname', 'text', '%' . $filter['query'] . '%'),
55  $this->db->like('ud.lastname', 'text', '%' . $filter['query'] . '%'),
56  $this->db->like('ud.email', 'text', '%' . $filter['query'] . '%')
57  ]) . ')';
58  }
59 
60  if (isset($filter['period']) && is_array($filter['period'])) {
61  $dateFilterParts = [];
62 
63  if (null !== $filter['period']['start']) {
64  $dateFilterParts[] = 'tos_acceptance_track.ts >= ' . $this->db->quote(
65  $filter['period']['start'],
66  'integer'
67  );
68  }
69 
70  if (null !== $filter['period']['end']) {
71  $dateFilterParts[] = 'tos_acceptance_track.ts <= ' . $this->db->quote(
72  $filter['period']['end'],
73  'integer'
74  );
75  }
76 
77  if (count($dateFilterParts) > 0) {
78  $where[] = '(' . implode(' AND ', $dateFilterParts) . ')';
79  }
80  }
81 
82  return implode(' AND ', $where);
83  }

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