Index: course/modduplicate.php
===================================================================
--- course/modduplicate.php (revision 16884)
+++ course/modduplicate.php (revision )
@@ -54,6 +54,20 @@
$output = $PAGE->get_renderer('core', 'backup');
+$a = new stdClass();
+$a->modtype = get_string('modulename', $cm->modname);
+$a->modname = format_string($cm->name);
+
+if (!plugin_supports('mod', $cm->modname, FEATURE_BACKUP_MOODLE2)) {
+ echo $output->header();
+ echo $output->notification(get_string('duplicatenosupport', 'core', $a));
+ echo $output->continue_button(
+ new moodle_url('/course/view.php#section-' . $cm->sectionnum, array('id' => $course->id))
+ );
+ echo $output->footer();
+ die;
+}
+
// backup the activity
$bc = new backup_controller(backup::TYPE_1ACTIVITY, $cm->id, backup::FORMAT_MOODLE,
@@ -125,10 +139,6 @@
fulldelete($backupbasepath);
}
-$a = new stdClass();
-$a->modtype = get_string('modulename', $cm->modname);
-$a->modname = format_string($cm->name);
-
echo $output->header();
if ($newcmid) {
Index: lang/en/moodle.php
===================================================================
--- lang/en/moodle.php (revision 16884)
+++ lang/en/moodle.php (revision )
@@ -465,6 +465,7 @@
$string['duplicateconfirm'] = 'Are you sure you want to duplicate {$a->modtype} \'{$a->modname}\' ?';
$string['duplicatecontcourse'] = 'Return to the course';
$string['duplicatecontedit'] = 'Edit the new copy';
+$string['duplicatenosupport'] = '\'{$a->modname}\' activity could not be duplicated because the {$a->modtype} module does not support backup and restore.';
$string['duplicatesuccess'] = '{$a->modtype} \'{$a->modname}\' has been duplicated successfully';
$string['duplicatinga'] = 'Duplicating: {$a}';
$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.';
Index: course/lib.php
===================================================================
--- course/lib.php (revision 16884)
+++ course/lib.php (revision )
@@ -3262,6 +3262,14 @@
$plugins .= $function($mod);
}
}
+ if (plugin_supports('mod', $mod->modname, FEATURE_BACKUP_MOODLE2)) {
+ $duplicate = '
'."\n";
+ } else {
+ $duplicate = '';
+ }
return ''."\n".$leftright.$move.
@@ -3269,10 +3277,7 @@
'&sesskey='.$sesskey.$section.'">
'."\n".
- '
'."\n".
+ $duplicate.
' . ')