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

« back to all changes in this revision

Viewing changes to Horde_Kolab_Format-2.0.1/doc/Horde/Kolab/Format/examples/event.php

  • Committer: Package Import Robot
  • Author(s): Mathieu Parent
  • Date: 2013-01-10 20:10:54 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130110201054-5pr1qia2dj6bikvf
Tags: 2.0.2-1
New upstream version 2.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/**
3
 
 * A sample script for reading/writing an event.
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 2.1
11
 
 * @link     http://www.horde.org/libraries/Horde_Kolab_Format
12
 
 */
13
 
 
14
 
/**
15
 
 * The Autoloader allows us to omit "require/include" statements.
16
 
 */
17
 
require_once 'Horde/Autoloader/Default.php';
18
 
 
19
 
/** Create the factory */
20
 
$factory = new Horde_Kolab_Format_Factory();
21
 
 
22
 
/** Generate the format handler */
23
 
$format = $factory->create('Xml', 'Event', array('version' => 1));
24
 
 
25
 
/** Prepare a test object */
26
 
$object = array(
27
 
    'uid' => 1,
28
 
    'summary' => 'test event',
29
 
    'start-date' => time(),
30
 
    'end-date' => time() + 24 * 60 * 60,
31
 
);
32
 
 
33
 
/** Save this test data array in Kolab XML format */
34
 
$xml = $format->save($object);
35
 
var_dump($xml);
36
 
 
37
 
/** Reload the object from the XML format */
38
 
$read_object = $format->load($xml);
39
 
var_dump($read_object);
40