Menu

## SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object
in package

inc.ClassDocument.php : 3246

Class to represent content of a document

Each document has content attached to it, often called a 'version' of the document. The document content represents a file on the disk with some meta data stored in the database. A document content has a version number which is incremented with each replacement of the old content. Old versions are kept unless they are explicitly deleted by SeedDMS_Core_Document::removeContent().

##### 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 : object
$_approvalStatus : int
$_attributes : array<string|int, mixed>
$_checksum : string
$_comment : string
$_date : string
$_dir : string
$_document : object
$_fileSize : int
$_fileType : string
$_id : int
$_mimeType : string
$_orgFileName : string
$_readAccessList : array<string|int, mixed>
$_reviewStatus : int
$_status : int
$_user : object
$_userID : int
$_version : int
$_workflow : object
$_workflowState : object

#### Methods

__construct() : mixed
  SeedDMS_Core_Object constructor.
addGrpApprover() : int|false
  Add group as new approver
addGrpReviewer() : int|false
  Add group as new reviewer
addIndApprover() : int|false
  Add user as new approver
addIndReviewer() : int|false
  Add user as new reviewer
content() : mixed
delGrpApprover() : mixed
delGrpReviewer() : mixed
delIndApprover() : mixed
delIndReviewer() : mixed
enterNextState() : bool
  Enter next state of workflow if possible
executeWorkflowTransitionIsAllowed() : bool
  Check if all conditions are met to change the workflow state of a document content (run the transition).
exists() : mixed
getAccessMode() : int
  Returns the access mode similar to a document
getApprovalStatus() : array<string|int, mixed>
  Get the current approval status of the document content The approval status is a list of approvers and its current status
getApproveLog() : array<string|int, mixed>
  Get the latest entries from the approval log of the document content
getApprovers() : array<string|int, mixed>|bool|null
  Return a list of all approvers separated by individuals and groups This list will not take the approval log into account. Therefore it can contain approvers which has actually been deleted as an approver.
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
getChecksum() : mixed
getComment() : mixed
getDate() : mixed
getDMS() : SeedDMS_Core_DMS
  Returns instance of dms
getDocument() : mixed
getFileName() : mixed
getFileSize() : mixed
getFileType() : mixed
getID() : int
  Returns the internal id of the object
getLastWorkflowLog() : object
  Get the latest workflow log entry for the document content within the workflow. Even after finishing the workflow (when the document content does not have workflow set anymore) this function returns the last log entry.
getMimeType() : mixed
getOriginalFileName() : mixed
getParentWorkflow() : mixed
  Run a sub workflow
getPath() : string
  Return path of file on disk relative to the content directory
getRealChecksum() : mixed
getRealMimeType() : mixed
getReviewers() : array<string|int, mixed>|bool|null
  Return a list of all reviewers separated by individuals and groups This list will not take the review log into account. Therefore it can contain reviewers which has actually been deleted as a reviewer.
getReviewLog() : array<string|int, mixed>
  Get the latest entries from the review log of the document content
getReviewStatus() : array<string|int, mixed>
  Get the current review status of the document content The review status is a list of reviewers and its current status
getStatus() : array<string|int, mixed>
  Get the latest status of the content
getStatusLog() : array<string|int, mixed>
  Get current and former states of the document content
getUser() : mixed
getVersion() : mixed
getWorkflow() : object
  Get workflow assigned to the document content
getWorkflowLog() : array<string|int, mixed>
  Get the so far logged operations on the document content within the workflow. Even after finishing the workflow (when the document content does not have workflow set anymore) this function returns the list of all log entries.
getWorkflowState() : object
  Get state of workflow assigned to the document content
isType() : mixed
  Check if this object is of type 'documentcontent'.
needsWorkflowAction() : bool
  Check if the document content needs an action by a user
removeApproval() : int|bool
  Add another entry to approval log which resets the status
removeAttribute() : bool
  Remove an attribute of the object for the given attribute definition
removeReview() : int|bool
  Add another entry to review log which resets the status
removeWorkflow() : bool
  Remove workflow
repair() : bool
  Checks the internal data of the document version and repairs it.
