/zf/library/Zend/Gdata/Photos/PhotoEntry.php
PHP | 691 lines | 287 code | 67 blank | 337 comment | 14 complexity | 7e33f519d6884c570f47356aa8886bc2 MD5 | raw file
Possible License(s): MIT, BSD-3-Clause, Apache-2.0, LGPL-2.1, LGPL-3.0, BSD-2-Clause
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 Photos 19 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) 20 * @license http://framework.zend.com/license/new-bsd New BSD License 21 * @version $Id: PhotoEntry.php 23775 2011-03-01 17:25:24Z ralph $ 22 */ 23 24/** 25 * @see Zend_Gdata_MediaEntry 26 */ 27require_once 'Zend/Gdata/Media/Entry.php'; 28 29/** 30 * @see Zend_Gdata_Photos_Extension_PhotoId 31 */ 32require_once 'Zend/Gdata/Photos/Extension/PhotoId.php'; 33 34/** 35 * @see Zend_Gdata_Photos_Extension_Version 36 */ 37require_once 'Zend/Gdata/Photos/Extension/Version.php'; 38 39/** 40 * @see Zend_Gdata_Photos_Extension_AlbumId 41 */ 42require_once 'Zend/Gdata/Photos/Extension/AlbumId.php'; 43 44/** 45 * @see Zend_Gdata_Photos_Extension_Id 46 */ 47require_once 'Zend/Gdata/Photos/Extension/Id.php'; 48 49/** 50 * @see Zend_Gdata_Photos_Extension_Width 51 */ 52require_once 'Zend/Gdata/Photos/Extension/Width.php'; 53 54/** 55 * @see Zend_Gdata_Photos_Extension_Height 56 */ 57require_once 'Zend/Gdata/Photos/Extension/Height.php'; 58 59/** 60 * @see Zend_Gdata_Photos_Extension_Size 61 */ 62require_once 'Zend/Gdata/Photos/Extension/Size.php'; 63 64/** 65 * @see Zend_Gdata_Photos_Extension_Client 66 */ 67require_once 'Zend/Gdata/Photos/Extension/Client.php'; 68 69/** 70 * @see Zend_Gdata_Photos_Extension_Checksum 71 */ 72require_once 'Zend/Gdata/Photos/Extension/Checksum.php'; 73 74/** 75 * @see Zend_Gdata_Photos_Extension_Timestamp 76 */ 77require_once 'Zend/Gdata/Photos/Extension/Timestamp.php'; 78 79/** 80 * @see Zend_Gdata_Photos_Extension_CommentingEnabled 81 */ 82require_once 'Zend/Gdata/Photos/Extension/CommentingEnabled.php'; 83 84/** 85 * @see Zend_Gdata_Photos_Extension_CommentCount 86 */ 87require_once 'Zend/Gdata/Photos/Extension/CommentCount.php'; 88 89/** 90 * @see Zend_Gdata_Exif_Extension_Tags 91 */ 92require_once 'Zend/Gdata/Exif/Extension/Tags.php'; 93 94/** 95 * @see Zend_Gdata_Geo_Extension_GeoRssWhere 96 */ 97require_once 'Zend/Gdata/Geo/Extension/GeoRssWhere.php'; 98 99/** 100 * @see Zend_Gdata_App_Extension_Category 101 */ 102require_once 'Zend/Gdata/App/Extension/Category.php'; 103 104/** 105 * Data model class for a Comment Entry. 106 * 107 * To transfer user entries to and from the servers, including 108 * creating new entries, refer to the service class, 109 * Zend_Gdata_Photos. 110 * 111 * This class represents <atom:entry> in the Google Data protocol. 112 * 113 * @category Zend 114 * @package Zend_Gdata 115 * @subpackage Photos 116 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) 117 * @license http://framework.zend.com/license/new-bsd New BSD License 118 */ 119class Zend_Gdata_Photos_PhotoEntry extends Zend_Gdata_Media_Entry 120{ 121 122 protected $_entryClassName = 'Zend_Gdata_Photos_PhotoEntry'; 123 124 /** 125 * gphoto:id element 126 * 127 * @var Zend_Gdata_Photos_Extension_Id 128 */ 129 protected $_gphotoId = null; 130 131 /** 132 * gphoto:albumid element 133 * 134 * @var Zend_Gdata_Photos_Extension_AlbumId 135 */ 136 protected $_gphotoAlbumId = null; 137 138 /** 139 * gphoto:version element 140 * 141 * @var Zend_Gdata_Photos_Extension_Version 142 */ 143 protected $_gphotoVersion = null; 144 145 /** 146 * gphoto:width element 147 * 148 * @var Zend_Gdata_Photos_Extension_Width 149 */ 150 protected $_gphotoWidth = null; 151 152 /** 153 * gphoto:height element 154 * 155 * @var Zend_Gdata_Photos_Extension_Height 156 */ 157 protected $_gphotoHeight = null; 158 159 /** 160 * gphoto:size element 161 * 162 * @var Zend_Gdata_Photos_Extension_Size 163 */ 164 protected $_gphotoSize = null; 165 166 /** 167 * gphoto:client element 168 * 169 * @var Zend_Gdata_Photos_Extension_Client 170 */ 171 protected $_gphotoClient = null; 172 173 /** 174 * gphoto:checksum element 175 * 176 * @var Zend_Gdata_Photos_Extension_Checksum 177 */ 178 protected $_gphotoChecksum = null; 179 180 /** 181 * gphoto:timestamp element 182 * 183 * @var Zend_Gdata_Photos_Extension_Timestamp 184 */ 185 protected $_gphotoTimestamp = null; 186 187 /** 188 * gphoto:commentCount element 189 * 190 * @var Zend_Gdata_Photos_Extension_CommentCount 191 */ 192 protected $_gphotoCommentCount = null; 193 194 /** 195 * gphoto:commentingEnabled element 196 * 197 * @var Zend_Gdata_Photos_Extension_CommentingEnabled 198 */ 199 protected $_gphotoCommentingEnabled = null; 200 201 /** 202 * exif:tags element 203 * 204 * @var Zend_Gdata_Exif_Extension_Tags 205 */ 206 protected $_exifTags = null; 207 208 /** 209 * georss:where element 210 * 211 * @var Zend_Gdata_Geo_Extension_GeoRssWhere 212 */ 213 protected $_geoRssWhere = null; 214 215 /** 216 * Create a new instance. 217 * 218 * @param DOMElement $element (optional) DOMElement from which this 219 * object should be constructed. 220 */ 221 public function __construct($element = null) 222 { 223 $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); 224 parent::__construct($element); 225 226 $category = new Zend_Gdata_App_Extension_Category( 227 'http://schemas.google.com/photos/2007#photo', 228 'http://schemas.google.com/g/2005#kind'); 229 $this->setCategory(array($category)); 230 } 231 232 /** 233 * Retrieves a DOMElement which corresponds to this element and all 234 * child properties. This is used to build an entry back into a DOM 235 * and eventually XML text for application storage/persistence. 236 * 237 * @param DOMDocument $doc The DOMDocument used to construct DOMElements 238 * @return DOMElement The DOMElement representing this element and all 239 * child properties. 240 */ 241 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 242 { 243 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 244 if ($this->_gphotoAlbumId !== null) { 245 $element->appendChild($this->_gphotoAlbumId->getDOM($element->ownerDocument)); 246 } 247 if ($this->_gphotoId !== null) { 248 $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); 249 } 250 if ($this->_gphotoVersion !== null) { 251 $element->appendChild($this->_gphotoVersion->getDOM($element->ownerDocument)); 252 } 253 if ($this->_gphotoWidth !== null) { 254 $element->appendChild($this->_gphotoWidth->getDOM($element->ownerDocument)); 255 } 256 if ($this->_gphotoHeight !== null) { 257 $element->appendChild($this->_gphotoHeight->getDOM($element->ownerDocument)); 258 } 259 if ($this->_gphotoSize !== null) { 260 $element->appendChild($this->_gphotoSize->getDOM($element->ownerDocument)); 261 } 262 if ($this->_gphotoClient !== null) { 263 $element->appendChild($this->_gphotoClient->getDOM($element->ownerDocument)); 264 } 265 if ($this->_gphotoChecksum !== null) { 266 $element->appendChild($this->_gphotoChecksum->getDOM($element->ownerDocument)); 267 } 268 if ($this->_gphotoTimestamp !== null) { 269 $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument)); 270 } 271 if ($this->_gphotoCommentingEnabled !== null) { 272 $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument)); 273 } 274 if ($this->_gphotoCommentCount !== null) { 275 $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument)); 276 } 277 if ($this->_exifTags !== null) { 278 $element->appendChild($this->_exifTags->getDOM($element->ownerDocument)); 279 } 280 if ($this->_geoRssWhere !== null) { 281 $element->appendChild($this->_geoRssWhere->getDOM($element->ownerDocument)); 282 } 283 return $element; 284 } 285 286 /** 287 * Creates individual Entry objects of the appropriate type and 288 * stores them as members of this entry based upon DOM data. 289 * 290 * @param DOMNode $child The DOMNode to process 291 */ 292 protected function takeChildFromDOM($child) 293 { 294 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 295 296 switch ($absoluteNodeName) { 297 case $this->lookupNamespace('gphoto') . ':' . 'albumid'; 298 $albumId = new Zend_Gdata_Photos_Extension_AlbumId(); 299 $albumId->transferFromDOM($child); 300 $this->_gphotoAlbumId = $albumId; 301 break; 302 case $this->lookupNamespace('gphoto') . ':' . 'id'; 303 $id = new Zend_Gdata_Photos_Extension_Id(); 304 $id->transferFromDOM($child); 305 $this->_gphotoId = $id; 306 break; 307 case $this->lookupNamespace('gphoto') . ':' . 'version'; 308 $version = new Zend_Gdata_Photos_Extension_Version(); 309 $version->transferFromDOM($child); 310 $this->_gphotoVersion = $version; 311 break; 312 case $this->lookupNamespace('gphoto') . ':' . 'width'; 313 $width = new Zend_Gdata_Photos_Extension_Width(); 314 $width->transferFromDOM($child); 315 $this->_gphotoWidth = $width; 316 break; 317 case $this->lookupNamespace('gphoto') . ':' . 'height'; 318 $height = new Zend_Gdata_Photos_Extension_Height(); 319 $height->transferFromDOM($child); 320 $this->_gphotoHeight = $height; 321 break; 322 case $this->lookupNamespace('gphoto') . ':' . 'size'; 323 $size = new Zend_Gdata_Photos_Extension_Size(); 324 $size->transferFromDOM($child); 325 $this->_gphotoSize = $size; 326 break; 327 case $this->lookupNamespace('gphoto') . ':' . 'client'; 328 $client = new Zend_Gdata_Photos_Extension_Client(); 329 $client->transferFromDOM($child); 330 $this->_gphotoClient = $client; 331 break; 332 case $this->lookupNamespace('gphoto') . ':' . 'checksum'; 333 $checksum = new Zend_Gdata_Photos_Extension_Checksum(); 334 $checksum->transferFromDOM($child); 335 $this->_gphotoChecksum = $checksum; 336 break; 337 case $this->lookupNamespace('gphoto') . ':' . 'timestamp'; 338 $timestamp = new Zend_Gdata_Photos_Extension_Timestamp(); 339 $timestamp->transferFromDOM($child); 340 $this->_gphotoTimestamp = $timestamp; 341 break; 342 case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled'; 343 $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled(); 344 $commentingEnabled->transferFromDOM($child); 345 $this->_gphotoCommentingEnabled = $commentingEnabled; 346 break; 347 case $this->lookupNamespace('gphoto') . ':' . 'commentCount'; 348 $commentCount = new Zend_Gdata_Photos_Extension_CommentCount(); 349 $commentCount->transferFromDOM($child); 350 $this->_gphotoCommentCount = $commentCount; 351 break; 352 case $this->lookupNamespace('exif') . ':' . 'tags'; 353 $exifTags = new Zend_Gdata_Exif_Extension_Tags(); 354 $exifTags->transferFromDOM($child); 355 $this->_exifTags = $exifTags; 356 break; 357 case $this->lookupNamespace('georss') . ':' . 'where'; 358 $geoRssWhere = new Zend_Gdata_Geo_Extension_GeoRssWhere(); 359 $geoRssWhere->transferFromDOM($child); 360 $this->_geoRssWhere = $geoRssWhere; 361 break; 362 default: 363 parent::takeChildFromDOM($child); 364 break; 365 366 } 367 } 368 369 /** 370 * Get the value for this element's gphoto:albumid attribute. 371 * 372 * @see setGphotoAlbumId 373 * @return string The requested attribute. 374 */ 375 public function getGphotoAlbumId() 376 { 377 return $this->_gphotoAlbumId; 378 } 379 380 /** 381 * Set the value for this element's gphoto:albumid attribute. 382 * 383 * @param string $value The desired value for this attribute. 384 * @return Zend_Gdata_Photos_Extension_AlbumId The element being modified. 385 */ 386 public function setGphotoAlbumId($value) 387 { 388 $this->_gphotoAlbumId = $value; 389 return $this; 390 } 391 392 /** 393 * Get the value for this element's gphoto:id attribute. 394 * 395 * @see setGphotoId 396 * @return string The requested attribute. 397 */ 398 public function getGphotoId() 399 { 400 return $this->_gphotoId; 401 } 402 403 /** 404 * Set the value for this element's gphoto:id attribute. 405 * 406 * @param string $value The desired value for this attribute. 407 * @return Zend_Gdata_Photos_Extension_Id The element being modified. 408 */ 409 public function setGphotoId($value) 410 { 411 $this->_gphotoId = $value; 412 return $this; 413 } 414 415 /** 416 * Get the value for this element's gphoto:version attribute. 417 * 418 * @see setGphotoVersion 419 * @return string The requested attribute. 420 */ 421 public function getGphotoVersion() 422 { 423 return $this->_gphotoVersion; 424 } 425 426 /** 427 * Set the value for this element's gphoto:version attribute. 428 * 429 * @param string $value The desired value for this attribute. 430 * @return Zend_Gdata_Photos_Extension_Version The element being modified. 431 */ 432 public function setGphotoVersion($value) 433 { 434 $this->_gphotoVersion = $value; 435 return $this; 436 } 437 438 /** 439 * Get the value for this element's gphoto:width attribute. 440 * 441 * @see setGphotoWidth 442 * @return string The requested attribute. 443 */ 444 public function getGphotoWidth() 445 { 446 return $this->_gphotoWidth; 447 } 448 449 /** 450 * Set the value for this element's gphoto:width attribute. 451 * 452 * @param string $value The desired value for this attribute. 453 * @return Zend_Gdata_Photos_Extension_Width The element being modified. 454 */ 455 public function setGphotoWidth($value) 456 { 457 $this->_gphotoWidth = $value; 458 return $this; 459 } 460 461 /** 462 * Get the value for this element's gphoto:height attribute. 463 * 464 * @see setGphotoHeight 465 * @return string The requested attribute. 466 */ 467 public function getGphotoHeight() 468 { 469 return $this->_gphotoHeight; 470 } 471 472 /** 473 * Set the value for this element's gphoto:height attribute. 474 * 475 * @param string $value The desired value for this attribute. 476 * @return Zend_Gdata_Photos_Extension_Height The element being modified. 477 */ 478 public function setGphotoHeight($value) 479 { 480 $this->_gphotoHeight = $value; 481 return $this; 482 } 483 484 /** 485 * Get the value for this element's gphoto:size attribute. 486 * 487 * @see setGphotoSize 488 * @return string The requested attribute. 489 */ 490 public function getGphotoSize() 491 { 492 return $this->_gphotoSize; 493 } 494 495 /** 496 * Set the value for this element's gphoto:size attribute. 497 * 498 * @param string $value The desired value for this attribute. 499 * @return Zend_Gdata_Photos_Extension_Size The element being modified. 500 */ 501 public function setGphotoSize($value) 502 { 503 $this->_gphotoSize = $value; 504 return $this; 505 } 506 507 /** 508 * Get the value for this element's gphoto:client attribute. 509 * 510 * @see setGphotoClient 511 * @return string The requested attribute. 512 */ 513 public function getGphotoClient() 514 { 515 return $this->_gphotoClient; 516 } 517 518 /** 519 * Set the value for this element's gphoto:client attribute. 520 * 521 * @param string $value The desired value for this attribute. 522 * @return Zend_Gdata_Photos_Extension_Client The element being modified. 523 */ 524 public function setGphotoClient($value) 525 { 526 $this->_gphotoClient = $value; 527 return $this; 528 } 529 530 /** 531 * Get the value for this element's gphoto:checksum attribute. 532 * 533 * @see setGphotoChecksum 534 * @return string The requested attribute. 535 */ 536 public function getGphotoChecksum() 537 { 538 return $this->_gphotoChecksum; 539 } 540 541 /** 542 * Set the value for this element's gphoto:checksum attribute. 543 * 544 * @param string $value The desired value for this attribute. 545 * @return Zend_Gdata_Photos_Extension_Checksum The element being modified. 546 */ 547 public function setGphotoChecksum($value) 548 { 549 $this->_gphotoChecksum = $value; 550 return $this; 551 } 552 553 /** 554 * Get the value for this element's gphoto:timestamp attribute. 555 * 556 * @see setGphotoTimestamp 557 * @return string The requested attribute. 558 */ 559 public function getGphotoTimestamp() 560 { 561 return $this->_gphotoTimestamp; 562 } 563 564 /** 565 * Set the value for this element's gphoto:timestamp attribute. 566 * 567 * @param string $value The desired value for this attribute. 568 * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified. 569 */ 570 public function setGphotoTimestamp($value) 571 { 572 $this->_gphotoTimestamp = $value; 573 return $this; 574 } 575 576 /** 577 * Get the value for this element's gphoto:commentCount attribute. 578 * 579 * @see setGphotoCommentCount 580 * @return string The requested attribute. 581 */ 582 public function getGphotoCommentCount() 583 { 584 return $this->_gphotoCommentCount; 585 } 586 587 /** 588 * Set the value for this element's gphoto:commentCount attribute. 589 * 590 * @param string $value The desired value for this attribute. 591 * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified. 592 */ 593 public function setGphotoCommentCount($value) 594 { 595 $this->_gphotoCommentCount = $value; 596 return $this; 597 } 598 599 /** 600 * Get the value for this element's gphoto:commentingEnabled attribute. 601 * 602 * @see setGphotoCommentingEnabled 603 * @return string The requested attribute. 604 */ 605 public function getGphotoCommentingEnabled() 606 { 607 return $this->_gphotoCommentingEnabled; 608 } 609 610 /** 611 * Set the value for this element's gphoto:commentingEnabled attribute. 612 * 613 * @param string $value The desired value for this attribute. 614 * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified. 615 */ 616 public function setGphotoCommentingEnabled($value) 617 { 618 $this->_gphotoCommentingEnabled = $value; 619 return $this; 620 } 621 622 /** 623 * Get the value for this element's exif:tags attribute. 624 * 625 * @see setExifTags 626 * @return string The requested attribute. 627 */ 628 public function getExifTags() 629 { 630 return $this->_exifTags; 631 } 632 633 /** 634 * Set the value for this element's exif:tags attribute. 635 * 636 * @param string $value The desired value for this attribute. 637 * @return Zend_Gdata_Exif_Extension_Tags The element being modified. 638 */ 639 public function setExifTags($value) 640 { 641 $this->_exifTags = $value; 642 return $this; 643 } 644 645 /** 646 * Get the value for this element's georss:where attribute. 647 * 648 * @see setGeoRssWhere 649 * @return string The requested attribute. 650 */ 651 public function getGeoRssWhere() 652 { 653 return $this->_geoRssWhere; 654 } 655 656 /** 657 * Set the value for this element's georss:where attribute. 658 * 659 * @param string $value The desired value for this attribute. 660 * @return Zend_Gdata_Geo_Extension_GeoRssWhere The element being modified. 661 */ 662 public function setGeoRssWhere($value) 663 { 664 $this->_geoRssWhere = $value; 665 return $this; 666 } 667 668 /** 669 * Get the value for this element's media:group attribute. 670 * 671 * @see setMediaGroup 672 * @return string The requested attribute. 673 */ 674 public function getMediaGroup() 675 { 676 return $this->_mediaGroup; 677 } 678 679 /** 680 * Set the value for this element's media:group attribute. 681 * 682 * @param string $value The desired value for this attribute. 683 * @return Zend_Gdata_Media_Extension_MediaGroup The element being modified. 684 */ 685 public function setMediaGroup($value) 686 { 687 $this->_mediaGroup = $value; 688 return $this; 689 } 690 691}