|
1
|
|
|
<?php namespace CalDAVClient\Facade\Requests; |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright 2017 OpenStack Foundation |
|
4
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5
|
|
|
* you may not use this file except in compliance with the License. |
|
6
|
|
|
* You may obtain a copy of the License at |
|
7
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
8
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
9
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
10
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
11
|
|
|
* See the License for the specific language governing permissions and |
|
12
|
|
|
* limitations under the License. |
|
13
|
|
|
**/ |
|
14
|
|
|
use Sabre\Xml\Service; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class CalendarMultigetRequest |
|
18
|
|
|
* @package CalDAVClient\Facade\Requests |
|
19
|
|
|
*/ |
|
20
|
|
|
final class CalendarMultiGetRequest implements IAbstractWebDAVRequest |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* @var string[] |
|
24
|
|
|
*/ |
|
25
|
|
|
private $hrefs; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* CalendarMultiGetRequest constructor. |
|
29
|
|
|
* @param array $hrefs |
|
30
|
|
|
*/ |
|
31
|
|
|
public function __construct(array $hrefs){ |
|
32
|
|
|
$this->hrefs = $hrefs; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @return string |
|
37
|
|
|
*/ |
|
38
|
|
|
public function getContent() |
|
39
|
|
|
{ |
|
40
|
|
|
$service = new Service(); |
|
41
|
|
|
|
|
42
|
|
|
$service->namespaceMap = [ |
|
43
|
|
|
'DAV:' => 'D', |
|
44
|
|
|
'urn:ietf:params:xml:ns:caldav' => 'C', |
|
45
|
|
|
]; |
|
46
|
|
|
$nodes = [ |
|
47
|
|
|
'{DAV:}prop' => [ |
|
48
|
|
|
'{DAV:}getetag' => '', |
|
49
|
|
|
'{urn:ietf:params:xml:ns:caldav}calendar-data' => '' |
|
50
|
|
|
], |
|
51
|
|
|
]; |
|
52
|
|
|
// set hrefs |
|
53
|
|
|
foreach ($this->hrefs as $href){ |
|
54
|
|
|
$nodes[] = ['name' => '{DAV:}href', 'value' => $href]; |
|
55
|
|
|
} |
|
56
|
|
|
return $service->write('{urn:ietf:params:xml:ns:caldav}calendar-multiget', $nodes); |
|
57
|
|
|
} |
|
58
|
|
|
} |