AlbumEntry.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  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 Photos
  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_Photos_Extension_Access
  27. */
  28. require_once 'Zend/Gdata/Photos/Extension/Access.php';
  29. /**
  30. * @see Zend_Gdata_Photos_Extension_BytesUsed
  31. */
  32. require_once 'Zend/Gdata/Photos/Extension/BytesUsed.php';
  33. /**
  34. * @see Zend_Gdata_Photos_Extension_Location
  35. */
  36. require_once 'Zend/Gdata/Photos/Extension/Location.php';
  37. /**
  38. * @see Zend_Gdata_Photos_Extension_Name
  39. */
  40. require_once 'Zend/Gdata/Photos/Extension/Name.php';
  41. /**
  42. * @see Zend_Gdata_Photos_Extension_NumPhotos
  43. */
  44. require_once 'Zend/Gdata/Photos/Extension/NumPhotos.php';
  45. /**
  46. * @see Zend_Gdata_Photos_Extension_NumPhotosRemaining
  47. */
  48. require_once 'Zend/Gdata/Photos/Extension/NumPhotosRemaining.php';
  49. /**
  50. * @see Zend_Gdata_Photos_Extension_CommentCount
  51. */
  52. require_once 'Zend/Gdata/Photos/Extension/CommentCount.php';
  53. /**
  54. * @see Zend_Gdata_Photos_Extension_CommentingEnabled
  55. */
  56. require_once 'Zend/Gdata/Photos/Extension/CommentingEnabled.php';
  57. /**
  58. * @see Zend_Gdata_Photos_Extension_Id
  59. */
  60. require_once 'Zend/Gdata/Photos/Extension/Id.php';
  61. /**
  62. * @see Zend_Gdata_Geo_Extension_GeoRssWhere
  63. */
  64. require_once 'Zend/Gdata/Geo/Extension/GeoRssWhere.php';
  65. /**
  66. * @see Zend_Gdata_Media_Extension_MediaGroup
  67. */
  68. require_once 'Zend/Gdata/Media/Extension/MediaGroup.php';
  69. /**
  70. * @see Zend_Gdata_App_Extension_Category
  71. */
  72. require_once 'Zend/Gdata/App/Extension/Category.php';
  73. /**
  74. * Data model class for a Photo Album Entry.
  75. *
  76. * To transfer user entries to and from the servers, including
  77. * creating new entries, refer to the service class,
  78. * Zend_Gdata_Photos.
  79. *
  80. * This class represents <atom:entry> in the Google Data protocol.
  81. *
  82. * @category Zend
  83. * @package Zend_Gdata
  84. * @subpackage Photos
  85. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  86. * @license http://framework.zend.com/license/new-bsd New BSD License
  87. */
  88. class Zend_Gdata_Photos_AlbumEntry extends Zend_Gdata_Entry
  89. {
  90. protected $_entryClassName = 'Zend_Gdata_Photos_AlbumEntry';
  91. /**
  92. * gphoto:id element
  93. *
  94. * @var Zend_Gdata_Photos_Extension_Id
  95. */
  96. protected $_gphotoId = null;
  97. /**
  98. * gphoto:access element
  99. *
  100. * @var Zend_Gdata_Photos_Extension_Access
  101. */
  102. protected $_gphotoAccess = null;
  103. /**
  104. * gphoto:location element
  105. *
  106. * @var Zend_Gdata_Photos_Extension_Location
  107. */
  108. protected $_gphotoLocation = null;
  109. /**
  110. * gphoto:user element
  111. *
  112. * @var Zend_Gdata_Photos_Extension_User
  113. */
  114. protected $_gphotoUser = null;
  115. /**
  116. * gphoto:nickname element
  117. *
  118. * @var Zend_Gdata_Photos_Extension_Nickname
  119. */
  120. protected $_gphotoNickname = null;
  121. /**
  122. * gphoto:timestamp element
  123. *
  124. * @var Zend_Gdata_Photos_Extension_Timestamp
  125. */
  126. protected $_gphotoTimestamp = null;
  127. /**
  128. * gphoto:name element
  129. *
  130. * @var Zend_Gdata_Photos_Extension_Name
  131. */
  132. protected $_gphotoName = null;
  133. /**
  134. * gphoto:numphotos element
  135. *
  136. * @var Zend_Gdata_Photos_Extension_NumPhotos
  137. */
  138. protected $_gphotoNumPhotos = null;
  139. /**
  140. * gphoto:commentCount element
  141. *
  142. * @var Zend_Gdata_Photos_Extension_CommentCount
  143. */
  144. protected $_gphotoCommentCount = null;
  145. /**
  146. * gphoto:commentingEnabled element
  147. *
  148. * @var Zend_Gdata_Photos_Extension_CommentingEnabled
  149. */
  150. protected $_gphotoCommentingEnabled = null;
  151. /**
  152. * media:group element
  153. *
  154. * @var Zend_Gdata_Media_MediaGroup
  155. */
  156. protected $_mediaGroup = null;
  157. /**
  158. * georss:where element
  159. *
  160. * @var Zend_Gdata_Geo_Extension_GeoRssWhere
  161. */
  162. protected $_geoRssWhere = null;
  163. /**
  164. * Create a new instance.
  165. *
  166. * @param DOMElement $element (optional) DOMElement from which this
  167. * object should be constructed.
  168. */
  169. public function __construct($element = null)
  170. {
  171. $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
  172. parent::__construct($element);
  173. $category = new Zend_Gdata_App_Extension_Category(
  174. 'http://schemas.google.com/photos/2007#album',
  175. 'http://schemas.google.com/g/2005#kind');
  176. $this->setCategory(array($category));
  177. }
  178. /**
  179. * Retrieves a DOMElement which corresponds to this element and all
  180. * child properties. This is used to build an entry back into a DOM
  181. * and eventually XML text for application storage/persistence.
  182. *
  183. * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  184. * @return DOMElement The DOMElement representing this element and all
  185. * child properties.
  186. */
  187. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  188. {
  189. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  190. if ($this->_gphotoTimestamp !== null) {
  191. $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument));
  192. }
  193. if ($this->_gphotoUser !== null) {
  194. $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument));
  195. }
  196. if ($this->_gphotoNickname !== null) {
  197. $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument));
  198. }
  199. if ($this->_gphotoAccess !== null) {
  200. $element->appendChild($this->_gphotoAccess->getDOM($element->ownerDocument));
  201. }
  202. if ($this->_gphotoLocation !== null) {
  203. $element->appendChild($this->_gphotoLocation->getDOM($element->ownerDocument));
  204. }
  205. if ($this->_gphotoName !== null) {
  206. $element->appendChild($this->_gphotoName->getDOM($element->ownerDocument));
  207. }
  208. if ($this->_gphotoNumPhotos !== null) {
  209. $element->appendChild($this->_gphotoNumPhotos->getDOM($element->ownerDocument));
  210. }
  211. if ($this->_gphotoCommentCount !== null) {
  212. $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument));
  213. }
  214. if ($this->_gphotoCommentingEnabled !== null) {
  215. $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument));
  216. }
  217. if ($this->_gphotoId !== null) {
  218. $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
  219. }
  220. if ($this->_mediaGroup !== null) {
  221. $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument));
  222. }
  223. return $element;
  224. }
  225. /**
  226. * Creates individual Entry objects of the appropriate type and
  227. * stores them as members of this entry based upon DOM data.
  228. *
  229. * @param DOMNode $child The DOMNode to process
  230. */
  231. protected function takeChildFromDOM($child)
  232. {
  233. $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  234. switch ($absoluteNodeName) {
  235. case $this->lookupNamespace('gphoto') . ':' . 'access';
  236. $access = new Zend_Gdata_Photos_Extension_Access();
  237. $access->transferFromDOM($child);
  238. $this->_gphotoAccess = $access;
  239. break;
  240. case $this->lookupNamespace('gphoto') . ':' . 'location';
  241. $location = new Zend_Gdata_Photos_Extension_Location();
  242. $location->transferFromDOM($child);
  243. $this->_gphotoLocation = $location;
  244. break;
  245. case $this->lookupNamespace('gphoto') . ':' . 'name';
  246. $name = new Zend_Gdata_Photos_Extension_Name();
  247. $name->transferFromDOM($child);
  248. $this->_gphotoName = $name;
  249. break;
  250. case $this->lookupNamespace('gphoto') . ':' . 'numphotos';
  251. $numPhotos = new Zend_Gdata_Photos_Extension_NumPhotos();
  252. $numPhotos->transferFromDOM($child);
  253. $this->_gphotoNumPhotos = $numPhotos;
  254. break;
  255. case $this->lookupNamespace('gphoto') . ':' . 'commentCount';
  256. $commentCount = new Zend_Gdata_Photos_Extension_CommentCount();
  257. $commentCount->transferFromDOM($child);
  258. $this->_gphotoCommentCount = $commentCount;
  259. break;
  260. case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled';
  261. $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled();
  262. $commentingEnabled->transferFromDOM($child);
  263. $this->_gphotoCommentingEnabled = $commentingEnabled;
  264. break;
  265. case $this->lookupNamespace('gphoto') . ':' . 'id';
  266. $id = new Zend_Gdata_Photos_Extension_Id();
  267. $id->transferFromDOM($child);
  268. $this->_gphotoId = $id;
  269. break;
  270. case $this->lookupNamespace('gphoto') . ':' . 'user';
  271. $user = new Zend_Gdata_Photos_Extension_User();
  272. $user->transferFromDOM($child);
  273. $this->_gphotoUser = $user;
  274. break;
  275. case $this->lookupNamespace('gphoto') . ':' . 'timestamp';
  276. $timestamp = new Zend_Gdata_Photos_Extension_Timestamp();
  277. $timestamp->transferFromDOM($child);
  278. $this->_gphotoTimestamp = $timestamp;
  279. break;
  280. case $this->lookupNamespace('gphoto') . ':' . 'nickname';
  281. $nickname = new Zend_Gdata_Photos_Extension_Nickname();
  282. $nickname->transferFromDOM($child);
  283. $this->_gphotoNickname = $nickname;
  284. break;
  285. case $this->lookupNamespace('georss') . ':' . 'where';
  286. $geoRssWhere = new Zend_Gdata_Geo_Extension_GeoRssWhere();
  287. $geoRssWhere->transferFromDOM($child);
  288. $this->_geoRssWhere = $geoRssWhere;
  289. break;
  290. case $this->lookupNamespace('media') . ':' . 'group';
  291. $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
  292. $mediaGroup->transferFromDOM($child);
  293. $this->_mediaGroup = $mediaGroup;
  294. break;
  295. default:
  296. parent::takeChildFromDOM($child);
  297. break;
  298. }
  299. }
  300. /**
  301. * Get the value for this element's gphoto:access attribute.
  302. *
  303. * @see setGphotoAccess
  304. * @return string The requested attribute.
  305. */
  306. public function getGphotoAccess()
  307. {
  308. return $this->_gphotoAccess;
  309. }
  310. /**
  311. * Set the value for this element's gphoto:access attribute.
  312. *
  313. * @param string $value The desired value for this attribute.
  314. * @return Zend_Gdata_Photos_Extension_Access The element being modified.
  315. */
  316. public function setGphotoAccess($value)
  317. {
  318. $this->_gphotoAccess = $value;
  319. return $this;
  320. }
  321. /**
  322. * Get the value for this element's gphoto:location attribute.
  323. *
  324. * @see setGphotoLocation
  325. * @return string The requested attribute.
  326. */
  327. public function getGphotoLocation()
  328. {
  329. return $this->_gphotoLocation;
  330. }
  331. /**
  332. * Set the value for this element's gphoto:location attribute.
  333. *
  334. * @param string $value The desired value for this attribute.
  335. * @return Zend_Gdata_Photos_Extension_Location The element being modified.
  336. */
  337. public function setGphotoLocation($value)
  338. {
  339. $this->_location = $value;
  340. return $this;
  341. }
  342. /**
  343. * Get the value for this element's gphoto:name attribute.
  344. *
  345. * @see setGphotoName
  346. * @return string The requested attribute.
  347. */
  348. public function getGphotoName()
  349. {
  350. return $this->_gphotoName;
  351. }
  352. /**
  353. * Set the value for this element's gphoto:name attribute.
  354. *
  355. * @param string $value The desired value for this attribute.
  356. * @return Zend_Gdata_Photos_Extension_Name The element being modified.
  357. */
  358. public function setGphotoName($value)
  359. {
  360. $this->_gphotoName = $value;
  361. return $this;
  362. }
  363. /**
  364. * Get the value for this element's gphoto:numphotos attribute.
  365. *
  366. * @see setGphotoNumPhotos
  367. * @return string The requested attribute.
  368. */
  369. public function getGphotoNumPhotos()
  370. {
  371. return $this->_gphotoNumPhotos;
  372. }
  373. /**
  374. * Set the value for this element's gphoto:numphotos attribute.
  375. *
  376. * @param string $value The desired value for this attribute.
  377. * @return Zend_Gdata_Photos_Extension_NumPhotos The element being modified.
  378. */
  379. public function setGphotoNumPhotos($value)
  380. {
  381. $this->_gphotoNumPhotos = $value;
  382. return $this;
  383. }
  384. /**
  385. * Get the value for this element's gphoto:commentCount attribute.
  386. *
  387. * @see setGphotoCommentCount
  388. * @return string The requested attribute.
  389. */
  390. public function getGphotoCommentCount()
  391. {
  392. return $this->_gphotoCommentCount;
  393. }
  394. /**
  395. * Set the value for this element's gphoto:commentCount attribute.
  396. *
  397. * @param string $value The desired value for this attribute.
  398. * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified.
  399. */
  400. public function setGphotoCommentCount($value)
  401. {
  402. $this->_gphotoCommentCount = $value;
  403. return $this;
  404. }
  405. /**
  406. * Get the value for this element's gphoto:commentingEnabled attribute.
  407. *
  408. * @see setGphotoCommentingEnabled
  409. * @return string The requested attribute.
  410. */
  411. public function getGphotoCommentingEnabled()
  412. {
  413. return $this->_gphotoCommentingEnabled;
  414. }
  415. /**
  416. * Set the value for this element's gphoto:commentingEnabled attribute.
  417. *
  418. * @param string $value The desired value for this attribute.
  419. * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified.
  420. */
  421. public function setGphotoCommentingEnabled($value)
  422. {
  423. $this->_gphotoCommentingEnabled = $value;
  424. return $this;
  425. }
  426. /**
  427. * Get the value for this element's gphoto:id attribute.
  428. *
  429. * @see setGphotoId
  430. * @return string The requested attribute.
  431. */
  432. public function getGphotoId()
  433. {
  434. return $this->_gphotoId;
  435. }
  436. /**
  437. * Set the value for this element's gphoto:id attribute.
  438. *
  439. * @param string $value The desired value for this attribute.
  440. * @return Zend_Gdata_Photos_Extension_Id The element being modified.
  441. */
  442. public function setGphotoId($value)
  443. {
  444. $this->_gphotoId = $value;
  445. return $this;
  446. }
  447. /**
  448. * Get the value for this element's georss:where attribute.
  449. *
  450. * @see setGeoRssWhere
  451. * @return string The requested attribute.
  452. */
  453. public function getGeoRssWhere()
  454. {
  455. return $this->_geoRssWhere;
  456. }
  457. /**
  458. * Set the value for this element's georss:where attribute.
  459. *
  460. * @param string $value The desired value for this attribute.
  461. * @return Zend_Gdata_Geo_Extension_GeoRssWhere The element being modified.
  462. */
  463. public function setGeoRssWhere($value)
  464. {
  465. $this->_geoRssWhere = $value;
  466. return $this;
  467. }
  468. /**
  469. * Get the value for this element's media:group attribute.
  470. *
  471. * @see setMediaGroup
  472. * @return string The requested attribute.
  473. */
  474. public function getMediaGroup()
  475. {
  476. return $this->_mediaGroup;
  477. }
  478. /**
  479. * Set the value for this element's media:group attribute.
  480. *
  481. * @param string $value The desired value for this attribute.
  482. * @return Zend_Gdata_Media_Extension_MediaGroup The element being modified.
  483. */
  484. public function setMediaGroup($value)
  485. {
  486. $this->_mediaGroup = $value;
  487. return $this;
  488. }
  489. /**
  490. * Get the value for this element's gphoto:user attribute.
  491. *
  492. * @see setGphotoUser
  493. * @return string The requested attribute.
  494. */
  495. public function getGphotoUser()
  496. {
  497. return $this->_gphotoUser;
  498. }
  499. /**
  500. * Set the value for this element's gphoto:user attribute.
  501. *
  502. * @param string $value The desired value for this attribute.
  503. * @return Zend_Gdata_Photos_Extension_User The element being modified.
  504. */
  505. public function setGphotoUser($value)
  506. {
  507. $this->_gphotoUser = $value;
  508. return $this;
  509. }
  510. /**
  511. * Get the value for this element's gphoto:nickname attribute.
  512. *
  513. * @see setGphotoNickname
  514. * @return string The requested attribute.
  515. */
  516. public function getGphotoNickname()
  517. {
  518. return $this->_gphotoNickname;
  519. }
  520. /**
  521. * Set the value for this element's gphoto:nickname attribute.
  522. *
  523. * @param string $value The desired value for this attribute.
  524. * @return Zend_Gdata_Photos_Extension_Nickname The element being modified.
  525. */
  526. public function setGphotoNickname($value)
  527. {
  528. $this->_gphotoNickname = $value;
  529. return $this;
  530. }
  531. /**
  532. * Get the value for this element's gphoto:timestamp attribute.
  533. *
  534. * @see setGphotoTimestamp
  535. * @return string The requested attribute.
  536. */
  537. public function getGphotoTimestamp()
  538. {
  539. return $this->_gphotoTimestamp;
  540. }
  541. /**
  542. * Set the value for this element's gphoto:timestamp attribute.
  543. *
  544. * @param string $value The desired value for this attribute.
  545. * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified.
  546. */
  547. public function setGphotoTimestamp($value)
  548. {
  549. $this->_gphotoTimestamp = $value;
  550. return $this;
  551. }
  552. }