returnFromSubWorkflow() : mixed
  Return from sub workflow to parent workflow.
rewindWorkflow() : bool
  Restart workflow from its initial state
rewriteApprovalLog() : bool
  Rewrites the complete approval log
rewriteReviewLog() : bool
  Rewrites the complete review log
rewriteStatusLog() : bool
  Rewrites the complete status log
rewriteWorkflowLog() : bool
  Rewrites the complete workflow log
runSubWorkflow() : mixed
  Run a sub workflow
setApprovalByGrp() : mixed
  Sets approval status of a document content for a group
setApprovalByInd() : int|bool
  Sets approval status of a document content for a user
setAttributeValue() : bool
  Set an attribute of the object for the given attribute definition
setChecksum() : mixed
  Set checksum by reading the file
setComment() : mixed
setDate() : bool
  Set upload date of document content
setDMS() : mixed
  Set dms this object belongs to.
setFileSize() : mixed
  Set file size by reading the file
setFileType() : mixed
  Set file type by evaluating the mime type
setMimeType() : mixed
setReviewByGrp() : int|bool
  Add a review to the document content
setReviewByInd() : int|bool
  Add a review to the document content
setStatus() : bool
  Set the status of the content
setWorkflow() : mixed
  Assign a workflow to a document content
setWorkflowState() : mixed
  Set state of workflow assigned to the document content
size() : mixed
triggerWorkflowTransition() : bool
  Trigger transition
triggerWorkflowTransitionIsAllowed() : bool
  Check if the user is allowed to trigger the transition A user is allowed if either the user itself or a group of which the user is a member of is registered for triggering a transition. This method does not change the workflow state of the document content.
verifyStatus() : mixed
  Recalculate the status of a document
__getDir() : mixed
  getDir and the corresponding database table field are deprecated

### Properties

#### $_dms

inc.ClassDocument.php : 3340
`public object $_dms`

dms

#### $_approvalStatus

inc.ClassDocument.php : 3330
`protected int $_approvalStatus`

state

#### $_attributes

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

list of attributes

#### $_checksum

inc.ClassDocument.php : 3300
`protected string $_checksum`

checksum of content

#### $_comment

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

comment

#### $_date

inc.ClassDocument.php : 3265
`protected string $_date`

date

#### $_dir

inc.ClassDocument.php : 3280
`protected string $_dir`

dir on disk (deprecated)

#### $_document

inc.ClassDocument.php : 3250
`protected object $_document`

document

#### $_fileSize

inc.ClassDocument.php : 3305
`protected int $_fileSize`

size of content file

#### $_fileType

inc.ClassDocument.php : 3290
`protected string $_fileType`

file type (actually the extension without the leading dot)

#### $_id

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

unique id of object

#### $_mimeType

inc.ClassDocument.php : 3295
`protected string $_mimeType`

mime type

#### $_orgFileName

inc.ClassDocument.php : 3285
`protected string $_orgFileName`

original file name

#### $_readAccessList

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

#### $_reviewStatus

inc.ClassDocument.php : 3325
`protected int $_reviewStatus`

state

#### $_status

inc.ClassDocument.php : 3320
`protected int $_status`

state

#### $_user

inc.ClassDocument.php : 3275
`protected object $_user`

#### $_userID

inc.ClassDocument.php : 3270
`protected int $_userID`

#### $_version

inc.ClassDocument.php : 3255
`protected int $_version`

version

#### $_workflow

inc.ClassDocument.php : 3310
`protected object $_workflow`

workflow

#### $_workflowState

inc.ClassDocument.php : 3315
`protected object $_workflowState`

workflow state

### Methods

#### __construct()

inc.ClassDocument.php : 3429

SeedDMS_Core_Object constructor.

`public __construct(mixed $id, mixed $document, mixed $version, mixed $comment, mixed $date, mixed $userID, mixed $dir, mixed $orgFileName, mixed $fileType, mixed $mimeType[, mixed $fileSize = 0 ][, mixed $checksum = '' ]) : mixed`

##### Parameters

