Menu

## SeedDMS_Core_Document extends SeedDMS_Core_Object
in package

inc.ClassDocument.php : 127

Class to represent a document in the document management system

A document in SeedDMS is a collection of content elements which are similar to a file in a regular file system. Documents may have any number of content elements (SeedDMS_Core_DocumentContent). These content elements are often called versions ordered in a timely manner. The most recent content element is the current version of the document.

Documents can be linked to other documents, can have attached files, can be assigned to a category and have additional attributes. The document content can be anything that can be stored in a regular file.

##### Tags

category

  DMS

author

  Markus Westphal, Malcolm Cowe, Matteo Lucarelli, Uwe Steinmann uwe@steinmann.cx

copyright

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

version

  Release: @package_version@

### Table of Contents

#### Properties

$_dms : SeedDMS_Core_DMS
$_notifyList : array<string|int, mixed>
$_accessList : array<string|int, mixed>
$_attributes : array<string|int, mixed>
$_categories : array<string|int, SeedDMS_Core_DocumentCategory>
$_comment : string
$_content : array<string|int, mixed>
$_date : int
$_defaultAccess : int
$_documentFiles : array<string|int, mixed>
$_documentLinks : array<string|int, mixed>
$_expires : int
$_folder : SeedDMS_Core_Folder
$_folderID : int
$_id : int
$_inheritAccess : bool
$_keywords : string
$_latestContent : SeedDMS_Core_DocumentContent
$_locked : bool
$_lockingUser : object
$_name : string
$_owner : object
$_ownerID : int
$_parent : object
$_readAccessList : array<string|int, mixed>
$_sequence : int

#### Methods

__construct() : mixed
  SeedDMS_Core_Object constructor.
__toString() : string
  Cast to string
addAccess() : bool
  Add access right to document
addCategories() : mixed
  Add a list of categories to the document
addContent() : bool|SeedDMS_Core_AddContentResultSet
  Add content to a document
addDocumentFile() : mixed
  Add an attachment to the document
addDocumentLink() : SeedDMS_Core_DocumentLink|bool
  Add a link to a target document
addNotify() : int
  Add a user/group to the notification list
applyDecorators() : object
  Apply decorators
changeAccess() : bool
  Change access right of document
cleanNotifyList() : mixed
  Make sure only users/groups with read access are in the notify list
clearAccessList() : bool
  Delete all entries for this document from the access control list
clearCache() : mixed
  Clear cache of this instance.
expires() : bool
  Check if document expires
getAccessList() : bool|array<string|int, mixed>
  Returns a list of access privileges
getAccessMode() : int
  Returns the greatest access privilege for a given user
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
getCategories() : bool|array<string|int, SeedDMS_Core_DocumentCategory>
  Retrieve a list of all categories this document belongs to
getComment() : string
  Return the comment of the document
getContent() : bool|array<string|int, SeedDMS_Core_DocumentContent>
  Return all content elements of a document
getContentByVersion() : SeedDMS_Core_DocumentContent|null|bool
  Return the content element of a document with a given version number
getDate() : int
  Return creation date of the document
getDefaultAccess() : bool|int
getDir() : string
  Return the directory of the document in the file system relativ to the contentDir
getDMS() : SeedDMS_Core_DMS
  Returns instance of dms
getDocumentFile() : object
  Get attached file by its id
getDocumentFiles() : array<string|int, mixed>
  Get list of files attached to document
getDocumentLink() : SeedDMS_Core_DocumentLink|bool
  Return a certain document link
getDocumentLinks() : array<string|int, mixed>
  Return all document links
getExpires() : int
  Get expiration time of document
getFolder() : SeedDMS_Core_Folder
  Return the parent folder of the document
getFolderList() : string
  Get the internally used folderList which stores the ids of folders from the root folder to the parent folder.
getGroupAccessMode() : int
  Returns the greatest access privilege for a given group
getID() : int
  Returns the internal id of the object
getInheritAccess() : bool
  This is supposed to be a replacement for inheritsAccess()
getInstance() : bool|SeedDMS_Core_Document
  Return an document by its id
getInstanceByData() : SeedDMS_Core_Folder|bool
  Return a folder by its database record
getKeywords() : string
getLatestContent() : bool|SeedDMS_Core_DocumentContent
  Get the latest version of document
getLockingUser() : SeedDMS_Core_User|bool
  Get the user currently locking the document
getName() : string
  Return the name of the document
getNotifyList() : array<string|int, mixed>|bool
  Returns a list of all notifications
getOwner() : SeedDMS_Core_User
  Return owner of document
getParent() : SeedDMS_Core_Folder
  Return the parent folder of the document
getReadAccessList() : array<string|int, mixed>
  Returns a list of groups and users with read access on the document
getReverseDocumentLinks() : array<string|int, mixed>
  Return all document having a link on this document
getSearchFields() : array<string|int, mixed>
  Return an array of database fields which are used for searching a term entered in the database search form
getSequence() : float
getTimeline() : array<string|int, mixed>
  Returns a list of events happend during the life of the document
getUsedDiskSpace() : int
  Calculate the disk space including all versions of the document
hasCategory() : bool
  Check if document has a given category
hasExpired() : bool
  Check if the document has expired
inheritsAccess() : bool
isDescendant() : bool
  Check, if this document is a child of a given folder
isLatestContent() : SeedDMS_Core_DocumentContent|bool
  Check if a given version is the latest version of the document
isLocked() : bool
  Check if document is locked
isType() : mixed
  Check if this object is of type 'document'.
remove() : bool
  Remove a document completly
removeAccess() : bool
  Remove access rights for a user or group
removeAttribute() : bool
  Remove an attribute of the object for the given attribute definition
removeCategories() : mixed
  Remove a list of categories from the document
removeContent() : bool|mixed
  Call callback onPreRemoveDocument before deleting content
removeDocumentFile() : mixed
removeDocumentLink() : mixed
removeNotify() : int
  Remove a user or group from the notification list
repair() : bool
  Checks the internal data of the document and repairs it.
replaceContent() : bool
  Replace a version of a document
setAttributeValue() : bool
  Set an attribute of the object for the given attribute definition
setCategories() : bool
  Set a list of categories for the document
setComment() : bool
  Set the comment of the document
setDate() : bool
  Set creation date of the document
setDefaultAccess() : bool
  Set default access mode
setDMS() : mixed
  Set dms this object belongs to.
setExpires() : bool
  Set expiration date as unix timestamp
setFolder() : bool
  Set folder of a document
setInheritAccess() : bool
  Set inherited access mode
setKeywords() : bool
setLocked() : bool
  Lock or unlock document
setName() : bool
  Set the name of the document
setOwner() : bool
  Set owner of a document
setParent() : bool
  Set folder of a document
setSequence() : bool
transferToUser() : bool
  Transfers the document to a new user
verifyLastestContentExpriry() : bool
  Check if the document has expired and set the status accordingly
__getApproversList() : mixed
  Get List of users and groups which have read access on the document.
__getLatestContent() : bool|null|SeedDMS_Core_DocumentContent
_removeContent() : bool
  Remove version of document

### Properties

#### $_dms

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

back reference to document management system

#### $_notifyList

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

list of notifications for users and groups

#### $_accessList

inc.ClassDocument.php : 229
`protected array<string|int, mixed> $_accessList`

of SeedDMS_Core_UserAccess and SeedDMS_Core_GroupAccess

#### $_attributes

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

list of attributes

#### $_categories

inc.ClassDocument.php : 206
`protected array<string|int, SeedDMS_Core_DocumentCategory> $_categories`

list of categories

#### $_comment

inc.ClassDocument.php : 136
`protected string $_comment`

comment of document

#### $_content

inc.ClassDocument.php : 221
`protected array<string|int, mixed> $_content`

temp. storage for content

#### $_date

inc.ClassDocument.php : 141
`protected int $_date`

unix timestamp of creation date

#### $_defaultAccess

inc.ClassDocument.php : 176
`protected int $_defaultAccess`

default access if access rights are not inherited

#### $_documentFiles

inc.ClassDocument.php : 239
`protected array<string|int, mixed> $_documentFiles`

#### $_documentLinks

inc.ClassDocument.php : 234
`protected array<string|int, mixed> $_documentLinks`

#### $_expires

inc.ClassDocument.php : 166
`protected int $_expires`

timestamp of expiration date

#### $_folder

inc.ClassDocument.php : 226
`protected SeedDMS_Core_Folder $_folder`

#### $_folderID

inc.ClassDocument.php : 156
`protected int $_folderID`

