Properties

$_dms

$_dms : object

Type

object — back reference to document management system

$_notifyList

$_notifyList : array

Type

array — list of notifications for users and groups

$_id

$_id : integer

Type

integer — unique id of object

$_attributes

$_attributes : array

Type

array — list of attributes

$_name

$_name : string

Type

string — name of folder

$_parentID

$_parentID : integer

Type

integer — id of parent folder

$_comment

$_comment : string

Type

string — comment of document

$_ownerID

$_ownerID : integer

Type

integer — id of user who is the owner

$_inheritAccess

$_inheritAccess : boolean

Type

boolean — true if access is inherited, otherwise false

$_defaultAccess

$_defaultAccess : integer

Type

integer — default access if access rights are not inherited

$_readAccessList

$_readAccessList : array

Type

array — list of notifications for users and groups

$_sequence

$_sequence : integer

Type

integer — position of folder within the parent folder

Methods

SeedDMS_Core_Object()

SeedDMS_Core_Object( $id)

Parameters

$id

setDMS()

setDMS( $dms)

Parameters

$dms

getID()

getID()

getAttributes()

getAttributes() : array

Returns all attributes set for the object

Returns

array —

list of objects of class SeedDMS_Core_Attribute

getAttributeValue()

getAttributeValue( $attrdef) : array|string

Returns an attribute of the object for the given attribute definition

Parameters

$attrdef

Returns

array|string —

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

setAttributeValue()

setAttributeValue(object $attrdef, array|\sting $value) : boolean

Set an attribute of the object for the given attribute definition

Parameters

object $attrdef

definition of attribute

array|\sting $value

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

Returns

boolean —

true if operation was successful, otherwise false

removeAttribute()

removeAttribute( $attrdef) : boolean

Remove an attribute of the object for the given attribute definition

Parameters

$attrdef

Returns

boolean —

true if operation was successful, otherwise false

SeedDMS_Core_Folder()

SeedDMS_Core_Folder( $id,  $name,  $parentID,  $comment,  $date,  $ownerID,  $inheritAccess,  $defaultAccess,  $sequence)

Parameters

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

getName()

getName()

setName()

setName( $newName)

Parameters

$newName

getComment()

getComment()

setComment()

setComment( $newComment)

Parameters

$newComment

getDate()

getDate() : integer

Return creation date of folder

Returns

integer —

unix timestamp of creation date

getParent()

getParent() : object

Returns the parent

Returns

object —

parent folder or false if there is no parent folder

isSubFolder()

isSubFolder( $subfolder) : boolean

Check if the folder is subfolder

This function checks if the passed folder is a subfolder of the current folder.

Parameters

$subfolder

Returns

boolean —

true if passes folder is a subfolder

setParent()

setParent(object $newParent) : boolean

Set a new folder

This function moves a folder from one parent folder into another parent folder. It will fail if the root folder is moved.

Parameters

object $newParent

new parent folder

Returns

boolean —

true if operation was successful otherwise false

getOwner()

getOwner() : object

Returns the owner

Returns

object —

owner of the folder

setOwner()

setOwner( $newOwner) : boolean

Set the owner

Parameters

$newOwner

Returns

boolean —

true if successful otherwise false

getDefaultAccess()

getDefaultAccess()

setDefaultAccess()

setDefaultAccess( $mode)

Parameters

$mode

inheritsAccess()

inheritsAccess()

setInheritAccess()

setInheritAccess( $inheritAccess)

Parameters

$inheritAccess

getSequence()

getSequence()

setSequence()

setSequence( $seq)

Parameters

$seq

hasSubFolders()

hasSubFolders() : int

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

Returns

int —

number of subfolders or false in case of an error

getSubFolders()

getSubFolders(string $orderby) : array

Returns a list of subfolders This function does not check for access rights. Use {@link SeedDMS_Core_DMS::filterAccess} for checking each folder against the currently logged in user and the access rights.

Parameters

string $orderby

if set to 'n' the list is ordered by name, otherwise

   it will be ordered by sequence

Returns

array —

list of folder objects or false in case of an error

addSubFolder()

addSubFolder(string $name, string $comment, object $owner, integer $sequence, array $attributes) : object

Add a new subfolder

Parameters

string $name

name of folder

string $comment

comment of folder

object $owner

owner of folder

integer $sequence

position of folder in list of sub folders.

array $attributes

list of document attributes. The element key

   must be the id of the attribute definition.

Returns

object —

object of type SeedDMS_Core_Folder or false in case of

    an error.

getPath()

getPath() : array

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

The folder itself is the last element of the array.

Returns

array —

Array of parents

getFolderPathPlain()

getFolderPathPlain() : string

Returns a unix file system path

Returns

string —

path separated with '/'

isDescendant()

isDescendant(object $folder) : boolean

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

Parameters

object $folder

parent folder

Returns

boolean —

true if folder is a subfolder

hasDocuments()

hasDocuments() : int

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

Returns

int —

number of documents or false in case of an error

hasDocumentByName()

hasDocumentByName( $name) : boolean

Check if folder has document with given name

Parameters

$name

Returns

boolean —

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

getDocuments()

getDocuments(string $orderby) : array