$id : mixed
$document : mixed
$version : mixed
$comment : mixed
$date : mixed
$userID : mixed
$dir : mixed
$orgFileName : mixed
$fileType : mixed
$mimeType : mixed
$fileSize : mixed = 0
$checksum : mixed = ''

#### addGrpApprover()

inc.ClassDocument.php : 4805

Add group as new approver

`public addGrpApprover(object $group, object $requestUser) : int|false`

##### Parameters

$group : object

  group in charge for the approval

$requestUser : object

  user requesting the operation (usually the currently logged in user)

##### Return values

int|false —

if > 0 the id of the approval log, if < 0 the error code, false in case of an sql error

#### addGrpReviewer()

inc.ClassDocument.php : 4489

Add group as new reviewer

`public addGrpReviewer(object $group, object $requestUser) : int|false`

##### Parameters

$group : object

  group in charge for the review

$requestUser : object

  user requesting the operation (usually the currently logged in user)

##### Return values

int|false —

if > 0 the id of the review log, if < 0 the error code, false in case of an sql error

#### addIndApprover()

inc.ClassDocument.php : 4739

Add user as new approver

`public addIndApprover(object $user, object $requestUser) : int|false`

##### Parameters

$user : object

  user in charge for the approval

$requestUser : object

  user requesting the operation (usually the currently logged in user)

##### Return values

int|false —

if > 0 the id of the approval log, if < 0 the error code, false in case of an sql error

#### addIndReviewer()

inc.ClassDocument.php : 4423

Add user as new reviewer

`public addIndReviewer(object $user, object $requestUser) : int|false`

##### Parameters

$user : object

  user in charge for the review

$requestUser : object

  user requesting the operation (usually the currently logged in user)

##### Return values

int|false —

if > 0 the id of the review log, if < 0 the error code, false in case of an sql error

#### content()

inc.ClassDocument.php : 3535
`public content() : mixed`

#### delGrpApprover()

inc.ClassDocument.php : 5141
`public delGrpApprover(mixed $group, mixed $requestUser[, mixed $msg = '' ]) : mixed`

##### Parameters

$group : mixed
$requestUser : mixed
$msg : mixed = ''

#### delGrpReviewer()

inc.ClassDocument.php : 5072
`public delGrpReviewer(mixed $group, mixed $requestUser[, mixed $msg = '' ]) : mixed`

##### Parameters

$group : mixed
$requestUser : mixed
$msg : mixed = ''

#### delIndApprover()

inc.ClassDocument.php : 5106
`public delIndApprover(mixed $user, mixed $requestUser[, mixed $msg = '' ]) : mixed`

##### Parameters

$user : mixed
$requestUser : mixed
$msg : mixed = ''

#### delIndReviewer()

inc.ClassDocument.php : 5039
`public delIndReviewer(mixed $user, mixed $requestUser[, mixed $msg = '' ]) : mixed`

##### Parameters

$user : mixed
$requestUser : mixed
$msg : mixed = ''

#### enterNextState()

inc.ClassDocument.php : 5748

Enter next state of workflow if possible

`public enterNextState(object $user, object $nextstate) : bool`

The method will check if one of the following states in the workflow can be reached. It does it by running the precondition function of that state. The precondition function gets a list of all transitions leading to the state. It will determine, whether the transitions has been triggered and if that is sufficient to enter the next state. If no pre condition function is set, then 1 of n transtions are enough to enter the next state.

If moving in the next state is possible and this state has a corresponding document state, then the document state will be updated and the workflow will be detached from the document.

##### Parameters

$user : object
$nextstate : object

##### Return values

bool —

true if the state could be reached false if not

#### executeWorkflowTransitionIsAllowed()

inc.ClassDocument.php : 5594

Check if all conditions are met to change the workflow state of a document content (run the transition).

`public executeWorkflowTransitionIsAllowed(mixed $transition) : bool`

The conditions are met if all explicitly set users and a sufficient number of users of the groups have acknowledged the content.

##### Parameters

$transition : mixed

##### Return values

bool —

true if transaction maybe executed

#### exists()

inc.ClassDocument.php : 3501
`public exists() : mixed`

#### getAccessMode()

inc.ClassDocument.php : 3950

Returns the access mode similar to a document