id of folder this document belongs to

#### $_id

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

unique id of object

#### $_inheritAccess

inc.ClassDocument.php : 171
`protected bool $_inheritAccess`

true if access is inherited, otherwise false

#### $_keywords

inc.ClassDocument.php : 201
`protected string $_keywords`

list of keywords

#### $_latestContent

inc.ClassDocument.php : 216
`protected SeedDMS_Core_DocumentContent $_latestContent`

temp. storage for latestcontent

#### $_locked

inc.ClassDocument.php : 191
`protected bool $_locked`

true if document is locked, otherwise false

#### $_lockingUser

inc.ClassDocument.php : 196
`protected object $_lockingUser`

user who has locked the document

#### $_name

inc.ClassDocument.php : 131
`protected string $_name`

name of document

#### $_owner

inc.ClassDocument.php : 151
`protected object $_owner`

user who is the owner

#### $_ownerID

inc.ClassDocument.php : 146
`protected int $_ownerID`

id of user who is the owner

#### $_parent

inc.ClassDocument.php : 161
`protected object $_parent`

parent folder this document belongs to

#### $_readAccessList

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

list of notifications for users and groups

#### $_sequence

inc.ClassDocument.php : 211
`protected int $_sequence`

position of document within the parent folder

### Methods

#### __construct()

inc.ClassDocument.php : 241

SeedDMS_Core_Object constructor.

`public __construct(mixed $id, mixed $name, mixed $comment, mixed $date, mixed $expires, mixed $ownerID, mixed $folderID, mixed $inheritAccess, mixed $defaultAccess, mixed $locked, mixed $keywords, mixed $sequence) : mixed`

##### Parameters

$id : mixed
$name : mixed
$comment : mixed
$date : mixed
$expires : mixed
$ownerID : mixed
$folderID : mixed
$inheritAccess : mixed
$defaultAccess : mixed
$locked : mixed
$keywords : mixed
$sequence : mixed

#### __toString()

inc.ClassDocument.php : 288

Cast to string

`public __toString() : string`

##### Return values

string

#### addAccess()

inc.ClassDocument.php : 1288

Add access right to document

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

This method may change in the future. Instead of passing a flag and a user/group id a user or group object will be expected. Starting with version 5.1.25 this method will first check if there is already an access right for the user/group.

##### 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 otherwise it will be considered a group id

##### Return values

bool —

true on success, otherwise false

#### addCategories()

inc.ClassDocument.php : 642

Add a list of categories to the document

`public addCategories(array<string|int, mixed> $newCategories) : mixed`

This method will add a list of new categories to the document.

##### Parameters

$newCategories : array<string|int, mixed>

  list of category objects

#### addContent()

inc.ClassDocument.php : 1826

Add content to a document

`public addContent(string $comment, object $user, string $tmpFile, string $orgFileName, string $fileType, string $mimeType[, array<string|int, mixed> $reviewers = array() ][, array<string|int, mixed> $approvers = array() ][, int $version = 0 ][, array<string|int, mixed> $attributes = array() ][, object $workflow = null ]) : bool|SeedDMS_Core_AddContentResultSet`

Each document may have any number of content elements attached to it. Each content element has a version number. Newer versions (greater version number) replace older versions.

##### Parameters

$comment : string

  comment

$user : object

  user who shall be the owner of this content

$tmpFile : string

  file containing the actuall content

$orgFileName : string

  original file name

$fileType : string
$mimeType : string

  MimeType of the content

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

  list of reviewers

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

  list of approvers

$version : int = 0

  version number of content or 0 if next higher version shall be used.

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

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

$workflow : object = null

##### Return values

bool|SeedDMS_Core_AddContentResultSet

#### addDocumentFile()

inc.ClassDocument.php : 2716

Add an attachment to the document

`public addDocumentFile(mixed $name, mixed $comment, mixed $user, mixed $tmpFile, mixed $orgFileName, mixed $fileType, mixed $mimeType[, mixed $version = 0 ][, mixed $public = 1 ]) : mixed`

##### Parameters

$name : mixed
$comment : mixed
$user : mixed
$tmpFile : mixed
$orgFileName : mixed
$fileType : mixed
$mimeType : mixed
$version : mixed = 0
$public : mixed = 1

#### addDocumentLink()

inc.ClassDocument.php : 2601

