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
a1166edf
Unverified
Commit
a1166edf
authored
1 year ago
by
Justus Dieckmann
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Hide menu when there is no manual workflow (#195)
Co-authored-by:
Justus Dieckmann
<
justusdieckmann@wwu.de
>
parent
421cc45b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
classes/local/manager/workflow_manager.php
+12
-0
12 additions, 0 deletions
classes/local/manager/workflow_manager.php
db/caches.php
+5
-0
5 additions, 0 deletions
db/caches.php
lib.php
+12
-3
12 additions, 3 deletions
lib.php
version.php
+1
-1
1 addition, 1 deletion
version.php
with
30 additions
and
4 deletions
classes/local/manager/workflow_manager.php
+
12
−
0
View file @
a1166edf
...
...
@@ -244,6 +244,14 @@ class workflow_manager {
$transaction
->
allow_commit
();
}
/**
* Resets the 'does a manual workflow exist?'-cache.
*/
private
static
function
reset_manual_workflow_cache
()
{
$cache
=
\cache
::
make
(
'tool_lifecycle'
,
'application'
);
$cache
->
delete
(
'manualworkflowexists'
);
}
/**
* Handles an action of the subplugin_settings.
*
...
...
@@ -260,6 +268,7 @@ class workflow_manager {
}
if
(
$action
===
action
::
WORKFLOW_ACTIVATE
)
{
self
::
activate_workflow
(
$workflowid
);
self
::
reset_manual_workflow_cache
();
}
else
if
(
$action
===
action
::
UP_WORKFLOW
)
{
self
::
change_sortindex
(
$workflowid
,
true
);
}
else
if
(
$action
===
action
::
DOWN_WORKFLOW
)
{
...
...
@@ -270,10 +279,12 @@ class workflow_manager {
self
::
backup_workflow
(
$workflowid
);
}
else
if
(
$action
===
action
::
WORKFLOW_DISABLE
)
{
self
::
disable
(
$workflowid
);
self
::
reset_manual_workflow_cache
();
return
;
// Return, since we do not want to redirect outside to deactivated workflows.
}
else
if
(
$action
===
action
::
WORKFLOW_ABORTDISABLE
)
{
self
::
disable
(
$workflowid
);
self
::
abortprocesses
(
$workflowid
);
self
::
reset_manual_workflow_cache
();
return
;
// Return, since we do not want to redirect outside to deactivated workflows.
}
else
if
(
$action
===
action
::
WORKFLOW_ABORT
)
{
self
::
abortprocesses
(
$workflowid
);
...
...
@@ -283,6 +294,7 @@ class workflow_manager {
if
(
self
::
get_workflow
(
$workflowid
)
&&
self
::
is_removable
(
$workflowid
))
{
self
::
remove
(
$workflowid
);
self
::
reset_manual_workflow_cache
();
}
else
{
\core\notification
::
add
(
get_string
(
'workflow_not_removeable'
,
'tool_lifecycle'
)
,
\core\notification
::
WARNING
);
...
...
This diff is collapsed.
Click to expand it.
db/caches.php
+
5
−
0
View file @
a1166edf
...
...
@@ -28,4 +28,9 @@ $definitions = [
'mformdata'
=>
[
'mode'
=>
cache_store
::
MODE_SESSION
,
],
'application'
=>
[
'mode'
=>
cache_store
::
MODE_APPLICATION
,
'simplekeys'
=>
true
,
'simpledata'
=>
true
]
];
This diff is collapsed.
Click to expand it.
lib.php
+
12
−
3
View file @
a1166edf
...
...
@@ -32,7 +32,7 @@
* @throws moodle_exception
*/
function
tool_lifecycle_extend_navigation_course
(
$navigation
,
$course
,
$context
)
{
global
$PAGE
;
global
$DB
,
$PAGE
;
// Only add this settings item on non-site course pages.
if
(
!
$PAGE
->
course
||
$PAGE
->
course
->
id
==
SITEID
)
{
...
...
@@ -43,8 +43,17 @@ function tool_lifecycle_extend_navigation_course($navigation, $course, $context)
return
null
;
}
$url
=
null
;
$settingnode
=
null
;
$cache
=
cache
::
make
(
'tool_lifecycle'
,
'application'
);
if
(
$cache
->
has
(
'manualworkflowexists'
))
{
$manualwfexists
=
$cache
->
get
(
'manualworkflowexists'
);
}
else
{
$manualwfexists
=
$DB
->
record_exists_select
(
'tool_lifecycle_workflow'
,
'manual = 1 AND timeactive IS NOT NULL'
);
$cache
->
set
(
'manualworkflowsexist'
,
$manualwfexists
);
}
if
(
!
$manualwfexists
)
{
return
null
;
}
$url
=
new
moodle_url
(
'/admin/tool/lifecycle/view.php'
,
[
'contextid'
=>
$context
->
id
,
...
...
This diff is collapsed.
Click to expand it.
version.php
+
1
−
1
View file @
a1166edf
...
...
@@ -25,7 +25,7 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
;
$plugin
->
maturity
=
MATURITY_BETA
;
$plugin
->
version
=
202
30502
00
;
$plugin
->
version
=
202
40220
00
;
$plugin
->
component
=
'tool_lifecycle'
;
$plugin
->
requires
=
2020061500
;
// Requires Moodle 3.9+.
$plugin
->
release
=
'v4.2-r1'
;
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