[dev] Ansel_Gallery

Michael Rubinsky mike at theupstairsroom.com
Wed May 16 23:38:56 UTC 2007


Now that subgalleries are displayed along with images, I've been  
toying with the idea of changing some things about Ansel_Gallery  
class.  For one, I think it makes sense, if it's possible, to add  
something like Ansel_Gallery::getChildren countChildren, listChildren  
etc... instead of getImages etc...so we can encapsulate more of the  
functionality into the gallery object.

I've really just started playing with moving some stuff around, and  
don't know for sure if it will work.  I can't figure out the best way  
to deal with the fact that we will basically be returning a mixed  
array or both Ansel_Image and Ansel_Gallery objects.  I don't like the  
thought of a bunch of if (is_a($child, 'Ansel_Gallery')) etc... but no  
matter what design I try, I've not been able to get past the fact that  
at some point we *will* need to know if an image or gallery...at least  
not without putting some sort of HTML generating methods into the  
objects.

Soooo, what I'm thinking so far is either:

- basically, return an array of objects, something like Ansel_Resource  
that would have something like $resource->resourceType property and  
$resource->object property that would contain the actual  
object...although this is not much different then using is_a where  
needed...

- just use is_a where needed

- scrap the whole idea, at least until Horde 4.

Thoughts?



Thanks,
mike

--
The Horde Project (www.horde.org)
mrubinsk at horde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 2013 bytes
Desc: PGP Public Key
Url : http://lists.horde.org/archives/dev/attachments/20070516/d401d4c2/attachment.bin 


More information about the dev mailing list