ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
 __construct ($quoted_term, $term)
 
 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.

22 {
23 if (is_array($this->data)) {
24 return array(
25 'login' => $this->data['login'],
26 'firstname' => '',
27 'lastname' => ''
28 );
29 } elseif (count($this->users_stack) > 0) {
30 return array(
31 'login' => array_shift($this->users_stack),
32 'firstname' => '',
33 'lastname' => ''
34 );
35 }
36 }
$this data['403_header']

References data.

◆ key()

ilMailAutoCompleteSentMailsRecipientsProvider::key ( )

"Key" implementation of iterator interface

Returns
boolean true/false

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

43 {
44 if (is_array($this->data)) {
45 return $this->data['login'];
46 } elseif (count($this->users_stack) > 0) {
47 return $this->users_stack[0];
48 }
49 }

References data.

◆ rewind()

ilMailAutoCompleteSentMailsRecipientsProvider::rewind ( )

"Rewind "implementation of iterator interface

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

83 {
84 if ($this->res) {
85 $this->db->free($this->res);
86 $this->res = null;
87 }
88
89 $query = "
90 SELECT DISTINCT
91 mail.rcp_to login
92 FROM mail
93 WHERE " . $this->db->like('mail.rcp_to', 'text', $this->quoted_term) . "
94 AND sender_id = " . $this->db->quote($this->user_id, 'integer') . "
95 AND mail.sender_id = mail.user_id";
96
97 $this->res = $this->db->query($query);
98 }
$query

References $query.

◆ valid()

ilMailAutoCompleteSentMailsRecipientsProvider::valid ( )
Returns
bool

Reimplemented from ilMailAutoCompleteRecipientProvider.

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

55 {
56 $this->data = $this->db->fetchAssoc($this->res);
57 if (
58 is_array($this->data) &&
59 (
60 strpos($this->data['login'], ',') !== false ||
61 strpos($this->data['login'], ';') !== false
62 )
63 ) {
64 $parts = array_filter(array_map('trim', preg_split("/[ ]*[;,][ ]*/", trim($this->data['login']))));
65 foreach ($parts as $part) {
66 if (ilStr::strPos(ilStr::strToLower($part), ilStr::strToLower($this->term)) !== false) {
67 $this->users_stack[] = $part;
68 }
69 }
70 if ($this->users_stack) {
71 $this->data = null;
72 }
73 }
74 return is_array($this->data) || count($this->users_stack) > 0;
75 }
static strPos($a_haystack, $a_needle, $a_offset=null)
Definition: class.ilStr.php:30
static strToLower($a_string)
Definition: class.ilStr.php:87

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

+ 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: