public static function notifyOfResourceRejection($event)
{
$accepted = $declined = array();
foreach ($event->getResources() as $id => $resource) {
if ($resource['response'] == self::RESPONSE_DECLINED) {
$r = self::getDriver('Resource')->getResource($id);
$declined[] = $r->get('name');
} elseif ($resource['response'] == self::RESPONSE_ACCEPTED) {
$r = self::getDriver('Resource')->getResource($id);
$accepted[] = $r->get('name');
}
}
if (count($declined)) {
$GLOBALS['notification']->push(sprintf(ngettext("The following resource has declined your request: %s", "The following resources have declined your request: %s", count($declined)), implode(", ", $declined)), 'horde.error');
}
if (count($accepted)) {
$GLOBALS['notification']->push(sprintf(ngettext("The following resource has accepted your request: %s", "The following resources have accepted your request: %s", count($accepted)), implode(", ", $accepted)), 'horde.success');
}
}