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

Class ilMailAutoCompleteSentMailsRecipientsProvider. More...

+ Inheritance diagram for ilMailAutoCompleteSentMailsRecipientsProvider:
+ Collaboration diagram for ilMailAutoCompleteSentMailsRecipientsProvider:

Public Member Functions

 current ()
 "Current" implementation of iterator interface More...
 
 key ()
 "Key" implementation of iterator interface More...
 
 valid ()
 
 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 Attributes

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

Detailed Description

Member Function Documentation

◆ current()

ilMailAutoCompleteSentMailsRecipientsProvider::current ( )

"Current" implementation of iterator interface

Returns
array

Definition at line 21 of file class.ilMailAutoCompleteSentMailsRecipientsProvider.php.

References array, and data.

22  {
23  if(is_array($this->data))
24  {
25  return array(
26  'login' => $this->data['login'],
27  'firstname' => '',
28  'lastname' => ''
29  );
30  }
31  else if(count($this->users_stack) > 0)
32  {
33  return array(
34  'login' => array_shift($this->users_stack),
35  'firstname' => '',
36  'lastname' => ''
37  );
38  }
39  }
Add some data
Create styles array
The data for the language used.

◆ key()

ilMailAutoCompleteSentMailsRecipientsProvider::key ( )

"Key" implementation of iterator interface

Returns
boolean true/false

Definition at line 45 of file class.ilMailAutoCompleteSentMailsRecipientsProvider.php.

References data.

46  {
47  if(is_array($this->data))
48  {
49  return $this->data['login'];
50  }
51  else if(count($this->users_stack) > 0)
52  {
53  return $this->users_stack[0];
54  }
55  }
Add some data

◆ rewind()

ilMailAutoCompleteSentMailsRecipientsProvider::rewind ( )

"Rewind "implementation of iterator interface

Definition at line 92 of file class.ilMailAutoCompleteSentMailsRecipientsProvider.php.

References $query.

93  {
94  if($this->res)
95  {
96  $this->db->free($this->res);
97  $this->res = null;
98  }
99 
100  $query = "
101  SELECT DISTINCT
102  mail.rcp_to login
103  FROM mail
104  WHERE " . $this->db->like('mail.rcp_to', 'text', $this->quoted_term) . "
105  AND sender_id = " . $this->db->quote($this->user_id, 'integer') . "
106  AND mail.sender_id = mail.user_id";
107 
108  $this->res = $this->db->query($query);
109  }

◆ valid()

ilMailAutoCompleteSentMailsRecipientsProvider::valid ( )
Returns
bool

Definition at line 60 of file class.ilMailAutoCompleteSentMailsRecipientsProvider.php.

References data, ilStr\strPos(), and ilStr\strToLower().

61  {
62  $this->data = $this->db->fetchAssoc($this->res);
63  if(
64  is_array($this->data) &&
65  (
66  strpos($this->data['login'], ',') !== false ||
67  strpos($this->data['login'], ';') !== false
68  )
69  )
70  {
71  $parts = array_filter(array_map('trim', preg_split("/[ ]*[;,][ ]*/", trim($this->data['login']))));
72  foreach($parts as $part)
73  {
74  if(ilStr::strPos(ilStr::strToLower($part), ilStr::strToLower($this->term)) !== false)
75  {
76  $this->users_stack[] = $part;
77  }
78  }
79  if($this->users_stack)
80  {
81  $this->data = null;
82  }
83  }
84  return is_array($this->data) || count($this->users_stack) > 0;
85  }
Add some data
static strPos($a_haystack, $a_needle, $a_offset=NULL)
Definition: class.ilStr.php:34
static strToLower($a_string)
+ Here is the call graph for this function:

Field Documentation

◆ $users_stack

ilMailAutoCompleteSentMailsRecipientsProvider::$users_stack = array()
protected

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