ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
 
 $rbacsystem
 
 $rbacreview
 
 $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 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  $grp_object = ilObjectFactory::getInstanceByRefId($ref_id);
34  break;
35  }
36 
37  if ($grp_object instanceof ilObjGroup) {
38  foreach ($grp_object->getGroupMemberIds() as $usr_id) {
39  $usr_ids[] = $usr_id;
40  }
41 
42  ilLoggerFactory::getLogger('mail')->debug(sprintf(
43  "Found the following group member user ids for address (object title) '%s' and obj_id %s: %s",
44  $possibleGroupTitle,
45  $possibleGroupObjId,
46  implode(', ', array_unique($usr_ids))
47  ));
48  } else {
49  ilLoggerFactory::getLogger('mail')->debug(sprintf(
50  "Did not find any group object for address (object title) '%s'",
51  $possibleGroupTitle
52  ));
53  }
54 
55  return array_unique($usr_ids);
56  }
static _getAllReferences($a_id)
get all reference ids of object
Create styles array
The data for the language used.
static _lookupIdByTitle($a_title)
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: