AlbumEntry.php 18 KB

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