Menu

## SeedDMS_Core_Folder extends SeedDMS_Core_Object
in package

inc.ClassFolder.php : 32

Class to represent a folder in the document management system

A folder in SeedDMS is equivalent to a directory in a regular file system. It can contain further subfolders and documents. Each folder has a single parent except for the root folder which has no parent.

##### Tags

category

  DMS

version

  @version@

version

  Release: @package_version@

author

  Uwe Steinmann uwe@steinmann.cx

copyright

  Copyright (C) 2002-2005 Markus Westphal, 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, 2010-2024 Uwe Steinmann

### Table of Contents

#### Properties

$_dms : SeedDMS_Core_DMS
$_notifyList : array<string|int, mixed>
$_accessList : array<string|int, SeedDMS_Core_UserAccess>|array<string|int, SeedDMS_Core_GroupAccess>
$_attributes : array<string|int, mixed>
$_comment : string
$_date : mixed
$_defaultAccess : int
$_documents : array<string|int, SeedDMS_Core_Document>
$_id : int
$_inheritAccess : bool
$_name : string
$_owner : SeedDMS_Core_User
$_ownerID : int
$_parent : SeedDMS_Core_Folder
$_parentID : int
$_readAccessList : array<string|int, mixed>
$_sequence : int
$_subFolders : array<string|int, SeedDMS_Core_Folder>

#### Methods

__construct() : mixed
  SeedDMS_Core_Folder constructor.
__toString() : string
  Cast to string
addAccess() : bool
  Add access right to folder
addDocument() : array<string|int, mixed>|bool
  Add a new document to the folder This method will add a new document and its content from a given file.
addNotify() : int
  Add a user/group to the notification list
addSubFolder() : bool|SeedDMS_Core_Folder
  Add a new subfolder
applyDecorators() : object
  Apply decorators
changeAccess() : bool
  Change access right of folder
cleanNotifyList() : mixed
  Make sure only users/groups with read access are in the notify list
clearAccessList() : bool
  Delete all entries for this folder from the access control list
clearCache() : mixed
  Clear cache of this instance.
emptyFolder() : bool
  Empty recursively a folder
getAccessList() : bool|SeedDMS_Core_GroupAccess|SeedDMS_Core_UserAccess
  Returns a list of access rights
getAccessMode() : int
  Get the access mode of a user on the folder
getApproversList() : mixed
  Get List of users and groups which have read access on the folder.
getAttribute() : array<string|int, mixed>|string
  Returns an attribute of the object for the given attribute definition
getAttributes() : array<string|int, mixed>|bool
  Returns all attributes set for the object
getAttributeValue() : mixed
  Returns an attribute value of the object for the given attribute definition This is a short cut for $object->getAttribute($attrdef)->getValue()
getAttributeValueAsArray() : mixed
  Returns an attribute value of the object for the given attribute definition
getAttributeValueAsString() : string
  Returns an attribute value of the object for the given attribute definition
getComment() : string
  Returns comment of folder
getDate() : int
  Return creation date of folder
getDefaultAccess() : bool|int
  Returns default access
getDMS() : SeedDMS_Core_DMS
  Returns instance of dms
getDocuments() : array<string|int, SeedDMS_Core_Document>|bool
  Get all documents of the folder
getDocumentsMinMax() : bool|array<string|int, mixed>
  Get the min and max sequence value for documents
getFolderList() : string
  Get the internally used folderList which stores the ids of folders from the root folder to the parent folder.
getFolderPathPlain() : string
  Returns a path like used for a file system
getFoldersMinMax() : bool|array<string|int, mixed>
  Get the min and max sequence value for folders
getGroupAccessMode() : int
  Get the access mode for a group on the folder
getID() : int
  Returns the internal id of the object
getInstance() : SeedDMS_Core_Folder|bool
  Return a folder by its id
getInstanceByData() : SeedDMS_Core_Folder|bool
  Return a folder by its database record
getInstanceByName() : SeedDMS_Core_Folder|bool
  Return a folder by its name
getName() : string
  Get the name of the folder.
getNotifyList() : array<string|int, SeedDMS_Core_User>|array<string|int, SeedDMS_Core_Group>|bool
  Get a list of all notification
getOwner() : object
  Returns the owner
getParent() : null|bool|SeedDMS_Core_Folder
  Returns the parent
getPath() : array<string|int, mixed>|bool
  Returns an array of all parents, grand parent, etc. up to the root folder.
getReadAccessList() : array<string|int, mixed>
  Returns a list of groups and users with read access on the folder
