Documentation

SeedDMS_Core_DMS
in package

Class to represent the complete document management system.

This class is needed to do most of the dms operations. It needs an instance of SeedDMS_Core_DatabaseAccess to access the underlying database. Many methods are factory functions which create objects representing the entities in the dms, like folders, documents, users, or groups.

Each dms has its own database for meta data and a data store for document content. Both must be specified when creating a new instance of this class. All folders and documents are organized in a hierachy like a regular file system starting with a SeedDMS_Core_DMS::rootFolderID

This class does not enforce any access rights on documents and folders by design. It is up to the calling application to use the methods SeedDMS_Core_Folder::getAccessMode() and SeedDMS_Core_Document::getAccessMode() and interpret them as desired. Though, there are two convenient functions to filter a list of documents/folders for which users have access rights for. See SeedDMS_Core_DMS::filterAccess() and SeedDMS_Core_DMS::filterUsersByAccess()

Though, this class has a method to set the currently logged in user (SeedDMS_Core_DMS::setUser()), it does not have to be called, because there is currently no class within the SeedDMS core which needs the logged in user. SeedDMS_Core_DMS itself does not do any user authentication. It is up to the application using this class.

<?php
include("inc/inc.ClassDMS.php");
$db = new SeedDMS_Core_DatabaseAccess($type, $hostname, $user, $passwd, $name);
$db->connect() or die ("Could not connect to db-server");
$dms = new SeedDMS_Core_DMS($db, $contentDir);
$dms->setRootFolderID(1);
...
?>
Tags
category

DMS

author

Uwe Steinmann uwe@steinmann.cx

copyright

Copyright (C) 2010-2024 Uwe Steinmann

Table of Contents

Properties

$callbacks  : array<string|int, mixed>
$checkWithinRootDir  : bool
$contentDir  : string
$forceLink  : bool
$forceRename  : bool
$lasterror  : string
$maxDirID  : int
$noReadForStatus  : array<string|int, mixed>
$rootFolderID  : int
$usecache  : bool
$version  : string
$cache  : array<string|int, mixed>
$classnames  : array<string|int, mixed>
$db  : SeedDMS_Core_DatabaseAccess
$decorators  : array<string|int, mixed>
$user  : SeedDMS_Core_User

Methods

__construct()  : mixed
Create a new instance of the dms
addAttributeDefinition()  : bool|SeedDMS_Core_User
Add a new attribute definition
addCallback()  : bool
Add a callback function
addDecorator()  : bool
Add a decorator
addDocumentCategory()  : SeedDMS_Core_DocumentCategory|bool
Add a new document category
addGroup()  : SeedDMS_Core_Group|bool
Create a new user group
addKeywordCategory()  : mixed
addRole()  : object
Create a new role
addTransmittal()  : object
Create a new transmittal
addUser()  : bool|SeedDMS_Core_User
Add a new user
addWorkflow()  : bool|SeedDMS_Core_Workflow
Add a new workflow
addWorkflowAction()  : SeedDMS_Core_Workflow_Action|bool
Add new workflow action
addWorkflowState()  : bool|SeedDMS_Core_Workflow_State
Add new workflow state
checkDate()  : bool
Checks if date conforms to a given format
checkDocuments()  : array<string|int, mixed>|bool
Returns a list of documents and error message not linked in the tree
checkFolders()  : array<string|int, mixed>|bool
Returns a list of folders and error message not linked in the tree
checkIfEqual()  : bool
Checks if two objects are equal by comparing their IDs
checkPasswordRequest()  : bool|SeedDMS_Core_User
Check if hash for a password request is valid.
checkVersion()  : bool
Check if the version in the database is the same as of this package Only the major and minor version number will be checked.
countTasks()  : array<string|int, mixed>
Returns all documents with a predefined search criteria
createPasswordRequest()  : string|bool
Create a token to request a new password.
deletePasswordRequest()  : bool
Delete a password request
filterAccess()  : array<string|int, mixed>
Filter out objects which are not accessible in a given mode by a user.
filterDocumentFiles()  : mixed
filterDocumentLinks()  : array<string|int, mixed>
Filter out document links which can not be accessed by a given user
filterUsersByAccess()  : array<string|int, mixed>
Filter out users which cannot access an object in a given mode.
getAllAttributeDefinitions()  : bool|array<string|int, SeedDMS_Core_AttributeDefinition>
Return list of all attribute definitions
getAllGroups()  : array<string|int, SeedDMS_Core_Group>
Get a list of all groups
getAllKeywordCategories()  : mixed
getAllRoles()  : array<string|int, mixed>
Return list of all roles
getAllTransmittals()  : array<string|int, mixed>
Return list of all transmittals
getAllUserKeywordCategories()  : array<string|int, SeedDMS_Core_KeywordCategory>|bool
This method should be replaced by getAllKeywordCategories()
getAllUsers()  : array<string|int, mixed>
Return list of all users
getAllWorkflowActions()  : array<string|int, SeedDMS_Core_Workflow_Action>|bool
Return list of workflow action
getAllWorkflows()  : array<string|int, SeedDMS_Core_Workflow>|bool
Return list of all workflows
getAllWorkflowStates()  : array<string|int, SeedDMS_Core_Workflow_State>|bool
Return list of all workflow states
getAttributeDefinition()  : bool|SeedDMS_Core_AttributeDefinition
Return a attribute definition by its id
getAttributeDefinitionByName()  : SeedDMS_Core_AttributeDefinition|bool
Return a attribute definition by its name
getClassname()  : string
Return class name of classes instanciated by SeedDMS_Core
getDB()  : SeedDMS_Core_DatabaseAccess
Return database where meta data is stored
getDBVersion()  : array<string|int, mixed>|bool
Return the database version
getDecorators()  : array<string|int, mixed>
Return list of decorators
getDocument()  : SeedDMS_Core_Document
Return a document by its id
getDocumentByName()  : SeedDMS_Core_Document|null|bool
Returns a document by its name
getDocumentByOriginalFilename()  : SeedDMS_Core_Document|null|bool
Returns a document by the original file name of the last version
getDocumentCategories()  : mixed
getDocumentCategory()  : mixed
getDocumentCategoryByName()  : SeedDMS_Core_DocumentCategory|bool
Get a category by its name
getDocumentContent()  : bool|null|SeedDMS_Core_DocumentContent
Return a document content by its id
getDocumentList()  : array<string|int, mixed>|bool
Returns all documents with a predefined search criteria
getDocumentsByUser()  : array<string|int, mixed>
Returns all documents of a given user
getDocumentsExpired()  : bool|array<string|int, SeedDMS_Core_Document>
Returns all documents which already expired or will expire in the future
getDocumentsInReception()  : array<string|int, mixed>
Return all waiting receptions
getDocumentsInRevision()  : array<string|int, mixed>
Return all documents revisors waiting for a revision to start (sleeping) or are required to revise the document (waiting)
getDocumentsLockedByUser()  : array<string|int, mixed>
Returns all documents locked by a given user
getDuplicateDocumentContent()  : array<string|int, mixed>|bool
Returns document content which is duplicated
getDuplicateSequenceNo()  : array<string|int, mixed>|bool
Returns folders which contain documents with none unique sequence number
getFolder()  : SeedDMS_Core_Folder
Return a folder by its id
getFolderByName()  : SeedDMS_Core_Folder|bool
Return a folder by its name
getGroup()  : SeedDMS_Core_Group|bool
Get a group by its id
getGroupByName()  : SeedDMS_Core_Group|bool
Get a group by its name
getKeywordCategory()  : mixed
getKeywordCategoryByName()  : mixed
getLoggedInUser()  : SeedDMS_Core_User
Get the logged in user
getNoChecksumDocumentContent()  : bool|array<string|int, SeedDMS_Core_Document>
Returns document content which has no checksum set
getNoFileSizeDocumentContent()  : array<string|int, SeedDMS_Core_Document>|bool
Returns document content which has no file size set
getNotificationsByGroup()  : array<string|int, mixed>
Get all notifications for a group
getNotificationsByUser()  : array<string|int, mixed>
Get all notifications for a user
getProcessWithoutUserGroup()  : array<string|int, mixed>
Returns a list of reviews, approvals, receipts, revisions which are not linked to a user, group anymore
getRole()  : object
Get a role by its id
getRoleByName()  : object
Get a role by its name
getRootFolder()  : SeedDMS_Core_Folder|bool
Get root folder
getStatisticalData()  : array<string|int, mixed>|bool
Returns statitical information
getTransmittal()  : object
Get a transmittal by its id
getTransmittalByName()  : object
Get a transmittal by its name
getUnlinkedDocumentContent()  : array<string|int, mixed>|bool
Returns document content which is not linked to a document
getUser()  : SeedDMS_Core_User|bool
Return a user by its id
getUserByEmail()  : object
Return a user by its email
getUserByLogin()  : object
Return a user by its login
getWorkflow()  : SeedDMS_Core_Workflow|bool
Return workflow by its Id
getWorkflowAction()  : SeedDMS_Core_Workflow_Action|bool
Return a workflow action by its id
getWorkflowActionByName()  : SeedDMS_Core_Workflow_Action|bool
Return a workflow action by its name
getWorkflowByName()  : SeedDMS_Core_Workflow|bool
Return workflow by its name
getWorkflowState()  : bool|SeedDMS_Core_Workflow_State
Return a workflow state by its id
getWorkflowStateByName()  : bool|SeedDMS_Core_Workflow_State
Return workflow state by its name
getWorkflowTransition()  : SeedDMS_Core_Workflow_Transition|bool
Return a workflow transition by its id
getWrongFiletypeDocumentContent()  : bool|array<string|int, SeedDMS_Core_Document>
Returns document content which has the incorrect file type
hasCallback()  : bool
Check if a callback with the given name has been set
inList()  : bool|int
Checks if a list of objects contains a single object by comparing their IDs
makeTimeStamp()  : int|bool
Create a unix time stamp
mergeAccessLists()  : array<string|int, mixed>
Merge access lists
removeProcessWithoutUserGroup()  : array<string|int, mixed>
Removes all reviews, approvals, receipts, revisions which are not linked to a user, group anymore
search()  : array<string|int, mixed>|bool
Search the database for documents
setCallback()  : bool
Set a callback function
setClassname()  : string
Set class name of instantiated objects
setForceLink()  : mixed
setForceRename()  : mixed
setMaxDirID()  : mixed
Set maximum number of subdirectories per directory
setRootFolderID()  : bool
Set id of root folder
setUser()  : bool|object
Set the logged in user

Properties

$callbacks

public array<string|int, mixed> $callbacks

list of methods called when certain operations, like removing a document, are executed. Set a callback with SeedDMS_Core_DMS::setCallback(). The key of the array is the internal callback function name. Each array element is an array with two elements: the function name and the parameter passed to the function.

Currently implemented callbacks are:

onPreRemoveDocument($user_param, $document); called before deleting a document. If this function returns false the document will not be deleted.

onPostRemoveDocument($user_param, $document_id); called after the successful deletion of a document.

Tags
access

public

$checkWithinRootDir

public bool $checkWithinRootDir

check if folder/document being accessed is within the rootdir

Tags
access

public

$contentDir

public string $contentDir

location in the file system where all the document data is located. This should be an absolute path.

Tags
access

public

public bool $forceLink

use linkFile() instead of copyFile() when copying the document content into the data store. The default is to copy the file. This parameter only affects the method SeedDMS_Core_Document::addDocument(). Use this with care, because it will leave the original document at its place.

Tags
access

public

$forceRename

public bool $forceRename

use renameFile() instead of copyFile() when copying the document content into the data store. The default is to copy the file. This parameter only affects the methods SeedDMS_Core_Document::addDocument() and SeedDMS_Core_Document::addDocumentFile(). Setting this to true may save resources especially for large files.

Tags
access

public

$lasterror

public string $lasterror

last error message. This can be set by hooks to pass an error message from the hook to the application which has called the method containing the hook. For example SeedDMS_Core_Document::remove() calls the hook 'onPreRemoveDocument'. The hook function can set $dms->lasterror which can than be read when SeedDMS_Core_Document::remove() fails. This variable could be set in any SeedDMS_Core class, but is currently only set by hooks.

Tags
access

public

$maxDirID

public int $maxDirID

maximum number of documents per folder on the filesystem. If this variable is set to a value != 0, the content directory will have a two level hierarchy for document storage.

Tags
access

public

$noReadForStatus

public array<string|int, mixed> $noReadForStatus

list of status without read right online. DO NOT USE ANYMORE. SeedDMS_Core_DocumentContent::getAccessMode() was the only method using it, but it now takes the noReadForStatus info from the user's role

Tags
access

public

$rootFolderID

public int $rootFolderID

ID of root folder

Tags
access

public

$usecache

public bool $usecache

true if internal cache shall be used

Tags
access

public

$version

public string $version

version of pear package

Tags
access

public

$cache

protected array<string|int, mixed> $cache

cache for various objects

Tags
access

public

$classnames

protected array<string|int, mixed> $classnames

list of classnames for objects being instanciate by the dms

Tags
access

protected

$decorators

protected array<string|int, mixed> $decorators

list of decorators for objects being instanciate by the dms

Tags
access

protected

Methods

addAttributeDefinition()

Add a new attribute definition

public addAttributeDefinition(string $name,  $objtype, string $type[, bool|int $multiple = 0 ][, int $minvalues = 0 ][, int $maxvalues = 1 ][, string $valueset = '' ][, string $regex = '' ]) : bool|SeedDMS_Core_User
Parameters
$name : string

name of attribute

$objtype :
$type : string

type of attribute

$multiple : bool|int = 0

set to 1 if attribute has multiple attributes

$minvalues : int = 0

minimum number of values

$maxvalues : int = 1

maximum number of values if multiple is set

$valueset : string = ''

list of allowed values (csv format)

$regex : string = ''
Return values
bool|SeedDMS_Core_User

addCallback()

Add a callback function

public addCallback(string $name, mixed $func[, mixed $params = null ]) : bool

The function passed in $func must be a callable and $name must not be empty. This method does not check if there is a callback with the given name.

Parameters
$name : string

internal name of callback

$func : mixed

function name as expected by {call_user_method}

$params : mixed = null

parameter passed as the first argument to the callback

Return values
bool

true if adding the callback succeeds otherwise false

addDecorator()

Add a decorator

public addDecorator(string $objectname, mixed $decorator) : bool

This method adds a single decorator class name to the list of decorators of those objects being instantiated by the dms. Each class has an internal place holder, which must be passed to function.

Parameters
$objectname : string

placeholder (can be one of 'folder', 'document', 'documentcontent', 'user', 'group')

$decorator : mixed
Return values
bool

true if decorator could be added, otherwise false

addKeywordCategory()

public addKeywordCategory(mixed $userID, mixed $name) : mixed
Parameters
$userID : mixed
$name : mixed

addRole()

Create a new role

public addRole(string $name, mixed $role) : object
Parameters
$name : string

name of role

$role : mixed
Return values
object

instance of or false in case of an error.

addTransmittal()

Create a new transmittal

public addTransmittal(string $name, string $comment, object $user) : object
Parameters
$name : string

name of group

$comment : string

comment of group

$user : object

user this transmittal belongs to

Return values
object

instance of or false in case of an error.

addUser()

Add a new user

public addUser(string $login, string $pwd, string $fullName, string $email, string $language, string $theme, string $comment[, int|string $role = '3' ][, int $isHidden = 0 ][, int $isDisabled = 0 ][, string $pwdexpiration = '' ][, int $quota = 0 ][, null $homefolder = null ]) : bool|SeedDMS_Core_User

This method calls the hook onPostAddUser after the user has been added successfully.

Parameters
$login : string

login name

$pwd : string

hashed password of new user

$fullName : string

full name of user

$email : string

Email of new user

$language : string

language of new user

$theme : string

theme

$comment : string

comment of new user

$role : int|string = '3'

role of new user (can be 0=normal, 1=admin, 2=guest)

$isHidden : int = 0

hide user in all lists, if this is set login is still allowed

$isDisabled : int = 0

disable user and prevent login

$pwdexpiration : string = ''
$quota : int = 0
$homefolder : null = null
Return values
bool|SeedDMS_Core_User

or false if the user already exists or in case of an error

checkDate()

Checks if date conforms to a given format

public static checkDate(string $date[, string $format = 'Y-m-d H:i:s' ]) : bool
Parameters
$date : string

date to be checked

$format : string = 'Y-m-d H:i:s'

format of date. Will default to 'Y-m-d H:i:s' if format is not given.

Return values
bool

true if date is in propper format, otherwise false

checkDocuments()

Returns a list of documents and error message not linked in the tree

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

This method checks all documents in the database.

Return values
array<string|int, mixed>|bool

checkFolders()

Returns a list of folders and error message not linked in the tree

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

This method checks all folders in the database.

Return values
array<string|int, mixed>|bool

checkIfEqual()

Checks if two objects are equal by comparing their IDs

public static checkIfEqual(object $object1, object $object2) : bool

The regular php check done by '==' compares all attributes of two objects, which is often not required. This method will first check if the objects are instances of the same class and than if they have the same id.

Parameters
$object1 : object

first object to be compared

$object2 : object

second object to be compared

Return values
bool

true if objects are equal, otherwise false

checkPasswordRequest()

Check if hash for a password request is valid.

public checkPasswordRequest(string $hash) : bool|SeedDMS_Core_User

This method searches a previously created password request and returns the user.

Parameters
$hash : string
Return values
bool|SeedDMS_Core_User

checkVersion()

Check if the version in the database is the same as of this package Only the major and minor version number will be checked.

public checkVersion() : bool
Return values
bool

returns false if versions do not match, but returns true if version matches or table tblVersion does not exists.

countTasks()

Returns all documents with a predefined search criteria

public countTasks(string $listtype[, object $user = null ][, mixed $param5 = true ]) : array<string|int, mixed>
Parameters
$listtype : string

type of document list, can be 'AppRevByMe', 'AppRevOwner', 'ReceiptByMe', 'ReviseByMe', 'LockedByMe', 'MyDocs'

$user : object = null

user

$param5 : mixed = true
Return values
array<string|int, mixed>

list of documents records

createPasswordRequest()

Create a token to request a new password.

public createPasswordRequest(SeedDMS_Core_User $user) : string|bool

This method will not delete the password but just creates an entry in tblUserRequestPassword indicating a password request.

Parameters
$user : SeedDMS_Core_User
Return values
string|bool

hash value of false in case of an error

deletePasswordRequest()

Delete a password request

public deletePasswordRequest(string $hash) : bool
Parameters
$hash : string
Return values
bool

filterAccess()

Filter out objects which are not accessible in a given mode by a user.

public static filterAccess(array<string|int, mixed> $objArr, object $user, int $minMode) : array<string|int, mixed>

The list of objects to be checked can be of any class, but has to have a method getAccessMode($user) which checks if the given user has at least the access right on the object as passed in $minMode. Hence, passing a group instead of a user is possible.

This function can be used for documents and folders and calls or . A document is also filtered out if it has no latest content, which can happen if access on documents in a certain state has been restricted.

Parameters
$objArr : array<string|int, mixed>

list of objects (either documents or folders)

$user : object

user for which access is checked

$minMode : int

minimum access mode required (M_ANY, M_NONE, M_READ, M_READWRITE, M_ALL)

Return values
array<string|int, mixed>

filtered list of objects

filterDocumentFiles()

public static filterDocumentFiles(mixed $user, mixed $files) : mixed
Parameters
$user : mixed
$files : mixed

Filter out document links which can not be accessed by a given user

public static filterDocumentLinks(object $user, array<string|int, SeedDMS_Core_DocumentLink$links[, string $access = '' ]) : array<string|int, mixed>

Returns a filtered list of links which are accessible by the given user. A link is only accessible, if it is publically visible, owned by the user, or the accessing user is an administrator.

Parameters
$user : object

user for which access is being checked

$links : array<string|int, SeedDMS_Core_DocumentLink>

list of objects of type SeedDMS_Core_DocumentLink

$access : string = ''

set if source or target of link shall be checked for sufficient access rights. Set to 'source' if the source document of a link is to be checked, set to 'target' for the target document. If not set, then access rights will not be checked at all.

Return values
array<string|int, mixed>

filtered list of links

filterUsersByAccess()

Filter out users which cannot access an object in a given mode.

public static filterUsersByAccess(object $obj, array<string|int, mixed> $users, int $minMode) : array<string|int, mixed>

The list of users to be checked can be of any class, but has to have a method getAccessMode($user) which checks if a user has at least the access right as passed in $minMode. Hence, passing a list of groups instead of users is possible.

Parameters
$obj : object

object that shall be accessed

$users : array<string|int, mixed>

list of users/groups which are to check for sufficient access rights

$minMode : int

minimum access right on the object for each user (M_ANY, M_NONE, M_READ, M_READWRITE, M_ALL)

