本文整理汇总了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;
}
}
示例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)) {
示例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');
}
}