getSearchFields() : array<string|int, mixed>
  Return an array of database fields which used for searching a term entered in the database search form
getSearchTables() : string
  Return a sql statement with all tables used for searching.
getSequence() : mixed
getSubFolders() : array<string|int, SeedDMS_Core_Folder>|bool
  Returns a list of subfolders
hasDocumentByName() : bool
  Check if folder has document with given name
hasDocuments() : int
  Check, if folder has documents
hasSubFolderByName() : bool
  Check, if folder has as subfolder with the given name
hasSubFolders() : int
  Check, if folder has subfolders
inheritsAccess() : bool
  Check, if folder inherits access rights
isDescendant() : bool
  Check, if this folder is a subfolder of a given folder
isSubFolder() : bool
  Check if the folder is subfolder
isType() : mixed
  Check if this object is of type 'folder'.
remove() : bool
  Remove recursively a folder
removeAccess() : bool
  Remove all access rights of folder
removeAttribute() : bool
  Remove an attribute of the object for the given attribute definition
removeNotify() : int
  Removes notify for a user or group to folder
reorderDocuments() : bool
  Reorder documents of folder
repair() : bool
  Checks the internal data of the folder and repairs it.
setAttributeValue() : bool
  Set an attribute of the object for the given attribute definition
setComment() : bool
  Set comment of folder
setDate() : bool
  Set creation date of the folder
setDefaultAccess() : bool
  Set default access mode
setDMS() : mixed
  Set dms this object belongs to.
setInheritAccess() : bool
  Set inherited access mode
setName() : bool
  Set the name of the folder.
setOwner() : bool
  Set the owner
setParent() : bool
  Set a new folder
setSequence() : mixed
removeFromDatabase() : bool
  Remove a single folder

### Properties

#### $_dms

inc.ClassObject.php : 41
`public SeedDMS_Core_DMS $_dms`

back reference to document management system

#### $_notifyList

inc.ClassFolder.php : 71
`public array<string|int, mixed> $_notifyList`

list of notifications for users and groups

#### $_accessList

inc.ClassFolder.php : 106
`protected array<string|int, SeedDMS_Core_UserAccess>|array<string|int, SeedDMS_Core_GroupAccess> $_accessList`

#### $_attributes

inc.ClassObject.php : 36
`protected array<string|int, mixed> $_attributes`

list of attributes

#### $_comment

inc.ClassFolder.php : 46
`protected string $_comment`

comment of document

#### $_date

inc.ClassFolder.php : 81
`protected mixed $_date`

#### $_defaultAccess

inc.ClassFolder.php : 61
`protected int $_defaultAccess`

default access if access rights are not inherited

#### $_documents

inc.ClassFolder.php : 101
`protected array<string|int, SeedDMS_Core_Document> $_documents`

cache array of child documents

#### $_id

inc.ClassObject.php : 31
`protected int $_id`

unique id of object

#### $_inheritAccess

inc.ClassFolder.php : 56
`protected bool $_inheritAccess`

true if access is inherited, otherwise false

#### $_name

inc.ClassFolder.php : 36
`protected string $_name`

name of folder

#### $_owner

inc.ClassFolder.php : 91
`protected SeedDMS_Core_User $_owner`

cached owner of folder

#### $_ownerID

inc.ClassFolder.php : 51
`protected int $_ownerID`

id of user who is the owner

#### $_parent

inc.ClassFolder.php : 86
`protected SeedDMS_Core_Folder $_parent`

cached parent folder

#### $_parentID

inc.ClassFolder.php : 41
`protected int $_parentID`

id of parent folder

#### $_readAccessList

inc.ClassFolder.php : 66
`protected array<string|int, mixed> $_readAccessList`

list of notifications for users and groups

#### $_sequence

inc.ClassFolder.php : 76
`protected int $_sequence`

position of folder within the parent folder

#### $_subFolders

inc.ClassFolder.php : 96
`protected array<string|int, SeedDMS_Core_Folder> $_subFolders`

cached array of sub folders

### Methods

#### __construct()

inc.ClassFolder.php : 120

SeedDMS_Core_Folder constructor.

`public __construct( $id, $name, $parentID, $comment, $date, $ownerID, $inheritAccess, $defaultAccess, $sequence) : mixed`

##### Parameters

$id :
$name :
$parentID :
$comment :
$date :
$ownerID :
$inheritAccess :
$defaultAccess :
$sequence :

#### __toString()

inc.ClassFolder.php : 159

Cast to string

`public __toString() : string`

##### Return values

string

#### addAccess()

inc.ClassFolder.php : 1482

Add access right to folder

