source: pmb4.2/trunk/fuentes/pmb/admin/connecteurs/out/webdav/lib/Sabre/CalDAV/Property/SupportedCalendarComponentSet.php @ 815

Last change on this file since 815 was 815, checked in by jrpelegrina, 4 years ago

Initial release of pmb 4.2

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1<?php
2
3namespace Sabre\CalDAV\Property;
4
5use Sabre\DAV;
6use Sabre\CalDAV;
7
8/**
9 * Supported component set property
10 *
11 * This property is a representation of the supported-calendar_component-set
12 * property in the CalDAV namespace. It simply requires an array of components,
13 * such as VEVENT, VTODO
14 *
15 * @copyright Copyright (C) 2007-2013 Rooftop Solutions. All rights reserved.
16 * @author Evert Pot (http://www.rooftopsolutions.nl/)
17 * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
18 */
19class SupportedCalendarComponentSet extends DAV\Property {
20
21    /**
22     * List of supported components, such as "VEVENT, VTODO"
23     *
24     * @var array
25     */
26    private $components;
27
28    /**
29     * Creates the property
30     *
31     * @param array $components
32     */
33    public function __construct(array $components) {
34
35       $this->components = $components;
36
37    }
38
39    /**
40     * Returns the list of supported components
41     *
42     * @return array
43     */
44    public function getValue() {
45
46        return $this->components;
47
48    }
49
50    /**
51     * Serializes the property in a DOMDocument
52     *
53     * @param DAV\Server $server
54     * @param \DOMElement $node
55     * @return void
56     */
57    public function serialize(DAV\Server $server,\DOMElement $node) {
58
59       $doc = $node->ownerDocument;
60       foreach($this->components as $component) {
61
62            $xcomp = $doc->createElement('cal:comp');
63            $xcomp->setAttribute('name',$component);
64            $node->appendChild($xcomp);
65
66       }
67
68    }
69
70    /**
71     * Unserializes the DOMElement back into a Property class.
72     *
73     * @param \DOMElement $node
74     * @return Property_SupportedCalendarComponentSet
75     */
76    static function unserialize(\DOMElement $node) {
77
78        $components = array();
79        foreach($node->childNodes as $childNode) {
80            if (DAV\XMLUtil::toClarkNotation($childNode)==='{' . CalDAV\Plugin::NS_CALDAV . '}comp') {
81                $components[] = $childNode->getAttribute('name');
82            }
83        }
84        return new self($components);
85
86    }
87
88}
Note: See TracBrowser for help on using the repository browser.