ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMailAutoCompleteSentMailsRecipientsProvider Class Reference

Class ilMailAutoCompleteSentMailsRecipientsProvider. More...

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

Public Member Functions

 current ()
 
 key ()
 
 valid ()
 
 rewind ()
 
- Public Member Functions inherited from ilMailAutoCompleteRecipientProvider
 __construct (protected string $quoted_term, protected string $term)
 
 valid ()
 
 next ()
 
 __destruct ()
 

Private Attributes

array $users_stack = []
 

Additional Inherited Members

- Protected Attributes inherited from ilMailAutoCompleteRecipientProvider
ilDBInterface $db
 
ilDBStatement $res = null
 
array $data = null
 
int $user_id = 0
 

Detailed Description

Member Function Documentation

◆ current()

ilMailAutoCompleteSentMailsRecipientsProvider::current ( )
Returns
array{login: string, firstname: string, lastname: string}
Exceptions
OutOfBoundsException

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

33  : array
34  {
35  if (is_array($this->data) && !empty($this->data)) {
36  return [
37  'login' => $this->data['login'],
38  'firstname' => '',
39  'lastname' => '',
40  ];
41  }
42 
43  if ($this->users_stack !== []) {
44  return [
45  'login' => array_shift($this->users_stack),
46  'firstname' => '',
47  'lastname' => '',
48  ];
49  }
50 
51  throw new OutOfBoundsException('No more users available');
52  }

◆ key()

ilMailAutoCompleteSentMailsRecipientsProvider::key ( )

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

54  : string
55  {
56  if (is_array($this->data) && !empty($this->data)) {
57  return $this->data['login'];
58  }
59 
60  if ($this->users_stack !== []) {
61  return $this->users_stack[0]['login'];
62  }
63 
64  return '';
65  }

◆ rewind()

ilMailAutoCompleteSentMailsRecipientsProvider::rewind ( )

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

References null.

97  : void
98  {
99  if ($this->res !== null) {
100  $this->db->free($this->res);
101  $this->res = null;
102  }
103 
104  $query = "
105  SELECT DISTINCT
106  mail.rcp_to login
107  FROM mail
108  WHERE " . $this->db->like('mail.rcp_to', 'text', $this->quoted_term) . "
109  AND mail.rcp_to IS NOT NULL AND mail.rcp_to != ''
110  AND sender_id = " . $this->db->quote($this->user_id, 'integer') . "
111  AND mail.sender_id = mail.user_id";
112 
113  $this->res = $this->db->query($query);
114  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ valid()

ilMailAutoCompleteSentMailsRecipientsProvider::valid ( )

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

References $parts, null, ilStr\strPos(), and ilStr\strToLower().

67  : bool
68  {
69  $this->data = $this->db->fetchAssoc($this->res);
70  if (is_array($this->data) &&
71  !empty($this->data) &&
72  (
73  strpos($this->data['login'], ',') ||
74  strpos($this->data['login'], ';')
75  )) {
76  $parts = array_filter(
77  array_map(
78  'trim',
79  preg_split("/[ ]*[;,][ ]*/", trim($this->data['login']))
80  )
81  );
82 
83  foreach ($parts as $part) {
84  if (ilStr::strPos(ilStr::strToLower($part), ilStr::strToLower($this->term), 0) !== false) {
85  $this->users_stack[] = $part;
86  }
87  }
88 
89  if ($this->users_stack) {
90  $this->data = null;
91  }
92  }
93 
94  return (is_array($this->data) && !empty($this->data)) || $this->users_stack !== [];
95  }
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61
static strPos(string $a_haystack, string $a_needle, int $a_offset=0)
Definition: class.ilStr.php:42
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static strToLower(string $a_string)
Definition: class.ilStr.php:72
+ Here is the call graph for this function:

Field Documentation

◆ $users_stack

array ilMailAutoCompleteSentMailsRecipientsProvider::$users_stack = []
private

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