sub albums

protocolus@gmail.com

Joined: 2005-04-22
Posts: 7
Posted: Fri, 2005-04-22 01:53

I want to have 3 different layouts for my gallery. one for premium users one for regular users and one for the main site. it is for a gallery of artists. i have tried to use the embed but, I have no idea how to specify a layout or theme in the php that calls embed. I was going to use 3 users that includes the albums of the other users but I don't know how to do this either. Can you point me in the right direction?

main site --> main theme & layout

premium link --> premium theme & layout

normal users link --> normal theme and layout

each of these will show a list of different user's albums.

some users albums will be the same in main and normal but will inheriet the theme depending on where they were called.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2005-04-22 03:27

you can modify fetchLayoutId in modules/core/classes/helpers/GalleryItemHelper_simple.class to use different logic to select the layout.

 
protocolus@gmail.com

Joined: 2005-04-22
Posts: 7
Posted: Fri, 2005-04-22 03:33

So maybe set a GLOBAL called $templeteoverride in my premium.php which calls embed.php and then set the fetchLayoutId to the GLOBAL var if it is set?

 
protocolus@gmail.com

Joined: 2005-04-22
Posts: 7
Posted: Fri, 2005-04-22 03:56

Thanks VERY much!

I got that working by putting a global in my page and throwing this in that file listed above:

if (!empty($lay_override)) {
$layoutId = $lay_override;
}

Do you know where I need to put the theme code? I grepped for themeId but no hits and I grepped for just theme but it came up with a themeDir which was the wrong part of the code.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2005-04-22 04:09

function doLoadTemplate in modules/core/classes/GalleryView.class
you'll see where it calls getThemeName and loads the default theme if no value is returned.

 
protocolus@gmail.com

Joined: 2005-04-22
Posts: 7
Posted: Fri, 2005-04-22 04:40

This is what I ended up doing in that file and it works great!

function doLoadTemplate(&$template) {
global $gallery;
global $temp_override;

/* Get the theme name from the view */
list ($ret, $themeName) = $this->getThemeName();
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null, null);
}

if (!empty($temp_override)) {
$themeName = $temp_override;
}

Thank you for answering all these questions. You are saving my life here. How about this one. Can I get a list of users in a particular group thru the embed interface?

If so I can have a premium group and a normal group and use that to display my gallery pages.

If that is hard is there anyway I can get an updated album linking module that works with the later codebase?

Thanks again for all your help.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2005-04-22 06:14

Check the dev forum for the updated albumlink module.. it's more of a sample code showing a possible approach, so you should read that topic and understand the caveats before using it.

If you're using GalleryEmbed you can call any GalleryCoreApi methods after you've done GalleryEmbed::init. Things like isUserInGroup, fetchUsersForGroup or fetchGroupsForUser.

 
protocolus@gmail.com

Joined: 2005-04-22
Posts: 7
Posted: Fri, 2005-04-22 15:53

so if I called fetchUsersForGroup what would display that users album? also how do i surpress the default of all the albums showing up. I basically want to only show albums from users of a particular group.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2005-04-22 16:12

you've lost me.. use permissions to make certain albums visible to certain groups and assign users to those groups.

 
protocolus@gmail.com

Joined: 2005-04-22
Posts: 7
Posted: Fri, 2005-04-22 16:18

I'm sorry I was thinking of it from a "guest" perspective.

So i'm a guest coming to the site and on the homepage I see a listing of all the preimium members. if I click another link I go to a normal users page and all of thier albums are shown.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sun, 2005-04-24 23:49

If you want to use a different list of albums, you'll have to modify loadSystemContent in modules/albumselect/module.inc to load up a different set of albums. Note that this code loads the list of all albums that the user can see, and caches it for speed. That code is a little hairy. You'll ultimately want to make a call other than GalleryCoreApi::fetchAlbumTree() to return the tree of your choosing, per user. And then you'll need to either disable caching (which will incur a performance hit) or expand the caching to support more than one type of data.

In short, you won't find this to be trivial to change. But give it a shot and we can help you with specific issues.

 
protocolus@gmail.com

Joined: 2005-04-22
Posts: 7
Posted: Mon, 2005-04-25 02:56

//just add a dash of this:

list ($ret, $group) = GalleryCoreApi::fetchGroupByGroupName($groupName);
if (isset($group))
{
list ($ret, $users) = GalleryCoreApi::fetchUsersForGroup($group->getId());
}

//and a pinch of this:

foreach($users as $userId=>$userName)
{
$items = array();

list($ret, $itemsTemp) = GalleryCoreApi::fetchAllItemIdsByOwnerId($userId);
list($ret, $thumbs) = GalleryCoreApi::fetchThumbnailsByItemIds($itemsTemp);

$thumb = null;
if (isset($thumbs) && is_array($thumbs))
{
foreach($thumbs as $currentThumb)
{
if (!isset($thumb))
{
$thumb = $currentThumb;
break;
}
}
}

for ($i=0, $limiti=count($itemsTemp); $i<$limiti; $i++)
{
list ($ret, $item) = GalleryCoreApi::loadEntitiesById($itemsTemp[$i]);

if (strcasecmp($item->getEntityType(), "GalleryAlbumItem") == 0)
{
$items[] = array (
"id" => $itemsTemp[$i],
"title" => $item->getTitle(),
"object" => $item
);
}
}

$user =& GalleryCoreApi::fetchUserByUserName($userName);

$users[$userId] = array (
"name" => $userName,
"albumid" => isset($items) ? $items[0]["id"] : null,
"album" => isset($items) ? $items[0] : null,
"thumbnail" => $thumb,
"object" => $user
);
}