Return values
array<string|int, mixed>

filtered list of users

getAllAttributeDefinitions()

Return list of all attribute definitions

public getAllAttributeDefinitions([int|array<string|int, mixed> $objtype = 0 ][, int|array<string|int, mixed> $type = 0 ]) : bool|array<string|int, SeedDMS_Core_AttributeDefinition>
Parameters
$objtype : int|array<string|int, mixed> = 0

select those attribute definitions defined for an object type

$type : int|array<string|int, mixed> = 0

select those attribute definitions defined for a type

Return values
bool|array<string|int, SeedDMS_Core_AttributeDefinition>

of instances of SeedDMS_Core_AttributeDefinition or false or false

getAllKeywordCategories()

public getAllKeywordCategories([mixed $userIDs = array() ]) : mixed
Parameters
$userIDs : mixed = array()

getAllRoles()

Return list of all roles

public getAllRoles([mixed $orderby = '' ]) : array<string|int, mixed>
Parameters
$orderby : mixed = ''
Return values
array<string|int, mixed>

of instances of or false

getAllTransmittals()

Return list of all transmittals

public getAllTransmittals([mixed $user = null ][, mixed $orderby = '' ]) : array<string|int, mixed>
Parameters
$user : mixed = null
$orderby : mixed = ''
Return values
array<string|int, mixed>

of instances of or false

getAllUsers()

Return list of all users

public getAllUsers([string $orderby = '' ]) : array<string|int, mixed>
Parameters
$orderby : string = ''
Return values
array<string|int, mixed>

list of instances of SeedDMS_Core_User or false in case of an error

getClassname()

Return class name of classes instanciated by SeedDMS_Core

public getClassname(string $objectname) : string

This method returns the class name of those objects being instantiated by the dms. Each class has an internal place holder, which must be passed to function.

Parameters
$objectname : string

placeholder (can be one of 'folder', 'document', 'documentcontent', 'user', 'group')

Return values
string

name of class or false if object name is invalid

getDBVersion()

Return the database version

public getDBVersion() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool

getDecorators()

Return list of decorators

public getDecorators(string $objectname) : array<string|int, mixed>

This method returns the list of decorator class names of those objects being instantiated by the dms. Each class has an internal place holder, which must be passed to function.

Parameters
$objectname : string

placeholder (can be one of 'folder', 'document', 'documentcontent', 'user', 'group')

Return values
array<string|int, mixed>

list of class names or false if object name is invalid

getDocumentByName()

Returns a document by its name

public getDocumentByName(string $name[, object $folder = null ]) : SeedDMS_Core_Document|null|bool

This method searches a document by its name and restricts the search to the given folder if passed as the second parameter. If there are more than one document with that name, then only the one with the highest id will be returned.

Parameters
$name : string

Name of the document

$folder : object = null

parent folder of document

Return values
SeedDMS_Core_Document|null|bool

found document or null if not document was found or false in case of an error

getDocumentByOriginalFilename()

Returns a document by the original file name of the last version

public getDocumentByOriginalFilename(string $name[, object $folder = null ]) : SeedDMS_Core_Document|null|bool

This method searches a document by the name of the last document version and restricts the search to given folder if passed as the second parameter. If there are more than one document with that name, then only the one with the highest id will be returned.

Parameters
$name : string

Name of the original file

$folder : object = null

parent folder of document

Return values
SeedDMS_Core_Document|null|bool

found document or null if not document was found or false in case of an error

getDocumentCategories()

public getDocumentCategories() : mixed

getDocumentCategory()

public getDocumentCategory(mixed $id) : mixed
Parameters
$id : mixed

getDocumentContent()

Return a document content by its id

public getDocumentContent(int $id) : bool|null|SeedDMS_Core_DocumentContent

This method retrieves a document content from the database by its id.

Parameters
$id : int

internal id of document content

Return values
bool|null|SeedDMS_Core_DocumentContent

found document content or null if not document content was found or false in case of an error

getDocumentList()

Returns all documents with a predefined search criteria

public getDocumentList(string $listtype[, SeedDMS_Core_User $param1 = null ][, bool|int|string $param2 = false ][, string $param3 = '' ][, string $param4 = '' ][, bool $param5 = true ]) : array<string|int, mixed>|bool

The records return have the following elements

From Table tblDocuments [id] => id of document [name] => name of document [comment] => comment of document [date] => timestamp of creation date of document [expires] => timestamp of expiration date of document [owner] => user id of owner [folder] => id of parent folder [folderList] => column separated list of folder ids, e.g. :1:41: [inheritAccess] => 1 if access is inherited [defaultAccess] => default access mode [locked] => always -1 (TODO: is this field still used?) [keywords] => keywords of document [sequence] => sequence of document

From Table tblDocumentLocks [lockUser] => id of user locking the document

From Table tblDocumentStatusLog [version] => latest version of document [statusID] => id of latest status log [documentID] => id of document [status] => current status of document [statusComment] => comment of current status [statusDate] => datetime when the status was entered, e.g. 2014-04-17 21:35:51 [userID] => id of user who has initiated the status change

From Table tblUsers [ownerName] => name of owner of document [statusName] => name of user who has initiated the status change

Parameters
$listtype : string

type of document list, can be 'AppRevByMe', 'AppRevOwner', 'ReceiptByMe', 'ReviseByMe', 'LockedByMe', 'MyDocs'

