Squiz Matrix
4.12.2
|
Public Member Functions | |
Workflow_Manager () | |
allowsWorkflow ($assetid) | |
getSchemas ($assetid, $granted=NULL, $running=FALSE, $cascades=NULL) | |
getAssetSchemaInfo ($assetid, $schemaid=NULL, $cascades=NULL, $include_cascades=TRUE, $include_last_started_by=FALSE) | |
setSchema ($assetid, $schemaid, $granted, $cascades=TRUE, $force_set=FALSE) | |
deleteSchema ($assetid, $schemaid, $running=TRUE) | |
getSchemaWorkflows ($assetid, $schemaid='all') | |
setWorkflow ($assetid, $workflow) | |
whoCanPublish ($assetid, $schemaid=NULL, $group=FALSE) | |
notifyOnLive ($assetid, $old_status) | |
requiresComment ($assetid, $userid) | |
_whoCanPublishWorkflow ($assetid, $schemaid) | |
_loadCurrentStep (&$workflow) | |
recordPublish ($assetid, $publisher) | |
testPublish ($assetid, $publisher, $stream_name='') | |
_recordPublish (&$workflow, $publisherid, $assetid) | |
generateWorkflowArray ($assetid, $streamid) | |
startWorkflow ($assetid, $auto_approve=TRUE, $base_msg=NULL, $stream_name=NULL) | |
isWorkflowComplete ($assetid) | |
getWorkflowCurrentSteps ($assetid) | |
cancelWorkflow ($assetid, $base_msg=NULL) | |
completeWorkflow ($assetid) | |
_clearWorkflow ($assetid) | |
purgeWorkflow ($assetid) | |
silentWorkflowParty ($assetid) | |
escalateWorkflow ($assetid, $schemaid) | |
& | getCurrentStepArray (&$workflow, $current_step=NULL) |
& | getCurrentStep (&$workflow, $current_step=NULL) |
getStreams ($schemaid, $ignore_default=FALSE) | |
getBypassableStreams ($assetid, $schemaid, $current_userid=NULL) | |
getDefaultStream ($schemaids) | |
getStreamByName ($schemaids, $stream_name) | |
setStartingStream ($assetid, $stream_name) | |
getStartingStream ($assetid) | |
addMessageReplacements ($asset, $subject, $body, &$replacements) | |
setCurrentUserAsLastStarted ($userid, $assetid) | |
Public Member Functions inherited from MySource_Object | |
MySource_Object () | |
__sleep () | |
__wakeup () | |
Data Fields | |
$_valid_logic_with_right_operand = Array('>=') | |
$_valid_step_logic = Array('>=' => 'At least', 'all' => 'All') | |
$_valid_cond_logic = Array('>=' => 'At least', 'all' => 'All') | |
Data Fields inherited from MySource_Object | |
$_tmp | |
Definition at line 31 of file workflow_manager.inc.
_clearWorkflow | ( | $assetid | ) |
Clears all generated workflow arrays from the workflow table for the passed assetID
int | $assetid | the ID of the asset to clear workflow for |
Definition at line 2083 of file workflow_manager.inc.
_loadCurrentStep | ( | & | $workflow | ) |
Goes through the passed workflow array and sets what step we are up to
array | &$workflow | the workflow we are working out the current step for |
Definition at line 872 of file workflow_manager.inc.
_recordPublish | ( | & | $workflow, |
$publisherid, | |||
$assetid | |||
) |
Changes the passed workflow to indicate that a user has approved the asset
Returns TRUE if the publisher was able to publish and thus that the passed workflow has actually changed - FALSE otherwise. This code is abstracted from RecordPublish so it can be used by testPublish
array | &$workflow | the workflow add approval to |
int | $publisherid | the ID of the user who has approved |
int | $assetid | the ID of the asset being published |
Definition at line 1464 of file workflow_manager.inc.
_whoCanPublishWorkflow | ( | $assetid, | |
$schemaid | |||
) |
Returns an array of all users who can publish the running workflow for the passed schemaID
The publishers are based on the current step in the workflow so the users returned are only users who will affect the workflow at this point
int | $assetid | the ID of the asset to get publishers for |
int | $schemaid | the id of the schema to find publishers for |
Definition at line 781 of file workflow_manager.inc.
addMessageReplacements | ( | $asset, | |
$subject, | |||
$body, | |||
& | $replacements | ||
) |
Add keyword values for the given $asset to the $replacements array by extracting any extra keywords found in the $subject and $body.
object | $asset | The asset in workflow to get keyword replacements from |
string | $subject | The message subject |
string | $body | The message body |
array | $replacements | The keywords and their replacement values |
Definition at line 2776 of file workflow_manager.inc.
allowsWorkflow | ( | $assetid | ) |
Check if workflow can be set on an asset
string | $assetid | the ID of the asset to check |
Definition at line 74 of file workflow_manager.inc.
cancelWorkflow | ( | $assetid, | |
$base_msg = NULL |
|||
) |
Cancel the currently running workflows for the passed asset
int | $assetid | the ID of the asset to cancel workflow for |
object | $msg | an internal message to be sent instead of the default |
Definition at line 1901 of file workflow_manager.inc.
completeWorkflow | ( | $assetid | ) |
Completes the workflow by clearing out all the running workflows from the DB
int | $assetid | the ID of the asset to complete workflow for |
Definition at line 2061 of file workflow_manager.inc.
deleteSchema | ( | $assetid, | |
$schemaid, | |||
$running = TRUE |
|||
) |
Remove a set schema from an asset
int | $assetid | the ID of the asset to delete the schema from |
int | $schemaid | the ID of the schema to delete |
boolean | $running | whether to check if the asset has running schemas |
Definition at line 341 of file workflow_manager.inc.
escalateWorkflow | ( | $assetid, | |
$schemaid | |||
) |
Escalates workflow
If there are escalation steps, move to them. If not, move to sibling.
int | $assetid | the ID of the asset who's workflow is being escalated |
int | $schemaid | The ID of the schema being escalated |
Definition at line 2178 of file workflow_manager.inc.
generateWorkflowArray | ( | $assetid, | |
$streamid | |||
) |
Generate an array representing the workflow structure for a STREAM at this point in time
The generated array is a snap shot of the schema at a point in time that can get written to the database and used for publishing etc.
int | $assetid | the ID of the asset to generate the file for |
int | $streamid | the ID of the stream |
Definition at line 1567 of file workflow_manager.inc.
getAssetSchemaInfo | ( | $assetid, | |
$schemaid = NULL , |
|||
$cascades = NULL , |
|||
$include_cascades = TRUE , |
|||
$include_last_started_by = FALSE |
|||
) |
Get list of schemas for a certain asset, optionally filtered by cascading setting
This is primarily used for showing settings on the Metadata Schemas screen.
int | $assetid | the ID of the asset |
int | $schemaid | the ID of the schema |
boolean | $cascades | limit to cascades setting : null = all, true = on, false = off |
boolean | $include_cascades | include schema cascades info |
boolean | $include_last_started_by | include schema last_started_by info |
Definition at line 169 of file workflow_manager.inc.
getBypassableStreams | ( | $assetid, | |
$schemaid, | |||
$current_userid = NULL |
|||
) |
Get a list of stream IDs that could bypass workflow for the passed asset and user
string | $assetid | ID of the asset being tested |
string | $schemaid | ID of the schema whose streams are being tested |
string | $current_userid | Test with this user, or NULL for current user |
Definition at line 2613 of file workflow_manager.inc.
& getCurrentStep | ( | & | $workflow, |
$current_step = NULL |
|||
) |
Returns a reference to the current or specified step
array | &$workflow | the workflow we are searching in |
array | $current_step | the address of the desired step |
Definition at line 2560 of file workflow_manager.inc.
& getCurrentStepArray | ( | & | $workflow, |
$current_step = NULL |
|||
) |
Returns an array of workflow steps containing the current or specified step and it's siblings
array | &$workflow | the workflow we are searching in |
array | $current_step | the address of the desired step |
Definition at line 2534 of file workflow_manager.inc.
getDefaultStream | ( | $schemaids | ) |
Returns the default stream for a certain schema or set of schemas
If sent an array of schema IDs, the return value will be an array of (schema ID => stream ID). If a single schema ID, the return will be a scalar asset ID (string) value.
mixed | array|string $schemaids Schema ID(s) to search |
Definition at line 2644 of file workflow_manager.inc.
getSchemas | ( | $assetid, | |
$granted = NULL , |
|||
$running = FALSE , |
|||
$cascades = NULL |
|||
) |
Get an array of schemaIDs for all schemas applied and denied on an asset Can also optionally get running workflows only.
Return value: Array( schemaid => granted[1|0] ) if $granted is null OR array(schemaid) if it is set
int | $assetid | the ID of the asset to get schemas for |
boolean | $granted | type of access : null = all, true = applied, false = denied |
boolean | $running | only getting running workflows |
Definition at line 96 of file workflow_manager.inc.
getSchemaWorkflows | ( | $assetid, | |
$schemaid = 'all' |
|||
) |
Get the workflow values set for an asset on a particular schema or all schemas
Return value: Array( schemaid => workflow_array )
int | $assetid | the ID of the asset to get workflow for |
int | $schemaid | the ID of the schema to get workflow for ('all' or omit for all workflows) |
Definition at line 400 of file workflow_manager.inc.
getStartingStream | ( | $assetid | ) |
Return a set starting stream name
string | $schemaid | The asset to get the starting stream name for |
Definition at line 2757 of file workflow_manager.inc.
getStreamByName | ( | $schemaids, | |
$stream_name | |||
) |
Returns the list of streams matching a defined stream name
If a stream name does not exist for a passed schema, it will use the default stream for these.
If sent an array of schema IDs, the return value will be an array of (schema ID => stream ID). If a single schema ID, the return will be a scalar asset ID (string) value.
mixed | array|string $schemaids Schema ID(s) to search | |
string | $stream_name | Stream name to search for |
Definition at line 2686 of file workflow_manager.inc.
getStreams | ( | $schemaid, | |
$ignore_default = FALSE |
|||
) |
Returns a list of streams attached to a certain schema
Returned array is in format (streamid => stream name)
string | $schemaid | Schema ID to search |
boolean | $ignore_default | TRUE = ignore the default stream: only alternate streams are returned |
Definition at line 2583 of file workflow_manager.inc.
getWorkflowCurrentSteps | ( | $assetid | ) |
Get the currently running steps of the workflow array, keyed by schema ID
int | $assetid | the ID of the asset to check workflow completness for |
Definition at line 1873 of file workflow_manager.inc.
isWorkflowComplete | ( | $assetid | ) |
Starts workflow by writing out all workflow arrays to the workflow table for the passed assetID
int | $assetid | the ID of the asset to check workflow completness for |
Definition at line 1848 of file workflow_manager.inc.
notifyOnLive | ( | $assetid, | |
$old_status | |||
) |
Notifies people in the workflow that want to know when the asset goes live
int | $assetid | the ID of the asset that has gone live |
int | $old_status | the status the asset is changing from |
Definition at line 580 of file workflow_manager.inc.
purgeWorkflow | ( | $assetid | ) |
Deletes any workflow entries that this asset has
string | $assetid | the asset id |
Definition at line 2122 of file workflow_manager.inc.
recordPublish | ( | $assetid, | |
$publisher | |||
) |
Changes the running workflows for an asset to indicate that a user has approved the asset
int | $assetid | the ID of the asset to set the approval for |
int | $publisher | the ID of the user who has approved |
Definition at line 1034 of file workflow_manager.inc.
requiresComment | ( | $assetid, | |
$userid | |||
) |
Determines whether commenting is mandatory for a particular user
string | $assetid | the ID of the asset to check |
string | $userid | the ID of the user to check |
Definition at line 704 of file workflow_manager.inc.
setCurrentUserAsLastStarted | ( | $userid, | |
$assetid | |||
) |
When the user is directly approving the asset changes without having to initiate the workflow, we need to set this user id as the value for 'last_started_by' col in the sq_ast_wflow table to prevent the issue cause in Bug #5871 Matrix emailing the workflow initiator from previous workflow process when asset pushed to Live.
string | $userid | userid to set 'last_started_by' col value in db |
string | $assetid | id of the asset we are changing the status |
Definition at line 2809 of file workflow_manager.inc.
setSchema | ( | $assetid, | |
$schemaid, | |||
$granted, | |||
$cascades = TRUE , |
|||
$force_set = FALSE |
|||
) |
Apply a schema to or Deny from, an asset
int | $assetid | the ID of the asset to set the schema on |
int | $schemaid | the ID of the schema to set |
boolean | $granted | is this schema applied (TRUE) or denied (FALSE)? |
boolean | $force_set | if true, existing workflow schemas will be updated regardless of whether or not the new workflow schemas are found to conflict with them |
Definition at line 235 of file workflow_manager.inc.
setStartingStream | ( | $assetid, | |
$stream_name | |||
) |
Set an stream to use when starting the workflow for a certain asset
This is to get around coupling issues - since the POST var handling should be at the Details static screen level, but the starting of workflow happens at status change level - and there is no way to pass extra data to a status change.
It is intended to be called immediately before starting workflow. This only has effect for the request, and is cleared when workflow is actually started.
It can still be overridden by sending a stream ID to startWorkflow().
If streamid is NULL, the set stream will be cleared, and the default stream will be used instead.
string | $assetid | The asset to set a starting stream for |
string | $stream_name | The stream to set as "active". NULL to clear. |
Definition at line 2743 of file workflow_manager.inc.
setWorkflow | ( | $assetid, | |
$workflow | |||
) |
Set workflow values for an asset
int | $assetid | the ID of the asset to set the values for |
array | $workflow | the values to set |
Definition at line 470 of file workflow_manager.inc.
silentWorkflowParty | ( | $assetid | ) |
Check if the passed assetid is a silent party in the worflow process
For example, when pulling a standard page through workflow, the bodycopy is a silent party because it cannot be shared and so has the same admins as the standard page. However, any tables can be shared and so they are not silent parties.
int | $assetid | the ID of the asset to check |
Definition at line 2157 of file workflow_manager.inc.
startWorkflow | ( | $assetid, | |
$auto_approve = TRUE , |
|||
$base_msg = NULL , |
|||
$stream_name = NULL |
|||
) |
Starts workflow by writing out all workflow arrays to the workflow table for the passed assetID
int | $assetid | the ID of the asset to start workflow for |
boolean | $auto_approve | register that the current user has approed the workflow once it has been started |
object | $msg | an internal message to be sent instead of the default |
Definition at line 1613 of file workflow_manager.inc.
testPublish | ( | $assetid, | |
$publisher, | |||
$stream_name = '' |
|||
) |
Pretend this user has approved the workflow to see if the workflow process will be completed
Use this to find out if the user is allowed to live edit.
If workflow has not started, it will test whether a user can approve a workflow simply by starting it. In this case, usually workflow can be bypassed completely (notwithstanding other roadblocks, such as incomplete metadata).
If a workflow schema contains multiple streams, it can test either a single stream or ALL of them (again, presuming workflow has not started). By default, it will test the default stream. If all streams are tested, it will only return TRUE if ALL of them are able to be completed.
int | $assetid | the ID of the asset to set the approval for |
int | $publisher | the ID of the user who we are testing approval for |
string | $stream_name | the name of the stream to test. NULL to test ALL streams. '' to test default stream. Only applicable when workflow has not started. |
Definition at line 1369 of file workflow_manager.inc.
whoCanPublish | ( | $assetid, | |
$schemaid = NULL , |
|||
$group = FALSE |
|||
) |
Returns an array of all users who can publish one of the running workflows
The publishers are based on the current step in the workflow so the users returned are only users who will affect the workflow at this point.
int | $assetid | the ID of the asset to get publishers for |
int | $schemaid | the schema to get publishers for |
boolean | $group | group the return value by workflowid |
Definition at line 543 of file workflow_manager.inc.
Workflow_Manager | ( | ) |
Constructor
Definition at line 60 of file workflow_manager.inc.