/** * Helper method to render the information about the available plugin update * * @param core_plugin_manager $pluginman plugin manager instance * @param \core\update\info $updateinfo information about the available update for the plugin */ protected function plugin_available_update_info(core_plugin_manager $pluginman, \core\update\info $updateinfo) { $boxclasses = 'pluginupdateinfo'; $info = array(); if (isset($updateinfo->release)) { $info[] = html_writer::div(get_string('updateavailable_release', 'core_plugin', $updateinfo->release), 'info release'); } if (isset($updateinfo->maturity)) { $info[] = html_writer::div(get_string('maturity' . $updateinfo->maturity, 'core_admin'), 'info maturity'); $boxclasses .= ' maturity' . $updateinfo->maturity; } if (isset($updateinfo->download)) { $info[] = html_writer::div(html_writer::link($updateinfo->download, get_string('download')), 'info download'); } if (isset($updateinfo->url)) { $info[] = html_writer::div(html_writer::link($updateinfo->url, get_string('updateavailable_moreinfo', 'core_plugin')), 'info more'); } $box = html_writer::start_div($boxclasses); $box .= html_writer::div(get_string('updateavailable', 'core_plugin', $updateinfo->version), 'version'); $box .= html_writer::div(implode(html_writer::span(' ', 'separator'), $info), 'infos'); if ($pluginman->is_remote_plugin_installable($updateinfo->component, $updateinfo->version, $reason)) { $box .= $this->output->single_button(new moodle_url($this->page->url, array('installupdate' => $updateinfo->component, 'installupdateversion' => $updateinfo->version)), get_string('updateavailableinstall', 'core_admin'), 'post', array('class' => 'singlebutton updateavailableinstall')); } else { $reasonhelp = $this->info_remote_plugin_not_installable($reason); if ($reasonhelp) { $box .= html_writer::div($reasonhelp, 'reasonhelp updateavailableinstall'); } } $box .= html_writer::end_div(); return $box; }