$param1 : SeedDMS_Core_User = null

user

$param2 : bool|int|string = false

if set to true 'ReviewByMe', 'ApproveByMe', 'AppRevByMe', 'ReviseByMe', 'ReceiptByMe' will also return documents which the reviewer, approver, etc. has already taken care of. If set to false only untouched documents will be returned. In case of 'ExpiredOwner', 'SleepingReviseByMe' this parameter contains the number of days (a negative number is allowed) relativ to the current date or a date in format 'yyyy-mm-dd' (even in the past).

$param3 : string = ''

sort list by this field

$param4 : string = ''

order direction

$param5 : bool = true

set to false if expired documents shall not be considered

Return values
array<string|int, mixed>|bool

getDocumentsByUser()

Returns all documents of a given user

public getDocumentsByUser(object $user) : array<string|int, mixed>
Parameters
$user : object
Return values
array<string|int, mixed>

list of documents

getDocumentsExpired()

Returns all documents which already expired or will expire in the future

public getDocumentsExpired(string $date[, SeedDMS_Core_User $user = null ][, string $orderby = 'e' ][, string $orderdir = 'desc' ][, bool $update = true ]) : bool|array<string|int, SeedDMS_Core_Document>

The parameter $date will be relative to the start of the day. It can be either a number of days (if an integer is passed) or a date string in the format 'YYYY-MM-DD'. If the parameter $date is a negative number or a date in the past, then all documents from the start of that date till the end of the current day will be returned. If $date is a positive integer or $date is a date in the future, then all documents from the start of the current day till the end of the day of the given date will be returned. Passing 0 or the current date in $date, will return all documents expiring the current day.

Parameters
$date : string

date in format YYYY-MM-DD or an integer with the number of days. A negative value will cover the days in the past.

$user : SeedDMS_Core_User = null

limits the documents on those owned by this user

$orderby : string = 'e'

n=name, e=expired

$orderdir : string = 'desc'

d=desc or a=asc

$update : bool = true

update status of document if set to true

Return values
bool|array<string|int, SeedDMS_Core_Document>

getDocumentsInReception()

Return all waiting receptions

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

This function retrieves all waiting receptions and it associated document version

{see SeedDMS_Core_DMS::getDocumentsInRevision()}

Return values
array<string|int, mixed>

list of receptions or false in case of an error

getDocumentsInRevision()

Return all documents revisors waiting for a revision to start (sleeping) or are required to revise the document (waiting)

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

This function retrieves all revisors which are waiting for revision or already in revision Note: the name of the method is somewhat misleading, because it does not return documents but just database records from table tblDocumentRevisors and tblDocumentRevisionLog

Return values
array<string|int, mixed>

list of revisors or false in case of an error

getDocumentsLockedByUser()

Returns all documents locked by a given user

public getDocumentsLockedByUser(object $user) : array<string|int, mixed>
Parameters
$user : object
Return values
array<string|int, mixed>

list of documents

getDuplicateDocumentContent()

Returns document content which is duplicated

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

This method is for finding document content which is available twice in the database. The checksum of a document content was introduced in version 4.0.0 of SeedDMS for finding duplicates.

Return values
array<string|int, mixed>|bool

getDuplicateSequenceNo()

Returns folders which contain documents with none unique sequence number

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

This method is for finding folders with documents not having a unique sequence number. Those documents cannot propperly be sorted by sequence and changing their position is impossible if more than two documents with the same sequence number exists, e.g. doc 1: 3 doc 2: 5 doc 3: 5 doc 4: 5 doc 5: 7 If document 4 was to be moved between doc 1 and 2 it get sequence number 4 ((5+3)/2). But if document 4 was to be moved between doc 2 and 3 it will again have sequence number 5.

Return values
array<string|int, mixed>|bool

getFolder()

Return a folder by its id

public getFolder(int $id) : SeedDMS_Core_Folder

This method retrieves a folder from the database by its id.

Parameters
$id : int

internal id of folder

Return values
SeedDMS_Core_Folder

instance of SeedDMS_Core_Folder or false

getFolderByName()

Return a folder by its name

public getFolderByName(string $name[, SeedDMS_Core_Folder $folder = null ]) : 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 = null

parent folder

Return values
SeedDMS_Core_Folder|bool

found folder or false

getKeywordCategory()

public getKeywordCategory(mixed $id) : mixed
Parameters
$id : mixed

getKeywordCategoryByName()

public getKeywordCategoryByName(mixed $name, mixed $userID) : mixed
Parameters
$name : mixed
$userID : mixed

getNoChecksumDocumentContent()

Returns document content which has no checksum set

public getNoChecksumDocumentContent() : bool|array<string|int, SeedDMS_Core_Document>

This method is for finding document content without a checksum set in the database. The checksum of a document content was introduced in version 4.0.0 of SeedDMS for finding duplicates.

Return values
bool|array<string|int, SeedDMS_Core_Document>

getNoFileSizeDocumentContent()

Returns document content which has no file size set

public getNoFileSizeDocumentContent() : array<string|int, SeedDMS_Core_Document>|bool

This method is for finding document content without a file size set in the database. The file size of a document content was introduced in version 4.0.0 of SeedDMS for implementation of user quotas.

Return values
array<string|int, SeedDMS_Core_Document>|bool

getNotificationsByGroup()

