The FileSet object is to Files what the Group object is to Users. Files can appear in more than one set. Additionally, when advanced permissions are enabled, file sets themselves may have their own permissions, specifying which users and groups may search them, add to them, and edit files within them.

Methods

$fs = FileSet::getGlobal();

This returns the global file set object. All files belong to this set implicitly, although it's mostly for permissions concerns.

$files = FileSet::getMySets($user = false)

Returns an array of FileSet objects that belong to the user, OR are public. If a user object isn't passed, the current logged-in user will be used.

$fs = FileSet::getByID($fsID)

Returns a FileSet object by its ID.

$fs = FileSet::getByName($fsName)

Returns a FileSet object by its name.

$fs->getFileSetID()

Returns the ID of a file set.

$fs->getFileSetName()

Returns the name of a file set.

$fs = FileSet::createAndGetSet($name, $type, $uID = false)

Creates a new file set if set doesn't exist. Type may be one of the following

	FileSet::TYPE_PRIVATE
	FileSet::TYPE_PUBLIC
	FileSet::TYPE_STARRED 

$fsf = $fs->addFileToSet($f)

Adds a file to a file set. $f may either be an instance of the File object or a file ID. Returns a FileSetFile object.

$fs->removeFileFromSet($f)

Removes a file from a file set.

$fs->resetPermissions()

Resets permissions on a file set.

$r =$fs->overrideGlobalPermissions()

Returns true if the fileset overrides the global file permissions.

$fs->setPermissions($obj, $canSearch, $canRead, $canWrite, $canAdmin, $canAdd, $extensions = array())

Sets up a permissions record on the current FileSet object. $obj may be an instance of the UserInfo or Group class. All arguments beginning with $can should be one of the following permissions levels:

	FilePermissions::PTYPE_NONE
	FilePermissions::PTYPE_MINE
	FilePermissions::PTYPE_ALL
	FilePermissions::PTYPE_CUSTOM

Recent Discussions on this Topic

Selecting files that match more than one set

Hello, I'm trying to select files from the file manager that are in two or more sets. For a file in a single set I do: $fileSet = FileSet::getByID(1); $fileList->filterBySet($fileSet); I would like to select files that are in both sets 1 and 6…

is it possible to pull a feed of files in a set?

Just as the title says, I'm wondering if it's possible to pull a feed (RSS or otherwise) of files that have been uplaoded to a particular set? This is to allow me to pull in content that has been uplaoded to concrete5 into a separate site, avoiding the…

Save display order not working after upgrade to 5.4.2.2

I recently upgraded a client site to the latest version of C5 and since then the Save Display Order within Sets is not working for me. As a photographer, controlling the order of the images in galleries is important to him and having just added 30 new ima…

Sorting Sets Not Saving

Hi - I am working on a site where I need to have a hero image to load first from a set. I have gone to the sets and tried dragging this image to the left so it is first to load. However on going to 'save display order'. It reverts to where it was before -…