`public getAccessMode(object $u) : int`

There is no real access mode for document content, so this is more like a virtual access mode, derived from the status of the document content. The function checks if SeedDMS_Core_DMS::noReadForStatus contains the status of the version and returns M_NONE if it exists and the user is not involved in a workflow or review/approval/revision. This method is called by all functions that returns the content e.g. SeedDMS_Core_Document::getLatestContent() It is also used by SeedDMS_Core_Document::getAccessMode() to prevent access on the whole document if there is no accessible version.

FIXME: This method only works propperly if $u is the currently logged in user, because noReadForStatus will be set for this user. FIXED: instead of using $dms->noReadForStatus it is take from the user's role

##### Parameters

$u : object

  user

##### Return values

int —

either M_NONE or M_READ

#### getApprovalStatus()

inc.ClassDocument.php : 4271

Get the current approval status of the document content The approval status is a list of approvers and its current status

`public getApprovalStatus([int $limit = 1 ]) : array<string|int, mixed>`

##### Parameters

$limit : int = 1

  the number of recent status changes per approver

##### Return values

array<string|int, mixed> —

list of approval status

#### getApproveLog()

inc.ClassDocument.php : 4327

Get the latest entries from the approval log of the document content

`public getApproveLog([int $limit = 1 ]) : array<string|int, mixed>`

##### Parameters

$limit : int = 1

  the number of log entries returned, defaults to 1

##### Return values

array<string|int, mixed> —

list of approval log entries

#### getApprovers()

inc.ClassDocument.php : 4240

Return a list of all approvers separated by individuals and groups This list will not take the approval log into account. Therefore it can contain approvers which has actually been deleted as an approver.

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

##### Return values

array<string|int, mixed>|bool|null

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

#### getChecksum()

inc.ClassDocument.php : 3602
`public getChecksum() : mixed`

#### getComment()

inc.ClassDocument.php : 3467
`public getComment() : mixed`

#### getDate()

inc.ClassDocument.php : 3468
`public getDate() : mixed`

#### getDMS()

inc.ClassObject.php : 80

Returns instance of dms

`public getDMS() : SeedDMS_Core_DMS`

##### Return values

SeedDMS_Core_DMS

#### getDocument()

inc.ClassDocument.php : 3477
`public getDocument() : mixed`

#### getFileName()

inc.ClassDocument.php : 3471
`public getFileName() : mixed`

#### getFileSize()

inc.ClassDocument.php : 3577
`public getFileSize() : mixed`

#### getFileType()

inc.ClassDocument.php : 3470
`public getFileType() : mixed`

#### getID()

inc.ClassObject.php : 89

Returns the internal id of the object

`public getID() : int`

##### Return values

int —

id of document/folder

#### getLastWorkflowLog()

inc.ClassDocument.php : 5864

Get the latest workflow log entry for the document content within the workflow. Even after finishing the workflow (when the document content does not have workflow set anymore) this function returns the last log entry.

`public getLastWorkflowLog() : object`

##### Return values

object

#### getMimeType()

inc.ClassDocument.php : 3476
`public getMimeType() : mixed`

#### getOriginalFileName()

inc.ClassDocument.php : 3469
`public getOriginalFileName() : mixed`

#### getParentWorkflow()

inc.ClassDocument.php : 5420

Run a sub workflow

`public getParentWorkflow() : mixed`

#### getPath()

inc.ClassDocument.php : 3494

Return path of file on disk relative to the content directory

`public getPath() : string`

Since version 5.1.13 a single '.' in the fileType will be skipped. On Windows a file named 'name.' will be saved as 'name' but the fileType will contain the a single '.'.

##### Return values

string —

path of file on disc

#### getRealChecksum()

inc.ClassDocument.php : 3606
`public getRealChecksum() : mixed`

#### getRealMimeType()

inc.ClassDocument.php : 3636
`public getRealMimeType() : mixed`

#### getReviewers()

inc.ClassDocument.php : 4060

Return a list of all reviewers separated by individuals and groups This list will not take the review log into account. Therefore it can contain reviewers which has actually been deleted as a reviewer.

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

##### Return values

array<string|int, mixed>|bool|null

#### getReviewLog()

inc.ClassDocument.php : 4147

Get the latest entries from the review log of the document content

`public getReviewLog([int $limit = 1 ]) : array<string|int, mixed>`

##### Parameters

$limit : int = 1

  the number of log entries returned, defaults to 1

##### Return values

array<string|int, mixed> —

list of review log entries

#### getReviewStatus()

inc.ClassDocument.php : 4091

Get the current review status of the document content The review status is a list of reviewers and its current status

`public getReviewStatus([int $limit = 1 ]) : array<string|int, mixed>`

##### Parameters

$limit : int = 1

  the number of recent status changes per reviewer

##### Return values

array<string|int, mixed> —

list of review status

#### getStatus()

inc.ClassDocument.php : 3751

Get the latest status of the content

`public getStatus([mixed $limit = 1 ]) : array<string|int, mixed>`

The status of the content reflects its current review, approval or workflow state. A status can be a negative or positive number or 0. A negative numbers indicate a missing approval, review or an obsolete content. Positive numbers indicate some kind of approval or workflow being active, but not necessarily a release. S_DRAFT_REV, 0 S_DRAFT_APP, 1 S_RELEASED, 2 S_IN_WORKFLOW, 3 S_REJECTED, -1 S_OBSOLETE, -2 S_EXPIRED, -3 When a content is inserted and does not need approval nor review, then its status is set to S_RELEASED immediately. Any change of the status is monitored in the table tblDocumentStatusLog. This function will always return the latest entry for the content.

##### Parameters

$limit : mixed = 1

##### Return values

array<string|int, mixed> —

latest record from tblDocumentStatusLog

#### getStatusLog()

inc.ClassDocument.php : 3785

Get current and former states of the document content

`public getStatusLog([int $limit = 0 ]) : array<string|int, mixed>`

##### Parameters

$limit : int = 0

  if not set all log entries will be returned

##### Return values

array<string|int, mixed> —

list of status changes

#### getUser()

inc.ClassDocument.php : 3479
`public getUser() : mixed`

#### getVersion()

inc.ClassDocument.php : 3466
`public getVersion() : mixed`

#### getWorkflow()

inc.ClassDocument.php : 5264

Get workflow assigned to the document content

`public getWorkflow() : object`

The method returns the last workflow if one was assigned. If the document version is in a sub workflow, it will have a never date and therefore will be found first.

##### Return values

object —

an object of class SeedDMS_Core_Workflow or false in case of error, e.g. the version has not a workflow

#### getWorkflowLog()

inc.ClassDocument.php : 5826

Get the so far logged operations on the document content within the workflow. Even after finishing the workflow (when the document content does not have workflow set anymore) this function returns the list of all log entries.

`public getWorkflowLog([mixed $transition = null ]) : array<string|int, mixed>`

##### Parameters

$transition : mixed = null

##### Return values

array<string|int, mixed> —

list of objects

#### getWorkflowState()

inc.ClassDocument.php : 5200

Get state of workflow assigned to the document content

`public getWorkflowState() : object`

##### Return values

object —

an object of class SeedDMS_Core_Workflow_State or false in case of error, e.g. the version has not a workflow

#### isType()

inc.ClassDocument.php : 3462

Check if this object is of type 'documentcontent'.

`public isType(string $type) : mixed`

##### Parameters

$type : string

  type of object

#### needsWorkflowAction()

inc.ClassDocument.php : 5898

Check if the document content needs an action by a user

`public needsWorkflowAction(SeedDMS_Core_User $user) : bool`

This method will return true if document content is in a transition which can be triggered by the given user.

##### Parameters

$user : SeedDMS_Core_User

##### Return values

bool —

true is action is needed

#### removeApproval()

inc.ClassDocument.php : 4955

Add another entry to approval log which resets the status

`public removeApproval(int $approveid, SeedDMS_Core_User $requestUser[, string $comment = '' ]) : int|bool`

This method will not delete anything from the database, but will add a new approval log entry which sets the status to 0. This is only allowed if the current status is either 1 (approved) or -1 (rejected).