Get all notifications for a group

public getNotificationsByGroup(object $group[, int $type = 0 ]) : array<string|int, mixed>

deprecated: User SeedDMS_Core_Group::getNotifications()

Parameters
$group : object

group for which notifications are to be retrieved

$type : int = 0

type of item (T_DOCUMENT or T_FOLDER)

Return values
array<string|int, mixed>

array of notifications

getNotificationsByUser()

Get all notifications for a user

public getNotificationsByUser(object $user[, int $type = 0 ]) : array<string|int, mixed>

deprecated: User SeedDMS_Core_User::getNotifications()

Parameters
$user : object

user for which notifications are to be retrieved

$type : int = 0

type of item (T_DOCUMENT or T_FOLDER)

Return values
array<string|int, mixed>

array of notifications

getProcessWithoutUserGroup()

Returns a list of reviews, approvals, receipts, revisions which are not linked to a user, group anymore

public getProcessWithoutUserGroup(string $process, string $usergroup) : array<string|int, mixed>

This method is for finding reviews or approvals whose user or group was deleted and not just removed from the process.

Parameters
$process : string
$usergroup : string
Return values
array<string|int, mixed>

getRole()

Get a role by its id

public getRole(int $id) : object
Parameters
$id : int

id of role

Return values
object

role or false if no role was found

getRoleByName()

Get a role by its name

public getRoleByName(int $name) : object
Parameters
$name : int

name of role

Return values
object

role or false if no role was found

getStatisticalData()

Returns statitical information

public getStatisticalData([string $type = '' ]) : array<string|int, mixed>|bool

This method returns all kind of statistical information like documents or used space per user, recent activity, etc.

Parameters
$type : string = ''

type of statistic

Return values
array<string|int, mixed>|bool

returns false if the sql statement fails, returns an empty array if no documents or folder where found, otherwise returns a non empty array with statistical data

getTransmittal()

Get a transmittal by its id

public getTransmittal(int $id) : object
Parameters
$id : int

id of transmittal

Return values
object

transmittal or false if no group was found

getTransmittalByName()

Get a transmittal by its name

public getTransmittalByName(string $name) : object
Parameters
$name : string

name of transmittal

Return values
object

transmittal or false if no group was found

getUnlinkedDocumentContent()

Returns document content which is not linked to a document

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

This method is for finding straying document content without a parent document. In normal operation this should not happen but little checks for database consistency and possible errors in the application may have left over document content though the document is gone already.

Return values
array<string|int, mixed>|bool

getUserByEmail()

Return a user by its email

public getUserByEmail(int $email) : object

This method retrieves a user from the database by its email. It is needed when the user requests a new password.

Parameters
$email : int

email address of user

Return values
object

instance of SeedDMS_Core_User or false in case of an error

getUserByLogin()

Return a user by its login

public getUserByLogin(string $login[, string $email = '' ]) : object

This method retrieves a user from the database by its login. If the second optional parameter $email is not empty, the user must also have the given email.

Parameters
$login : string

internal login of user

$email : string = ''

email of user

Return values
object

instance of SeedDMS_Core_User or false

getWrongFiletypeDocumentContent()

Returns document content which has the incorrect file type

public getWrongFiletypeDocumentContent() : bool|array<string|int, SeedDMS_Core_Document>

This method is for finding document content with an incorrect or missing file type. It just checks documents contents with a certain mime type.

Return values
bool|array<string|int, SeedDMS_Core_Document>

hasCallback()

Check if a callback with the given name has been set

public hasCallback(string $name) : bool
Parameters
$name : string

internal name of callback

Return values
bool

true if callback exists otherwise false

inList()

Checks if a list of objects contains a single object by comparing their IDs

public static inList(object $object, array<string|int, mixed> $list) : bool|int

This method is only applicable on list containing objects which have a method getID() because it is used to check if two objects are equal. The regular php check on objects done by '==' compares all attributes of two objects, which often isn't required. The method will first check if the objects are instances of the same class.

The result of the function can be 0 which happens if the first element of an indexed array matches.

Parameters
$object : object

object to look for (needle)

$list : array<string|int, mixed>

list of objects (haystack)

Return values
bool|int

index in array if object was found, otherwise false

makeTimeStamp()

Create a unix time stamp

public makeTimeStamp(int $hour, int $min, int $sec, int $year, int $month, int $day) : int|bool

This method is much like mktime() but does some range checks on the passed values.

Parameters
$hour : int

hour

$min : int

minute

$sec : int

second

$year : int

year

$month : int

month

$day : int

day

Return values
int|bool

unix time stamp or false if range check failed

mergeAccessLists()

Merge access lists

public static mergeAccessLists(array<string|int, mixed> $first, mixed $second) : array<string|int, mixed>

Merges two access lists. Objects of the second list will override objects in the first list.

Parameters
$first : array<string|int, mixed>

list of access rights as returned by SeedDMS_Core_Document:: getAccessList() or SeedDMS_Core_Folder::getAccessList()

$second : mixed
Return values
array<string|int, mixed>

merged list

removeProcessWithoutUserGroup()

Removes all reviews, approvals, receipts, revisions which are not linked to a user, group anymore

public removeProcessWithoutUserGroup(string $process, string $usergroup[, int $id = 0 ]) : array<string|int, mixed>

