public __construct ( $entity = '', $event = '', $object = null, $options = [] ) | ||
$entity | (default '') | |
$event | (default '') | |
$object | (default null) | |
$options | array |
function __construct($entity = '', $event = '', $object = null, $options = array())
{
if ($entity === '') {
$this->entity = isset($_SESSION['glpiactive_entity']) ? $_SESSION['glpiactive_entity'] : 0;
} else {
$this->entity = $entity;
}
if ($object) {
if ($object instanceof CommonDBTM && isset($object->fields['id'])) {
// Reread to avoid slashes issue
$object->getFromDB($object->fields['id']);
}
$this->obj = $object;
$this->getObjectItem($event);
}
$this->raiseevent = $event;
$this->options = $options;
$this->getNotificationTargets($entity);
$this->getAdditionalTargets($event);
// add new target by plugin
unset($this->data);
Plugin::doHook('item_add_targets', $this);
asort($this->notification_targets);
}
function __construct($entity = '', $event = '', $object = null, $options = array()) { parent::__construct($entity, $event, $object, $options); $this->options['sendprivate'] = false; if (isset($options['followup_id'])) { $fup = new TicketFollowup(); if ($fup->getFromDB($options['followup_id'])) { if ($fup->fields['is_private']) { $this->options['sendprivate'] = true; } } } if (isset($options['task_id'])) { $fup = new TicketTask(); if ($fup->getFromDB($options['task_id'])) { if ($fup->fields['is_private']) { $this->options['sendprivate'] = true; } } } }