ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMailAutoCompleteSentMailsRecipientsProvider Class Reference

Class ilMailAutoCompleteSentMailsRecipientsProvider. More...

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

Public Member Functions

 current ()
 "Current" implementation of iterator interface
 key ()
 "Key" implementation of iterator interface
 valid ()
 rewind ()
 "Rewind "implementation of iterator interface
- Public Member Functions inherited from ilMailAutoCompleteRecipientProvider
 next ()
 "Next" implementation of iterator interface
 __destruct ()
 Destructor Free the result.

Protected Attributes

 $users_stack = array()
- Protected Attributes inherited from ilMailAutoCompleteRecipientProvider
 $db
 $res
 $data = array()
 $quoted_term = ''
 $term = ''
 $user_id = 0

Detailed Description

Member Function Documentation

ilMailAutoCompleteSentMailsRecipientsProvider::current ( )

"Current" implementation of iterator interface

Returns
array

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

{
if(is_array($this->data))
{
return array(
'login' => $this->data['login'],
'firstname' => '',
'lastname' => ''
);
}
else if(count($this->users_stack) > 0)
{
return array(
'login' => array_shift($this->users_stack),
'firstname' => '',
'lastname' => ''
);
}
}
ilMailAutoCompleteSentMailsRecipientsProvider::key ( )

"Key" implementation of iterator interface

Returns
boolean true/false

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

{
if(is_array($this->data))
{
return $this->data['login'];
}
else if(count($this->users_stack) > 0)
{
return $this->users_stack[0];
}
}
ilMailAutoCompleteSentMailsRecipientsProvider::rewind ( )

"Rewind "implementation of iterator interface

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

References $query.

{
if($this->res)
{
$this->db->free($this->res);
$this->res = null;
}
$query = "
SELECT DISTINCT
mail.rcp_to login
FROM mail
WHERE " . $this->db->like('mail.rcp_to', 'text', $this->quoted_term) . "
AND sender_id = " . $this->db->quote($this->user_id, 'integer') . "
AND mail.sender_id = mail.user_id";
$this->res = $this->db->query($query);
}
ilMailAutoCompleteSentMailsRecipientsProvider::valid ( )
Returns
bool

Reimplemented from ilMailAutoCompleteRecipientProvider.

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

References ilStr\strPos(), and ilStr\strToLower().

{
$this->data = $this->db->fetchAssoc($this->res);
if(
is_array($this->data) &&
(
strpos($this->data['login'], ',') !== false ||
strpos($this->data['login'], ';') !== false
)
)
{
$parts = array_filter(array_map('trim', preg_split("/[ ]*[;,][ ]*/", trim($this->data['login']))));
foreach($parts as $part)
{
if(ilStr::strPos(ilStr::strToLower($part), ilStr::strToLower($this->term)) !== false)
{
$this->users_stack[] = $part;
}
}
if($this->users_stack)
{
$this->data = null;
}
}
return is_array($this->data) || count($this->users_stack) > 0;
}

+ Here is the call graph for this function:

Field Documentation

ilMailAutoCompleteSentMailsRecipientsProvider::$users_stack = array()
protected

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