EmailListRecipientEntry.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 Gapps
  18. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @see Zend_Gdata_Entry
  23. */
  24. require_once 'Zend/Gdata/Entry.php';
  25. /**
  26. * @see Zend_Gdata_Extension_Who
  27. */
  28. require_once 'Zend/Gdata/Extension/Who.php';
  29. /**
  30. * Data model class for a Google Apps Email List Recipient Entry.
  31. *
  32. * Each instance of this class represents a recipient of an email list
  33. * hosted on a Google Apps domain. Each email list may contain multiple
  34. * recipients. Email lists themselves are described by
  35. * Zend_Gdata_EmailListEntry. Multiple recipient entries are contained within
  36. * instances of Zend_Gdata_Gapps_EmailListRecipientFeed.
  37. *
  38. * To transfer email list recipients to and from the Google Apps servers,
  39. * including creating new recipients, refer to the Google Apps service class,
  40. * Zend_Gdata_Gapps.
  41. *
  42. * This class represents <atom:entry> in the Google Data protocol.
  43. *
  44. * @category Zend
  45. * @package Zend_Gdata
  46. * @subpackage Gapps
  47. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  48. * @license http://framework.zend.com/license/new-bsd New BSD License
  49. */
  50. class Zend_Gdata_Gapps_EmailListRecipientEntry extends Zend_Gdata_Entry
  51. {
  52. protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListRecipientEntry';
  53. /**
  54. * <gd:who> element used to store the email address of the current
  55. * recipient. Only the email property of this element should be
  56. * populated.
  57. *
  58. * @var Zend_Gdata_Extension_Who
  59. */
  60. protected $_who = null;
  61. /**
  62. * Create a new instance.
  63. *
  64. * @param DOMElement $element (optional) DOMElement from which this
  65. * object should be constructed.
  66. */
  67. public function __construct($element = null)
  68. {
  69. $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
  70. parent::__construct($element);
  71. }
  72. /**
  73. * Retrieves a DOMElement which corresponds to this element and all
  74. * child properties. This is used to build an entry back into a DOM
  75. * and eventually XML text for application storage/persistence.
  76. *
  77. * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  78. * @return DOMElement The DOMElement representing this element and all
  79. * child properties.
  80. */
  81. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  82. {
  83. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  84. if ($this->_who !== null) {
  85. $element->appendChild($this->_who->getDOM($element->ownerDocument));
  86. }
  87. return $element;
  88. }
  89. /**
  90. * Creates individual Entry objects of the appropriate type and
  91. * stores them as members of this entry based upon DOM data.
  92. *
  93. * @param DOMNode $child The DOMNode to process
  94. */
  95. protected function takeChildFromDOM($child)
  96. {
  97. $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  98. switch ($absoluteNodeName) {
  99. case $this->lookupNamespace('gd') . ':' . 'who';
  100. $who = new Zend_Gdata_Extension_Who();
  101. $who->transferFromDOM($child);
  102. $this->_who = $who;
  103. break;
  104. default:
  105. parent::takeChildFromDOM($child);
  106. break;
  107. }
  108. }
  109. /**
  110. * Get the value of the who property for this object.
  111. *
  112. * @see setWho
  113. * @return Zend_Gdata_Extension_Who The requested object.
  114. */
  115. public function getWho()
  116. {
  117. return $this->_who;
  118. }
  119. /**
  120. * Set the value of the who property for this object. This property
  121. * is used to store the email address of the current recipient.
  122. *
  123. * @param Zend_Gdata_Extension_Who $value The desired value for this
  124. * instance's who property.
  125. * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface.
  126. */
  127. public function setWho($value)
  128. {
  129. $this->_who = $value;
  130. return $this;
  131. }
  132. }