`public addAccess(int $mode, int $userOrGroupID, int $isUser) : bool`

This method may change in the future. Instead of passing the a flag and a user/group id a user or group object will be expected.

##### Parameters

$mode : int

  access mode

$userOrGroupID : int

  id of user or group

$isUser : int

  set to 1 if $userOrGroupID is the id of a user

##### Return values

bool

#### addDocument()

inc.ClassFolder.php : 1131

Add a new document to the folder This method will add a new document and its content from a given file.

`public addDocument(string $name, string $comment, int $expires, object $owner, SeedDMS_Core_User $keywords, array<string|int, SeedDMS_Core_DocumentCategory> $categories, string $tmpFile, string $orgFileName, string $fileType, string $mimeType, float $sequence[, array<string|int, mixed> $reviewers = array() ][, array<string|int, mixed> $approvers = array() ][, int|string $reqversion = 0 ][, string $version_comment = "" ][, array<string|int, mixed> $attributes = array() ][, array<string|int, mixed> $version_attributes = array() ][, SeedDMS_Core_Workflow $workflow = null ]) : array<string|int, mixed>|bool`

It does not check for access rights on the folder. The new documents default access right is read only and the access right is inherited.

##### Parameters

$name : string

  name of new document

$comment : string

  comment of new document

$expires : int

  expiration date as a unix timestamp or 0 for no expiration date

$owner : object

  owner of the new document

$keywords : SeedDMS_Core_User

  keywords of new document

$categories : array<string|int, SeedDMS_Core_DocumentCategory>

  list of category objects

$tmpFile : string

  the path of the file containing the content

$orgFileName : string

  the original file name

$fileType : string

  usually the extension of the filename

$mimeType : string

  mime type of the content

$sequence : float

  position of new document within the folder

$reviewers : array<string|int, mixed> = array()

  list of users who must review this document

$approvers : array<string|int, mixed> = array()

  list of users who must approve this document

$reqversion : int|string = 0

  version number of the content

$version_comment : string = ""

  comment of the content. If left empty the $comment will be used.

$attributes : array<string|int, mixed> = array()

  list of document attributes. The element key must be the id of the attribute definition.

$version_attributes : array<string|int, mixed> = array()

  list of document version attributes. The element key must be the id of the attribute definition.

$workflow : SeedDMS_Core_Workflow = null

##### Return values

array<string|int, mixed>|bool —

false in case of error, otherwise an array containing two elements. The first one is the new document, the second one is the result set returned when inserting the content.

#### addNotify()

inc.ClassFolder.php : 1809

Add a user/group to the notification list

`public addNotify(int $userOrGroupID, bool $isUser) : int`

This method does not check if the currently logged in user is allowed to add a notification. This must be checked by the calling application.

##### Parameters

$userOrGroupID : int
$isUser : bool

  true if $userOrGroupID is a user id otherwise false

##### Return values

int —

error code -1: Invalid User/Group ID. -2: Target User / Group does not have read access. -3: User is already subscribed. -4: Database / internal error. 0: Update successful.

#### addSubFolder()

inc.ClassFolder.php : 796

Add a new subfolder

`public addSubFolder(string $name, string $comment, object $owner, int $sequence[, array<string|int, mixed> $attributes = array() ]) : bool|SeedDMS_Core_Folder`

##### Parameters

$name : string

  name of folder

$comment : string

  comment of folder

$owner : object

  owner of folder

$sequence : int

  position of folder in list of sub folders.

$attributes : array<string|int, mixed> = array()

  list of document attributes. The element key must be the id of the attribute definition.

##### Return values

bool|SeedDMS_Core_Folder —

an error.

#### applyDecorators()

inc.ClassFolder.php : 288

Apply decorators

`public applyDecorators() : object`

##### Return values

object —

final object after all decorators has been applied

#### changeAccess()

inc.ClassFolder.php : 1525

Change access right of folder

`public changeAccess(int $newMode, int $userOrGroupID, int $isUser) : bool`

This method may change in the future. Instead of passing the a flag and a user/group id a user or group object will be expected.

##### Parameters

$newMode : int

  access mode

$userOrGroupID : int

  id of user or group

$isUser : int

  set to 1 if $userOrGroupID is the id of a user

##### Return values

bool

#### cleanNotifyList()

inc.ClassFolder.php : 1767

Make sure only users/groups with read access are in the notify list

`public cleanNotifyList() : mixed`

#### clearAccessList()

inc.ClassFolder.php : 1454

Delete all entries for this folder from the access control list

`public clearAccessList([bool $noclean = false ]) : bool`

