19 declare(strict_types=1);
34 protected int $mode = self::MODE_STOP_ON_MAX_ENTRIES;
39 'hasMoreResults' => false
46 $this->allow_smtp = $DIC->rbac()->system()->checkAccess(
'smtp_mail',
MAIL_SETTINGS_ID);
47 $this->user_id = $DIC->user()->getId();
58 if (!in_array($mode, [self::MODE_FETCH_ALL, self::MODE_STOP_ON_MAX_ENTRIES],
true)) {
66 if ($this->mode === self::MODE_STOP_ON_MAX_ENTRIES &&
67 $this->max_entries >= 0 && count($this->result[
'items']) >= $this->max_entries) {
71 if ($this->mode === self::MODE_FETCH_ALL &&
72 count($this->result[
'items']) >= self::MAX_RESULT_ENTRIES) {
79 public function addResult(
string $login,
string $firstname,
string $lastname): void
81 if ($login !==
'' && !isset($this->handled_recipients[$login])) {
83 $recipient[
'value'] = $login;
86 if ($firstname && $lastname) {
87 $label .=
" [" . $firstname .
", " . $lastname .
"]";
89 $recipient[
'label'] = $label;
91 $this->result[
'items'][] = $recipient;
92 $this->handled_recipients[$login] = 1;
106 return count($this->result[
'items']);
final const MODE_FETCH_ALL
final const MAX_RESULT_ENTRIES
addResult(string $login, string $firstname, string $lastname)
Class ilMailAutoCompleteRecipientResult.
array $handled_recipients
array __construct(int $mode)
final const MODE_STOP_ON_MAX_ENTRIES