Add a link to a target document

`public addDocumentLink(int $targetID, int $userID, mixed $public) : SeedDMS_Core_DocumentLink|bool`

##### Parameters

$targetID : int

  Id of target document

$userID : int

  Id of user adding the link

$public : mixed

##### Return values

SeedDMS_Core_DocumentLink|bool

#### addNotify()

inc.ClassDocument.php : 1626

Add a user/group to the notification list

`public addNotify( $userOrGroupID, $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 :

  integer id of user or group to add

$isUser :

  integer 1 if $userOrGroupID is a user, 0 if $userOrGroupID is a group

##### Return values

int —

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

#### applyDecorators()

inc.ClassDocument.php : 383

Apply decorators

`public applyDecorators() : object`

##### Return values

object —

final object after all decorators has been applied

#### changeAccess()

inc.ClassDocument.php : 1331

Change access right of document

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

This method may change in the future. Instead of passing 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 otherwise it will be considered a group id

##### Return values

bool —

true on success, otherwise false

#### cleanNotifyList()

inc.ClassDocument.php : 1585

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

`public cleanNotifyList() : mixed`

#### clearAccessList()

inc.ClassDocument.php : 1205

Delete all entries for this document 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.ClassDocument.php : 272

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.

#### expires()

inc.ClassDocument.php : 1042

Check if document expires

`public expires() : bool`

##### Return values

bool —

true if document has expiration date set, otherwise false

#### getAccessList()

inc.ClassDocument.php : 1239

Returns a list of access privileges

`public getAccessList([int $mode = M_ANY ][, int|string $op = O_EQ ]) : bool|array<string|int, mixed>`

If the document inherits the access privileges from the parent folder those will be returned. $mode and $op can be set to restrict the list of returned access privileges. If $mode is set to M_ANY no restriction will apply regardless of the value of $op. The returned array contains a list of SeedDMS_Core_UserAccess and SeedDMS_Core_GroupAccess 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|string = O_EQ

  operation (defaults to O_EQ)

##### Return values

bool|array<string|int, mixed>

#### getAccessMode()

inc.ClassDocument.php : 1433

Returns the greatest access privilege for a given user

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

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 other users have access rights according to the access control lists or the default access. This method will recursive check for access rights of parent folders if access rights are inherited.

The function searches the access control list for entries of user $user. If it finds more than one entry it will return the one allowing the greatest privileges, but user rights will always precede group rights. If there is no entry in the access control list, it will return the default access mode. The function takes inherited access rights into account. For a list of possible access rights see @file inc.AccessUtils.php

Having access on a document does not necessarily mean the document content is accessible too. Accessing the content is checked by SeedDMS_Core_DocumentContent::getAccessMode() which calls a callback function defined by the application. If the callback function is not set, access on the content is always granted.

Before checking the access in the method itself a callback 'onCheckAccessDocument' 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.

##### Parameters

$user :

  object instance of class SeedDMS_Core_User

$context : string = ''

  context in which the access mode is requested

##### Return values

int —

access mode

#### 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

#### getCategories()

inc.ClassDocument.php : 563

Retrieve a list of all categories this document belongs to

`public getCategories() : bool|array<string|int, SeedDMS_Core_DocumentCategory>`

##### Return values

bool|array<string|int, SeedDMS_Core_DocumentCategory>

#### getComment()

inc.ClassDocument.php : 459

Return the comment of the document

`public getComment() : string`

##### Return values

string —

comment of document

#### getContent()

inc.ClassDocument.php : 2103

Return all content elements of a document

`public getContent() : bool|array<string|int, SeedDMS_Core_DocumentContent>`

This method returns an array of content elements ordered by version. Version which are not accessible because of its status, will be filtered out. Access rights based on the document status are calculated for the currently logged in user.

##### Return values

bool|array<string|int, SeedDMS_Core_DocumentContent>

#### getContentByVersion()

inc.ClassDocument.php : 2146

Return the content element of a document with a given version number

`public getContentByVersion(int $version) : SeedDMS_Core_DocumentContent|null|bool`

This method will check if the version is accessible and return false if not. Access rights based on the document status are calculated for the currently logged in user.

##### Parameters

$version : int

  version number of content element

##### Return values

SeedDMS_Core_DocumentContent|null|bool —

object of class SeedDMS_Core_DocumentContent, null if not content was found, false in case of an error

#### getDate()

inc.ClassDocument.php : 738

Return creation date of the document

`public getDate() : int`

##### Return values

int —

unix timestamp of creation date

#### getDefaultAccess()

inc.ClassDocument.php : 948
`public getDefaultAccess() : bool|int`

##### Return values

bool|int

#### getDir()

inc.ClassDocument.php : 401

Return the directory of the document in the file system relativ to the contentDir

`public getDir() : string`

##### Return values

string —

directory of document

#### getDMS()

inc.ClassObject.php : 80

Returns instance of dms

`public getDMS() : SeedDMS_Core_DMS`

##### Return values

SeedDMS_Core_DMS

#### getDocumentFile()

inc.ClassDocument.php : 2650

Get attached file by its id

`public getDocumentFile(mixed $ID) : object`

##### Parameters

$ID : mixed

##### Return values

object —

instance of SeedDMS_Core_DocumentFile, null if file is not accessible, false in case of an sql error

#### getDocumentFiles()

inc.ClassDocument.php : 2676

Get list of files attached to document

`public getDocumentFiles([int $version = 0 ][, bool $incnoversion = true ]) : array<string|int, mixed>`

##### Parameters

$version : int = 0

  get only attachments for this version

$incnoversion : bool = true

  include attachments without a version

##### Return values

array<string|int, mixed> —

list of files, false in case of an sql error

#### getDocumentLink()

inc.ClassDocument.php : 2466

Return a certain document link

`public getDocumentLink(int $linkID) : SeedDMS_Core_DocumentLink|bool`

##### Parameters

$linkID : int

  id of link

##### Return values

SeedDMS_Core_DocumentLink|bool —

of SeedDMS_Core_DocumentLink or false in case of an error.

#### getDocumentLinks()

inc.ClassDocument.php : 2513

Return all document links

`public getDocumentLinks([bool $publiconly = false ][, SeedDMS_Core_User $user = null ]) : array<string|int, mixed>`

The list may contain all links to other documents, even those which may not be visible by certain users, unless you pass appropriate parameters to filter out public links and those created by the given user. The two parameters are or'ed. If $publiconly is set the method will return all public links disregarding the user. If $publiconly is not set but a user is set, the method will return all links of that user (public and none public). Setting a user and $publiconly to true will not return the public links of that user but all links which are public or owned by that user.

The application must call SeedDMS_Core_DMS::filterDocumentLinks() afterwards to filter out those links pointing to a document not accessible by a given user.

##### Parameters

$publiconly : bool = false

  return all publically visible links

$user : SeedDMS_Core_User = null

  return also private links of this user

##### Return values

array<string|int, mixed> —

list of objects of class SeedDMS_Core_DocumentLink

#### getExpires()

inc.ClassDocument.php : 1054

Get expiration time of document

`public getExpires() : int`

##### Return values

int —

expiration date as unix timestamp or false

#### getFolder()

inc.ClassDocument.php : 800

Return the parent folder of the document

`public getFolder() : SeedDMS_Core_Folder`

##### Return values

SeedDMS_Core_Folder —

parent folder

#### getFolderList()

inc.ClassDocument.php : 3058

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

#### getGroupAccessMode()

inc.ClassDocument.php : 1517

Returns the greatest access privilege for a given group

`public getGroupAccessMode(SeedDMS_Core_Group $group) : int`

This method searches the access control list for entries of group $group. If it finds more than one entry it will return the one allowing the greatest privileges. If there is no entry in the access control list, it will return the default access mode. The function takes inherited access rights into account. For a list of possible access rights see @file inc.AccessUtils.php

##### Parameters

$group : SeedDMS_Core_Group

  object instance of class SeedDMS_Core_Group

##### 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

#### getInheritAccess()

inc.ClassDocument.php : 1004

This is supposed to be a replacement for inheritsAccess()

`public getInheritAccess() : bool`

##### Return values

bool

#### getInstance()

inc.ClassDocument.php : 359

Return an document by its id

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

##### Parameters

$id : int

  id of document

$dms : SeedDMS_Core_DMS

##### Return values

bool|SeedDMS_Core_Document —

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

#### getInstanceByData()

inc.ClassDocument.php : 342

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

#### getKeywords()

inc.ClassDocument.php : 501
`public getKeywords() : string`

##### Return values

string

#### getLatestContent()

inc.ClassDocument.php : 2224

Get the latest version of document

`public getLatestContent() : bool|SeedDMS_Core_DocumentContent`

This method returns the latest accessible version of a document. If content access has been restricted by setting SeedDMS_Core_DMS::noReadForStatus the function will go backwards in history until an accessible version is found. If none is found null will be returned. Access rights based on the document status are calculated for the currently logged in user.

##### Return values

bool|SeedDMS_Core_DocumentContent —

object of class SeedDMS_Core_DocumentContent

#### getLockingUser()

inc.ClassDocument.php : 1170

Get the user currently locking the document

`public getLockingUser() : SeedDMS_Core_User|bool`

##### Return values

SeedDMS_Core_User|bool —

user have a lock

#### getName()

inc.ClassDocument.php : 415

Return the name of the document

`public getName() : string`

##### Return values

string —

name of document

#### getNotifyList()

inc.ClassDocument.php : 1555

Returns a list of all notifications

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

The returned list has two elements called 'users' and 'groups'. Each one is an array itself countaining objects of class SeedDMS_Core_User and SeedDMS_Core_Group.

##### 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, mixed>|bool

#### getOwner()

inc.ClassDocument.php : 893

Return owner of document

`public getOwner() : SeedDMS_Core_User`

##### Return values

SeedDMS_Core_User —

owner of document as an instance of SeedDMS_Core_User

#### getParent()

inc.ClassDocument.php : 791

Return the parent folder of the document

`public getParent() : SeedDMS_Core_Folder`

##### Tags

see
  SeedDMS_Core_Document::getFolder()

##### Return values

SeedDMS_Core_Folder —

parent folder

#### getReadAccessList()

inc.ClassDocument.php : 2940

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

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

##### 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

#### getReverseDocumentLinks()

inc.ClassDocument.php : 2565

Return all document having a link on this document

`public getReverseDocumentLinks([bool $publiconly = false ][, SeedDMS_Core_User $user = null ]) : array<string|int, mixed>`

The list contains all documents which have a link to the current document. The list contains even those documents which may not be accessible by the user, unless you pass appropriate parameters to filter out public links and those created by the given user. This method is basically the reverse of SeedDMS_Core_Document::getDocumentLinks()

The application must call SeedDMS_Core_DMS::filterDocumentLinks() afterwards to filter out those links pointing to a document not accessible by a given user.

##### Parameters

$publiconly : bool = false

  return all publically visible links

$user : SeedDMS_Core_User = null

  return also private links of this user

##### Return values

array<string|int, mixed> —

list of objects of class SeedDMS_Core_DocumentLink

#### getSearchFields()

inc.ClassDocument.php : 310

Return an array of database fields which are 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

#### getSequence()

inc.ClassDocument.php : 1182
`public getSequence() : float`

##### Return values

float

#### getTimeline()

inc.ClassDocument.php : 3125

Returns a list of events happend during the life of the document

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

This includes the creation of new versions, approval and reviews, etc.

##### Return values

array<string|int, mixed> —

list of events

#### getUsedDiskSpace()

inc.ClassDocument.php : 3107

Calculate the disk space including all versions of the document

`public getUsedDiskSpace() : int`

This is done by using the internal database field storing the filesize of a document version.

##### Return values

int —

total disk space in Bytes

#### hasCategory()

inc.ClassDocument.php : 544

Check if document has a given category

`public hasCategory(SeedDMS_Core_DocumentCategory $cat) : bool`

##### Parameters

$cat : SeedDMS_Core_DocumentCategory

##### Return values

bool —

true if document has category, otherwise false

#### hasExpired()

inc.ClassDocument.php : 1095

Check if the document has expired

`public hasExpired() : bool`

The method expects to database field 'expired' to hold the timestamp of the start of day at which end the document expires. The document will expire if that day is over. Hence, a document will not be expired during the day of expiration but at the end of that day

##### Return values

bool —

true if document has expired otherwise false

#### inheritsAccess()

inc.ClassDocument.php : 997
`public inheritsAccess() : bool`

##### Return values

bool

#### isDescendant()

inc.ClassDocument.php : 772

Check, if this document is a child of a given folder

`public isDescendant(object $folder) : bool`

##### Parameters

$folder : object

  parent folder

##### Return values

bool —

true if document is a direct child of the given folder

#### isLatestContent()

inc.ClassDocument.php : 2187

Check if a given version is the latest version of the document

`public isLatestContent(int $version) : SeedDMS_Core_DocumentContent|bool`

##### Parameters

$version : int

  version number of content element

##### Return values

SeedDMS_Core_DocumentContent|bool —

object of class SeedDMS_Core_DocumentContent or false

#### isLocked()

inc.ClassDocument.php : 1135

Check if document is locked

`public isLocked() : bool`

##### Return values

bool —

true if locked otherwise false

#### isType()

inc.ClassDocument.php : 297

Check if this object is of type 'document'.

`public isType(string $type) : mixed`

##### Parameters

$type : string

  type of object

#### remove()

inc.ClassDocument.php : 2809

Remove a document completly

`public remove() : bool`

This methods calls the callback 'onPreRemoveDocument' before removing the document. The current document will be passed as the second parameter to the callback function. After successful deletion the 'onPostRemoveDocument' callback will be used. The current document id will be passed as the second parameter. If onPreRemoveDocument fails the whole function will fail and the document will not be deleted. The return value of 'onPostRemoveDocument' will be disregarded.

##### Return values

bool —

true on success, otherwise false

#### removeAccess()

inc.ClassDocument.php : 1368

Remove access rights for a user or group

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

##### Parameters

$userOrGroupID : int

  ID of user or group

$isUser : bool

  true if $userOrGroupID is a user id, false if it is a group id.

##### Return values

bool —

true on success, otherwise false

#### 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

#### removeCategories()

inc.ClassDocument.php : 697

Remove a list of categories from the document

`public removeCategories(mixed $categories) : mixed`

This method will remove a list of assigned categories to the document.

##### Parameters

$categories : mixed

#### removeContent()

inc.ClassDocument.php : 2408

Call callback onPreRemoveDocument before deleting content

`public removeContent(SeedDMS_Core_DocumentContent $version) : bool|mixed`

##### Parameters

$version : SeedDMS_Core_DocumentContent

  version number of content

##### Return values

bool|mixed

#### removeDocumentFile()

inc.ClassDocument.php : 2757
`public removeDocumentFile(mixed $ID) : mixed`

##### Parameters

$ID : mixed

#### removeDocumentLink()

inc.ClassDocument.php : 2632
`public removeDocumentLink(mixed $linkID) : mixed`

##### Parameters

$linkID : mixed

#### removeNotify()

inc.ClassDocument.php : 1744

Remove a user or group from the notification list

`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

  id of user or group

