\WorkflowRequest
A "workflow request" represents a full review process for one set of changes to a single page.
Only one workflow request can be active for any given page; however, a page may have a number
of historical, closed workflow requests.
The WorkflowRequest object shouldn't be directly edited. Instead, you call "workflow step"
methods on the object, that will update the object appropriately.
To create or retrieve a WorkflowRequest object, call or on the relevant object.
The following examples show how a workflow can be created.
Request publication:
<code>
$wf = $page->openOrNewWorkflowRequest('WorkflowPublicationRequest')
$wf->request("Can you please publish this page");
</code>
Reject changes:
<code>
$wf = $page->openWorkflowRequest()
$wf->deny("It's not acceptable. Please correct the spelling.");
</code>
Approve changes:
<code>
$wf = $page->openWorkflowRequest()
$wf->approve("Thanks, looks good now");
</code>
Make the changes 'go live' changes:
<code>
$wf = $page->openWorkflowRequest()
$wf->action();
</code>
will provide a list of the changes that the workflow has gone through,
suitable for presentation as a discussion thread attached to the page.
Synopsis
- // members
- public static array $db = ;
- public static array $has_one = ;
- public static array $has_many = ;
- public static array $many_many = ;
- public static boolean $allow_deny = true;
- public static $alerts = NULL;
- public static boolean $enable_all_alerts = false;
- protected array $memberIdsEmailed = ;
- protected static boolean $publisher_can_create_wf_requests = true;
- protected static boolean $force_publishers_to_use_workflow = false;
- // methods
- public static boolean|WorkflowPublicationRequest create_for_page()
- public static void should_send_alert()
- public static void set_alert()
- public static void load_default_alerts()
- public void set_publisher_can_create_wf_requests()
- public static void set_force_publishers_to_use_workflow()
- public boolean request()
- public void comment()
- public boolean requestedit()
- public boolean deny()
- public boolean cancel()
- public WorkflowRequestChange addNewChange()
- public void getCMSFields()
- public void ApprovalDate()
- public void getCMSDetailFields()
- public void EmbargoField()
- public void ExpiryField()
- public void getEmbargoDate()
- public void getExpiryDate()
- public void ExpiryDate()
- public void WorkflowTimezone()
- public void CanChangeEmbargoExpiry()
- public void notifyDenied()
- public void notifyCancelled()
- public void notifyAwaitingEdit()
- public void sendNotificationEmail()
- protected void ActionOnPage()
- public final void addMemberEmailed()
- public final DataObjectSet getMembersEmailed()
- public final void clearMembersEmailed()
- public void Diff()
- public void fromRecord()
- public void toRecord()
- public boolean isOpen()
- protected string getDiffLinkToLastPublished()
- public static boolean can_create()
- public static DataObjectSet get_by_author()
- public static DataObjectSet get()
- public string getTitle()
- public string getStatusDescription()
- public static void get_status_description()
- public void fieldLabels()
- public void provideI18nEntities()
- public void setSchedule()
Hierarchy
Extends
- DataObject
Implements
- i18nEntityProvider
Tasks
Line | Task |
---|---|
645+ | Make the generation of this syntax use translatable. |
645+ | Get the generation out of here. The message that is displayed for any given operation should be generated by the operation, not centralised here. This logic assumes a certain syntax of the sentence, which assumes a modification to the page. |
Members
protected
- $force_publishers_to_use_workflow
- $memberIdsEmailed
-
$publisher_can_create_wf_requests
Set this to true if publishers and admins can request new workflows.
public
-
$alerts
Control who gets alerts for certain events data structure is fairly self-explanitory self::$alerts[CLASS][EVENT][USERROLE] = boolean Not all event/role combinations are neccessairily implemented by all ApprovalPaths. - $allow_deny
- $db
- $enable_all_alerts
- $has_many
- $has_one
- $many_many
Methods
protected
- ActionOnPage() — Work out the phrase of what has happened to the page. This is sensitive to the type of request, the person making the change and the action they invoked. This allows us to send more descriptive emails. The cases specifically handled: - if an author has deleted a page => "deleted the page" - if a publisher or approver has denied deletion of a page => "undeleted the page" - otherwise => "made changes to"
- getDiffLinkToLastPublished() — Returns a CMS link to see differences made in the request
public
- ApprovalDate()
- CanChangeEmbargoExpiry() — Return true/false whether we can currently change the PublishAt time
- Diff() — Returns a {@link DataDifferencer} object representing the changes. Has some nasty logic to make it so that only changes that are made through fields that are exposed by the CMS are tracked.
- EmbargoField() — Return the field used for setting Embargo/Expiry date.
- ExpiryDate()
- ExpiryField()
- WorkflowTimezone()
- addMemberEmailed() — Add a member to the 'i've emailed them' list
- addNewChange() — Create a new {@link WorkflowRequestChange} with the current page status and versions, and link it to this object.
- can_create() — Determines if a request can be created by an author for a specific page.
- cancel() — Cancel this request, notify interested parties and close it. Used by {@link LeftAndMainCMSWorkflow} and {@link SiteTreeCMSWorkflow}.
- clearMembersEmailed() — Clear the list of people emailed this http request
- comment() — Comment on a workflow item without changing the status
- create_for_page() — Factory method setting up a new WorkflowRequest with associated state. Sets relations to publishers and authors,
- deny() — Deny this request, notify interested parties and close it. Used by {@link LeftAndMainCMSWorkflow} and {@link SiteTreeCMSWorkflow}.
- fieldLabels()
- fromRecord() — Returns the old record that will be replaced by this publication.
- get() — Get publication requests from all users
- getCMSDetailFields()
- getCMSFields()
- getEmbargoDate()
- getExpiryDate()
- getMembersEmailed() — Get a list of people emails this http request
- getStatusDescription()
- getTitle()
- get_status_description()
- isOpen() — Is the workflow request still pending.
- load_default_alerts()
- notifyAwaitingEdit()
- notifyCancelled()
- notifyDenied()
- provideI18nEntities()
- request() — Approve this request, notify interested parties and close it. Used by {@link LeftAndMainCMSWorkflow} and {@link SiteTreeCMSWorkflow}.
- requestedit() — Request an edit to this page before it can be published.
- sendNotificationEmail()
- setSchedule()
- set_alert()
- set_force_publishers_to_use_workflow() — Set this to true to force publishers to use the "Request publication" button, rather than "Save & Publish". Workflow admins won't be affected by this change.
- set_publisher_can_create_wf_requests()
- should_send_alert() — Should we send an email to the following group under these circumstances. Default to false.
- toRecord() — Returns the new record for which publication is being requested.