##### Parameters

$noclean : bool = false

  set to true if notifier list shall not be clean up

##### Return values

bool —

true if operation was successful otherwise false

#### clearCache()

inc.ClassFolder.php : 144

Clear cache of this instance.

`public clearCache() : mixed`

The result of some expensive database actions (e.g. get all subfolders or documents) will be saved in a class variable to speed up consecutive calls of the same method. If a second call of the same method shall not use the cache, then it must be cleared.

#### emptyFolder()

inc.ClassFolder.php : 1348

Empty recursively a folder

`public emptyFolder() : bool`

Removes all subfolders and documents of a folder but not the folder itself This method will call remove() on all its children. This method triggers the callbacks onPreEmptyFolder and onPostEmptyFolder. If onPreEmptyFolder returns a boolean then this method will return imediately. Be aware that the recursive calls of remove() will trigger the callbacks onPreRemoveFolder, onPostRemoveFolder, onPreRemoveDocument and onPostRemoveDocument.

##### Return values

bool —

true on success, false in case of an error

#### getAccessList()

inc.ClassFolder.php : 1409

Returns a list of access rights

`public getAccessList([int $mode = M_ANY ][, int $op = O_EQ ]) : bool|SeedDMS_Core_GroupAccess|SeedDMS_Core_UserAccess`

If the folder inherits the access rights from the parent folder those will be returned. $mode and $op can be set to restrict the list of returned access rights. If $mode is set to M_ANY no restriction will apply regardless of the value of $op. The returned array contains a list of and objects. Even if the document has no access list the returned array contains the two elements 'users' and 'groups' which are than empty. The methode returns false if the function fails.

##### Parameters

$mode : int = M_ANY

  access mode (defaults to M_ANY)

$op : int = O_EQ

  operation (defaults to O_EQ)

##### Return values

bool|SeedDMS_Core_GroupAccess|SeedDMS_Core_UserAccess

#### getAccessMode()

inc.ClassFolder.php : 1622

Get the access mode of a user on the folder

`public getAccessMode(SeedDMS_Core_User $user[, string $context = '' ]) : int`

The access mode is either M_READ, M_READWRITE, M_ALL, or M_NONE. It is determined

- by the user (admins and owners have always access mode M_ALL)
- by the access list for the user (possibly inherited)
- by the default access mode

This method returns the access mode for a given user. An administrator and the owner of the folder has unrestricted access. A guest user has read only access or no access if access rights are further limited by access control lists all the default access. All other users have access rights according to the access control lists or the default access. This method will recursively check for access rights of parent folders if access rights are inherited.

Before checking the access itself a callback 'onCheckAccessFolder' is called. If it returns a value > 0, then this will be returned by this method without any further checks. The optional paramater $context will be passed as a third parameter to the callback. It contains the operation for which the access mode is retrieved. It is for example set to 'removeDocument' if the access mode is used to check for sufficient permission on deleting a document. This callback could be used to override any existing access mode in a certain context.

##### Parameters

$user : SeedDMS_Core_User

  user for which access shall be checked

$context : string = ''

  context in which the access mode is requested

##### Return values

int —

access mode

#### getApproversList()

inc.ClassFolder.php : 2002

Get List of users and groups which have read access on the folder.

`public getApproversList() : mixed`

The list will not include any guest users, administrators and the owner of the folder.

This method is deprecated. Use SeedDMS_Core_Folder::getReadAccessList() instead.

#### getAttribute()

inc.ClassObject.php : 136

Returns an attribute of the object for the given attribute definition

`public getAttribute(SeedDMS_Core_AttributeDefinition $attrdef) : array<string|int, mixed>|string`

##### Parameters

$attrdef : SeedDMS_Core_AttributeDefinition

##### Return values

array<string|int, mixed>|string —

value of attritbute or false. The value is an array if the attribute is defined as multi value

#### getAttributes()

inc.ClassObject.php : 96

Returns all attributes set for the object

`public getAttributes() : array<string|int, mixed>|bool`

##### Return values

array<string|int, mixed>|bool

#### getAttributeValue()

inc.ClassObject.php : 156

Returns an attribute value of the object for the given attribute definition This is a short cut for $object->getAttribute($attrdef)->getValue()

`public getAttributeValue(SeedDMS_Core_AttributeDefinition $attrdef) : mixed`

##### Parameters

$attrdef : SeedDMS_Core_AttributeDefinition

##### Return values

mixed —

value of attritbute or null if the attribute is not set. The value is an array if the attribute is defined as multi value

#### getAttributeValueAsArray()

inc.ClassObject.php : 179

