/** * setFormData * * Saves all the data passed in from the form upload. * * @param array $formData * * @return void */ public function setFormData($formData) { $this->formData = $formData; $token = getUserPicasaSessionToken($this->fcmsUser->id); $albumId = $formData['albums']; $user = $formData['picasa_user']; $httpClient = Zend_Gdata_AuthSub::getHttpClient($token); $picasaService = new Zend_Gdata_Photos($httpClient, "Google-DevelopersGuide-1.0"); $thumbSizes = '150c,600'; if ($this->usingFullSizePhotos) { $thumbSizes .= ',d'; } try { $query = new Zend_Gdata_Photos_AlbumQuery(); $query->setUser($user); $query->setAlbumId($albumId); $query->setParam('thumbsize', $thumbSizes); $albumFeed = $picasaService->getAlbumFeed($query); } catch (Zend_Gdata_App_Exception $e) { $this->fcmsError->add(array('type' => 'operation', 'message' => T_('Could not get Picasa data.'), 'error' => $e->getMessage(), 'file' => __FILE__, 'line' => __LINE__)); return false; } $this->albumFeed = $albumFeed; }
/** * displayEditPicasa * * @return void */ function displayEditPicasa() { $this->displayHeader(); $token = getUserPicasaSessionToken($this->fcmsUser->id); // Setup url for callbacks $callbackUrl = getDomainAndDir(); $callbackUrl .= 'settings.php?view=picasa'; if (!is_null($token)) { $httpClient = Zend_Gdata_AuthSub::getHttpClient($token); $picasaService = new Zend_Gdata_Photos($httpClient, "Google-DevelopersGuide-1.0"); try { $feed = $picasaService->getUserFeed("default"); } catch (Zend_Gdata_App_Exception $e) { print '<div class="error-alert">' . T_('Could not get Picasa session token.') . '</div>'; return; } $username = $feed->getTitle(); $user = '******' . $username . '">' . $username . '</a>'; $status = sprintf(T_('Currently connected as: %s'), $user); $link = '<a class="disconnect" href="?revoke=picasa">' . T_('Disconnect') . '</a>'; } else { $url = Zend_Gdata_AuthSub::getAuthSubTokenUri($callbackUrl, 'https://picasaweb.google.com/data', false, true); $status = T_('Not Connected'); $link = '<a href="' . $url . '">' . T_('Connect') . '</a>'; } echo ' <div class="social-media-connect"> <img class="icon" src="ui/img/picasa.png" alt="Picasa"/> <h2>Picasa Web</h2> <p>' . T_('Picasa Web allows users to share photos with friends and family.') . '</p> <div class="status">' . $status . '</div> <div class="action">' . $link . '</div> </div>'; $this->displayFooter(); }