本文整理汇总了PHP中Kronolith::unsubscribeRemoteCalendar方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::unsubscribeRemoteCalendar方法的具体用法?PHP Kronolith::unsubscribeRemoteCalendar怎么用?PHP Kronolith::unsubscribeRemoteCalendar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kronolith
的用法示例。
在下文中一共展示了Kronolith::unsubscribeRemoteCalendar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @throws Kronolith_Exception
*/
public function execute()
{
if ($this->_vars->get('submitbutton') == _("Cancel")) {
Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
}
return Kronolith::unsubscribeRemoteCalendar($this->_vars->get('url'));
}
示例2: deleteCalendar
/**
* TODO
*/
public function deleteCalendar()
{
$calendar_id = $this->vars->calendar;
$result = new stdClass();
switch ($this->vars->type) {
case 'internal':
try {
$calendar = $GLOBALS['injector']->getInstance('Kronolith_Shares')->getShare($calendar_id);
} catch (Exception $e) {
$GLOBALS['notification']->push($e, 'horde.error');
return $result;
}
try {
Kronolith::deleteShare($calendar);
} catch (Exception $e) {
$GLOBALS['notification']->push(sprintf(_("Unable to delete \"%s\": %s"), $calendar->get('name'), $e->getMessage()), 'horde.error');
return $result;
}
$GLOBALS['notification']->push(sprintf(_("The calendar \"%s\" has been deleted."), $calendar->get('name')), 'horde.success');
break;
case 'tasklists':
$calendar_id = substr($calendar_id, 6);
$tasklists = $GLOBALS['registry']->tasks->listTasklists(true);
if (!isset($tasklists[$calendar_id])) {
$GLOBALS['notification']->push(_("You are not allowed to delete this task list."), 'horde.error');
return $result;
}
try {
$GLOBALS['registry']->tasks->deleteTasklist($calendar_id);
} catch (Exception $e) {
$GLOBALS['notification']->push(sprintf(_("Unable to delete \"%s\": %s"), $tasklists[$calendar_id]->get('name'), $e->getMessage()), 'horde.error');
return $result;
}
$GLOBALS['notification']->push(sprintf(_("The task list \"%s\" has been deleted."), $tasklists[$calendar_id]->get('name')), 'horde.success');
break;
case 'remote':
try {
$deleted = Kronolith::unsubscribeRemoteCalendar($calendar_id);
} catch (Exception $e) {
$GLOBALS['notification']->push($e, 'horde.error');
return $result;
}
$GLOBALS['notification']->push(sprintf(_("You have been unsubscribed from \"%s\" (%s)."), $deleted['name'], $deleted['url']), 'horde.success');
break;
case 'resource':
try {
$rdriver = Kronolith::getDriver('Resource');
$resource = $rdriver->getResource($rdriver->getResourceIdByCalendar($calendar_id));
if (!$resource->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
$GLOBALS['notification']->push(_("You are not allowed to delete this resource."), 'horde.error');
return $result;
}
$name = $resource->get('name');
$rdriver->delete($resource);
} catch (Kronolith_Exception $e) {
$GLOBALS['notification']->push($e->getMessage(), 'horde.error');
return $result;
}
$GLOBALS['notification']->push(sprintf(_("The resource \"%s\" has been deleted."), $name), 'horde.success');
break;
case 'resourcegroup':
try {
$rdriver = Kronolith::getDriver('Resource');
$resource = $rdriver->getResource($calendar_id);
if (!$resource->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
$GLOBALS['notification']->push(_("You are not allowed to delete this resource."), 'horde.error');
return $result;
}
$name = $resource->get('name');
$rdriver->delete($resource);
} catch (Kronolith_Exception $e) {
$GLOBALS['notification']->push($e->getMessage(), 'horde.error');
return $result;
}
$GLOBALS['notification']->push(sprintf(_("The resource \"%s\" has been deleted."), $name), 'horde.success');
}
$result->deleted = true;
return $result;
}