From 5976a78a95a218e36fce08ef6c668857e4e6a333 Mon Sep 17 00:00:00 2001 From: Charles Fulton Date: Tue, 18 Jul 2017 13:46:07 -0700 Subject: [PATCH] MDL-59567 block_mnet_hosts: use html_writer to build links --- blocks/mnet_hosts/block_mnet_hosts.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/blocks/mnet_hosts/block_mnet_hosts.php b/blocks/mnet_hosts/block_mnet_hosts.php index 4d0431b8087dc..9e0715cf496f5 100644 --- a/blocks/mnet_hosts/block_mnet_hosts.php +++ b/blocks/mnet_hosts/block_mnet_hosts.php @@ -139,15 +139,15 @@ function get_content() { if ($hosts) { foreach ($hosts as $host) { - $icon = $OUTPUT->pix_icon('i/'.$host->application.'_host', get_string('server', 'block_mnet_hosts')) . ' '; - if ($host->id == $USER->mnethostid) { - $this->content->items[]="name). - "\" href=\"{$host->wwwroot}\">".$icon. s($host->name) .""; + $url = new \moodle_url($host->wwwroot); } else { - $this->content->items[]="name). - "\" href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$host->id}\">" .$icon. s($host->name) .""; + $url = new \moodle_url('/auth/mnet/jump.php', array('hostid' => $host->id)); } + $this->content->items[] = html_writer::tag('a', + $OUTPUT->pix_icon("i/{$host->application}_host", get_string('server', 'block_mnet_hosts')) . s($host->name), + array('href' => $url->out(), 'title' => s($host->name)) + ); } }