ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMailAutoCompleteUserProvider Class Reference

Class ilMailAutoCompleteUserProvider. More...

+ Inheritance diagram for ilMailAutoCompleteUserProvider:
+ Collaboration diagram for ilMailAutoCompleteUserProvider:

Public Member Functions

 __construct ($quoted_term, $term)
 
 valid ()
 "Valid" implementation of iterator interface More...
 
 current ()
 "Current" implementation of iterator interface More...
 
 key ()
 "Key" implementation of iterator interface More...
 
 rewind ()
 "Rewind "implementation of iterator interface More...
 
- Public Member Functions inherited from ilMailAutoCompleteRecipientProvider
 valid ()
 "Valid" implementation of iterator interface More...
 
 next ()
 "Next" implementation of iterator interface More...
 
 __destruct ()
 Destructor Free the result. More...
 

Protected Member Functions

 getSelectPart ()
 
 getOrderByPart ()
 
 getFields ()
 Get searchable fields. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilMailAutoCompleteRecipientProvider
 $db
 
 $res
 
 $data = array()
 
 $quoted_term = ''
 
 $term = ''
 
 $user_id = 0
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMailAutoCompleteUserProvider::__construct (   $quoted_term,
  $term 
)

Member Function Documentation

◆ current()

ilMailAutoCompleteUserProvider::current ( )

"Current" implementation of iterator interface

Returns
array

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

References array, and data.

37  {
38  return array(
39  'login' => $this->data['login'],
40  'firstname' => $this->data['firstname'],
41  'lastname' => $this->data['lastname']
42  );
43  }
Add some data
Create styles array
The data for the language used.

◆ getFields()

ilMailAutoCompleteUserProvider::getFields ( )
protected

Get searchable fields.

Returns
array

Definition at line 229 of file class.ilMailAutoCompleteUserProvider.php.

References ilUserSearchOptions\_isEnabled(), and array.

Referenced by getSelectPart().

230  {
231  $available_fields = array();
232  foreach(array('firstname', 'lastname') as $field)
233  {
234  include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
236  {
237  $available_fields[] = $field;
238  }
239  }
240  return $available_fields;
241  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrderByPart()

ilMailAutoCompleteUserProvider::getOrderByPart ( )
protected
Returns
string

Definition at line 205 of file class.ilMailAutoCompleteUserProvider.php.

References $ilDB.

Referenced by rewind().

206  {
207  return 'login ASC';
208  }
+ Here is the caller graph for this function:

◆ getSelectPart()

ilMailAutoCompleteUserProvider::getSelectPart ( )
protected
Returns
string

Definition at line 80 of file class.ilMailAutoCompleteUserProvider.php.

References $ilDB, array, getFields(), ilUserAccountSettings\getInstance(), and ilUserFilter\getInstance().

Referenced by rewind().

81  {
82  $fields = array(
83  'login',
84  sprintf(
85  "(CASE WHEN (profpref.value = %s OR profpref.value = %s OR profpref.value IS NULL) THEN firstname ELSE '' END) firstname",
86  $this->db->quote('y', 'text'), $this->db->quote('g', 'text')
87  ),
88  sprintf(
89  "(CASE WHEN (profpref.value = %s OR profpref.value = %s OR profpref.value IS NULL) THEN lastname ELSE '' END) lastname",
90  $this->db->quote('y', 'text'), $this->db->quote('g', 'text')
91  ),
92  sprintf(
93  "(CASE WHEN ((profpref.value = %s OR profpref.value = %s OR profpref.value IS NULL) AND pubemail.value = %s) THEN email ELSE '' END) email",
94  $this->db->quote('y', 'text'), $this->db->quote('g', 'text'), $this->db->quote('y', 'text')
95  ),
96  );
97 
98  $fields[] = 'profpref.value profile_value';
99  $fields[] = 'pubemail.value email_value';
100 
101  return implode(', ', $fields);
102  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ key()

ilMailAutoCompleteUserProvider::key ( )

"Key" implementation of iterator interface

Returns
boolean true/false

Definition at line 49 of file class.ilMailAutoCompleteUserProvider.php.

References data.

50  {
51  return $this->data['login'];
52  }
Add some data

◆ rewind()

ilMailAutoCompleteUserProvider::rewind ( )

"Rewind "implementation of iterator interface

Definition at line 57 of file class.ilMailAutoCompleteUserProvider.php.

References $query, array, getOrderByPart(), and getSelectPart().

58  {
59  if($this->res)
60  {
61  $this->db->free($this->res);
62  $this->res = null;
63  }
64  $select_part = $this->getSelectPart();
65  $where_part = $this->getWherePart($this->quoted_term);
66  $order_by_part = $this->getOrderByPart();
67  $query = implode(" ", array(
68  'SELECT ' . $select_part,
69  'FROM ' . $this->getFromPart(),
70  $where_part ? 'WHERE ' . $where_part : '',
71  $order_by_part ? 'ORDER BY ' . $order_by_part : ''
72  ));
73 
74  $this->res = $this->db->query($query);
75  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ valid()

ilMailAutoCompleteUserProvider::valid ( )

"Valid" implementation of iterator interface

Returns
boolean true/false

Definition at line 25 of file class.ilMailAutoCompleteUserProvider.php.

References data.

26  {
27  $this->data = $this->db->fetchAssoc($this->res);
28 
29  return is_array($this->data);
30  }
Add some data

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