Returns an attribute value of the object for the given attribute definition

`public getAttributeValueAsArray(SeedDMS_Core_AttributeDefinition $attrdef) : mixed`

This is a short cut for getAttribute($attrdef)->getValueAsArray() but first checks if the object has an attribute for the given attribute definition.

##### Parameters

$attrdef : SeedDMS_Core_AttributeDefinition

##### Return values

mixed —

value of attritbute or null if the attribute is not set. Even if the attribute is not defined as multi value

#### getAttributeValueAsString()

inc.ClassObject.php : 202

Returns an attribute value of the object for the given attribute definition

`public getAttributeValueAsString(SeedDMS_Core_AttributeDefinition $attrdef) : string`

This is a short cut for getAttribute($attrdef)->getValueAsString() but first checks if the object has an attribute for the given attribute definition.

##### Parameters

$attrdef : SeedDMS_Core_AttributeDefinition

##### Return values

string —

value of attritbute or false. The value is always a string even if the attribute is defined as multi value

#### getComment()

inc.ClassFolder.php : 349

Returns comment of folder

`public getComment() : string`

##### Return values

string —

comment

#### getDate()

inc.ClassFolder.php : 395

Return creation date of folder

`public getDate() : int`

##### Return values

int —

unix timestamp of creation date

#### getDefaultAccess()

inc.ClassFolder.php : 604

Returns default access

`public getDefaultAccess() : bool|int`

If access rights are inherited, the method will return the default access of the parent folder.

##### Return values

bool|int —

access right or fals in case of an error

#### getDMS()

inc.ClassObject.php : 80

Returns instance of dms

`public getDMS() : SeedDMS_Core_DMS`

##### Return values

SeedDMS_Core_DMS

#### getDocuments()

inc.ClassFolder.php : 979

Get all documents of the folder

`public getDocuments([string $orderby = "" ][, string $dir = "asc" ][, int $limit = 0 ][, int $offset = 0 ]) : array<string|int, SeedDMS_Core_Document>|bool`

This method does not check for access rights. Use for checking each document against the currently logged in user and the access rights.

##### Parameters

$orderby : string = ""

  if set to 'n' the list is ordered by name, otherwise it will be ordered by sequence

$dir : string = "asc"

  direction of sorting (asc or desc)

$limit : int = 0

  limit number of documents

$offset : int = 0

  offset in retrieved list of documents

##### Return values

array<string|int, SeedDMS_Core_Document>|bool —

list of documents or false in case of an error

#### getDocumentsMinMax()

inc.ClassFolder.php : 2177

Get the min and max sequence value for documents

`public getDocumentsMinMax() : bool|array<string|int, mixed>`

##### Return values

bool|array<string|int, mixed> —

array with keys 'min' and 'max', false in case of an error

#### getFolderList()

inc.ClassFolder.php : 2132

Get the internally used folderList which stores the ids of folders from the root folder to the parent folder.

`public getFolderList() : string`

##### Return values

string —

column separated list of folder ids

#### getFolderPathPlain()

inc.ClassFolder.php : 887

Returns a path like used for a file system

`public getFolderPathPlain([bool $skiproot = false ][, string $sep = ' / ' ]) : string`

This path contains by default spaces around the slashes for better readability. Run str_replace(' / ', '/', $path) on it or pass '/' as $sep to get a valid unix file system path.

The returned path is not a real path in a file system. It just uses the common syntax on unix systems to format a path.

##### Parameters

$skiproot : bool = false

  skip the name of the root folder and start with $sep

$sep : string = ' / '

  separator between path elements

##### Return values

string —

path separated with ' / '

#### getFoldersMinMax()

inc.ClassFolder.php : 2193

Get the min and max sequence value for folders

`public getFoldersMinMax() : bool|array<string|int, mixed>`

##### Return values

bool|array<string|int, mixed> —

array with keys 'min' and 'max', false in case of an error

#### getGroupAccessMode()

inc.ClassFolder.php : 1703

Get the access mode for a group on the folder

`public getGroupAccessMode(SeedDMS_Core_Group $group) : int`

This method returns the access mode for a given group. The algorithmn applied to get the access mode is the same as describe at

##### Parameters

$group : SeedDMS_Core_Group

  group for which access shall be checked

##### Return values

int —

access mode

#### getID()

inc.ClassObject.php : 89

Returns the internal id of the object

`public getID() : int`

##### Return values

int —

id of document/folder

#### getInstance()

inc.ClassFolder.php : 235

Return a folder by its id