After calling this method SeedDMS_Core_DocumentContent::verifyStatus() should be called to recalculate the document status.

##### Parameters

$approveid : int

  id of approval

$requestUser : SeedDMS_Core_User

  user requesting the removal

$comment : string = ''

  comment

##### Return values

int|bool —

true if successful, error code < 0, false in case of an sql error

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

#### removeReview()

inc.ClassDocument.php : 4636

Add another entry to review log which resets the status

`public removeReview(int $reviewid, SeedDMS_Core_User $requestUser[, string $comment = '' ]) : int|bool`

This method will not delete anything from the database, but will add a new review log entry which sets the status to 0. This is only allowed if the current status is either 1 (reviewed) or -1 (rejected).

After calling this method SeedDMS_Core_DocumentContent::verifyStatus() should be called to recalculate the document status.

##### Parameters

$reviewid : int

  id of review

$requestUser : SeedDMS_Core_User

  user requesting the removal

$comment : string = ''

  comment

##### Return values

int|bool —

true if successful, error code < 0, false in case of an sql error

#### removeWorkflow()

inc.ClassDocument.php : 5371

Remove workflow

`public removeWorkflow(object $user[, bool $unlink = false ]) : bool`

Fully removing a workflow including entries in the workflow log is only allowed if the workflow is still its initial state. At a later point of time only unlinking the document from the workflow is allowed. It will keep any log entries. A workflow is unlinked from a document when enterNextState() succeeds.

##### Parameters

$user : object

  user doing initiating the removal

$unlink : bool = false

  if true, just unlink the workflow from the document but do not remove the workflow log. The $unlink flag has been added to detach the workflow from the document when it has reached a valid end state (see SeedDMS_Core_DocumentContent::enterNextState())

##### Return values

bool —

true if workflow could be removed or false in case of error

#### repair()

inc.ClassDocument.php : 5921

Checks the internal data of the document version and repairs it.

`public repair() : bool`

Currently, this function only repairs a missing filetype

##### Return values

bool —

true on success, otherwise false

#### returnFromSubWorkflow()

inc.ClassDocument.php : 5484

Return from sub workflow to parent workflow.

`public returnFromSubWorkflow(object $user[, mixed $transition = null ][, mixed $comment = '' ]) : mixed`

The method will trigger the given transition

FIXME: Needs much better checking if this is allowed

##### Parameters

$user : object

  intiating the return

$transition : mixed = null
$comment : mixed = ''

#### rewindWorkflow()

inc.ClassDocument.php : 5330

Restart workflow from its initial state

`public rewindWorkflow() : bool`

##### Return values

bool —

true if workflow could be restarted or false in case of error

#### rewriteApprovalLog()

inc.ClassDocument.php : 4352

Rewrites the complete approval log

`public rewriteApprovalLog(mixed $reviewers) : bool`

Attention: this function is highly dangerous. It removes an existing review log and rewrites it. This method was added for importing an xml dump.

##### Parameters

$reviewers : mixed

##### Return values

bool —

true on success, otherwise false

#### rewriteReviewLog()

inc.ClassDocument.php : 4172

Rewrites the complete review log

`public rewriteReviewLog(mixed $reviewers) : bool`

Attention: this function is highly dangerous. It removes an existing review log and rewrites it. This method was added for importing an xml dump.

##### Parameters

$reviewers : mixed

##### Return values

bool —

true on success, otherwise false

#### rewriteStatusLog()

inc.ClassDocument.php : 3891

Rewrites the complete status log

`public rewriteStatusLog(array<string|int, mixed> $statuslog) : bool`

Attention: this function is highly dangerous. It removes an existing status log and rewrites it. This method was added for importing an xml dump.

##### Parameters

$statuslog : array<string|int, mixed>

  new status log with the newest log entry first.

##### Return values

bool —

true on success, otherwise false

#### rewriteWorkflowLog()

inc.ClassDocument.php : 5293

Rewrites the complete workflow log

`public rewriteWorkflowLog(array<string|int, mixed> $workflowlog) : bool`

Attention: this function is highly dangerous. It removes an existing workflow log and rewrites it. This method was added for importing an xml dump.

##### Parameters

