public notify ( string $user = null, boolean $load = true, boolean $preload = true, array $exclude = [] ) | ||
$user | string | Notify this user, all users if null, or guest users if empty. |
$load | boolean | Update active alarms from all applications? |
$preload | boolean | Preload alarms that go off within the next ttl time span? |
$exclude | array | Don't notify with these methods. |
public function notify($user = null, $load = true, $preload = true, array $exclude = array())
{
try {
$alarms = $this->listAlarms($user, null, $load, $preload);
} catch (Horde_Alarm_Exception $e) {
if ($this->_logger) {
$this->_logger->log($e, 'ERR');
}
throw $e;
}
if (empty($alarms)) {
return;
}
$handlers = $this->handlers();
foreach ($alarms as $alarm) {
foreach ($alarm['methods'] as $alarm_method) {
if (isset($handlers[$alarm_method]) && !in_array($alarm_method, $exclude)) {
try {
$handlers[$alarm_method]->notify($alarm);
} catch (Horde_Alarm_Exception $e) {
$this->_errors[] = $e;
}
}
}
}
}