`public static getInstance(int $id, SeedDMS_Core_DMS $dms) : SeedDMS_Core_Folder|bool`

##### Parameters

$id : int

  id of folder

$dms : SeedDMS_Core_DMS

##### Return values

SeedDMS_Core_Folder|bool —

instance of SeedDMS_Core_Folder if document exists, null if document does not exist, false in case of error

#### getInstanceByData()

inc.ClassFolder.php : 218

Return a folder by its database record

`public static getInstanceByData(array<string|int, mixed> $resArr, SeedDMS_Core_DMS $dms) : SeedDMS_Core_Folder|bool`

##### Parameters

$resArr : array<string|int, mixed>

  array of folder data as returned by database

$dms : SeedDMS_Core_DMS

##### Return values

SeedDMS_Core_Folder|bool —

instance of SeedDMS_Core_Folder if document exists

#### getInstanceByName()

inc.ClassFolder.php : 262

Return a folder by its name

`public static getInstanceByName(string $name, SeedDMS_Core_Folder $folder, mixed $dms) : SeedDMS_Core_Folder|bool`

This method retrieves a folder from the database by its name. The search covers the whole database. If the parameter $folder is not null, it will search for the name only within this parent folder. It will not be done recursively.

##### Parameters

$name : string

  name of the folder

$folder : SeedDMS_Core_Folder

  parent folder

$dms : mixed

##### Return values

SeedDMS_Core_Folder|bool —

found folder or false

#### getName()

inc.ClassFolder.php : 305

Get the name of the folder.

`public getName() : string`

##### Return values

string —

name of folder

#### getNotifyList()

inc.ClassFolder.php : 1738

Get a list of all notification

`public getNotifyList([int $type = 0 ][, bool $incdisabled = false ]) : array<string|int, SeedDMS_Core_User>|array<string|int, SeedDMS_Core_Group>|bool`

This method returns all users and groups that have registerd a notification for the folder

##### Parameters

$type : int = 0

  type of notification (not yet used)

$incdisabled : bool = false

  set to true if disabled user shall be included

##### Return values

array<string|int, SeedDMS_Core_User>|array<string|int, SeedDMS_Core_Group>|bool —

array with a the elements 'users' and 'groups' which contain a list of users and groups.

#### getOwner()

inc.ClassFolder.php : 550

Returns the owner

`public getOwner() : object`

##### Return values

object —

owner of the folder

#### getParent()

inc.ClassFolder.php : 429

Returns the parent

`public getParent() : null|bool|SeedDMS_Core_Folder`

##### Return values

null|bool|SeedDMS_Core_Folder —

returns null, if there is no parent folder and false in case of an error

#### getPath()

inc.ClassFolder.php : 858

Returns an array of all parents, grand parent, etc. up to the root folder.

`public getPath() : array<string|int, mixed>|bool`

The folder itself is the last element of the array.

##### Return values

array<string|int, mixed>|bool

#### getReadAccessList()

inc.ClassFolder.php : 2018

Returns a list of groups and users with read access on the folder

`public getReadAccessList([bool $listadmin = 0 ][, bool $listowner = 0 ][, bool $listguest = 0 ]) : array<string|int, mixed>`

The list will not include any guest users, administrators and the owner of the folder unless $listadmin resp. $listowner is set to true.

##### Parameters

$listadmin : bool = 0

  if set to true any admin will be listed too

$listowner : bool = 0

  if set to true the owner will be listed too

$listguest : bool = 0

  if set to true any guest will be listed too

##### Return values

array<string|int, mixed> —

list of users and groups

#### getSearchFields()

inc.ClassFolder.php : 181

Return an array of database fields which used for searching a term entered in the database search form

`public static getSearchFields(SeedDMS_Core_DMS $dms, array<string|int, mixed> $searchin) : array<string|int, mixed>`

##### Parameters

$dms : SeedDMS_Core_DMS
$searchin : array<string|int, mixed>

  integer list of search scopes (2=name, 3=comment, 4=attributes)

##### Return values

array<string|int, mixed> —

list of database fields

#### getSearchTables()

inc.ClassFolder.php : 206

Return a sql statement with all tables used for searching.

`public static getSearchTables() : string`

This must be a syntactically correct left join of all tables.

##### Return values

string —

sql expression for left joining tables

#### getSequence()

inc.ClassFolder.php : 684
`public getSequence() : mixed`

#### getSubFolders()

inc.ClassFolder.php : 753

Returns a list of subfolders

`public getSubFolders([string $orderby = "" ][, string $dir = "asc" ][, int $limit = 0 ][, int $offset = 0 ]) : array<string|int, SeedDMS_Core_Folder>|bool`