$workflowlog : array<string|int, mixed>

  new workflow log with the newest log entry first.

##### Return values

bool —

true on success, otherwise false

#### runSubWorkflow()

inc.ClassDocument.php : 5450

Run a sub workflow

`public runSubWorkflow(object $subworkflow) : mixed`

##### Parameters

$subworkflow : object

#### setApprovalByGrp()

inc.ClassDocument.php : 4995

Sets approval status of a document content for a group

`public setApprovalByGrp(mixed $group, mixed $requestUser, mixed $status, mixed $comment[, mixed $file = '' ]) : mixed`

The functions behaves like {link SeedDMS_Core_DocumentContent::setApprovalByInd} but does it for a group instead of a user

##### Parameters

$group : mixed
$requestUser : mixed
$status : mixed
$comment : mixed
$file : mixed = ''

#### setApprovalByInd()

inc.ClassDocument.php : 4894

Sets approval status of a document content for a user

`public setApprovalByInd(object $user, object $requestUser, int $status, string $comment[, mixed $file = '' ]) : int|bool`

This method can be used to approve or reject a document content, or to reset its approval state. In most cases this function will be called by an user, but an admin may set the approval for somebody else. It is first checked if the user is in the list of approvers at all. Then it is check if the approval status is already -2. In both cases the function returns with an error.

##### Parameters

$user : object

  user in charge for doing the approval

$requestUser : object

  user actually calling this function

$status : int

  the status of the approval, possible values are 0=unprocessed (maybe used to reset a status) 1=approved, -1=rejected, -2=user is deleted (use {link SeedDMS_Core_DocumentContent::delIndApprover} instead)

$comment : string

  approval comment

$file : mixed = ''

##### Tags

see
  SeedDMS_Core_DocumentContent::setReviewByInd()

##### Return values

int|bool —

new review log id, error code 0 till -4, false in case of an sql error

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

#### setChecksum()

inc.ClassDocument.php : 3618

Set checksum by reading the file

`public setChecksum() : mixed`

#### setComment()

inc.ClassDocument.php : 3698
`public setComment(mixed $newComment) : mixed`

##### Parameters

$newComment : mixed

#### setDate()

inc.ClassDocument.php : 3554

Set upload date of document content

`public setDate([string $date = false ]) : bool`

##### Parameters

$date : string = false

  date must be a timestamp or in the format 'Y-m-d H:i:s'

##### Return values

bool —

true on success, otherwise false

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

#### setFileSize()

inc.ClassDocument.php : 3584

Set file size by reading the file

`public setFileSize() : mixed`

#### setFileType()

inc.ClassDocument.php : 3648

Set file type by evaluating the mime type

`public setFileType() : mixed`

#### setMimeType()

inc.ClassDocument.php : 3678
`public setMimeType(mixed $newMimetype) : mixed`

##### Parameters

$newMimetype : mixed

#### setReviewByGrp()

inc.ClassDocument.php : 4685

Add a review to the document content

`public setReviewByGrp(object $group, object $requestUser, int $status, string $comment[, mixed $file = '' ]) : int|bool`

This method is similar to SeedDMS_Core_DocumentContent::setReviewByInd() but adds a review for a group instead of a user.

##### Parameters

$group : object

  group doing the review

$requestUser : object

  user asking for the review, this is mostly the user currently logged in.

$status : int

  status of review

$comment : string

  comment for review

$file : mixed = ''

##### Return values

int|bool —

new review log id, error code 0 till -4, false in case of an sql error

#### setReviewByInd()

inc.ClassDocument.php : 4575

Add a review to the document content

`public setReviewByInd(object $user, object $requestUser, int $status, string $comment[, mixed $file = '' ]) : int|bool`

This method will add an entry to the table tblDocumentReviewLog. It will first check if the user is ment to review the document version. It not the return value is -3. Next it will check if the users has been removed from the list of reviewers. In that case -4 will be returned. If the given review status has been set by the user before, it cannot be set again and 0 will be returned. Іf the review could be succesfully added, the review log id will be returned.

##### Parameters

$user : object

  user doing the review

$requestUser : object

  user asking for the review, this is mostly the user currently logged in.

$status : int

  status of review

$comment : string

  comment for review

$file : mixed = ''

##### Tags

see
  SeedDMS_Core_DocumentContent::setApprovalByInd()

##### Return values

int|bool —

new review log id, error code 0 till -4, false in case of an sql error

#### setStatus()

inc.ClassDocument.php : 3823

Set the status of the content

`public setStatus(int $status, string $comment, object $updateUser[, string $date = '' ]) : bool`

Setting the status means to add another entry into the table tblDocumentStatusLog. The method returns also false if the status is already set on the value passed to the method.

##### Parameters

$status : int

  new status of content

$comment : string

  comment for this status change

$updateUser : object

  user initiating the status change

$date : string = ''

  date in the format 'Y-m-d H:i:s'

##### Return values

bool —

true on success, otherwise false

#### setWorkflow()

inc.ClassDocument.php : 5228

Assign a workflow to a document content

`public setWorkflow(object $workflow, mixed $user) : mixed`

##### Parameters

$workflow : object
$user : mixed

#### setWorkflowState()

inc.ClassDocument.php : 5180

Set state of workflow assigned to the document content

`public setWorkflowState(object $state) : mixed`

##### Parameters

$state : object

#### size()

inc.ClassDocument.php : 3518
`public size() : mixed`

#### triggerWorkflowTransition()

inc.ClassDocument.php : 5682

Trigger transition

`public triggerWorkflowTransition(object $user, object $transition[, string $comment = '' ]) : bool`

This method will be deprecated

The method will first check if the user is allowed to trigger the transition. If the user is allowed, an entry in the workflow log will be added, which is later used to check if the transition can actually be processed. The method will finally call executeWorkflowTransitionIsAllowed() which checks all log entries and does the transitions post function if all users and groups have triggered the transition. Finally enterNextState() is called which will try to enter the next state.

##### Parameters

$user : object
$transition : object
$comment : string = ''

  user comment

##### Return values

bool —

next state if transition could be triggered and then next state could be entered, true if the transition could just be triggered or false in case of an error

#### triggerWorkflowTransitionIsAllowed()

inc.ClassDocument.php : 5540

Check if the user is allowed to trigger the transition A user is allowed if either the user itself or a group of which the user is a member of is registered for triggering a transition. This method does not change the workflow state of the document content.

`public triggerWorkflowTransitionIsAllowed(object $user, mixed $transition) : bool`

##### Parameters

$user : object
$transition : mixed

##### Return values

bool —

true if user may trigger transaction

#### verifyStatus()

inc.ClassDocument.php : 3377

Recalculate the status of a document

`public verifyStatus([bool $ignorecurrentstatus = false ][, object $user = null ][, string $msg = '' ]) : mixed`

The methods checks the review and approval status and sets the status of the document accordingly.

If status is S_RELEASED and the version has a workflow, then set the status to S_IN_WORKFLOW If status is S_RELEASED and there are reviewers => set status S_DRAFT_REV If status is S_RELEASED or S_DRAFT_REV and there are approvers => set status S_DRAFT_APP If status is draft and there are no approver and no reviewers => set status to S_RELEASED The status of a document with the current status S_OBSOLETE, S_REJECTED, or S_EXPIRED will not be changed unless the parameter $ignorecurrentstatus is set to true.

This method may not be called after a negative approval or review to recalculated the status, because it doesn't take a defeating approval or review into account. This method does not set the status to S_REJECTED! It will just check for a pending workflow, approval or review and set the status accordingly, e.g. after the list of reviewers or appovers has been modified. If there is no pending workflow, approval or review the status will be set to S_RELEASED.

This method will call SeedDMS_Core_DocumentContent::setStatus() which checks if the status has actually changed. This is, why this function can be called at any time without harm to the status log.

##### Parameters

$ignorecurrentstatus : bool = false

  ignore the current status and recalculate a new status in any case

$user : object = null

  the user initiating this method

$msg : string = ''

  message stored in status log when status is set

#### __getDir()

inc.ClassDocument.php : 3475

getDir and the corresponding database table field are deprecated

`private __getDir() : mixed`

## Search results