Get all documents of the folder This function does not check for access rights. Use {@link SeedDMS_Core_DMS::filterAccess} for checking each document against the currently logged in user and the access rights.

Parameters

string $orderby

if set to 'n' the list is ordered by name, otherwise

   it will be ordered by sequence

Returns

array —

list of documents or false in case of an error

countChildren()

countChildren( $user, integer $limit) : array

Count all documents and subfolders of the folder

This function also counts documents and folders of subfolders, so basically it works like recursively counting children.

This function checks for access rights up the given limit. If more documents or folders are found, the returned value will be the number of objects available and the precise flag in the return array will be set to false. This number should not be revelead to the user, because it allows to gain information about the existens of objects without access right. Setting the parameter $limit to 0 will turn off access right checking which is reasonable if the $user is an administrator.

Parameters

$user
integer $limit

maximum number of folders and documents that will

   be precisly counted by taken the access rights into account

Returns

array —

array with four elements 'document_count', 'folder_count'

   'document_precise', 'folder_precise' holding
   the counted number and a flag if the number is precise.

addDocument()

addDocument(string $name, string $comment, integer $expires, object $owner, string $keywords, array $categories, string $tmpFile, string $orgFileName, string $fileType, string $mimeType, float $sequence, array $reviewers, array $approvers, string $reqversion, string $version_comment, array $attributes, array $version_attributes,  $workflow) : \array/boolean

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

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

string $name

name of new document

string $comment

comment of new document

integer $expires

expiration date as a unix timestamp or 0 for no

   expiration date
object $owner

owner of the new document

string $keywords

keywords of new document

array $categories

list of category ids

string $tmpFile

the path of the file containing the content

string $orgFileName

the original file name

string $fileType

usually the extension of the filename

string $mimeType

mime type of the content

float $sequence

position of new document within the folder

array $reviewers

list of users who must review this document

array $approvers

list of users who must approve this document

string $reqversion

version number of the content

string $version_comment

comment of the content. If left empty

   the $comment will be used.
array $attributes

list of document attributes. The element key

   must be the id of the attribute definition.
array $version_attributes

list of document version attributes.

   The element key must be the id of the attribute definition.
$workflow

Returns

\array/boolean —

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.

remove()

remove()

getAccessList()

getAccessList(integer $mode, integer $op) : array

Returns a list of access privileges

If the folder 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 {@link SeedDMS_Core_UserAccess} and {@link 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

integer $mode

access mode (defaults to M_ANY)

integer $op

operation (defaults to O_EQ)

Returns

array —

multi dimensional array

clearAccessList()

clearAccessList() : boolean

Delete all entries for this folder from the access control list

Returns

boolean —

true if operation was successful otherwise false

addAccess()

addAccess(integer $mode, integer $userOrGroupID, integer $isUser)

Add access right to folder This function 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

integer $mode

access mode

integer $userOrGroupID

id of user or group

integer $isUser

set to 1 if $userOrGroupID is the id of a

   user

changeAccess()

changeAccess(integer $newMode, integer $userOrGroupID, integer $isUser)

Change access right of folder This function 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

integer $newMode

access mode

integer $userOrGroupID

id of user or group

integer $isUser

set to 1 if $userOrGroupID is the id of a

   user

removeAccess()

removeAccess( $userOrGroupID,  $isUser)

Parameters

$userOrGroupID
$isUser

getAccessMode()

getAccessMode(object $user) : integer

Get the access mode of a user on the folder

This function 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 function will recursive check for access rights of parent folders if access rights are inherited.

This function 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 function will recursive check for access rights of parent folders if access rights are inherited.

Parameters

object $user

user for which access shall be checked

Returns

integer —

access mode

getGroupAccessMode()

getGroupAccessMode(object $group) : integer

Get the access mode for a group on the folder This function returns the access mode for a given group. The algorithmn applied to get the access mode is the same as describe at {@link getAccessMode}

Parameters

object $group

group for which access shall be checked

Returns

integer —

access mode

getNotifyList()

getNotifyList(integer $type) : array

Get a list of all notification This function returns all users and groups that have registerd a notification for the folder

Parameters

integer $type

type of notification (not yet used)

Returns

array —

array with a the elements 'users' and 'groups' which

   contain a list of users and groups.

addNotify()

addNotify( $userOrGroupID,  $isUser)

Parameters

$userOrGroupID
$isUser

removeNotify()

removeNotify( $userOrGroupID,  $isUser,  $type)

Parameters

$userOrGroupID
$isUser
$type

getApproversList()

getApproversList()

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

This function is deprecated. Use {@see SeedDMS_Core_Folder::getReadAccessList()} instead.

getReadAccessList()

getReadAccessList(boolean $listadmin, boolean $listowner) : array

Returns a list of groups and users with read access on the folder The list will not include any guest users, administrators and the owner of the folder unless $listadmin resp.

$listowner is set to true.

Parameters

boolean $listadmin

if set to true any admin will be listed too

boolean $listowner

if set to true the owner will be listed too

Returns

array —

list of users and groups

getFolderList()

getFolderList() : string

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

Returns

string —

column separated list of folder ids

repair()

repair() : boolean

Checks the internal data of the folder and repairs it.

Currently, this function only repairs an incorrect folderList

Returns

boolean —

true on success, otherwise false