This method does not check for access rights. Use for checking each folder against the currently logged in user and the access rights.

##### Parameters

$orderby : string = ""

  if set to 'n' the list is ordered by name, otherwise it will be ordered by sequence

$dir : string = "asc"

  direction of sorting (asc or desc)

$limit : int = 0

  limit number of subfolders

$offset : int = 0

  offset in retrieved list of subfolders

##### Return values

array<string|int, SeedDMS_Core_Folder>|bool —

list of folder objects or false in case of an error

#### hasDocumentByName()

inc.ClassFolder.php : 952

Check if folder has document with given name

`public hasDocumentByName(string $name) : bool`

##### Parameters

$name : string

##### Return values

bool —

true if document exists, false if not or in case of an error

#### hasDocuments()

inc.ClassFolder.php : 929

Check, if folder has documents

`public hasDocuments() : int`

This method just checks if a folder has documents diregarding any access rights.

##### Return values

int —

number of documents or false in case of an error

#### hasSubFolderByName()

inc.ClassFolder.php : 726

Check, if folder has as subfolder with the given name

`public hasSubFolderByName(string $name) : bool`

##### Parameters

$name : string

##### Return values

bool —

true if subfolder exists, false if not or in case of an error

#### hasSubFolders()

inc.ClassFolder.php : 705

Check, if folder has subfolders

`public hasSubFolders() : int`

This method just checks if a folder has subfolders disregarding any access rights.

##### Return values

int —

number of subfolders or false in case of an error

#### inheritsAccess()

inc.ClassFolder.php : 649

Check, if folder inherits access rights

`public inheritsAccess() : bool`

##### Return values

bool —

true, if access rights are inherited, otherwise false

#### isDescendant()

inc.ClassFolder.php : 908

Check, if this folder is a subfolder of a given folder

`public isDescendant(object $folder) : bool`

This is basically the opposite of SeedDMS_Core_Folder::isSubFolder()

##### Parameters

$folder : object

  parent folder

##### Return values

bool —

true if folder is a subfolder

#### isSubFolder()

inc.ClassFolder.php : 455

Check if the folder is subfolder

`public isSubFolder(SeedDMS_Core_Folder $subfolder) : bool`

This method checks if the current folder is in the path of the passed subfolder. In that case the current folder is a parent, grant parent, grant grant parent, etc. of the subfolder or to say it differently the passed folder is somewhere below the current folder.

This is basically the opposite of SeedDMS_Core_Folder::isDescendant()

##### Parameters

$subfolder : SeedDMS_Core_Folder

  folder to be checked if it is a subfolder on any level of the current folder

##### Return values

bool —

true if passed folder is a subfolder, otherwise false

#### isType()

inc.ClassFolder.php : 168

Check if this object is of type 'folder'.

`public isType(string $type) : mixed`

##### Parameters

$type : string

  type of object

#### remove()

inc.ClassFolder.php : 1283

Remove recursively a folder

`public remove() : bool`

Removes a folder, all its subfolders and documents This method triggers the callbacks onPreRemoveFolder and onPostRemoveFolder. If onPreRemoveFolder returns a boolean then this method will return imediately with the value returned by the callback. Otherwise the regular removal is executed, which in turn triggers further onPreRemoveFolder and onPostRemoveFolder callbacks and its counterparts for documents (onPreRemoveDocument, onPostRemoveDocument).

##### Return values

bool —

true on success, false in case of an error

#### removeAccess()

inc.ClassFolder.php : 1563

Remove all access rights of folder

`public removeAccess( $userOrGroupID, $isUser) : bool`

This method removes all access rights of a given user or group.

##### Parameters

$userOrGroupID :
$isUser :

##### Return values

bool

#### removeAttribute()

inc.ClassObject.php : 296

Remove an attribute of the object for the given attribute definition

`public removeAttribute(SeedDMS_Core_AttributeDefinition $attrdef) : bool`

FIXME: shouldn't this rather be setAttributeValue() with an empty value?

##### Parameters

$attrdef : SeedDMS_Core_AttributeDefinition

##### Return values

bool —

true if operation was successful, otherwise false

#### removeNotify()

inc.ClassFolder.php : 1932

Removes notify for a user or group to folder

`public removeNotify(int $userOrGroupID, bool $isUser[, int $type = 0 ]) : int`

This method does not check if the currently logged in user is allowed to remove a notification. This must be checked by the calling application.

##### Parameters

$userOrGroupID : int
$isUser : bool

  true if $userOrGroupID is a user id otherwise false

