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

Class ilMailGroupAddressType. More...

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

Public Member Functions

 isValid ($a_sender_id)
 {} More...
 
 resolve ()
 {Returns an array of resolved user ids.
Returns
int[]
} More...
 
- Public Member Functions inherited from ilBaseMailAddressType
 __construct (ilMailAddress $a_address)
 ilBaseMailAddressType constructor. More...
 
 validate ($a_sender_id)
 {
Parameters
$a_sender_idinteger
Returns
bool
} More...
 
 getErrors ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilBaseMailAddressType
 init ()
 
 isValid ($a_sender_id)
 
- Protected Attributes inherited from ilBaseMailAddressType
 $address
 
 $errors = array()
 

Detailed Description

Member Function Documentation

◆ isValid()

ilMailGroupAddressType::isValid (   $a_sender_id)

{}

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

References ilUtil\groupNameExists().

17  {
18  return ilUtil::groupNameExists(substr($this->address->getMailbox(), 1));
19  }
static groupNameExists($a_group_name, $a_id=0)
checks if group name already exists.
+ Here is the call graph for this function:

◆ resolve()

ilMailGroupAddressType::resolve ( )

{Returns an array of resolved user ids.

Returns
int[]
}

Implements ilMailAddressType.

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

References $ref_id, ilObject\_getAllReferences(), ilObjGroup\_lookupIdByTitle(), array, ilObjectFactory\getInstanceByRefId(), and ilLoggerFactory\getLogger().

25  {
26  $usr_ids = array();
27 
28  $possibleGroupTitle = substr($this->address->getMailbox(), 1);
29  $possibleGroupObjId = ilObjGroup::_lookupIdByTitle($possibleGroupTitle);
30 
31  $grp_object = null;
32  foreach(ilObject::_getAllReferences($possibleGroupObjId) as $ref_id)
33  {
34  $grp_object = ilObjectFactory::getInstanceByRefId($ref_id);
35  break;
36  }
37 
38  if($grp_object instanceof ilObjGroup)
39  {
40  foreach($grp_object->getGroupMemberIds() as $usr_id)
41  {
42  $usr_ids[] = $usr_id;
43  }
44 
45  ilLoggerFactory::getLogger('mail')->debug(sprintf(
46  "Found the following group member user ids for address (object title) '%s' and obj_id %s: %s", $possibleGroupTitle, $possibleGroupObjId, implode(', ', array_unique($usr_ids))
47  ));
48  }
49  else
50  {
51  ilLoggerFactory::getLogger('mail')->debug(sprintf(
52  "Did not find any group object for address (object title) '%s'", $possibleGroupTitle
53  ));
54  }
55 
56  return array_unique($usr_ids);
57  }
static _getAllReferences($a_id)
get all reference ids of object
Create styles array
The data for the language used.
static _lookupIdByTitle($a_title)
$ref_id
Definition: sahs_server.php:39
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjGroup.
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

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