From e3723892512ef4d0a5f4dfbb9c1b2b53646f5cfb Mon Sep 17 00:00:00 2001 From: Rohan Khajuria Date: Mon, 10 Sep 2018 15:02:00 -0700 Subject: [PATCH] MDL-59227 course: add (copy) to duplicated modules --- backup/util/ui/tests/behat/duplicate_activities.feature | 3 ++- course/lib.php | 3 +++ lang/en/moodle.php | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/backup/util/ui/tests/behat/duplicate_activities.feature b/backup/util/ui/tests/behat/duplicate_activities.feature index 1207eb77b15..40a65dc53bd 100644 --- a/backup/util/ui/tests/behat/duplicate_activities.feature +++ b/backup/util/ui/tests/behat/duplicate_activities.feature @@ -20,12 +20,13 @@ Feature: Duplicate activities | Name | Test database name | | Description | Test database description | And I duplicate "Test database name" activity + And I should see "Test database name (copy)" And I wait until section "1" is available And I click on "Edit settings" "link" in the "Test database name" activity And I set the following fields to these values: | Name | Original database name | And I press "Save and return to course" - And I click on "Edit settings" "link" in the "Test database name" activity + And I click on "Edit settings" "link" in the "Test database name (copy)" activity And I set the following fields to these values: | Name | Duplicated database name | | Description | Duplicated database description | diff --git a/course/lib.php b/course/lib.php index aba5bdc9d54..2b95f097290 100644 --- a/course/lib.php +++ b/course/lib.php @@ -3469,6 +3469,9 @@ function duplicate_module($course, $cm) { $newcm = get_fast_modinfo($cm->course)->get_cm($newcmid); $event = \core\event\course_module_created::create_from_cm($newcm); $event->trigger(); + + // Add ' (copy)' to duplicates. + set_coursemodule_name($newcm->id, get_string('duplicatedmodule', 'moodle', $newcm->name)); } return isset($newcm) ? $newcm : null; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index a854d1978e5..1680fc196bf 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -537,6 +537,7 @@ $string['downloadtext'] = 'Download in text format'; $string['doyouagree'] = 'Have you read these conditions and understood them?'; $string['droptoupload'] = 'Drop files here to upload'; $string['duplicate'] = 'Duplicate'; +$string['duplicatedmodule'] = '{$a} (copy)'; $string['edhelpaspellpath'] = 'To use spell-checking within the editor, you MUST have aspell 0.50 or later installed on your server, and you must specify the correct path to access the aspell binary. On Unix/Linux systems, this path is usually /usr/bin/aspell, but it might be something else.'; $string['edhelpbgcolor'] = 'Define the edit area\'s background color.
Valid values are, for example: #FFFFFF or white'; $string['edhelpcleanword'] = 'This setting enables or disables Word-specific format filtering.';