Permalink
Browse files

MDL-32416: Picasa repository now returns path, also fixed album title…

… retrieval
  • Loading branch information...
1 parent aa753ac commit 169709383ac8ef8b468c561bfa4b6d5875954261 @marinaglancy marinaglancy committed May 3, 2012
Showing with 16 additions and 1 deletion.
  1. +12 −1 lib/googleapi.php
  2. +4 −0 repository/picasa/lib.php
View
@@ -379,6 +379,7 @@ class google_picasa {
const MANAGE_URL = 'http://picasaweb.google.com/';
private $google_curl = null;
+ private $lastalbumname = null;
/**
* Constructor.
@@ -455,6 +456,15 @@ public function get_album_photos($albumid){
}
/**
+ * Returns the name of the album for which get_photo_details was called last time.
+ *
+ * @return string
+ */
+ public function get_last_album_name() {
+ return $this->lastalbumname;
+ }
+
+ /**
* Does text search on the users photos and returns
* matches in format for picasa api
*
@@ -486,7 +496,7 @@ public function get_albums(){
//hacky...
$thumbnailinfo = $mediainfo->group->thumbnail[0]->attributes();
- $files[] = array( 'title' => (string) $gphoto->name,
+ $files[] = array( 'title' => (string) $album->title,
'date' => userdate($gphoto->timestamp),
'size' => (int) $gphoto->bytesUsed,
'path' => (string) $gphoto->id,
@@ -511,6 +521,7 @@ public function get_albums(){
public function get_photo_details($rawxml){
$xml = new SimpleXMLElement($rawxml);
+ $this->lastalbumname = (string)$xml->title;
$files = array();
@@ -86,6 +86,10 @@ public function get_listing($path='', $page = '') {
$ret['dynload'] = true;
$ret['manage'] = google_picasa::MANAGE_URL;
$ret['list'] = $picasa->get_file_list($path);
+ $ret['path'] = array((object)array('name'=>get_string('home'), 'path' => ''));
+ if ($path) {
+ $ret['path'][] = (object)array('name'=>$picasa->get_last_album_name(), 'path' => $path);
+ }
return $ret;
}

0 comments on commit 1697093

Please sign in to comment.