/** * Retrieves a list of Picasa albums. There are three possible scenarios that * this method can be used. * <ol> * <li> * Pass instance of Zend_Gdata_Photos_UserFeed and retrieve the album * attributes * </li> * <li> * If {@link getUserFeedInstance()} has been called and is an instance of * Zend_Gdata_Photos_UserFeed the retrieve the album attributes * </li> * <li> * If there isn't an instance of Zend_Gdata_Photos_UserFeed then create * the query and retrieve the attributes. * </li> * </ol> * * @access public * @see Zend_Gdata_Photos_UserFeed * @param Zend_Gdata_Photos_UserFeed $zgpuf * @throws Exception */ public function getUserAlbums(Zend_Gdata_Photos_UserFeed $zgpuf = null) { if ($zgpuf != null && !$zgpuf instanceof Zend_Gdata_Photos_UserFeed) { throw new Exception("Invalid parameter. Must be an instance of Zend_Gdata_Photos_UserFeed"); } elseif ($zgpuf instanceof Zend_Gdata_Photos_UserFeed) { foreach ($zgpuf as $gallery) { $gPicasa = new CW_Google_Picasa_Gallery($gallery->getGphotoId(), $gallery->getGphotoName(), $gallery->getPublished(), $gallery->getGphotoAccess(), $gallery->getUpdated(), $gallery->getSummary(), $gallery->getGphotoLocation(), $gallery->mediaGroup->thumbnail[0]->url, $gallery->getGphotoNumPhotos()); $this->setGalleryAttrs($gPicasa); } } elseif ($this->getUserFeedInstance() instanceof Zend_Gdata_Photos_UserFeed) { foreach ($this->getUserFeedInstance() as $gallery) { $gPicasa = new CW_Google_Picasa_Gallery($gallery->getGphotoId(), $gallery->getGphotoName(), $gallery->getPublished(), $gallery->getGphotoAccess(), $gallery->getUpdated(), $gallery->getSummary(), $gallery->getGphotoLocation(), $gallery->mediaGroup->thumbnail[0]->url, $gallery->getGphotoNumPhotos()); $this->setGalleryAttrs($gPicasa); } } else { $query = new Zend_Gdata_Photos_UserQuery(); $query->setUser($this->getUser()); $query->setKind("album"); $this->setUserFeedInstance($this->getGphotoService()->getUserFeed(null, $query)); foreach ($this->getUserFeedInstance() as $gallery) { $gPicasa = new CW_Google_Picasa_Gallery($gallery->getGphotoId(), $gallery->getGphotoName(), $gallery->getPublished(), $gallery->getGphotoAccess(), $gallery->getUpdated(), $gallery->getSummary(), $gallery->getGphotoLocation(), $gallery->mediaGroup->thumbnail[0]->url, $gallery->getGphotoNumPhotos()); $this->setGalleryAttrs($gPicasa); } } return $this->getGalleryAttrs(); }