ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMailGroupAddressType Class Reference

Class ilMailGroupAddressType. More...

+ Inheritance diagram for ilMailGroupAddressType:
+ Collaboration diagram for ilMailGroupAddressType:

Public Member Functions

 resolve ()
 Returns an array of resolved user ids based on an address instance.
Returns
int[]
More...
 
- Public Member Functions inherited from ilBaseMailAddressType
 __construct (\ilMailAddressTypeHelper $typeHelper, \ilMailAddress $address, \ilLogger $logger)
 ilBaseMailAddressType constructor. More...
 
 validate (int $senderId)
 Validates the parsed recipients and set errors accordingly.
See also
::getErrors
Parameters
$senderIdinteger The id of the acting ILIAS user, can be used for permission checks etc.
Returns
bool
More...
 
 getErrors ()
 Returns a list of errors determined in the validation process.The errors should be reset everytime the validation is triggered.

See also
::validate
Returns
More...
 
 getAddress ()
 The address instance used for validation and user id lookup.
Returns
More...
 

Protected Member Functions

 isValid (int $senderId)
 
- Protected Member Functions inherited from ilBaseMailAddressType
 isValid (int $senderId)
 
 pushError (string $languageVariable, array $placeHolderValues=[])
 

Additional Inherited Members

- Protected Attributes inherited from ilBaseMailAddressType
 $typeHelper
 
 $address
 
 $logger
 

Detailed Description

Member Function Documentation

◆ isValid()

ilMailGroupAddressType::isValid ( int  $senderId)
protected

Definition at line 13 of file class.ilMailGroupAddressType.php.

13  : bool
14  {
15  return $this->typeHelper->doesGroupNameExists(substr($this->address->getMailbox(), 1));
16  }

◆ resolve()

ilMailGroupAddressType::resolve ( )

Returns an array of resolved user ids based on an address instance.

Returns
int[]

Implements ilMailAddressType.

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

21  : array
22  {
23  $usrIds = [];
24 
25  $possibleGroupTitle = substr($this->address->getMailbox(), 1);
26  $possibleGroupObjId = $this->typeHelper->getGroupObjIdByTitle($possibleGroupTitle);
27 
28  $group = null;
29  foreach ($this->typeHelper->getAllRefIdsForObjId($possibleGroupObjId) as $refId) {
30  $group = $this->typeHelper->getInstanceByRefId($refId);
31  break;
32  }
33 
34  if ($group instanceof \ilObjGroup) {
35  foreach ($group->getGroupMemberIds() as $usr_id) {
36  $usrIds[] = $usr_id;
37  }
38 
39  $this->logger->debug(sprintf(
40  "Found the following group member user ids for address (object title) '%s' and obj_id %s: %s",
41  $possibleGroupTitle,
42  $possibleGroupObjId,
43  implode(', ', array_unique($usrIds))
44  ));
45  } else {
46  $this->logger->debug(sprintf(
47  "Did not find any group object for address (object title) '%s'",
48  $possibleGroupTitle
49  ));
50  }
51 
52  return array_unique($usrIds);
53  }
Class ilObjGroup.

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