diff --git a/admin/reports.php b/admin/reports.php index e03c9282993..00e9a69b1e3 100644 --- a/admin/reports.php +++ b/admin/reports.php @@ -33,40 +33,6 @@ require_once($CFG->libdir.'/tablelib.php'); admin_externalpage_setup('managereports'); -$delete = optional_param('delete', '', PARAM_PLUGIN); -$confirm = optional_param('confirm', '', PARAM_BOOL); - -/// If data submitted, then process and store. - -if (!empty($delete) and confirm_sesskey()) { - echo $OUTPUT->header(); - echo $OUTPUT->heading(get_string('reports')); - - if (!$confirm) { - if (get_string_manager()->string_exists('pluginname', 'report_' . $delete)) { - $strpluginname = get_string('pluginname', 'report_' . $delete); - } else { - $strpluginname = $delete; - } - echo $OUTPUT->confirm(get_string('reportsdeleteconfirm', 'admin', $strpluginname), - new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)), - $PAGE->url); - echo $OUTPUT->footer(); - die(); - - } else { - uninstall_plugin('report', $delete); - $a = new stdclass(); - $a->name = $delete; - $pluginlocation = get_plugin_types(); - $a->directory = $pluginlocation['report'] . '/' . $delete; - echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess'); - echo $OUTPUT->continue_button($PAGE->url); - echo $OUTPUT->footer(); - die(); - } -} - echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('reports')); @@ -104,8 +70,10 @@ foreach ($installed as $config) { } foreach ($plugins as $plugin => $name) { - $delete = new moodle_url($PAGE->url, array('delete' => $plugin, 'sesskey' => sesskey())); - $delete = html_writer::link($delete, get_string('delete')); + $delete = ''; + if ($deleteurl = plugin_manager::instance()->get_uninstall_url('report_'.$plugin)) { + $delete = html_writer::link($deleteurl, get_string('delete')); + } if (!isset($versions[$plugin])) { if (file_exists("$CFG->dirroot/report/$plugin/version.php")) { diff --git a/lang/en/admin.php b/lang/en/admin.php index b20082ff50b..40c6eceec89 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -907,7 +907,6 @@ $string['releasenoteslink'] = 'For information about this version of Moodle, ple $string['rememberusername'] = 'Remember username'; $string['rememberusername_desc'] = 'Enable if you want to store permanent cookies with usernames during user login. Permanent cookies may be considered a privacy issue if used without consent.'; $string['reportsmanage'] = 'Manage reports'; -$string['reportsdeleteconfirm'] = 'You are about to completely delete the report \'{$a}\'. This will completely delete everything in the database associated with this plugin. Are you SURE you want to continue?'; $string['requiredentrieschanged'] = '<strong>IMPORTANT - PLEASE READ<br/>(This warning message will only be displayed during this upgrade)</strong><br/>Due to a bug fix, the behaviour of database activities using the \'Required entries\' and \'Required entries before viewing settings\' settings will change. A more detailed explanation of the changes can be read on <a href="http://moodle.org/mod/forum/discuss.php?d=110928" target="_blank">the database module forum</a>. The expected behavior of these settings can also be read on <a href="http://docs.moodle.org/en/Adding/editing_a_database#Required_entries" target="_blank">Moodle Docs</a>. <br/><br/>This change affects the following databases in your system: (Please save this list now, and after the upgrade, check that these activities still work the way that the teacher intends.)<br/><strong>{$a->text}</strong><br/>'; $string['requiremodintro'] = 'Require activity description'; diff --git a/lib/pluginlib.php b/lib/pluginlib.php index a99150b8e1a..e0f421702ae 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -3883,10 +3883,6 @@ class plugininfo_report extends plugininfo_base { public function is_uninstall_allowed() { return true; } - - public function get_uninstall_url() { - return new moodle_url('/admin/reports.php', array('delete' => $this->name, 'sesskey' => sesskey())); - } } @@ -3895,8 +3891,8 @@ class plugininfo_report extends plugininfo_base { */ class plugininfo_local extends plugininfo_base { - public function get_uninstall_url() { - return new moodle_url('/admin/localplugins.php', array('delete' => $this->name, 'sesskey' => sesskey())); + public function is_uninstall_allowed() { + return true; } }