PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/library/Zend/Gdata/Calendar/Extension/Link.php

https://bitbucket.org/rtsukui/jelly2
PHP | 125 lines | 45 code | 13 blank | 67 comment | 3 complexity | e55da2e4c7295b0a47edb2e1247358fc MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Gdata
  17. * @subpackage Calendar
  18. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: Link.php 23775 2011-03-01 17:25:24Z ralph $
  21. */
  22. /**
  23. * @see Zend_Gdata_Entry
  24. */
  25. require_once 'Zend/Gdata/App/Extension/Link.php';
  26. /**
  27. * @see Zend_Gdata_Entry
  28. */
  29. require_once 'Zend/Gdata/Calendar/Extension/WebContent.php';
  30. /**
  31. * Specialized Link class for use with Calendar. Enables use of gCal extension elements.
  32. *
  33. * @category Zend
  34. * @package Zend_Gdata
  35. * @subpackage Calendar
  36. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  37. * @license http://framework.zend.com/license/new-bsd New BSD License
  38. */
  39. class Zend_Gdata_Calendar_Extension_Link extends Zend_Gdata_App_Extension_Link
  40. {
  41. protected $_webContent = null;
  42. /**
  43. * Constructs a new Zend_Gdata_Calendar_Extension_Link object.
  44. * @see Zend_Gdata_App_Extension_Link#__construct
  45. * @param Zend_Gdata_Calendar_Extension_Webcontent $webContent
  46. */
  47. public function __construct($href = null, $rel = null, $type = null,
  48. $hrefLang = null, $title = null, $length = null, $webContent = null)
  49. {
  50. $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
  51. parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
  52. $this->_webContent = $webContent;
  53. }
  54. /**
  55. * Retrieves a DOMElement which corresponds to this element and all
  56. * child properties. This is used to build an entry back into a DOM
  57. * and eventually XML text for sending to the server upon updates, or
  58. * for application storage/persistence.
  59. *
  60. * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  61. * @return DOMElement The DOMElement representing this element and all
  62. * child properties.
  63. */
  64. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  65. {
  66. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  67. if ($this->_webContent != null) {
  68. $element->appendChild($this->_webContent->getDOM($element->ownerDocument));
  69. }
  70. return $element;
  71. }
  72. /**
  73. * Creates individual Entry objects of the appropriate type and
  74. * stores them as members of this entry based upon DOM data.
  75. *
  76. * @param DOMNode $child The DOMNode to process
  77. */
  78. protected function takeChildFromDOM($child)
  79. {
  80. $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  81. switch ($absoluteNodeName) {
  82. case $this->lookupNamespace('gCal') . ':' . 'webContent':
  83. $webContent = new Zend_Gdata_Calendar_Extension_WebContent();
  84. $webContent->transferFromDOM($child);
  85. $this->_webContent = $webContent;
  86. break;
  87. default:
  88. parent::takeChildFromDOM($child);
  89. break;
  90. }
  91. }
  92. /**
  93. * Get the value for this element's WebContent attribute.
  94. *
  95. * @return Zend_Gdata_Calendar_Extension_Webcontent The WebContent value
  96. */
  97. public function getWebContent()
  98. {
  99. return $this->_webContent;
  100. }
  101. /**
  102. * Set the value for this element's WebContent attribute.
  103. *
  104. * @param Zend_Gdata_Calendar_Extension_WebContent $value The desired value for this attribute.
  105. * @return Zend_Calendar_Extension_Link The element being modified. Provides a fluent interface.
  106. */
  107. public function setWebContent($value)
  108. {
  109. $this->_webContent = $value;
  110. return $this;
  111. }
  112. }