This method is for removing all reviews or approvals whose user or group was deleted and not just removed from the process. If the optional parameter $id is set, only this user/group id is removed.

Parameters
$process : string
$usergroup : string
$id : int = 0
Return values
array<string|int, mixed>

Search the database for documents

public search(string $query[, int $limit = 0 ][, int $offset = 0 ][, string $logicalmode = 'AND' ][, array<string|int, mixed> $searchin = array() ][, SeedDMS_Core_Folder|null $startFolder = null ][, SeedDMS_Core_User $owner = null ][, array<string|int, mixed> $status = array() ][, array<string|int, mixed> $creationstartdate = array() ][, array<string|int, mixed> $creationenddate = array() ][, array<string|int, mixed> $modificationstartdate = array() ][, array<string|int, mixed> $modificationenddate = array() ][, array<string|int, mixed> $categories = array() ][, array<string|int, mixed> $attributes = array() ][, int $mode = 0x3 ][, array<string|int, mixed> $expirationstartdate = array() ][, array<string|int, mixed> $expirationenddate = array() ][, mixed $reception = array() ]) : array<string|int, mixed>|bool

Note: the creation date will be used to check againts the date saved with the document or folder. The modification date will only be used for documents. It is checked against the creation date of the document content. This meanѕ that updateѕ of a document will only result in a searchable modification if a new version is uploaded.

If the search is filtered by an expiration date, only documents with an expiration date will be found. Even if just an end date is given.

dates, integers and floats fields are treated as ranges (expecting a 'from' and 'to' value) unless they have a value set.

Parameters
$query : string

seach query with space separated words

$limit : int = 0

number of items in result set

$offset : int = 0

index of first item in result set

$logicalmode : string = 'AND'

either AND or OR

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

list of fields to search in 1 = keywords, 2=name, 3=comment, 4=attributes, 5=id

$startFolder : SeedDMS_Core_Folder|null = null

search in the folder only (null for root folder)

$owner : SeedDMS_Core_User = null

search for documents owned by this user

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

list of status

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

search for documents created after this date

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

search for documents created before this date

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

search for documents modified after this date

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

search for documents modified before this date

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

list of categories the documents must have assigned

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

list of attributes. The key of this array is the attribute definition id. The value of the array is the value of the attribute. If the attribute may have multiple values it must be an array. attributes with a range must have the elements 'from' and 'to'

$mode : int = 0x3

decide whether to search for documents/folders 0x1 = documents only 0x2 = folders only 0x3 = both

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

search for documents expiring after and on this date

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

search for documents expiring before and on this date

$reception : mixed = array()
Return values
array<string|int, mixed>|bool

setCallback()

Set a callback function

public setCallback(string $name, mixed $func[, mixed $params = null ]) : bool

The function passed in $func must be a callable and $name must not be empty.

Setting a callback with this method will remove all previously set callbacks. Use SeedDMS_Core_DMS::addCallback() to register additional callbacks. This method does not check if there is a callback with the given name.

Parameters
$name : string

internal name of callback

$func : mixed

function name as expected by {call_user_method}

$params : mixed = null

parameter passed as the first argument to the callback

Return values
bool

true if adding the callback succeeds otherwise false

setClassname()

Set class name of instantiated objects

public setClassname(string $objectname, string $classname) : string

This method sets the class name of those objects being instatiated by the dms. It is mainly used to create a new class (possible inherited from one of the available classes) implementing new features. The method should be called in the postInitDMS hook.

Parameters
$objectname : string

placeholder (can be one of 'folder', 'document', 'documentcontent', 'user', 'group'

$classname : string

name of class

Return values
string

name of old class or false if not set

public setForceLink(mixed $enable) : mixed
Parameters
$enable : mixed

setForceRename()

public setForceRename(mixed $enable) : mixed
Parameters
$enable : mixed

setMaxDirID()

Set maximum number of subdirectories per directory

public setMaxDirID(int $id) : mixed

The value of maxDirID is quite crucial, because each document is stored within a directory in the filesystem. Consequently, there can be a maximum number of documents, because depending on the file system the maximum number of subdirectories is limited. Since version 3.3.0 of SeedDMS an additional directory level has been introduced, which will be created when maxDirID is not 0. All documents from 1 to maxDirID-1 will be saved in 1/, documents from maxDirID to 2*maxDirID-1 are stored in 2/ and so on.

Modern file systems like ext4 do not have any restrictions on the number of subdirectories anymore. Therefore it is best if this parameter is set to 0. Never change this parameter if documents has already been created.

This method must be called right after creating an instance of SeedDMS_Core_DMS

Parameters
$id : int

id of root folder

setRootFolderID()

Set id of root folder

public setRootFolderID(int $id) : bool

This method must be called right after creating an instance of SeedDMS_Core_DMS

The new root folder id will only be set if the folder actually exists. In that case the old root folder id will be returned. If it does not exists, the method will return false;

Parameters
$id : int

id of root folder

Return values
bool

old root folder id if new root folder exists, otherwise false

setUser()

Set the logged in user

public setUser(object $user) : bool|object

This method tells SeeDMS_Core_DMS the currently logged in user. It must be called right after instanciating the class, because some methods in SeedDMS_Core_Document() require the currently logged in user.

Parameters
$user : object

this muss not be empty and an instance of SeedDMS_Core_User

Return values
bool|object

returns the old user object or null on success, otherwise false


        
On this page

Search results