return the gallery's parent id too
authorMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 3 Jan 2011 17:18:42 +0000 (12:18 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 3 Jan 2011 18:25:05 +0000 (13:25 -0500)
ansel/lib/Gallery.php

index 872696d..37ce737 100644 (file)
@@ -999,6 +999,15 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical implements Seria
         $json->d = $this->get('desc');
         $json->ki = Ansel::getImageUrl($this->getKeyImage(), 'mini', false, Ansel::getStyleDefinition('ansel_default'))->toString();
 
+        // Parent
+        $parents = $this->get('parents');
+        if (empty($parents)) {
+            $json->p = null;
+        } else {
+            $parents = explode(':', $parents);
+            $json->p = array_pop($parents);
+        }
+
         if ($full) {
             $json->sg = array();
             if ($this->hasSubGalleries()) {