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
710308f9
Commit
710308f9
authored
3 years ago
by
Justus Dieckmann
Browse files
Options
Downloads
Patches
Plain Diff
Make active workflows editable
parent
c14be4fe
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
adminlib.php
+1
-1
1 addition, 1 deletion
adminlib.php
classes/local/manager/settings_manager.php
+16
-4
16 additions, 4 deletions
classes/local/manager/settings_manager.php
step/lib.php
+10
-0
10 additions, 0 deletions
step/lib.php
trigger/lib.php
+10
-0
10 additions, 0 deletions
trigger/lib.php
with
37 additions
and
5 deletions
adminlib.php
+
1
−
1
View file @
710308f9
...
...
@@ -639,7 +639,7 @@ class workflow_settings {
}
if
(
!
empty
(
$data
->
id
))
{
$step
=
step_manager
::
get_step_instance
(
$data
->
id
);
if
(
$data
->
instancename
)
{
if
(
isset
(
$data
->
instancename
)
)
{
$step
->
instancename
=
$data
->
instancename
;
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
classes/local/manager/settings_manager.php
+
16
−
4
View file @
710308f9
...
...
@@ -23,6 +23,7 @@
*/
namespace
tool_lifecycle\local\manager
;
use
tool_lifecycle
\local\entity\workflow
;
use
tool_lifecycle\settings_type
;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
...
...
@@ -63,8 +64,6 @@ class settings_manager {
global
$DB
;
self
::
validate_type
(
$type
);
// TODO before PR merges: Saveguard for changing settings
if
(
!
$data
)
{
return
;
}
...
...
@@ -76,8 +75,12 @@ class settings_manager {
if
(
$type
==
settings_type
::
TRIGGER
)
{
$lib
=
lib_manager
::
get_trigger_lib
(
$subpluginname
);
$trigger
=
trigger_manager
::
get_instance
(
$instanceid
);
$wfeditable
=
workflow_manager
::
is_editable
(
$trigger
->
workflowid
);
}
else
{
$lib
=
lib_manager
::
get_step_lib
(
$subpluginname
);
$step
=
step_manager
::
get_step_instance
(
$instanceid
);
$wfeditable
=
workflow_manager
::
is_editable
(
$step
->
workflowid
);
}
$settingsfields
=
$lib
->
instance_settings
();
...
...
@@ -85,6 +88,9 @@ class settings_manager {
throw
new
\moodle_exception
(
'id of the step instance has to be set!'
);
}
foreach
(
$settingsfields
as
$setting
)
{
if
(
!
$wfeditable
&&
!
$setting
->
editable
)
{
continue
;
}
if
(
array_key_exists
(
$setting
->
name
,
$data
))
{
$value
=
$data
[
$setting
->
name
];
// Needed for editor support.
...
...
@@ -107,8 +113,14 @@ class settings_manager {
'name'
=>
$setting
->
name
)
);
if
(
$record
)
{
if
(
$record
->
value
!=
$cleanedvalue
)
{
$oldvalue
=
$record
->
value
;
$record
->
value
=
$cleanedvalue
;
$DB
->
update_record
(
'tool_lifecycle_settings'
,
$record
);
if
(
!
$wfeditable
)
{
$lib
->
on_setting_changed
(
$setting
->
name
,
$cleanedvalue
,
$oldvalue
);
}
}
}
else
{
$newrecord
=
new
\stdClass
();
$newrecord
->
instanceid
=
$instanceid
;
...
...
This diff is collapsed.
Click to expand it.
step/lib.php
+
10
−
0
View file @
710308f9
...
...
@@ -107,6 +107,16 @@ abstract class libbase {
return
array
();
}
/**
* Is called when a setting is changed after a workflow is activated.
* @param string $settingname name of the setting
* @param mixed $newvalue the new value
* @param mixed $oldvalue the old value
*/
public
function
on_setting_changed
(
$settingname
,
$newvalue
,
$oldvalue
)
{
}
/**
* This method can be overriden, to add form elements to the form_step_instance.
* It is called in definition().
...
...
This diff is collapsed.
Click to expand it.
trigger/lib.php
+
10
−
0
View file @
710308f9
...
...
@@ -53,6 +53,16 @@ abstract class base {
return
array
();
}
/**
* Is called when a setting is changed after a workflow is activated.
* @param string $settingname name of the setting
* @param mixed $newvalue the new value
* @param mixed $oldvalue the old value
*/
public
function
on_setting_changed
(
$settingname
,
$newvalue
,
$oldvalue
)
{
}
/**
* This method can be overriden, to add form elements to the form_step_instance.
* It is called in definition().
...
...
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