ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMailAutoCompleteRecipientResult Class Reference

Class ilMailAutoCompleteRecipientResult. More...

+ Collaboration diagram for ilMailAutoCompleteRecipientResult:

Public Member Functions

 __construct ($mode)
 
 isResultAddable ()
 
 addResult ($login, $firstname, $lastname)
 
 getItems ()
 
 numItems ()
 

Data Fields

const MODE_STOP_ON_MAX_ENTRIES = 1
 
const MODE_FETCH_ALL = 2
 
const MAX_RESULT_ENTRIES = 1000
 
 $result = array()
 

Protected Member Functions

 initMode ($mode)
 

Protected Attributes

 $allow_smtp = null
 
 $user_id = null
 
 $handled_recipients = array()
 
 $mode = self::MODE_STOP_ON_MAX_ENTRIES
 
 $max_entries = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMailAutoCompleteRecipientResult::__construct (   $mode)
Parameters
int$mode

Definition at line 26 of file class.ilMailAutoCompleteRecipientResult.php.

References $DIC, $mode, array, ilSearchSettings\getInstance(), and initMode().

27  {
28  global $DIC;
29 
30  $this->allow_smtp = $DIC->rbac()->system()->checkAccess('smtp_mail', MAIL_SETTINGS_ID);
31  $this->user_id = $DIC->user()->getId();
32  $this->max_entries = ilSearchSettings::getInstance()->getAutoCompleteLength();
33 
34  $this->result['items'] = array();
35  $this->result['hasMoreResults'] = false;
36 
37  $this->initMode($mode);
38  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
+ Here is the call graph for this function:

Member Function Documentation

◆ addResult()

ilMailAutoCompleteRecipientResult::addResult (   $login,
  $firstname,
  $lastname 
)
Parameters
string$login
string$firstname
string$lastname

Definition at line 76 of file class.ilMailAutoCompleteRecipientResult.php.

References array.

77  {
78  if (!isset($this->handled_recipients[$login])) {
79  $recipient = array();
80  $recipient['value'] = $login;
81 
82  $label = $login;
83  if ($firstname && $lastname) {
84  $label .= " [" . $firstname . ", " . $lastname . "]";
85  }
86  $recipient['label'] = $label;
87 
88  $this->result['items'][] = $recipient;
89  $this->handled_recipients[$login] = 1;
90  }
91  }
Create styles array
The data for the language used.

◆ getItems()

ilMailAutoCompleteRecipientResult::getItems ( )
Returns
array

Definition at line 96 of file class.ilMailAutoCompleteRecipientResult.php.

References $result.

◆ initMode()

ilMailAutoCompleteRecipientResult::initMode (   $mode)
protected
Parameters
int$mode
Exceptions
InvalidArgumentException

Definition at line 44 of file class.ilMailAutoCompleteRecipientResult.php.

References $mode, and array.

Referenced by __construct().

45  {
46  if (!in_array($mode, array(self::MODE_FETCH_ALL, self::MODE_STOP_ON_MAX_ENTRIES))) {
47  throw new InvalidArgumentException("Wrong mode passed!");
48  }
49  $this->mode = $mode;
50  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ isResultAddable()

ilMailAutoCompleteRecipientResult::isResultAddable ( )
Returns
bool

Definition at line 55 of file class.ilMailAutoCompleteRecipientResult.php.

56  {
57  if (
58  $this->mode == self::MODE_STOP_ON_MAX_ENTRIES &&
59  $this->max_entries >= 0 && count($this->result['items']) >= $this->max_entries
60  ) {
61  return false;
62  } elseif (
63  $this->mode == self::MODE_FETCH_ALL &&
64  count($this->result['items']) >= self::MAX_RESULT_ENTRIES
65  ) {
66  return false;
67  }
68  return true;
69  }

◆ numItems()

ilMailAutoCompleteRecipientResult::numItems ( )
Returns
int

Definition at line 104 of file class.ilMailAutoCompleteRecipientResult.php.

105  {
106  return (int) count($this->result['items']);
107  }

Field Documentation

◆ $allow_smtp

ilMailAutoCompleteRecipientResult::$allow_smtp = null
protected

Definition at line 16 of file class.ilMailAutoCompleteRecipientResult.php.

◆ $handled_recipients

ilMailAutoCompleteRecipientResult::$handled_recipients = array()
protected

Definition at line 18 of file class.ilMailAutoCompleteRecipientResult.php.

◆ $max_entries

ilMailAutoCompleteRecipientResult::$max_entries = null
protected

Definition at line 20 of file class.ilMailAutoCompleteRecipientResult.php.

◆ $mode

ilMailAutoCompleteRecipientResult::$mode = self::MODE_STOP_ON_MAX_ENTRIES
protected

Definition at line 19 of file class.ilMailAutoCompleteRecipientResult.php.

Referenced by __construct(), and initMode().

◆ $result

ilMailAutoCompleteRecipientResult::$result = array()

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

Referenced by getItems().

◆ $user_id

ilMailAutoCompleteRecipientResult::$user_id = null
protected

Definition at line 17 of file class.ilMailAutoCompleteRecipientResult.php.

◆ MAX_RESULT_ENTRIES

const ilMailAutoCompleteRecipientResult::MAX_RESULT_ENTRIES = 1000

Definition at line 14 of file class.ilMailAutoCompleteRecipientResult.php.

◆ MODE_FETCH_ALL

const ilMailAutoCompleteRecipientResult::MODE_FETCH_ALL = 2

Definition at line 12 of file class.ilMailAutoCompleteRecipientResult.php.

◆ MODE_STOP_ON_MAX_ENTRIES

const ilMailAutoCompleteRecipientResult::MODE_STOP_ON_MAX_ENTRIES = 1

Definition at line 11 of file class.ilMailAutoCompleteRecipientResult.php.


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