move getPublicCalendar inside the caldav backend

This commit is contained in:
Thomas Citharel 2016-08-01 15:07:22 +02:00 committed by Lukas Reschke
parent 762726d988
commit 1899116509
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
2 changed files with 23 additions and 11 deletions

View File

@ -42,6 +42,7 @@ use Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp;
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
use Sabre\DAV;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\PropPatch;
use Sabre\HTTP\URLUtil;
use Sabre\VObject\DateTimeParser;
@ -289,7 +290,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
return array_values($calendars);
}
<<<<<<< HEAD
private function getUserDisplayName($uid) {
if (!isset($this->userDisplayNames[$uid])) {
$user = $this->userManager->get($uid);
@ -302,8 +302,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
}
return $this->userDisplayNames[$uid];
=======
}
/**
* @return array
*/
public function getPublicCalendars() {
$fields = array_values($this->propertyMap);
$fields[] = 'a.id';
@ -354,7 +357,22 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$result->closeCursor();
return array_values($calendars);
>>>>>>> bf223b9... Add new root collection public-calendars which holds all public calendars
}
/**
* @param string $uri
* @return Calendar
* @throws NotFound
*/
public function getPublicCalendar($uri) {
$l10n = \OC::$server->getL10N('dav');
foreach ($this->getPublicCalendars() as $calendar) {
if ($calendar['uri'] === $uri) {
// TODO: maybe implement a new class PublicCalendar ???
return new Calendar($this, $calendar, $l10n);
}
}
throw new NotFound('Node with name \'' . $uri . '\' could not be found');
}
/**

View File

@ -47,13 +47,7 @@ class PublicCalendarRoot extends Collection {
* @inheritdoc
*/
function getChild($name) {
foreach ($this->caldavBackend->getPublicCalendars() as $calendar) {
if ($calendar['uri'] === $name) {
// TODO: maybe implement a new class PublicCalendar ???
return new Calendar($this->caldavBackend, $calendar, $this->l10n);
}
}
throw new NotFound('Node with name \'' . $name . '\' could not be found');
return $this->caldavBackend->getPublicCalendar($name);
}
/**