create() 공개 메소드

Generates a handler for a specific Kolab object type.
public create ( string $format = 'Xml', string $type = '', array $params = [] ) : Horde_Kolab_Format
$format string The format that the handler should work with.
$type string The object type that should be handled.
$params array Additional parameters.
'version' - The format version.
리턴 Horde_Kolab_Format The handler.
예제 #1
0
 private function _getHprefsV1()
 {
     $factory = new Horde_Kolab_Format_Factory();
     return $factory->create('Xml', 'Hprefs', array('version' => 1));
 }
예제 #2
0
파일: FactoryTest.php 프로젝트: horde/horde
 public function testConstructorParams()
 {
     if (!class_exists('Horde_Support_Timer')) {
         $this->markTestSkipped('Horde_Support package missing!');
     }
     $factory = new Horde_Kolab_Format_Factory(array('timelog' => true));
     $this->assertInstanceOf('Horde_Kolab_Format_Decorator_Timed', $factory->create('Xml', 'contact'));
 }
예제 #3
0
<?php

/**
 * A sample script for reading/writing an event using internal API version 2.
 *
 * PHP version 5
 *
 * @category Kolab
 * @package  Kolab_Format
 * @author   Gunnar Wrobel <*****@*****.**>
 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @link     http://www.horde.org/libraries/Horde_Kolab_Format
 */
/**
 * The Autoloader allows us to omit "require/include" statements.
 */
require_once 'Horde/Autoloader/Default.php';
/** Create the factory */
$factory = new Horde_Kolab_Format_Factory();
/** Generate the format handler */
$format = $factory->create('Xml', 'Event');
$now = new DateTime();
/** Prepare a test object */
$object = array('uid' => 1, 'summary' => 'test event', 'start-date' => array('date' => $now), 'end-date' => array('date' => $now));
/** Save this test data array in Kolab XML format */
$xml = $format->save($object);
var_dump($xml);
/** Reload the object from the XML format */
$read_object = $format->load($xml);
var_dump($read_object);
예제 #4
0
{
    /**
     * Specific data fields for the prefs object
     *
     * @var Kolab
     */
    protected $_fields_specific;
    /**
     * Constructor
     */
    public function __construct($parser, $params = array())
    {
        $this->_root_name = 'string';
        /** Specific preferences fields, in kolab format specification order
         */
        $this->_fields_specific = array('string' => array('type' => self::TYPE_STRING, 'value' => self::VALUE_MAYBE_MISSING));
        parent::__construct($parser, $params);
    }
}
/** Create the factory */
$factory = new Horde_Kolab_Format_Factory();
/** Generate the format handler */
$format = $factory->create('Xml', 'String');
/** Prepare a test object */
$object = array('uid' => 1, 'string' => 'test string');
/** Save this test data array in Kolab XML format */
$xml = $format->save($object);
var_dump($xml);
/** Reload the object from the XML format */
$read_object = $format->load($xml);
var_dump($read_object);
예제 #5
0
파일: Format.php 프로젝트: horde/horde
 private function _getParser($type)
 {
     return $this->_factory->create('Xml', $type, $this->_params);
 }
예제 #6
0
파일: XmlTest.php 프로젝트: raz0rsdge/horde
 public function testVersion()
 {
     $factory = new Horde_Kolab_Format_Factory();
     $note = $factory->create('Xml', 'Note');
     $this->assertEquals(2, $note->getVersion());
 }
예제 #7
0
 private function _getContact()
 {
     $factory = new Horde_Kolab_Format_Factory();
     return $factory->create('Xml', 'Contact');
 }
예제 #8
0
파일: event.php 프로젝트: jubinpatel/horde
<?php

/**
 * A sample script for reading/writing an event.
 *
 * PHP version 5
 *
 * @category Kolab
 * @package  Kolab_Format
 * @author   Gunnar Wrobel <*****@*****.**>
 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @link     http://www.horde.org/libraries/Horde_Kolab_Format
 */
/**
 * The Autoloader allows us to omit "require/include" statements.
 */
require_once 'Horde/Autoloader/Default.php';
/** Create the factory */
$factory = new Horde_Kolab_Format_Factory();
/** Generate the format handler */
$format = $factory->create('Xml', 'Event', array('version' => 1));
/** Prepare a test object */
$object = array('uid' => 1, 'summary' => 'test event', 'start-date' => time(), 'end-date' => time() + 24 * 60 * 60);
/** Save this test data array in Kolab XML format */
$xml = $format->save($object);
var_dump($xml);
/** Reload the object from the XML format */
$read_object = $format->load($xml);
var_dump($read_object);
예제 #9
0
 private function _getEnvelope()
 {
     $factory = new Horde_Kolab_Format_Factory();
     return $factory->create('Xml', 'Envelope');
 }