SeedDMS_Core_DocumentContent
extends SeedDMS_Core_Object
in package
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
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
- $_receiptStatus : int
- $_reviewStatus : int
- $_revisionDate : string
- $_revisionStatus : 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
- addGrpRecipient() : mixed
- addGrpReviewer() : int|false
- Add group as new reviewer
- addGrpRevisor() : mixed
- addIndApprover() : int|false
- Add user as new approver
- addIndRecipient() : mixed
- addIndReviewer() : int|false
- Add user as new reviewer
- addIndRevisor() : mixed
- addRevisor() : int
- Add an individual revisor to the document content
- checkForDueRevisionWorkflow() : bool
- Check if document version has a scheduled revision workflow.
- delGrpApprover() : mixed
- delGrpRecipient() : mixed
- delGrpReviewer() : mixed
- delGrpRevisor() : mixed
- delIndApprover() : mixed
- delIndRecipient() : mixed
- delIndReviewer() : mixed
- delIndRevisor() : mixed
- delRevisor() : int
- Removes a user from the revision workflow
- 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).
- finishRevision() : mixed
- Finish a revision workflow
- 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() : array<string|int, mixed>|string
- Returns an attribute value of the object for the given attribute definition
- getAttributeValueAsArray() : array<string|int, mixed>|bool
- 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
- getInstance() : bool|SeedDMS_Core_DocumentContent
- Return an document content by its id
- 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 a 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
- getReceiptLog() : array<string|int, mixed>
- Get the latest entries from the receipt log of the document content
- getReceiptStatus() : array<string|int, mixed>
- Get the current receipt status of the document content The receipt status is a list of receipts
- getRecipients() : array<string|int, mixed>|bool|null
- Return a list of all recipients separated by individuals and groups This list will not take the receipt log into account. Therefore it can contain recipients which has actually been deleted as a recipient.
- 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
- getRevisionDate() : mixed
- getRevisionLog() : array<string|int, mixed>
- Get the latest entries from the revision log of the document content
- getRevisionStatus() : array<string|int, mixed>
- Get the current revision status of the document content The revision status is a list of revisions If $limit is 1 it will return just the last log entry for each revisor.
- getRevisors() : array<string|int, mixed>|bool|null
- Return a list of all revisors separated by individuals and groups This list will not take the revision log into account. Therefore it can contain revisors which has actually been deleted as a revisor.
- 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. If the document content is currently in a workflow and a transition is passed, then the log entries will be restricted on the workflow and returned as a one dimensional list. Without a running workflow the log entries of all workflows in the past are returned grouped by workflow.
- 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
- rewriteReceiptLog() : bool
- Rewrites the complete receipt log
- rewriteReviewLog() : bool
- Rewrites the complete review log
- rewriteRevisionLog() : bool
- Rewrites the complete revision 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
- setReceiptByGrp() : int
- Add a receipt to the document content
- setReceiptByInd() : int
- Add a receipt to the document content
- setReviewByGrp() : int|bool
- Add a review to the document content
- setReviewByInd() : int|bool
- Add a review to the document content
- setRevision() : int
- Add a revision to the document content
- setRevisionByGrp() : mixed
- setRevisionByInd() : mixed
- setRevisionDate() : mixed
- 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
- startRevision() : mixed
- Start a new revision workflow
- 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
public
object
$_dms
dms
$_approvalStatus
protected
int
$_approvalStatus
state
$_attributes
protected
array<string|int, mixed>
$_attributes
list of attributes
$_checksum
protected
string
$_checksum
checksum of content
$_comment
protected
string
$_comment
comment
$_date
protected
string
$_date
date
$_dir
protected
string
$_dir
dir on disk (deprecated)
$_document
protected
object
$_document
document
$_fileSize
protected
int
$_fileSize
size of content file
$_fileType
protected
string
$_fileType
file type (actually the extension without the leading dot)
$_id
protected
int
$_id
unique id of object
$_mimeType
protected
string
$_mimeType
mime type
$_orgFileName
protected
string
$_orgFileName
original file name
$_receiptStatus
protected
int
$_receiptStatus
state
$_reviewStatus
protected
int
$_reviewStatus
state
$_revisionDate
protected
string
$_revisionDate
date of revision
$_revisionStatus
protected
int
$_revisionStatus
state
$_status
protected
int
$_status
state
$_user
protected
object
$_user
$_userID
protected
int
$_userID
$_version
protected
int
$_version
version
$_workflow
protected
object
$_workflow
workflow
$_workflowState
protected
object
$_workflowState
workflow state
Methods
__construct()
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 $revisionDate = null ]) : 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 = ''
- $revisionDate : mixed = null
addGrpApprover()
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
addGrpRecipient()
public
addGrpRecipient(mixed $group, mixed $requestUser) : mixed
Parameters
- $group : mixed
- $requestUser : mixed
addGrpReviewer()
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
addGrpRevisor()
public
addGrpRevisor(mixed $group, mixed $requestUser[, mixed $donotstart = true ]) : mixed
Parameters
- $group : mixed
- $requestUser : mixed
- $donotstart : mixed = true
addIndApprover()
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
addIndRecipient()
public
addIndRecipient(mixed $user, mixed $requestUser) : mixed
Parameters
- $user : mixed
- $requestUser : mixed
addIndReviewer()
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
addIndRevisor()
public
addIndRevisor(mixed $user, mixed $requestUser[, mixed $donotstart = true ]) : mixed
Parameters
- $user : mixed
- $requestUser : mixed
- $donotstart : mixed = true
addRevisor()
Add an individual revisor to the document content
public
addRevisor(mixed $object, object $requestUser) : int
This function adds a user as a revisor but doesn't start the revision workflow by default. This behaviour is different from all other workflows (approval, review, receipt), because it adds an initial entry in the revision log, which marks the revision as 'sleeping'. The workflow is started at a later point in time by adding the second entry in the revision log which puts it into 'waiting'.
Parameters
- $object : mixed
- $requestUser : object
-
user requesting the addition
Return values
int —0 if successful otherwise a value < 0
checkForDueRevisionWorkflow()
Check if document version has a scheduled revision workflow.
public
checkForDueRevisionWorkflow(object $user[, string $next = '' ]) : bool
The method will update the document status log database table if needed and set the revisiondate of the content to $next.
FIXME: This method does not check if there are any revisors left. Even if all revisors have been removed, it will still start the revision workflow! NOTE: This seems not the case anymore. The status of each revision is checked. Only if at least one status is S_LOG_SLEEPING the revision will be started. This wouldn't be the case if all revisors had been removed.
Parameters
- $user : object
-
user requesting the possible automatic change
- $next : string = ''
-
next date for review
Return values
bool —true if status has changed
delGrpApprover()
public
delGrpApprover(mixed $group, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
- $group : mixed
- $requestUser : mixed
- $msg : mixed = ''
delGrpRecipient()
public
delGrpRecipient(mixed $group, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
- $group : mixed
- $requestUser : mixed
- $msg : mixed = ''
delGrpReviewer()
public
delGrpReviewer(mixed $group, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
- $group : mixed
- $requestUser : mixed
- $msg : mixed = ''
delGrpRevisor()
public
delGrpRevisor(mixed $group, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
- $group : mixed
- $requestUser : mixed
- $msg : mixed = ''
delIndApprover()
public
delIndApprover(mixed $user, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
- $user : mixed
- $requestUser : mixed
- $msg : mixed = ''
delIndRecipient()
public
delIndRecipient(mixed $user, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
- $user : mixed
- $requestUser : mixed
- $msg : mixed = ''
delIndReviewer()
public
delIndReviewer(mixed $user, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
- $user : mixed
- $requestUser : mixed
- $msg : mixed = ''
delIndRevisor()
public
delIndRevisor(mixed $user, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
- $user : mixed
- $requestUser : mixed
- $msg : mixed = ''
delRevisor()
Removes a user from the revision workflow
public
delRevisor(object $object, object $requestUser[, mixed $msg = '' ]) : int
This methods behaves differently from one in the other workflows, e.g. SeedDMS_Core_DocumentContent::delIndReviewer, because it also takes into account if the workflow has been started already. A workflow has been started, when there are entries in the revision log. If the revision workflow has not been started, then the user will be silently removed from the list of revisors. If the workflow has started already, then log entry will indicated the removal of the user (just as it is done with the other workflows)
Parameters
- $object : object
-
user/group which is to be removed
- $requestUser : object
-
user requesting the removal
- $msg : mixed = ''
Return values
int —0 if removal was successfull, -1 if an internal error occured, -3 if the user is not in the list of revisors
enterNextState()
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()
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
finishRevision()
Finish a revision workflow
public
finishRevision(object $requestUser, int $docstatus[, string $msg = '' ][, mixed $docmsg = '' ]) : mixed
This function ends a revision This means the log status is set back S_LOG_SLEEPING and the document status is set as passed to the method. The function doesn't not check if all users/groups has made it vote already.
Parameters
- $requestUser : object
-
user requesting the revision start
- $docstatus : int
-
document status
- $msg : string = ''
-
message saved in document status log
- $docmsg : mixed = ''
getAccessMode()
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()
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()
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()
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|nullgetAttribute()
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()
Returns all attributes set for the object
public
getAttributes() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|boolgetAttributeValue()
Returns an attribute value of the object for the given attribute definition
public
getAttributeValue(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
getAttributeValueAsArray()
Returns an attribute value of the object for the given attribute definition
public
getAttributeValueAsArray(SeedDMS_Core_AttributeDefinition $attrdef) : array<string|int, mixed>|bool
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
array<string|int, mixed>|bool —even if the attribute is not defined as multi value
getAttributeValueAsString()
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()
public
getChecksum() : mixed
getComment()
public
getComment() : mixed
getDate()
public
getDate() : mixed
getDMS()
Returns instance of dms
public
getDMS() : SeedDMS_Core_DMS
Return values
SeedDMS_Core_DMSgetDocument()
public
getDocument() : mixed
getFileName()
public
getFileName() : mixed
getFileSize()
public
getFileSize() : mixed
getFileType()
public
getFileType() : mixed
getID()
Returns the internal id of the object
public
getID() : int
Return values
int —id of document/folder
getInstance()
Return an document content by its id
public
static getInstance(int $id, SeedDMS_Core_DMS $dms) : bool|SeedDMS_Core_DocumentContent
Parameters
- $id : int
-
id of document
- $dms : SeedDMS_Core_DMS
Return values
bool|SeedDMS_Core_DocumentContent —instance of SeedDMS_Core_DocumentContent if document content exists, null if document does not exist, false in case of error
getLastWorkflowLog()
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 a workflow set anymore) this function returns the last log entry.
public
getLastWorkflowLog() : object
Return values
objectgetMimeType()
public
getMimeType() : mixed
getOriginalFileName()
public
getOriginalFileName() : mixed
getParentWorkflow()
Run a sub workflow
public
getParentWorkflow() : mixed
getPath()
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
getReceiptLog()
Get the latest entries from the receipt log of the document content
public
getReceiptLog([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 receiptlog entries
getReceiptStatus()
Get the current receipt status of the document content The receipt status is a list of receipts
public
getReceiptStatus([int $limit = 1 ]) : array<string|int, mixed>
Parameters
- $limit : int = 1
-
maximum number of status changes per receiver
Return values
array<string|int, mixed> —list of receipts
getRecipients()
Return a list of all recipients separated by individuals and groups This list will not take the receipt log into account. Therefore it can contain recipients which has actually been deleted as a recipient.
public
getRecipients() : array<string|int, mixed>|bool|null
Return values
array<string|int, mixed>|bool|nullgetReviewers()
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|nullgetReviewLog()
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()
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
getRevisionDate()
public
getRevisionDate() : mixed
getRevisionLog()
Get the latest entries from the revision log of the document content
public
getRevisionLog([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 revisionlog entries
getRevisionStatus()
Get the current revision status of the document content The revision status is a list of revisions If $limit is 1 it will return just the last log entry for each revisor.
public
getRevisionStatus([int $limit = 1 ]) : array<string|int, mixed>
Keep in mind that a revision log may contain repeating revisions.
Parameters
- $limit : int = 1
-
maximum number of records per revisor
Return values
array<string|int, mixed> —list of revisions
getRevisors()
Return a list of all revisors separated by individuals and groups This list will not take the revision log into account. Therefore it can contain revisors which has actually been deleted as a revisor.
public
getRevisors() : array<string|int, mixed>|bool|null
Return values
array<string|int, mixed>|bool|nullgetStatus()
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_IN_REVISION, 4 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()
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()
public
getUser() : mixed
getVersion()
public
getVersion() : mixed
getWorkflow()
Get workflow assigned to the document content
public
getWorkflow([bool $full = false ]) : 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. The methods also sets $this->_workflow['id'] and $this->_workflow['parent']. $this->_workflow['id'] is the id from table tblWorkflowDocumentContent which is used to get log entries for this workflow. This method will only get a currently running workflow in a state. Once a workflow has ended, the current state of the workflow was set to null.
Parameters
- $full : bool = false
-
return not just workflow but the data from tblWorkflowDocumentContent too
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()
Get the so far logged operations on the document content within the workflow. If the document content is currently in a workflow and a transition is passed, then the log entries will be restricted on the workflow and returned as a one dimensional list. Without a running workflow the log entries of all workflows in the past are returned grouped by workflow.
public
getWorkflowLog([mixed $transition = null ]) : array<string|int, mixed>
This result is a two dimensional array. The keys of the first dimension are the ids used in table tblWorkflowDocumentContent. If only the logs of last workflow run are of interesst, then just take the last element of the returned array.
Example: A workflow was started for a document content. This will add an entry in tblWorkflowDocumentContent whose state is set to the initial state of the workflow and a new autoinc id, e.g. with id 45 Once any step in the workflow was triggered, the table tblWorkflowLog will have an entry for workflowdocumentcontent=45. Retrieving the workflow log as long the document is still in the workflow will return the log entries for the current workflow. In this particular case it will be an array with one log entry. Once the workflow has ended this method will still return the log entries but in a 2-dimensional array with the first dimension set to 45.
The same document version can be run through the same or a different workflow again which will lead to a new entry in tblWorkflowDocumentContent, e.g. with id 46. Getting the log entries while the content is still in the workflow will return only those entries for the current workflow. Once the workflow has ended, this methods returns a 2-dimensional array with two elements in the first dimension. One for key 45 and another one for key 46.
Parameters
- $transition : mixed = null
Return values
array<string|int, mixed> —list of objects
getWorkflowState()
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()
Check if this object is of type 'documentcontent'.
public
isType(string $type) : mixed
Parameters
- $type : string
-
type of object
needsWorkflowAction()
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()
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()
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()
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()
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 and set the state to NULL. 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()
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()
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()
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()
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
rewriteReceiptLog()
Rewrites the complete receipt log
public
rewriteReceiptLog(mixed $recipients) : bool
Attention: this function is highly dangerous. It removes an existing receipt log and rewrites it. This method was added for importing an xml dump.
Parameters
- $recipients : mixed
Return values
bool —true on success, otherwise false
rewriteReviewLog()
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
rewriteRevisionLog()
Rewrites the complete revision log
public
rewriteRevisionLog(mixed $revisions) : bool
Attention: this function is highly dangerous. It removes an existing revision log and rewrites it. This method was added for importing an xml dump.
Parameters
- $revisions : mixed
Return values
bool —0 on success, otherwise a negativ error number
rewriteStatusLog()
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()
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()
Run a sub workflow
public
runSubWorkflow(object $subworkflow) : mixed
Parameters
- $subworkflow : object
setApprovalByGrp()
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()
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
Return values
int|bool —new review log id, error code 0 till -4, false in case of an sql error
setAttributeValue()
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()
Set checksum by reading the file
public
setChecksum() : mixed
setComment()
public
setComment(mixed $newComment) : mixed
Parameters
- $newComment : mixed
setDate()
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()
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()
Set file size by reading the file
public
setFileSize() : mixed
setFileType()
Set file type by evaluating the mime type
public
setFileType() : mixed
setMimeType()
public
setMimeType(mixed $newMimetype) : mixed
Parameters
- $newMimetype : mixed
setReceiptByGrp()
Add a receipt to the document content
public
setReceiptByGrp(object $group, object $requestUser, mixed $status, mixed $comment) : int
This method is similar to SeedDMS_Core_DocumentContent::setReceiptByInd() but adds a receipt for a group instead of a user.
Parameters
- $group : object
-
group doing the receipt
- $requestUser : object
-
user asking for the receipt, this is mostly the user currently logged in.
- $status : mixed
- $comment : mixed
Return values
int —new receipt log id
setReceiptByInd()
Add a receipt to the document content
public
setReceiptByInd(object $user, object $requestUser, int $status, mixed $comment) : int
This method will add an entry to the table tblDocumentReceiptLog. It will first check if the user is ment to receipt the document version. If not the return value is -3. Next it will check if the user has been removed from the list of recipients. In that case -4 will be returned. If the given receipt has been set by the user before, it cannot be set again and 0 will be returned. Іf the receipt could be succesfully added, the receiptview log id will be returned.
Parameters
- $user : object
-
user doing the receipt
- $requestUser : object
-
user asking for the receipt, this is mostly
- $status : int
-
the status of the receipt, possible values are 0=unprocessed (may be used to reset a status) 1=received, -1=rejected, -2=user is deleted (use {link SeedDMS_Core_DocumentContent::delIndRecipient} instead) the user currently logged in.
- $comment : mixed
Tags
Return values
int —new receipt log id
setReviewByGrp()
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()
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
Return values
int|bool —new review log id, error code 0 till -4, false in case of an sql error
setRevision()
Add a revision to the document content
public
setRevision(mixed $object, object $requestUser, int $status, mixed $comment) : int
This method will add an entry to the table tblDocumentRevisionLog. It will first check if the user is ment to revision the document version. If not the return value is -3. Next it will check if the user has been removed from the list of recipients. In that case -4 will be returned. If the given revision has been set by the user before, it cannot be set again and 0 will be returned. Іf the revision could be succesfully added, the revision log id will be returned.
Parameters
- $object : mixed
- $requestUser : object
-
user asking for the revision, this is mostly the user currently logged in.
- $status : int
-
the status of the revision, possible values are 0=unprocessed (may be used to reset a status) 1=revised, -2=user is deleted (use {link SeedDMS_Core_DocumentContent::delIndRecipient} instead) -3=workflow revision is sleeping
- $comment : mixed
Tags
Return values
int —new revision log id, 0, or a value < 0. 0 means the status has not changed because the new status is equal the current status. A value < 0 indicate an error. -1: internal error, -3: user may not revise this document -4: the user has been removed from the list of revisors, -5: the revision has not been started at all.
setRevisionByGrp()
public
setRevisionByGrp(mixed $group, mixed $requestUser, mixed $status, mixed $comment) : mixed
Parameters
- $group : mixed
- $requestUser : mixed
- $status : mixed
- $comment : mixed
setRevisionByInd()
public
setRevisionByInd(mixed $user, mixed $requestUser, mixed $status, mixed $comment) : mixed
Parameters
- $user : mixed
- $requestUser : mixed
- $status : mixed
- $comment : mixed
setRevisionDate()
public
setRevisionDate([mixed $date = false ]) : mixed
Parameters
- $date : mixed = false
setStatus()
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()
Assign a workflow to a document content
public
setWorkflow(object $workflow, mixed $user) : mixed
Parameters
- $workflow : object
- $user : mixed
setWorkflowState()
Set state of workflow assigned to the document content
public
setWorkflowState(object $state) : mixed
Parameters
- $state : object
startRevision()
Start a new revision workflow
public
startRevision(object $requestUser[, string $msg = '' ]) : mixed
This function starts a new revision unless there are users/groups having finished the previous revision. This means the log status must be S_LOG_SLEEPING or the user/group was removed (S_LOG_USER_REMOVED)
Parameters
- $requestUser : object
-
user requesting the revision start
- $msg : string = ''
-
message saved for the initial log message
triggerWorkflowTransition()
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()
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()
Recalculate the status of a document
public
verifyStatus([bool $ignorecurrentstatus = false ][, object $user = null ][, string $msg = '' ][, int $initialstatus = S_RELEASED ]) : 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, S_NEEDS_CORRECTION 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. The $initialstatus can be set, to define the status set when no other status is set. This happens if the document has no
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
- $initialstatus : int = S_RELEASED
-
status to be set if no other status is set
__getDir()
getDir and the corresponding database table field are deprecated
private
__getDir() : mixed