blob: b0b9505350bb3c6ffd2453044f916732c254ca36 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
<?php
namespace Sabre\DAV\Property;
use Sabre\DAV;
use Sabre\HTTP;
/**
* This property represents the {DAV:}getlastmodified property.
*
* Although this is normally a simple property, windows requires us to add
* some new attributes.
*
* This class uses unix timestamps internally, and converts them to RFC 1123 times for
* serialization
*
* @copyright Copyright (C) 2007-2014 fruux GmbH (https://fruux.com/).
* @author Evert Pot (http://evertpot.com/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class GetLastModified extends DAV\Property {
/**
* time
*
* @var int
*/
public $time;
/**
* __construct
*
* @param int|DateTime $time
*/
public function __construct($time) {
if ($time instanceof \DateTime) {
$this->time = $time;
} elseif (is_int($time) || ctype_digit($time)) {
$this->time = new \DateTime('@' . $time);
} else {
$this->time = new \DateTime($time);
}
// Setting timezone to UTC
$this->time->setTimezone(new \DateTimeZone('UTC'));
}
/**
* serialize
*
* @param DAV\Server $server
* @param \DOMElement $prop
* @return void
*/
public function serialize(DAV\Server $server, \DOMElement $prop) {
$doc = $prop->ownerDocument;
//$prop->setAttribute('xmlns:b','urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/');
//$prop->setAttribute('b:dt','dateTime.rfc1123');
$prop->nodeValue = HTTP\Util::toHTTPDate($this->time);
}
/**
* getTime
*
* @return \DateTime
*/
public function getTime() {
return $this->time;
}
}
|