MDL-83008 course: make subection completion not editable
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
issueNumber: MDL-83008
|
||||
notes:
|
||||
core_completion:
|
||||
- message: >
|
||||
A new FEATURE_COMPLETION plugin support constant has been added. In the
|
||||
future, this constant will be used to indicate when a plugin does not
|
||||
allow completion and it is enabled by default.
|
||||
type: improved
|
||||
@@ -276,6 +276,9 @@ class manager {
|
||||
*/
|
||||
public static function can_edit_bulk_completion($courseorid, $cm = null) {
|
||||
if ($cm) {
|
||||
if (!plugin_supports('mod', $cm->modname, FEATURE_COMPLETION, true)) {
|
||||
return false;
|
||||
}
|
||||
return $cm->uservisible && has_capability('moodle/course:manageactivities', $cm->context);
|
||||
}
|
||||
$coursecontext = context_course::instance(is_object($courseorid) ? $courseorid->id : $courseorid);
|
||||
|
||||
@@ -425,6 +425,8 @@ define('FEATURE_CONTROLS_GRADE_VISIBILITY', 'controlsgradevisbility');
|
||||
/** True if module supports plagiarism plugins */
|
||||
define('FEATURE_PLAGIARISM', 'plagiarism');
|
||||
|
||||
/** True if module supports completion (true by default) */
|
||||
define('FEATURE_COMPLETION', 'completion_enabled');
|
||||
/** True if module has code to track whether somebody viewed it */
|
||||
define('FEATURE_COMPLETION_TRACKS_VIEWS', 'completion_tracks_views');
|
||||
/** True if module has custom completion rules */
|
||||
|
||||
@@ -37,6 +37,7 @@ function subsection_supports($feature) {
|
||||
FEATURE_GROUPS => false,
|
||||
FEATURE_GROUPINGS => false,
|
||||
FEATURE_MOD_INTRO => false,
|
||||
FEATURE_COMPLETION => false,
|
||||
FEATURE_COMPLETION_TRACKS_VIEWS => false,
|
||||
FEATURE_GRADE_HAS_GRADE => false,
|
||||
FEATURE_GRADE_OUTCOMES => false,
|
||||
|
||||
@@ -16,9 +16,10 @@ Feature: Subsection does not have completion.
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber | section |
|
||||
| subsection | Subsection 1 | C1 | subsection1 | 1 |
|
||||
| page | Page in Subsection 1 | C1 | page1 | 2 |
|
||||
| activity | name | course | idnumber | section |
|
||||
| wiki | Wiki activity | C1 | subsection1 | 1 |
|
||||
| subsection | Subsection 1 | C1 | subsection1 | 1 |
|
||||
| page | Page in Subsection | C1 | page1 | 2 |
|
||||
|
||||
Scenario: Subsection does not appear in the site default completion form
|
||||
Given I log in as "admin"
|
||||
@@ -35,3 +36,15 @@ Feature: Subsection does not have completion.
|
||||
And I should see "Default activity completion"
|
||||
Then I should see "Forum" in the "region-main" "region"
|
||||
And I should not see "Subsection" in the "region-main" "region"
|
||||
|
||||
@javascript
|
||||
Scenario: Subsection completion should not be editable in the completion bulk edit
|
||||
Given I am on the "C1" "Course" page logged in as "teacher1"
|
||||
When I navigate to "Course completion" in current page administration
|
||||
And I set the field "Course completion tertiary navigation" to "Bulk edit activity completion"
|
||||
And I should see "Bulk edit activity completion"
|
||||
Then I should see "Wiki activity" in the "region-main" "region"
|
||||
Then I should see "Page in Subsection" in the "region-main" "region"
|
||||
# It appears as a subsection but not as an editable element.
|
||||
Then I should see "Subsection 1" in the "region-main" "region"
|
||||
And "Subsection 1" "link" in the "region-main" "region" should not be visible
|
||||
|
||||
Reference in New Issue
Block a user