/** * Deletes a share. * * @param Horde_Share $calendar The share to delete. * * @throws Kronolith_Exception */ 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); } }
/** * Return the name of this address book. * * @string Address book name */ public function getName() { $share_parts = explode(':', $this->_share->getName()); return array_pop($share_parts); }