Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-theme_boost_campus
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-theme_boost_campus
Commits
99e5a868
Commit
99e5a868
authored
4 years ago
by
Alexander Bias
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix: Unrestricted self enrolment hint did not respect existing but disabled enrolment instances.
parent
b6fb4cbd
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGES.md
+4
-0
4 additions, 0 deletions
CHANGES.md
classes/output/core_renderer.php
+5
-1
5 additions, 1 deletion
classes/output/core_renderer.php
tests/behat/theme_boost_campus_course_layout_settings.feature
+104
-6
104 additions, 6 deletions
...s/behat/theme_boost_campus_course_layout_settings.feature
with
113 additions
and
7 deletions
CHANGES.md
+
4
−
0
View file @
99e5a868
...
...
@@ -4,6 +4,10 @@ moodle-theme_boost_campus
Changes
-------
### Unreleased
*
2021-03-13 - Bugfix: Unrestricted self enrolment hint did not respect existing but disabled enrolment instances.
### v3.10-r3
*
2021-02-05 - Improvement: Add missing catch branch in Back-to-top button JS
...
...
This diff is collapsed.
Click to expand it.
classes/output/core_renderer.php
+
5
−
1
View file @
99e5a868
...
...
@@ -257,7 +257,11 @@ class core_renderer extends \core_renderer {
// Get the active enrol instances for this course.
$enrolinstances
=
enrol_get_instances
(
$COURSE
->
id
,
true
);
foreach
(
$enrolinstances
as
$instance
)
{
if
(
$instance
->
enrol
==
'self'
&&
empty
(
$instance
->
password
)
&&
empty
(
$instance
->
enrolenddate
))
{
// Check if unrestricted self enrolment is possible.
$now
=
(
new
\DateTime
(
"now"
,
\core_date
::
get_server_timezone_object
()))
->
getTimestamp
();
if
(
$instance
->
enrol
==
'self'
&&
empty
(
$instance
->
password
)
&&
$instance
->
customint6
==
1
&&
(
empty
(
$instance
->
enrolenddate
)
||
$instance
->
enrolenddate
>
$now
)
&&
(
empty
(
$instance
->
enrolstartdate
)
||
$instance
->
enrolstartdate
<
$now
))
{
if
(
empty
(
$instance
->
name
))
{
$selfenrolinstances
[
$instance
->
id
]
=
get_string
(
'pluginname'
,
'enrol_self'
)
.
" ("
.
get_string
(
'defaultcoursestudent'
,
'core'
)
.
")"
;
...
...
This diff is collapsed.
Click to expand it.
tests/behat/theme_boost_campus_course_layout_settings.feature
+
104
−
6
View file @
99e5a868
...
...
@@ -138,7 +138,7 @@ Feature: Configuring the theme_boost_campus plugin for the "Course Layout settin
Then I should not see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\""
And
".course-selfenrol-infobox"
"css_element"
should not exist
Scenario
:
Enable "Show hint for unrestricted self enrolment and check that it
hides when password or end dat
e is
set"
Scenario
:
Enable "Show hint for unrestricted self enrolment
"
and check that it
is hidden when new enrolments ar
e
d
is
abled
Given the following config values are set as admin
:
|
config
|
value
|
plugin
|
|
showhintcourseselfenrol
|
yes
|
theme_boost_campus
|
...
...
@@ -153,25 +153,123 @@ Feature: Configuring the theme_boost_campus plugin for the "Course Layout settin
And
".course-selfenrol-infobox"
"css_element"
should exist
When
I click on
"enrolment settings"
"link"
in the
".course-selfenrol-infobox"
"css_element"
And I set the following fields to these values
:
|
Allow
new
enrolments
|
0
|
And
I
press
"Save
changes"
And
I am on
"Course 1"
course homepage
Then I should not see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\""
And
".course-selfenrol-infobox"
"css_element"
should not exist
Scenario
:
Enable "Show hint for unrestricted self enrolment" and check that it is hidden when a password is set
Given the following config values are set as admin
:
|
config
|
value
|
plugin
|
|
showhintcourseselfenrol
|
yes
|
theme_boost_campus
|
When
I log in as
"teacher1"
And
I am on
"Course 1"
course homepage
Then I should not see "This course is currently visible and an unrestricted self enrolment is active
:
"
And
".course-selfenrol-infobox"
"css_element"
should not exist
And
I navigate to
"Users > Enrolment methods"
in current page administration
When
I click on
"Enable"
"link"
in the
"Self enrolment (Student)"
"table_row"
And
I am on
"Course 1"
course homepage
Then I should see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\"."
And
".course-selfenrol-infobox"
"css_element"
should exist
When
I click on
"enrolment settings"
"link"
in the
".course-selfenrol-infobox"
"css_element"
And I set the following fields to these values
:
|
Enrolment
key
|
1234
|
And
I
press
"Save
changes"
And
I am on
"Course 1"
course homepage
Then I should not see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\""
And
".course-selfenrol-infobox"
"css_element"
should not exist
Scenario
:
Enable "Show hint for unrestricted self enrolment and check that it is hidden when appropriate start and / or end dates are set"
Given the following config values are set as admin
:
|
config
|
value
|
plugin
|
|
showhintcourseselfenrol
|
yes
|
theme_boost_campus
|
When
I log in as
"teacher1"
And
I am on
"Course 1"
course homepage
Then I should not see "This course is currently visible and an unrestricted self enrolment is active
:
"
And
".course-selfenrol-infobox"
"css_element"
should not exist
And
I navigate to
"Users > Enrolment methods"
in current page administration
When
I click on
"Enable"
"link"
in the
"Self enrolment (Student)"
"table_row"
And
I am on
"Course 1"
course homepage
Then I should see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\"."
And
".course-selfenrol-infobox"
"css_element"
should exist
When
I click on
"enrolment settings"
"link"
in the
".course-selfenrol-infobox"
"css_element"
And I set the following fields to these values
:
|
id_enrolstartdate_enabled
|
0
|
|
id_enrolenddate_enabled
|
1
|
|
id_enrolenddate
|
##yesterday## |
And
I press
"Save changes"
And
I am on
"Course 1"
course homepage
Then I should not see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\""
And
".course-selfenrol-infobox"
"css_element"
should not exist
When
I navigate to
"Users > Enrolment methods"
in current page administration
And
I click on
"Edit"
"link"
in the
"Self enrolment (Student)"
"table_row"
And I set the following fields to these values
:
|
id_enrolstartdate_enabled
|
0
|
|
id_enrolenddate_enabled
|
1
|
|
id_enrolenddate
|
##tomorrow## |
And
I press
"Save changes"
And
I am on
"Course 1"
course homepage
Then I should see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\"."
And
".course-selfenrol-infobox"
"css_element"
should exist
When
I navigate to
"Users > Enrolment methods"
in current page administration
And
I click on
"Edit"
"link"
in the
"Self enrolment (Student)"
"table_row"
And I set the following fields to these values
:
|
id_enrolstartdate_enabled
|
1
|
|
id_enrolstartdate
|
##yesterday## |
|
id_enrolenddate_enabled
|
0
|
And
I press
"Save changes"
And
I am on
"Course 1"
course homepage
Then I should see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\"."
And
".course-selfenrol-infobox"
"css_element"
should exist
When
I click on
"enrolment settings"
"link"
in the
".course-selfenrol-infobox"
"css_element"
When
I navigate to
"Users > Enrolment methods"
in current page administration
And
I click on
"Edit"
"link"
in the
"Self enrolment (Student)"
"table_row"
And I set the following fields to these values
:
|
Enrolment
key
|
1234
|
|
id_enrolstartdate_enabled
|
1
|
|
id_enrolstartdate
|
##tomorrow## |
|
id_enrolenddate_enabled
|
0
|
And
I press
"Save changes"
And
I am on
"Course 1"
course homepage
Then I should not see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\""
Then I should not see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\"."
And
".course-selfenrol-infobox"
"css_element"
should not exist
When
I navigate to
"Users > Enrolment methods"
in current page administration
And
I click on
"Edit"
"link"
in the
"Self enrolment (Student)"
"table_row"
And I set the following fields to these values
:
|
id_enrolstartdate_enabled
|
1
|
|
id_enrolstartdate
|
##Monday next week## |
|
id_enrolenddate_enabled
|
1
|
|
id_enrolenddate
|
##Tuesday next week## |
And
I press
"Save changes"
And
I am on
"Course 1"
course homepage
Then I should not see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\"."
And
".course-selfenrol-infobox"
"css_element"
should not exist
When
I navigate to
"Users > Enrolment methods"
in current page administration
And
I click on
"Edit"
"link"
in the
"Self enrolment (Student)"
"table_row"
And I set the following fields to these values
:
|
id_enrolstartdate_enabled
|
1
|
|
id_enrolstartdate
|
##yesterday## |
|
id_enrolenddate_enabled
|
1
|
|
id_enrolenddate
|
##tomorrow## |
And
I press
"Save changes"
And
I am on
"Course 1"
course homepage
Then I should see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\"."
And
".course-selfenrol-infobox"
"css_element"
should exist
When
I navigate to
"Users > Enrolment methods"
in current page administration
And
I click on
"Edit"
"link"
in the
"Self enrolment (Student)"
"table_row"
And I set the following fields to these values
:
|
id_enrolstartdate_enabled
|
1
|
|
id_enrolstartdate
|
##3 days ago## |
|
id_enrolenddate_enabled
|
1
|
|
id_enrolenddate
|
##2 days ago## |
And
I press
"Save changes"
And
I am on
"Course 1"
course homepage
Then I should not see "This course is currently visible and an unrestricted self enrolment is active
:
\"Self
enrolment
(Student)\"."
And
".course-selfenrol-infobox"
"css_element"
should not exist
Scenario
:
Enable "Show hint for unrestricted self enrolment and add more than one self enrolment instance"
...
...
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