public static function removeUserEvents($user)
{
if (!$GLOBALS['registry']->isAdmin()) {
throw new Horde_Exception_PermissionDenied();
}
try {
$shares = $GLOBALS['injector']->getInstance('Kronolith_Shares')->listShares($user, array('perm' => Horde_Perms::EDIT));
} catch (Horde_Share_Exception $e) {
Horde::log($shares, 'ERR');
throw new Kronolith_Exception($shares);
}
foreach (array_keys($shares) as $calendar) {
$driver = self::getDriver(null, $calendar);
$events = $driver->listEvents(null, null, array('cover_dates' => false));
$uids = array();
foreach ($events as $dayevents) {
foreach ($dayevents as $event) {
$uids[] = $event->uid;
}
}
foreach ($uids as $uid) {
$event = $driver->getByUID($uid, array($calendar));
if ($event->creator == $user) {
$driver->deleteEvent($event->id);
}
}
}
}