how to get a list of all file sets

Permalink
I have several file sets and I need to sit in a loop and search each set for particular files (images in this case).

To get the list of file set names I used:
$filesets = FileSet::getMySets($user = false);

This works fine as long as I'm logged in to C5 as admin, but when I log out it seems getMySets produces nothing.

Any clues why this would be the case? I should have thought "$user = false" would remove any user dependencies. Is there another way to get a list of file sets?

Thank you.

 
mesuva replied on at Permalink Best Answer Reply
mesuva
I think you need to use a FileSetList and not just FileSet.

Something like:
$fsl = new FileSetList();
$filesets = $fsl->get(1000, 0);   // set a big number here to get all sets
foreach($filesets as $fs) {
    echo 'The file set: ' . $fs->getFileSetName() . '  has an ID of ' . $fs->getFileSetID() . '<br />';
}


getMySets() takes into consideration users, etc, while the get function of FileSetList is just a simple retrieval. Have a look at: /concrete/core/models/file_set.php

(I haven't tried the above, but I'm pretty sure that's the way to do it)
jaulfh replied on at Permalink Reply
That works perfectly. I can't believe after all the searching around I never stumbled across FileSetList().

Thanks so much for your help.