~ubuntu-branches/ubuntu/vivid/php-horde-icalendar/vivid-proposed

« back to all changes in this revision

Viewing changes to Horde_Icalendar-2.0.5/lib/Horde/Icalendar/Vnote.php

  • Committer: Package Import Robot
  • Author(s): Mathieu Parent
  • Date: 2013-05-14 20:46:43 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130514204643-xq5x2ezjku3om1um
Tags: 2.0.5-1
New upstream version 2.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Class representing vNotes.
 
4
 *
 
5
 * Copyright 2003-2013 Horde LLC (http://www.horde.org/)
 
6
 *
 
7
 * See the enclosed file COPYING for license information (LGPL). If you
 
8
 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 
9
 *
 
10
 * @author   Mike Cochrane <mike@graftonhall.co.nz>
 
11
 * @author   Karsten Fourmont <fourmont@gmx.de>
 
12
 * @category Horde
 
13
 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 
14
 * @package  Icalendar
 
15
 */
 
16
class Horde_Icalendar_Vnote extends Horde_Icalendar
 
17
{
 
18
    /**
 
19
     * The component type of this class.
 
20
     *
 
21
     * @var string
 
22
     */
 
23
    public $type = 'vNote';
 
24
 
 
25
    /**
 
26
     * Constructor.
 
27
     */
 
28
    public function __construct($version = '1.1')
 
29
    {
 
30
        parent::__construct($version);
 
31
    }
 
32
 
 
33
    /**
 
34
     * Sets the version of this component.
 
35
     *
 
36
     * @see $version
 
37
     * @see $oldFormat
 
38
     *
 
39
     * @param string  A float-like version string.
 
40
     */
 
41
    public function setVersion($version)
 
42
    {
 
43
        $this->_oldFormat = $version < 1;
 
44
        $this->_version = $version;
 
45
    }
 
46
 
 
47
    /**
 
48
     * Unlike vevent and vtodo, a vnote is normally not enclosed in an
 
49
     * iCalendar container. (BEGIN..END)
 
50
     *
 
51
     * @return TODO
 
52
     */
 
53
    public function exportvCalendar()
 
54
    {
 
55
        $requiredAttributes['BODY'] = '';
 
56
        $requiredAttributes['VERSION'] = '1.1';
 
57
 
 
58
        foreach ($requiredAttributes as $name => $default_value) {
 
59
            try {
 
60
                $this->getAttribute($name);
 
61
            } catch (Horde_Icalendar_Exception $e) {
 
62
                $this->setAttribute($name, $default_value);
 
63
            }
 
64
        }
 
65
 
 
66
        return $this->_exportvData('VNOTE');
 
67
    }
 
68
 
 
69
}