Pull all File Set names

Permalink
Hey!

I'm trying to create a custom gallery by using a custom attribute that has the File Set name in it. To check that that the File Set actually exists, I pull all the File Set names and do a quick run through to see. If it doesn't exist, it doesn't do anything, but if it does, it displays the slideshow. I'm running into a small snare where the the File Sets are only pulled when I'm logged in. It doesn't read it when I'm logged out.

Loader::model("file_set");
Loader::model('file_list');
$fileSets = FileSet::getMySets();
$allFileSets = array();
foreach ($fileSets as $fs) {
     $allFileSets[$fs->fsID] = $fs->fsName;
}


I try to display the fileSets array and I get nothing. Same with $allFileSets array.

Help?
THANKS!

rainmaker
 
mesuva replied on at Permalink Best Answer Reply
mesuva
I think that's because getMySets() is a function really only intended for logged in users, not something you'd use for just viewing. You'd use that function to be able to fetch a list of filesets for an admin to pick (in a drop down, etc), but then you'd just store the fileset ID.

Instead of storing the name of the fileset, I think you should be storing the ID, so you'd then just pass that to your slideshow. Remember too that you can re-name filesets in the dashboard, so you don't want to be associating data using the labels, just the IDs.

Have you seen: http://www.concrete5.org/marketplace/addons/fileset-attribute/... ?

When I want to relate a fileset to a page I use this attribute. You might find an older blog post I wrote about this relevant too: http://www.mesuva.com.au/blog/concrete5/creating-a-composer-driven-...
rainmaker replied on at Permalink Reply
rainmaker
Hey mesuva!

Great, great tips! I'll give that a try. I did not see that custom attribute. Dang. That would have made this a lot easier! :)

THANKS! :D
JohntheFish replied on at Permalink Reply
JohntheFish
You can create such a gallery with no custom code using Sorcerer's Gallery and Magic Data.

http://www.concrete5.org/marketplace/addons/sorcerers-gallery/...

http://www.concrete5.org/marketplace/addons/magic-data/...

You may also find http://www.concrete5.org/marketplace/addons/fileset-attribute/... useful, but it is not required by the above because Magic Data can work with a fileset name or id.
rainmaker replied on at Permalink Reply
rainmaker
Hey JohnTheFish!

Thanks for responding! I was trying to do this within a page type for another package (ProEvents) so I was trying to do it using "Additional" Attributes part of that package so clients didn't have to search to figure out the gallery. I was trying to make it as easy as possible.

Of course, I do always look forward to using any of your plugins though. :) Thanks for taking the time to respond!