~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Gdata/Geo/Extension/GeoRssWhere.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * Zend Framework
 
5
 *
 
6
 * LICENSE
 
7
 *
 
8
 * This source file is subject to the new BSD license that is bundled
 
9
 * with this package in the file LICENSE.txt.
 
10
 * It is also available through the world-wide-web at this URL:
 
11
 * http://framework.zend.com/license/new-bsd
 
12
 * If you did not receive a copy of the license and are unable to
 
13
 * obtain it through the world-wide-web, please send an email
 
14
 * to license@zend.com so we can send you a copy immediately.
 
15
 *
 
16
 * @category   Zend
 
17
 * @package    Zend_Gdata
 
18
 * @subpackage Geo
 
19
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
20
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
21
 */
 
22
 
 
23
/**
 
24
 * @see Zend_Gdata_Extension
 
25
 */
 
26
require_once 'Zend/Gdata/Extension.php';
 
27
 
 
28
/**
 
29
 * @see Zend_Gdata_Geo
 
30
 */
 
31
require_once 'Zend/Gdata/Geo.php';
 
32
 
 
33
/**
 
34
 * @see Zend_Gdata_Geo_Extension_GmlPoint
 
35
 */
 
36
require_once 'Zend/Gdata/Geo/Extension/GmlPoint.php';
 
37
 
 
38
 
 
39
/**
 
40
 * Represents the georss:where element used by the Gdata Geo extensions.
 
41
 *
 
42
 * @category   Zend
 
43
 * @package    Zend_Gdata
 
44
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
45
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
46
 */
 
47
class Zend_Gdata_Geo_Extension_GeoRssWhere extends Zend_Gdata_Extension
 
48
{
 
49
 
 
50
    protected $_rootNamespace = 'georss';
 
51
    protected $_rootElement = 'where';
 
52
 
 
53
    /**
 
54
     * The point location for this geo element
 
55
     * 
 
56
     * @var Zend_Gdata_Geo_Extension_GmlPoint
 
57
     */   
 
58
    protected $_point = null;
 
59
    
 
60
    /**
 
61
     * Create a new instance.
 
62
     * 
 
63
     * @param Zend_Gdata_Geo_Extension_GmlPoint $point (optional) Point to which
 
64
     *          object should be initialized.
 
65
     */
 
66
    public function __construct($point = null) 
 
67
    {
 
68
        foreach (Zend_Gdata_Geo::$namespaces as $nsPrefix => $nsUri) {
 
69
            $this->registerNamespace($nsPrefix, $nsUri);
 
70
        }
 
71
        parent::__construct();
 
72
        $this->setPoint($point);
 
73
    }
 
74
    
 
75
    /**
 
76
     * Retrieves a DOMElement which corresponds to this element and all
 
77
     * child properties.  This is used to build an entry back into a DOM
 
78
     * and eventually XML text for application storage/persistence.
 
79
     *
 
80
     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
 
81
     * @return DOMElement The DOMElement representing this element and all
 
82
     *          child properties.
 
83
     */
 
84
    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 
85
    {
 
86
        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
 
87
        if ($this->_point !== null) {
 
88
            $element->appendChild($this->_point->getDOM($element->ownerDocument));
 
89
        }
 
90
        return $element;
 
91
    }
 
92
 
 
93
    /**
 
94
     * Creates individual Entry objects of the appropriate type and
 
95
     * stores them as members of this entry based upon DOM data.
 
96
     *
 
97
     * @param DOMNode $child The DOMNode to process
 
98
     */
 
99
    protected function takeChildFromDOM($child)
 
100
    {
 
101
        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
 
102
        
 
103
        switch ($absoluteNodeName) {
 
104
            case $this->lookupNamespace('gml') . ':' . 'Point'; 
 
105
                $point = new Zend_Gdata_Geo_Extension_GmlPoint();
 
106
                $point->transferFromDOM($child);
 
107
                $this->_point = $point;
 
108
                break;
 
109
        }
 
110
    }
 
111
    
 
112
    /**
 
113
     * Get the value for this element's point attribute.
 
114
     *
 
115
     * @see setPoint
 
116
     * @return Zend_Gdata_Geo_Extension_GmlPoint The requested attribute.
 
117
     */
 
118
    public function getPoint()
 
119
    {
 
120
        return $this->_point;
 
121
    }
 
122
 
 
123
    /**
 
124
     * Set the value for this element's point attribute.
 
125
     *
 
126
     * @param Zend_Gdata_Geo_Extension_GmlPoint $value The desired value for this attribute.
 
127
     * @return Zend_Gdata_Geo_Extension_GeoRssWhere Provides a fluent interface
 
128
     */
 
129
    public function setPoint($value)
 
130
    {
 
131
        $this->_point = $value;
 
132
        return $this;
 
133
    }
 
134
 
 
135
}