diff --git a/admin/tool/monitor/lang/en/tool_monitor.php b/admin/tool/monitor/lang/en/tool_monitor.php index 7e8d4bf5fa9..25b2198115a 100644 --- a/admin/tool/monitor/lang/en/tool_monitor.php +++ b/admin/tool/monitor/lang/en/tool_monitor.php @@ -82,7 +82,8 @@ $string['norules'] = 'There are no event monitoring rules.'; $string['pluginname'] = 'Event monitor'; $string['processevents'] = 'Process events'; $string['rulename'] = 'Rule name'; -$string['ruleareyousure'] = 'Are you sure you want to delete rule "{$a}"?'; +$string['ruleareyousure'] = 'Are you sure you want to delete the rule "{$a}"?'; +$string['ruleareyousureextra'] = 'There are {$a} subscription(s) to this rule that will also be deleted.'; $string['rulecopysuccess'] = 'Rule successfully duplicated'; $string['ruledeletesuccess'] = 'Rule successfully deleted'; $string['rulehelp'] = 'Rule details'; @@ -91,9 +92,9 @@ $string['rulenopermissions'] = 'You do not have permissions to "{$a} a rule"'; $string['rulescansubscribe'] = 'Rules you can subscribe to'; $string['selectacourse'] = 'Select a course'; $string['selectcourse'] = 'Visit this report at course level to get a list of possible modules'; -$string['subareyousure'] = 'Are you sure you want to delete this subscription for the rule "{$a}"?'; -$string['subcreatesuccess'] = "Subscription successfully created"; -$string['subdeletesuccess'] = "Subscription successfully removed"; +$string['subareyousure'] = 'Are you sure you want to delete the subscription to the rule "{$a}"?'; +$string['subcreatesuccess'] = 'Subscription successfully created'; +$string['subdeletesuccess'] = 'Subscription successfully removed'; $string['subhelp'] = 'Subscription details'; $string['subhelp_help'] = 'This subscription listens for when the event \'{$a->eventname}\' has been triggered in \'{$a->moduleinstance}\' {$a->frequency} time(s) in {$a->minutes} minute(s).'; $string['subscribeto'] = 'Subscribe to rule "{$a}"'; diff --git a/admin/tool/monitor/managerules.php b/admin/tool/monitor/managerules.php index 62957fcdade..acfaef20239 100644 --- a/admin/tool/monitor/managerules.php +++ b/admin/tool/monitor/managerules.php @@ -94,8 +94,12 @@ if (!empty($action) && $ruleid) { $rule->delete_rule(); echo $OUTPUT->notification(get_string('ruledeletesuccess', 'tool_monitor'), 'notifysuccess'); } else { - echo $OUTPUT->confirm(get_string('ruleareyousure', 'tool_monitor', $rule->get_name($context)), - $confirmurl, $cancelurl); + $strconfirm = get_string('ruleareyousure', 'tool_monitor', $rule->get_name($context)); + if ($numberofsubs = $DB->count_records('tool_monitor_subscriptions', array('ruleid' => $ruleid))) { + $strconfirm .= '
'; + $strconfirm .= get_string('ruleareyousureextra', 'tool_monitor', $numberofsubs); + } + echo $OUTPUT->confirm($strconfirm, $confirmurl, $cancelurl); echo $OUTPUT->footer(); exit(); }