ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilMailAutoCompleteSentMailsRecipientsProvider Class Reference
+ 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 30 of file class.ilMailAutoCompleteSentMailsRecipientsProvider.php.

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

◆ key()

ilMailAutoCompleteSentMailsRecipientsProvider::key ( )

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

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

◆ rewind()

ilMailAutoCompleteSentMailsRecipientsProvider::rewind ( )

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

References null.

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

◆ valid()

ilMailAutoCompleteSentMailsRecipientsProvider::valid ( )

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

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

64  : bool
65  {
66  $this->data = $this->db->fetchAssoc($this->res);
67  if (is_array($this->data) &&
68  !empty($this->data) &&
69  (
70  strpos((string) $this->data['login'], ',') ||
71  strpos((string) $this->data['login'], ';')
72  )) {
73  $parts = array_filter(
74  array_map(
75  'trim',
76  preg_split("/[ ]*[;,][ ]*/", trim((string) $this->data['login']))
77  )
78  );
79 
80  foreach ($parts as $part) {
81  if (ilStr::strPos(ilStr::strToLower($part), ilStr::strToLower($this->term), 0) !== false) {
82  $this->users_stack[] = $part;
83  }
84  }
85 
86  if ($this->users_stack) {
87  $this->data = null;
88  }
89  }
90 
91  return (is_array($this->data) && !empty($this->data)) || $this->users_stack !== [];
92  }
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:39
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static strToLower(string $a_string)
Definition: class.ilStr.php:69
+ 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: