Permalink
Browse files

MDL-35238 Admin renderer method to display the plugin update confirma…

…tion page
  • Loading branch information...
1 parent bcc8397 commit 6aa2e2881a12beb69b3f3249d4c4b71a171911a7 @mudrd8mz mudrd8mz committed Oct 7, 2012
Showing with 57 additions and 0 deletions.
  1. +54 −0 admin/renderer.php
  2. +3 −0 lang/en/plugin.php
View
@@ -234,6 +234,60 @@ public function upgrade_plugin_check_page(plugin_manager $pluginman, available_u
return $output;
}
+ /**
+ * Prints a page with a summary of plugin deployment to be confirmed.
+ *
+ * @param available_update_deployer $deployer
+ * @param array $data deployer's data package as returned by {@link available_update_deployer::submitted_data()}
+ * @return string
+ */
+ public function upgrade_plugin_confirm_deploy_page(available_update_deployer $deployer, array $data) {
+
+ if (!$deployer->initialized()) {
+ throw new coding_exception('Unable to render a page for non-initialized deployer.');
+ }
+
+ if (empty($data['updateinfo'])) {
+ throw new coding_exception('Missing required data component.');
+ }
+
+ $updateinfo = $data['updateinfo'];
+
+ $output = '';
+ $output .= $this->header();
+ $output .= $this->container_start('generalbox', 'notice');
+
+ $a = new stdClass();
+ if (get_string_manager()->string_exists('pluginname', $updateinfo->component)) {
+ $a->name = get_string('pluginname', $updateinfo->component);
+ } else {
+ $a->name = $updateinfo->component;
+ }
+
+ if (isset($updateinfo->release)) {
+ $a->version = $updateinfo->release . ' (' . $updateinfo->version . ')';
+ } else {
+ $a->version = $updateinfo->version;
+ }
+ $a->url = $updateinfo->download;
+
+ $output .= $this->output->heading(get_string('updatepluginconfirm', 'core_plugin'));
+ $output .= $this->output->container(format_text(
+ get_string('updatepluginconfirminfo', 'core_plugin', $a) . PHP_EOL . PHP_EOL .
+ get_string('updatepluginconfirmwarning', 'core_plugin')
+ ));
+
+ $widget = $deployer->make_execution_widget($data['updateinfo']);
+ $output .= $this->output->render($widget);
+
+ $output .= $this->output->single_button($data['returnurl'], get_string('cancel', 'core'), 'get');
+
+ $output .= $this->container_end();
+ $output .= $this->footer();
+
+ return $output;
+ }
+
/**
* Display the admin notifications page.
* @param int $maturity
View
@@ -131,6 +131,9 @@
$string['updateavailable'] = 'There is a new version {$a} available!';
$string['updateavailable_moreinfo'] = 'More info...';
$string['updateavailable_release'] = 'Release {$a}';
+$string['updatepluginconfirm'] = 'Plugin update confirmation';
+$string['updatepluginconfirminfo'] = 'You are about to install a new version of the plugin <strong>{$a->name}</strong>. A zip package with version {$a->version} of the plugin will be downloaded from <a href="{$a->url}">{$a->url}</a> and extracted to your Moodle installation so it can upgrade your installation.';
+$string['updatepluginconfirmwarning'] = 'Please note that Moodle will not automatically make a backup of your database before the upgrade. We strongly recommend that you make a full snapshot backup now, to cope with the rare case that the new code has bugs that make your site unavailable or even corrupts your database. Proceed at your own risk.';
$string['uninstall'] = 'Uninstall';
$string['version'] = 'Version';
$string['versiondb'] = 'Current version';

0 comments on commit 6aa2e28

Please sign in to comment.