$isUser : bool

  boolean true if a user is passed in $userOrGroupID, false if a group is passed in $userOrGroupID

$type : int = 0

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

##### Return values

int —

0 if operation was succesful -1 if the userid/groupid is invalid -3 if the user/group is already subscribed -4 in case of an internal database error

#### repair()

inc.ClassDocument.php : 3075

Checks the internal data of the document and repairs it.

`public repair() : bool`

Currently, this function only repairs an incorrect folderList

##### Return values

bool —

true on success, otherwise false

#### replaceContent()

inc.ClassDocument.php : 2009

Replace a version of a document

`public replaceContent(int $version, object $user, string $tmpFile, string $orgFileName, string $fileType, string $mimeType[, mixed $allowoverride = [] ]) : bool`

Each document may have any number of content elements attached to it. This method replaces the file content of a given version. Using this function is highly discourage, because it undermines the idea of keeping all versions of a document as originally saved. Content will only be replaced if the mimetype, filetype, user and original filename are identical to the version being updated.

This method was introduced for the webdav server because any saving of a document created a new version.

##### Parameters

$version : int

  version number of content or 0 if latest version shall be replaced.

$user : object

  user who shall be the owner of this content

$tmpFile : string

  file containing the actuall content

$orgFileName : string

  original file name

$fileType : string
$mimeType : string

  MimeType of the content

