function getAddressesByTarget($data, $options = array())
{
//Look for all targets whose type is Notification::USER_TYPE
switch ($data['type']) {
//Notifications for one people
case Notification::USER_TYPE:
switch ($data['items_id']) {
//Send to glpi's global admin (as defined in the mailing configuration)
case Notification::GLOBAL_ADMINISTRATOR:
$this->getAdminAddress();
break;
//Send to the entity's admninistrator
//Send to the entity's admninistrator
case Notification::ENTITY_ADMINISTRATOR:
$this->getEntityAdminAddress();
break;
//Technician in charge of the ticket
//Technician in charge of the ticket
case Notification::ITEM_TECH_IN_CHARGE:
$this->getItemTechnicianInChargeAddress();
break;
//Group of technician in charge of the ticket
//Group of technician in charge of the ticket
case Notification::ITEM_TECH_GROUP_IN_CHARGE:
$this->getItemGroupTechInChargeAddress();
break;
//User who's owner of the material
//User who's owner of the material
case Notification::ITEM_USER:
$this->getItemOwnerAddress();
break;
//Send to the author of the ticket
//Send to the author of the ticket
case Notification::AUTHOR:
$this->getItemAuthorAddress();
break;
default:
//Maybe a target specific to a type
$this->getSpecificTargets($data, $options);
}
break;
//Send to all the users of a group
//Send to all the users of a group
case Notification::GROUP_TYPE:
$this->getAddressesByGroup(0, $data['items_id']);
break;
//Send to all the users of a group
//Send to all the users of a group
case Notification::SUPERVISOR_GROUP_TYPE:
$this->getAddressesByGroup(1, $data['items_id']);
break;
//Send to all the users of a profile
//Send to all the users of a profile
case Notification::PROFILE_TYPE:
$this->getUsersAddressesByProfile($data['items_id']);
break;
default:
//Maybe a target specific to a type
$this->getSpecificTargets($data, $options);
}
// action for target from plugin
$this->data = $data;
Plugin::doHook('item_action_targets', $this);
}