aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-08-01 15:07:22 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-09-26 11:55:39 +0200
commit189911650958b2bdca8f733a8f891af373c96ae9 (patch)
treefcccbb33b272c808ee006d49392adabb6c89076c
parent762726d988e12986b88e19766fb5b3a6c9fe6edc (diff)
downloadnextcloud-server-189911650958b2bdca8f733a8f891af373c96ae9.tar.gz
nextcloud-server-189911650958b2bdca8f733a8f891af373c96ae9.zip
move getPublicCalendar inside the caldav backend
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php26
-rw-r--r--apps/dav/lib/CalDAV/PublicCalendarRoot.php8
2 files changed, 23 insertions, 11 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index e6a023bda64..1be8db160cb 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -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');
}
/**
diff --git a/apps/dav/lib/CalDAV/PublicCalendarRoot.php b/apps/dav/lib/CalDAV/PublicCalendarRoot.php
index 797074f7e56..b8d209d7073 100644
--- a/apps/dav/lib/CalDAV/PublicCalendarRoot.php
+++ b/apps/dav/lib/CalDAV/PublicCalendarRoot.php
@@ -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);
}
/**