From 194342144bbfee1c14d46872604dada8a34feb6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Sun, 7 Oct 2012 20:01:14 +0200 Subject: [PATCH] MDL-35814 improve confirmation when deleting enrol instances --- enrol/instances.php | 6 +++++- lang/en/enrol.php | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/enrol/instances.php b/enrol/instances.php index 8b8d55851fb..ac4db48e665 100644 --- a/enrol/instances.php +++ b/enrol/instances.php @@ -105,7 +105,11 @@ if ($canconfig and $action and confirm_sesskey()) { $yesurl = new moodle_url('/enrol/instances.php', array('id'=>$course->id, 'action'=>'delete', 'instance'=>$instance->id, 'confirm'=>1,'sesskey'=>sesskey())); $displayname = $plugin->get_instance_name($instance); $users = $DB->count_records('user_enrolments', array('enrolid'=>$instance->id)); - $message = get_string('deleteinstanceconfirm', 'enrol', array('name'=>$displayname, 'users'=>$users)); + if ($users) { + $message = markdown_to_html(get_string('deleteinstanceconfirm', 'enrol', array('name'=>$displayname, 'users'=>$users))); + } else { + $message = markdown_to_html(get_string('deleteinstancenousersconfirm', 'enrol', array('name'=>$displayname))); + } echo $OUTPUT->confirm($message, $yesurl, $PAGE->url); echo $OUTPUT->footer(); die(); diff --git a/lang/en/enrol.php b/lang/en/enrol.php index 48baef73014..3b36f34ac7a 100644 --- a/lang/en/enrol.php +++ b/lang/en/enrol.php @@ -35,7 +35,10 @@ $string['configenrolplugins'] = 'Please select all required plugins and arrange $string['custominstancename'] = 'Custom instance name'; $string['defaultenrol'] = 'Add instance to new courses'; $string['defaultenrol_desc'] = 'It is possible to add this plugin to all new courses by default.'; -$string['deleteinstanceconfirm'] = 'Do you really want to delete enrol plugin instance "{$a->name}" with {$a->users} enrolled users?'; +$string['deleteinstanceconfirm'] = 'Do you really want to delete enrol plugin instance "{$a->name}"? + +All {$a->users} users currently enrolled via this instance will be unenrolled and course-related data including users\' grades, group membership or forum subscriptions may be deleted.'; +$string['deleteinstancenousersconfirm'] = 'Do you really want to delete enrol plugin instance "{$a->name}"?'; $string['durationdays'] = '{$a} days'; $string['enrol'] = 'Enrol'; $string['enrolcandidates'] = 'Not enrolled users';