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


PHP Kronolith::subscribeRemoteCalendar方法代码示例

本文整理汇总了PHP中Kronolith::subscribeRemoteCalendar方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::subscribeRemoteCalendar方法的具体用法?PHP Kronolith::subscribeRemoteCalendar怎么用?PHP Kronolith::subscribeRemoteCalendar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kronolith的用法示例。


在下文中一共展示了Kronolith::subscribeRemoteCalendar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * @throws Kronolith_Exception
  */
 public function execute()
 {
     switch ($this->_vars->submitbutton) {
         case _("Save"):
             $info = array();
             foreach (array('name', 'new_url', 'user', 'password', 'color', 'desc') as $key) {
                 $info[$key == 'new_url' ? 'url' : $key] = $this->_vars->get($key);
             }
             Kronolith::subscribeRemoteCalendar($info, trim($this->_vars->get('url')));
             break;
         case _("Unsubscribe"):
             Horde::url('calendars/remote_unsubscribe.php')->add('url', $this->_vars->url)->redirect();
             break;
         case _("Cancel"):
             Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
             break;
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:21,代码来源:EditRemoteCalendar.php

示例2: saveCalendar


//.........这里部分代码省略.........
             }
             // Update a task list.
             $calendar_id = substr($calendar_id, 6);
             try {
                 $registry->tasks->updateTasklist($calendar_id, $calendar);
                 $tasklists = $registry->tasks->listTasklists(true, Horde_Perms::EDIT);
                 $tasklist = $tasklists[$calendar_id];
                 $original_owner = $tasklist->get('owner');
                 Kronolith::readPermsForm($tasklist);
                 if ($tasklist->get('owner') != $original_owner) {
                     $result->deleted = true;
                 }
                 if ($tasklist->hasPermission($registry->getAuth(), Horde_Perms::SHOW)) {
                     $wrapper = new Kronolith_Calendar_External_Tasks(array('api' => 'tasks', 'name' => $calendar_id, 'share' => $tasklist));
                     $result->saved = true;
                     $result->calendar = $wrapper->toHash();
                 }
             } catch (Exception $e) {
                 $notification->push($e, 'horde.error');
                 return $result;
             }
             if ($tasklist->get('name') != $calendar['name']) {
                 $notification->push(sprintf(_("The task list \"%s\" has been renamed to \"%s\"."), $tasklist->get('name'), $calendar['name']), 'horde.success');
             } else {
                 $notification->push(sprintf(_("The task list \"%s\" has been saved."), $tasklist->get('name')), 'horde.success');
             }
             break;
         case 'remote':
             $calendar = array();
             foreach (array('name', 'desc', 'url', 'color', 'user', 'password') as $key) {
                 $calendar[$key] = $this->vars->{$key};
             }
             try {
                 Kronolith::subscribeRemoteCalendar($calendar, $calendar_id);
             } catch (Exception $e) {
                 $notification->push($e, 'horde.error');
                 return $result;
             }
             if ($calendar_id) {
                 $notification->push(sprintf(_("The calendar \"%s\" has been saved."), $calendar['name']), 'horde.success');
             } else {
                 $notification->push(sprintf(_("You have been subscribed to \"%s\" (%s)."), $calendar['name'], $calendar['url']), 'horde.success');
                 $result->id = $calendar['url'];
             }
             $wrapper = new Kronolith_Calendar_Remote($calendar);
             $result->saved = true;
             $result->calendar = $wrapper->toHash();
             break;
         case 'resource':
             foreach (array('name', 'desc', 'response_type') as $key) {
                 $info[$key] = $this->vars->{$key};
             }
             if (!$calendar_id) {
                 // New resource
                 if (!$registry->isAdmin() && !$injector->getInstance('Horde_Core_Perms')->hasAppPermission('resource_management')) {
                     $notification->push(_("You are not allowed to create new resources."), 'horde.error');
                     return $result;
                 }
                 $resource = Kronolith_Resource::addResource($info);
                 Kronolith::readPermsForm($resource);
                 $resource->save();
             } else {
                 try {
                     $rdriver = Kronolith::getDriver('Resource');
                     $resource = $rdriver->getResource($rdriver->getResourceIdByCalendar($calendar_id));
                     if (!$resource->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
开发者ID:kossamums,项目名称:horde,代码行数:67,代码来源:Handler.php

示例3: unsubscribe

 /**
  * Unsubscribe from a calendar.
  *
  * @param array $calendar  Calendar description array, with required 'type'
  *                         parameter. Currently supports 'http' and
  *                         'webcal' for remote calendars.
  *
  * @throws Kronolith_Exception
  */
 public function unsubscribe($calendar)
 {
     if (!isset($calendar['type'])) {
         throw new Kronolith_Exception('Unknown calendar specification');
     }
     switch ($calendar['type']) {
         case 'http':
         case 'webcal':
             Kronolith::subscribeRemoteCalendar($calendar['url']);
             break;
         case 'external':
             $cals = unserialize($GLOBALS['prefs']->getValue('display_external_cals'));
             if (($key = array_search($calendar['name'], $cals)) !== false) {
                 unset($cals[$key]);
                 $GLOBALS['prefs']->setValue('display_external_cals', serialize($cals));
             }
         default:
             throw new Kronolith_Exception('Unknown calendar specification');
     }
 }
开发者ID:horde,项目名称:horde,代码行数:29,代码来源:Api.php


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