Пример #1
0
 /**
  * Retrieves a DOMElement which corresponds to this element and all
  * child properties.  This is used to build an entry back into a DOM
  * and eventually XML text for application storage/persistence.
  *
  * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  * @return DOMElement The DOMElement representing this element and all
  *          child properties.
  */
 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 {
     $element = parent::getDOM($doc, $majorVersion, $minorVersion);
     if ($this->_gphotoNickname !== null) {
         $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument));
     }
     if ($this->_gphotoThumbnail !== null) {
         $element->appendChild($this->_gphotoThumbnail->getDOM($element->ownerDocument));
     }
     if ($this->_gphotoUser !== null) {
         $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument));
     }
     if ($this->_gphotoQuotaCurrent !== null) {
         $element->appendChild($this->_gphotoQuotaCurrent->getDOM($element->ownerDocument));
     }
     if ($this->_gphotoQuotaLimit !== null) {
         $element->appendChild($this->_gphotoQuotaLimit->getDOM($element->ownerDocument));
     }
     if ($this->_gphotoMaxPhotosPerAlbum !== null) {
         $element->appendChild($this->_gphotoMaxPhotosPerAlbum->getDOM($element->ownerDocument));
     }
     return $element;
 }
Пример #2
0
    /**
     * Creates individual Entry objects of the appropriate type and
     * stores them as members of this entry based upon DOM data.
     *
     * @param DOMNode $child The DOMNode to process
     */
    protected function takeChildFromDOM($child)
    {
        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;

        switch ($absoluteNodeName) {
            case $this->lookupNamespace('gphoto') . ':' . 'nickname';
                $nickname = new Extension\Nickname();
                $nickname->transferFromDOM($child);
                $this->_gphotoNickname = $nickname;
                break;
            case $this->lookupNamespace('gphoto') . ':' . 'thumbnail';
                $thumbnail = new Extension\Thumbnail();
                $thumbnail->transferFromDOM($child);
                $this->_gphotoThumbnail = $thumbnail;
                break;
            case $this->lookupNamespace('gphoto') . ':' . 'user';
                $user = new Extension\User();
                $user->transferFromDOM($child);
                $this->_gphotoUser = $user;
                break;
            case $this->lookupNamespace('gphoto') . ':' . 'quotacurrent';
                $quotaCurrent = new Extension\QuotaCurrent();
                $quotaCurrent->transferFromDOM($child);
                $this->_gphotoQuotaCurrent = $quotaCurrent;
                break;
            case $this->lookupNamespace('gphoto') . ':' . 'quotalimit';
                $quotaLimit = new Extension\QuotaLimit();
                $quotaLimit->transferFromDOM($child);
                $this->_gphotoQuotaLimit = $quotaLimit;
                break;
            case $this->lookupNamespace('gphoto') . ':' . 'maxPhotosPerAlbum';
                $maxPhotosPerAlbum = new Extension\MaxPhotosPerAlbum();
                $maxPhotosPerAlbum->transferFromDOM($child);
                $this->_gphotoMaxPhotosPerAlbum = $maxPhotosPerAlbum;
                break;
            default:
                parent::takeChildFromDOM($child);
                break;
        }
    }