~ubuntu-branches/ubuntu/saucy/php-horde-kolab-format/saucy

« back to all changes in this revision

Viewing changes to Horde_Kolab_Format-2.0.3/lib/Horde/Kolab/Format/Xml/Type/EventDateTime/V1.php

  • Committer: Package Import Robot
  • Author(s): Mathieu Parent
  • Date: 2013-04-07 15:55:32 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130407155532-cserelt1ix1m9cs3
Tags: 2.0.3-1
New upstream version 2.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Handles event start and end dates.
 
4
 *
 
5
 * PHP version 5
 
6
 *
 
7
 * @category Kolab
 
8
 * @package  Kolab_Format
 
9
 * @author   Gunnar Wrobel <wrobel@pardus.de>
 
10
 * @license  http://www.horde.org/licenses/lgpl21 LGPL
 
11
 * @link     http://www.horde.org/libraries/Horde_Kolab_Format
 
12
 */
 
13
 
 
14
/**
 
15
 * Handles event start and end dates.
 
16
 *
 
17
 * Copyright 2011-2013 Horde LLC (http://www.horde.org/)
 
18
 *
 
19
 * See the enclosed file COPYING for license information (LGPL). If you did not
 
20
 * receive this file, see
 
21
 * http://www.horde.org/licenses/lgpl21.
 
22
 *
 
23
 * @category Kolab
 
24
 * @package  Kolab_Format
 
25
 * @author   Gunnar Wrobel <wrobel@pardus.de>
 
26
 * @license  http://www.horde.org/licenses/lgpl21 LGPL
 
27
 * @link     http://www.horde.org/libraries/Horde_Kolab_Format
 
28
 */
 
29
class Horde_Kolab_Format_Xml_Type_EventDateTime_V1
 
30
extends Horde_Kolab_Format_Xml_Type_DateTime_V1
 
31
{
 
32
    /**
 
33
     * Indicate which value type is expected.
 
34
     *
 
35
     * @var int
 
36
     */
 
37
    protected $value = Horde_Kolab_Format_Xml::VALUE_NOT_EMPTY;
 
38
 
 
39
    /**
 
40
     * Load the value of a node.
 
41
     *
 
42
     * @param DOMNode                       $node   Retrieve value for this node.
 
43
     * @param Horde_Kolab_Format_Xml_Helper $helper A XML helper instance.
 
44
     * @param array                         $params Additiona parameters for
 
45
     *                                              this parse operation.
 
46
     *
 
47
     * @return mixed|null The value or null if no value was found.
 
48
     */
 
49
    public function loadNodeValue(
 
50
        $node,
 
51
        Horde_Kolab_Format_Xml_Helper $helper,
 
52
        $params = array()
 
53
    )
 
54
    {
 
55
        $result = $helper->fetchNodeValue($node);
 
56
        if (strlen($result) == 10) {
 
57
            return array(
 
58
                'date' => Horde_Kolab_Format_Date::readDate($result),
 
59
                'date-only' => true
 
60
            );
 
61
        }
 
62
        return array(
 
63
            'date' => Horde_Kolab_Format_Date::readDateTime($result),
 
64
            'date-only' => false
 
65
        );
 
66
    }
 
67
}