]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/GNUsocialPhotos/classes/gnusocialphotoalbum.php
Merge branch '1.0.x' of git://gitorious.org/statusnet/mainline
[quix0rs-gnu-social.git] / plugins / GNUsocialPhotos / classes / gnusocialphotoalbum.php
index 13c7663a672b76082add78a0fc461d15826909fb..848f92dffabdaed1488a71f2d23314b15cf65437 100644 (file)
@@ -36,9 +36,10 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
 class GNUsocialPhotoAlbum extends Memcached_DataObject
 {
     public $__table = 'GNUsocialPhotoAlbum';
-    public $album_id;       // int(11) -- Unique identifier for the album
-    public $profile_id;     // int(11) -- Profile ID for the owner of the album
-    public $album_name;     // varchar(256) -- Title for this album
+    public $album_id;          // int(11) -- Unique identifier for the album
+    public $profile_id;        // int(11) -- Profile ID for the owner of the album
+    public $album_name;        // varchar(256) -- Title for this album
+    public $album_description; // text -- A description of the album
     
 
     function staticGet($k,$v=NULL)
@@ -52,7 +53,8 @@ class GNUsocialPhotoAlbum extends Memcached_DataObject
     {
         return array('album_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
                      'profile_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
-                     'album_name' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL);
+                     'album_name' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
+                     'album_description' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL);
     }
     
     function keys()
@@ -72,7 +74,21 @@ class GNUsocialPhotoAlbum extends Memcached_DataObject
         return array('album_id', true, false);
     }
 
-    static function newAlbum($profile_id, $album_name)
+    function getPageLink()
+    {
+        $profile = Profile::StaticGet('id', $this->profile_id);
+        return '/' . $profile->nickname . '/photos/' . $this->album_id;
+    }
+
+    function getThumbUri()
+    {
+        $photo = GNUsocialPhoto::staticGet('album_id', $this->album_id);
+        if (empty($photo))
+            return '/theme/default/default-avatar-profile.png'; //For now...
+        return $photo->thumb_uri;
+    }
+
+    static function newAlbum($profile_id, $album_name, $album_description)
     {
         //TODO: Should use foreign key instead...
         if (!Profile::staticGet('id', $profile_id)){
@@ -83,6 +99,7 @@ class GNUsocialPhotoAlbum extends Memcached_DataObject
         $album = new GNUsocialPhotoAlbum();
         $album->profile_id = $profile_id;
         $album->album_name = $album_name;
+        $album->album_description = $album_description;
        
         $album->album_id = $album->insert();
         if (!$album->album_id){
@@ -91,6 +108,6 @@ class GNUsocialPhotoAlbum extends Memcached_DataObject
         }
         common_log(LOG_INFO, 'album_id : ' . $album->album_id);
         return $album;
-    } 
+    }
 
 }