ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMailAutoCompleteRecipientResult Class Reference

Class ilMailAutoCompleteRecipientResult. More...

+ Collaboration diagram for ilMailAutoCompleteRecipientResult:

Public Member Functions

 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

Member Function Documentation

◆ addResult()

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

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

References array.

85  {
86  if(!isset($this->handled_recipients[$login]))
87  {
88  $recipient = array();
89  $recipient['value'] = $login;
90 
91  $label = $login;
92  if($firstname && $lastname)
93  {
94  $label .= " [" . $firstname . ", " . $lastname . "]";
95  }
96  $recipient['label'] = $label;
97 
98  $this->result['items'][] = $recipient;
99  $this->handled_recipients[$login] = 1;
100  }
101  }
Create styles array
The data for the language used.

◆ getItems()

ilMailAutoCompleteRecipientResult::getItems ( )
Returns
array

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

References $result.

◆ initMode()

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

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

References $mode, and array.

49  {
50  if(!in_array($mode, array(self::MODE_FETCH_ALL, self::MODE_STOP_ON_MAX_ENTRIES)))
51  {
52  throw new InvalidArgumentException("Wrong mode passed!");
53  }
54  $this->mode = $mode;
55  }
Create styles array
The data for the language used.

◆ isResultAddable()

ilMailAutoCompleteRecipientResult::isResultAddable ( )
Returns
bool

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

61  {
62  if(
63  $this->mode == self::MODE_STOP_ON_MAX_ENTRIES &&
64  $this->max_entries >= 0 && count($this->result['items']) >= $this->max_entries
65  )
66  {
67  return false;
68  }
69  else if(
70  $this->mode == self::MODE_FETCH_ALL &&
71  count($this->result['items']) >= self::MAX_RESULT_ENTRIES
72  )
73  {
74  return false;
75  }
76  return true;
77  }

◆ numItems()

ilMailAutoCompleteRecipientResult::numItems ( )
Returns
int

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

115  {
116  return (int)count($this->result['items']);
117  }

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