Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-tool_lifecycle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-tool_lifecycle
Commits
df0626a6
Commit
df0626a6
authored
6 years ago
by
Yorick Reum
Browse files
Options
Downloads
Patches
Plain Diff
made disabling action work (with confirm step)
parent
2897c5c2
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/manager/workflow_manager.php
+27
-0
27 additions, 0 deletions
classes/manager/workflow_manager.php
workflowsettings.php
+6
-2
6 additions, 2 deletions
workflowsettings.php
with
33 additions
and
2 deletions
classes/manager/workflow_manager.php
+
27
−
0
View file @
df0626a6
...
...
@@ -196,6 +196,7 @@ class workflow_manager {
*/
public
static
function
handle_action
(
$action
,
$workflowid
)
{
global
$OUTPUT
;
$confirm
=
optional_param
(
'confirm'
,
0
,
PARAM_BOOL
);
if
(
$action
===
ACTION_WORKFLOW_ACTIVATE
)
{
self
::
activate_workflow
(
$workflowid
);
}
...
...
@@ -208,6 +209,21 @@ class workflow_manager {
if
(
$action
===
ACTION_WORKFLOW_DUPLICATE
)
{
self
::
duplicate_workflow
(
$workflowid
);
}
if
(
$action
===
ACTION_WORKFLOW_DISABLE
)
{
if
(
$confirm
and
confirm_sesskey
())
{
self
::
disable
(
$workflowid
);
}
else
{
self
::
render_demand_confirm
(
$action
,
$workflowid
,
get_string
(
'disableworkflow_confirm'
,
'tool_lifecycle'
));
}
}
if
(
$action
===
ACTION_WORKFLOW_ABORTDISABLE
)
{
if
(
$confirm
and
confirm_sesskey
())
{
self
::
abortprocesses
(
$workflowid
);
self
::
disable
(
$workflowid
);
}
else
{
self
::
render_demand_confirm
(
$action
,
$workflowid
,
get_string
(
'abortdisableworkflow_confirm'
,
'tool_lifecycle'
));
}
}
if
(
$action
===
ACTION_WORKFLOW_DELETE
)
{
if
(
self
::
is_active
(
$workflowid
))
{
echo
$OUTPUT
->
notification
(
get_string
(
'active_workflow_not_removeable'
,
'tool_lifecycle'
)
...
...
@@ -219,6 +235,17 @@ class workflow_manager {
}
}
private
static
function
render_demand_confirm
(
$action
,
$workflowid
,
$message
)
{
global
$OUTPUT
,
$PAGE
;
$yesurl
=
new
\moodle_url
(
$PAGE
->
url
,
array
(
'workflowid'
=>
$workflowid
,
'action'
=>
$action
,
'sesskey'
=>
sesskey
(),
'confirm'
=>
1
));
$nourl
=
new
\moodle_url
(
'/admin/tool/lifecycle/adminsettings.php'
);
$output
=
$OUTPUT
->
header
();
$output
.
=
$OUTPUT
->
confirm
(
$message
,
$yesurl
,
$nourl
);
$output
.
=
$OUTPUT
->
footer
();
echo
$output
;
}
/**
* Changes the sortindex of a workflow by swapping it with another.
* @param int $workflowid id of the workflow
...
...
This diff is collapsed.
Click to expand it.
workflowsettings.php
+
6
−
2
View file @
df0626a6
...
...
@@ -41,5 +41,9 @@ if (!$workflow) {
$workflowsettings
=
new
tool_lifecycle\workflow_settings
(
$workflowid
);
// Execute the controller.
$workflowsettings
->
execute
(
optional_param
(
'action'
,
null
,
PARAM_TEXT
),
optional_param
(
'subplugin'
,
null
,
PARAM_INT
));
\ No newline at end of file
// @TODO what's the purpose of subplugin? why not workflowid?
$subplugin
=
optional_param
(
'subplugin'
,
null
,
PARAM_INT
);
if
(
$subplugin
==
null
&&
$workflowid
)
{
$subplugin
=
$workflowid
;
}
$workflowsettings
->
execute
(
optional_param
(
'action'
,
null
,
PARAM_TEXT
),
$subplugin
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment