1 | <?php |
||
25 | class WorkflowActionInstance extends DataObject |
||
26 | { |
||
27 | private static $db = array( |
||
|
|||
28 | 'Comment' => 'Text', |
||
29 | 'Finished' => 'Boolean' |
||
30 | ); |
||
31 | |||
32 | private static $has_one = array( |
||
33 | 'Workflow' => WorkflowInstance::class, |
||
34 | 'BaseAction' => WorkflowAction::class, |
||
35 | 'Member' => Member::class, |
||
36 | ); |
||
37 | |||
38 | private static $summary_fields = array( |
||
39 | 'BaseAction.Title', |
||
40 | 'Comment', |
||
41 | 'Created', |
||
42 | 'Member.Name', |
||
43 | ); |
||
44 | |||
45 | private static $table_name = 'WorkflowActionInstance'; |
||
46 | |||
47 | public function fieldLabels($includerelations = true) |
||
58 | |||
59 | /** |
||
60 | * Gets fields for when this is part of an active workflow |
||
61 | */ |
||
62 | public function updateWorkflowFields($fields) |
||
81 | |||
82 | public function updateFrontendWorkflowFields($fields) |
||
94 | |||
95 | /** |
||
96 | * Gets Front-End DataObject |
||
97 | * |
||
98 | * Use the DataObject as defined in the WorkflowAction, otherwise fall back to the |
||
99 | * context object. |
||
100 | * |
||
101 | * Useful for situations where front end workflow deals with multiple data objects |
||
102 | * |
||
103 | * @return DataObject |
||
104 | */ |
||
105 | public function getFrontEndDataObject() |
||
118 | |||
119 | public function updateFrontEndWorkflowActions($actions) |
||
127 | |||
128 | public function getRequiredFields() |
||
139 | |||
140 | public function setFrontendFormRequirements() |
||
148 | |||
149 | public function doFrontEndAction(array $data, Form $form, HTTPRequest $request) |
||
162 | |||
163 | |||
164 | /** |
||
165 | * Gets the title of this active action instance |
||
166 | * |
||
167 | * @return string |
||
168 | */ |
||
169 | public function getTitle() |
||
173 | |||
174 | /** |
||
175 | * Returns all the valid transitions that lead out from this action. |
||
176 | * |
||
177 | * This is called if this action has finished, and the workflow engine wants |
||
178 | * to run the next action. |
||
179 | * |
||
180 | * If this action returns only one valid transition it will be immediately |
||
181 | * followed; otherwise the user will decide which transition to follow. |
||
182 | * |
||
183 | * @return ArrayList |
||
184 | */ |
||
185 | public function getValidTransitions() |
||
204 | |||
205 | /** |
||
206 | * Called when this instance is started within the workflow |
||
207 | */ |
||
208 | public function actionStart(WorkflowTransition $transition) |
||
212 | |||
213 | /** |
||
214 | * Called when this action has been completed within the workflow |
||
215 | */ |
||
216 | public function actionComplete(WorkflowTransition $transition) |
||
222 | |||
223 | |||
224 | /** |
||
225 | * Can documents in the current workflow state be edited? |
||
226 | * |
||
227 | * @param DataObject $target |
||
228 | * @return bool |
||
229 | */ |
||
230 | public function canEditTarget(DataObject $target) |
||
246 | |||
247 | /** |
||
248 | * Does this action restrict viewing of the document? |
||
249 | * |
||
250 | * @param DataObject $target |
||
251 | * @return bool |
||
252 | */ |
||
253 | public function canViewTarget(DataObject $target) |
||
257 | |||
258 | /** |
||
259 | * Does this action restrict the publishing of a document? |
||
260 | * |
||
261 | * @param DataObject $target |
||
262 | * @return bool |
||
263 | */ |
||
264 | public function canPublishTarget(DataObject $target) |
||
272 | |||
273 | public function canView($member = null) |
||
277 | |||
278 | public function canEdit($member = null) |
||
282 | |||
283 | public function canDelete($member = null) |
||
287 | } |
||
288 |