public static function deleteShare($calendar)
{
if (!$GLOBALS['registry']->getAuth() || $calendar->get('owner') != $GLOBALS['registry']->getAuth() && (!is_null($calendar->get('owner')) || !$GLOBALS['registry']->isAdmin())) {
throw new Kronolith_Exception(_("You are not allowed to delete this calendar."));
}
// Delete the calendar.
try {
self::getDriver()->delete($calendar->getName());
} catch (Exception $e) {
throw new Kronolith_Exception(sprintf(_("Unable to delete \"%s\": %s"), $calendar->get('name'), $e->getMessage()));
}
// Remove share and all groups/permissions.
try {
$GLOBALS['injector']->getInstance('Kronolith_Shares')->removeShare($calendar);
} catch (Horde_Share_Exception $e) {
throw new Kronolith_Exception($e);
}
}