当前位置: 首页>>代码示例>>PHP>>正文


PHP Kronolith::unsubscribeRemoteCalendar方法代码示例

本文整理汇总了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'));
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:10,代码来源:UnsubscribeRemoteCalendar.php

示例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;
 }
开发者ID:kossamums,项目名称:horde,代码行数:82,代码来源:Handler.php


注:本文中的Kronolith::unsubscribeRemoteCalendar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。