Kronolith::deleteShare PHP 메소드

deleteShare() 공개 정적인 메소드

Deletes a share and removes all events associated with it.
public static deleteShare ( Horde_Share $calendar )
$calendar Horde_Share The share to delete.
    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);
        }
    }

Usage Example

예제 #1
0
 /**
  * @throws Kronolith_Exception
  */
 public function execute()
 {
     if ($this->_vars->get('submitbutton') == _("Cancel")) {
         Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
     }
     Kronolith::deleteShare($this->_calendar);
 }
All Usage Examples Of Kronolith::deleteShare