Hey,
My situation:
I have a toplevel album with subalbums. Each of those subalbums has more subalbums. The toplevel album has its sort order set to "Last Changed Date - Decending." I figured that when someone adds something to a nested subalbum, the last changed date would update itself all the way up to the toplevel album, which aparently isn't the case.
Could someone give me a pointer as to where I would have to add my custom code to do this and what the function for changing the "Last Changed Date" is? I'm using a G2.1 snapshot from 23/Jan/2006.
My guess is that it would work similar to this pseudocode (which was aparently how it was done in G1):
function SomeFunction() {
$album = GetCurrentAlbum();
$album->SetLastChangedDate(time());
while ($album->hasParents()) {
$album = $album->getParent();
$album->SetLastChangedDate(time());
}
}
Thanks!!
//Demeli
Posts: 224
maybe check out your themes album.tpl, its where the date is called and displayed for your albums
Posts: 8601
search for "addShutdownAction" in modules/core/classes/GalleryItem.class
you'll find a couple places there that update the parent modification timestamp.
check GalleryCoreApi.class for apis to get all the ancestor ids..
Posts: 2
I've managed to implement it and it seems to be working perfectly.
For sake of completion, here's the code I used. (It goes into modules/core/classes/GalleryItem.class, line 436)
Thanks again for your help.
EDIT: 27/Jan - Updated code to adapt to G2 coding style. That should make this hack be able to survive more API changes.
Posts: 8601
cool, glad you got it to work!
list ($ret, $parents) = GalleryCoreApi::fetchParents($this);
is the proper call.. a $ret value of NULL means success, non-null is an error..
also we generally use $item->getId() rather than direct access to ->id
these are just coding style things....