$type : int = 0

  type of notification (0 will delete all) Not used yet!

##### Return values

int —

error code -1: Invalid User/Group ID. -3: User is not subscribed. -4: Database / internal error. 0: Update successful.

#### reorderDocuments()

inc.ClassFolder.php : 2214

Reorder documents of folder

`public reorderDocuments() : bool`

Fix the sequence numbers of all documents in the folder, by assigning new numbers starting from 1 incrementing by 1. This can be necessary if sequence numbers are not unique which makes manual reordering for documents with identical sequence numbers impossible.

##### Return values

bool —

false in case of an error, otherwise true

#### repair()

inc.ClassFolder.php : 2148

Checks the internal data of the folder and repairs it.

`public repair() : bool`

Currently, this function only repairs an incorrect folderList

##### Return values

bool —

true on success, otherwise false

#### setAttributeValue()

inc.ClassObject.php : 222

Set an attribute of the object for the given attribute definition

`public setAttributeValue(SeedDMS_Core_AttributeDefinition $attrdef, array<string|int, mixed>|string $value) : bool`

##### Parameters

$attrdef : SeedDMS_Core_AttributeDefinition

  definition of attribute

$value : array<string|int, mixed>|string

  value of attribute, for multiple values this must be an array

##### Return values

bool —

true if operation was successful, otherwise false

#### setComment()

inc.ClassFolder.php : 359

Set comment of folder

`public setComment( $newComment) : bool`

This method calls the hooks `onPreSetComment` and `onPostSetComment`.

##### Parameters

$newComment :

  new comment

##### Return values

bool —

true if comment could be set, otherwise false

#### setDate()

inc.ClassFolder.php : 406

Set creation date of the folder

`public setDate(int $date) : bool`

##### Parameters

$date : int

  timestamp of creation date. If false then set it to the current timestamp

##### Return values

bool —

true on success

#### setDefaultAccess()

inc.ClassFolder.php : 628

Set default access mode

`public setDefaultAccess(int $mode[, bool $noclean = false ]) : bool`

This method sets the default access mode and also removes all notifiers which will not have read access anymore.

##### Parameters

$mode : int

  access mode

$noclean : bool = false

  set to true if notifier list shall not be clean up

##### Return values

bool

#### setDMS()

inc.ClassObject.php : 71

Set dms this object belongs to.

`public setDMS(SeedDMS_Core_DMS $dms) : mixed`

Each object needs a reference to the dms it belongs to. It will be set when the object is created. The dms has a references to the currently logged in user and the database connection.

##### Parameters

$dms : SeedDMS_Core_DMS

  reference to dms

#### setInheritAccess()

inc.ClassFolder.php : 666

Set inherited access mode

`public setInheritAccess(bool $inheritAccess[, bool $noclean = false ]) : bool`

Setting inherited access mode will set or unset the internal flag which controls if the access mode is inherited from the parent folder or not. It will not modify the access control list for the current object. It will remove all notifications of users which do not even have read access anymore after setting or unsetting inherited access.

##### Parameters

$inheritAccess : bool

  set to true for setting and false for unsetting inherited access mode

$noclean : bool = false

  set to true if notifier list shall not be clean up

##### Return values

bool —

true if operation was successful otherwise false

#### setName()

inc.ClassFolder.php : 313

Set the name of the folder.

`public setName(string $newName) : bool`

##### Parameters

$newName : string

  set a new name of the folder

##### Return values

bool

#### setOwner()

inc.ClassFolder.php : 562

Set the owner

`public setOwner(SeedDMS_Core_User $newOwner) : bool`

##### Parameters

$newOwner : SeedDMS_Core_User

  of the folder

##### Return values

bool —

true if successful otherwise false

#### setParent()

inc.ClassFolder.php : 474

Set a new folder

`public setParent(SeedDMS_Core_Folder $newParent) : bool`

This method moves a folder from one parent folder into another parent folder. It will fail if the root folder is moved or the folder is moved into one of its own subfolders.

##### Parameters

$newParent : SeedDMS_Core_Folder

  new parent folder

##### Return values

bool —

true if operation was successful otherwise false

#### setSequence()

inc.ClassFolder.php : 686
`public setSequence(mixed $seq) : mixed`

##### Parameters

$seq : mixed

#### removeFromDatabase()

inc.ClassFolder.php : 1214

Remove a single folder

`protected removeFromDatabase() : bool`

Removes just a single folder, but not its subfolders or documents This method will fail if the folder has subfolders or documents because of referencial integrity errors.

##### Return values

bool —

true on success, false in case of an error

## Search results