$allowoverride : mixed = []

##### Return values

bool —

false in case of an error or a result set

#### 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

#### setCategories()

inc.ClassDocument.php : 591

Set a list of categories for the document

`public setCategories(array<string|int, SeedDMS_Core_DocumentCategory> $newCategories) : bool`

This method will delete currently assigned categories and sets new categories.

##### Parameters

$newCategories : array<string|int, SeedDMS_Core_DocumentCategory>

  list of category objects

##### Return values

bool

#### setComment()

inc.ClassDocument.php : 467

Set the comment of the document

`public setComment( $newComment) : bool`

##### Parameters

$newComment :

  string new comment of document

##### Return values

bool

#### setDate()

inc.ClassDocument.php : 749

Set creation date of the document

`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.ClassDocument.php : 971

Set default access mode

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

This method sets the default access mode and also removes all notifiers which will not have read access anymore. Setting a default access mode will only have an immediate effect if the access rights are not inherited, otherwise it just updates the database record of the document and once the inheritance is turn off the default access mode will take effect.

##### Parameters

$mode : int

  access mode

$noclean : bool|string = 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

#### setExpires()

inc.ClassDocument.php : 1067

Set expiration date as unix timestamp

`public setExpires(int $expires) : bool`

##### Parameters

$expires : int

  unix timestamp of expiration date

##### Return values

bool

#### setFolder()

inc.ClassDocument.php : 828

Set folder of a document

`public setFolder(SeedDMS_Core_Folder $newFolder) : bool`

This method basically moves a document from a folder to another folder.

##### Parameters

$newFolder : SeedDMS_Core_Folder

##### Return values

bool —

false in case of an error, otherwise true

#### setInheritAccess()

inc.ClassDocument.php : 1021

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

#### setKeywords()

inc.ClassDocument.php : 507
`public setKeywords(string $newKeywords) : bool`

##### Parameters

$newKeywords : string

##### Return values

bool

#### setLocked()

inc.ClassDocument.php : 1143

Lock or unlock document

`public setLocked(SeedDMS_Core_User|bool $falseOrUser) : bool`

##### Parameters

$falseOrUser : SeedDMS_Core_User|bool

  user object for locking or false for unlocking

##### Return values

bool —

true if operation was successful otherwise false

#### setName()

inc.ClassDocument.php : 423

Set the name of the document

`public setName( $newName) : bool`

##### Parameters

$newName :

  string new name of document

##### Return values

bool

#### setOwner()

inc.ClassDocument.php : 905

Set owner of a document

`public setOwner(SeedDMS_Core_User $newOwner) : bool`

##### Parameters

$newOwner : SeedDMS_Core_User

  new owner

##### Return values

bool —

true if successful otherwise false

#### setParent()

inc.ClassDocument.php : 815

Set folder of a document

`public setParent(SeedDMS_Core_Folder $newFolder) : bool`

This method basically moves a document from a folder to another folder.

##### Parameters

$newFolder : SeedDMS_Core_Folder

##### Return values

bool —

false in case of an error, otherwise true

#### setSequence()

inc.ClassDocument.php : 1188
`public setSequence(float $seq) : bool`

##### Parameters

$seq : float

##### Return values

bool

#### transferToUser()

inc.ClassDocument.php : 3186

Transfers the document to a new user

`public transferToUser(mixed $newuser) : bool`

This method not just sets a new owner of the document but also transfers the document links, attachments and locks to the new user.

##### Parameters

$newuser : mixed

##### Return values

bool —

true if successful, otherwise false

#### verifyLastestContentExpriry()

inc.ClassDocument.php : 1114

Check if the document has expired and set the status accordingly

`public verifyLastestContentExpriry() : bool`

It will also recalculate the status if the current status is set to S_EXPIRED but the document isn't actually expired. The method will update the document status log database table if needed. FIXME: some left over reviewers/approvers are in the way if no workflow is set and traditional workflow mode is on. In that case the status is set to S_DRAFT_REV or S_DRAFT_APP

##### Return values

bool —

true if status has changed

#### __getApproversList()

inc.ClassDocument.php : 2927

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

`protected __getApproversList() : mixed`

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

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

#### __getLatestContent()

inc.ClassDocument.php : 2194
`private __getLatestContent() : bool|null|SeedDMS_Core_DocumentContent`

##### Return values

bool|null|SeedDMS_Core_DocumentContent

#### _removeContent()

inc.ClassDocument.php : 2261

Remove version of document

`private _removeContent(SeedDMS_Core_DocumentContent $version) : bool`

##### Parameters

$version : SeedDMS_Core_DocumentContent

  version number of content

##### Return values

bool —

true if successful, otherwise false

## Search results