From 0f4c64b79fa12429f10b70d37c0327e7087c5500 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Thu, 14 Jan 2010 22:10:20 +0000 Subject: [PATCH] MDL-21235 new link method in html_write, partinally replaces old html_link, going to add new action_link soon --- blocks/blog_recent/block_blog_recent.php | 8 ++--- blocks/blog_tags/block_blog_tags.php | 6 ++-- blocks/rss_client/managefeeds.php | 8 ++--- blog/locallib.php | 20 ++++++------ course/report/outline/index.php | 8 ++--- grade/report/grader/lib.php | 21 ++++++------ lib/outputcomponents.php | 13 ++++++++ mod/lesson/renderer.php | 16 ++++----- mod/lesson/view.php | 20 +++++------- mod/workshop/renderer.php | 41 ++++++++---------------- repository/lib.php | 6 ++-- user/index.php | 25 ++++++--------- 12 files changed, 84 insertions(+), 108 deletions(-) diff --git a/blocks/blog_recent/block_blog_recent.php b/blocks/blog_recent/block_blog_recent.php index a64078ba60..b1eb7394e2 100644 --- a/blocks/blog_recent/block_blog_recent.php +++ b/blocks/blog_recent/block_blog_recent.php @@ -96,8 +96,8 @@ class block_blog_recent extends block_base { foreach ($entries as $entryid => $entry) { $viewblogurl->param('entryid', $entryid); - $entrylink = html_link::make($viewblogurl, shorten_text($entry->subject)); - $entrieslist->add_item($OUTPUT->link($entrylink)); + $entrylink = html_writer::link($viewblogurl, shorten_text($entry->subject)); + $entrieslist->add_item($entrylink); } $this->content->text .= $OUTPUT->htmllist($entrieslist); @@ -105,8 +105,8 @@ class block_blog_recent extends block_base { if (!empty($blogheaders['strview'])) { $strview = $blogheaders['strview']; } - $viewallentrieslink = html_link::make($blogheaders['url'], $strview); - $this->content->text .= $OUTPUT->link($viewallentrieslink); + $viewallentrieslink = html_writer::link($blogheaders['url'], $strview); + $this->content->text .= $viewallentrieslink; } else { $this->content->text .= get_string('norecentblogentries', 'block_blog_recent'); } diff --git a/blocks/blog_tags/block_blog_tags.php b/blocks/blog_tags/block_blog_tags.php index e9da3a0b12..4627265b05 100644 --- a/blocks/blog_tags/block_blog_tags.php +++ b/blocks/blog_tags/block_blog_tags.php @@ -154,10 +154,8 @@ class block_blog_tags extends block_base { } $blogurl->param('tagid', $tag->id); - $link = html_link::make($blogurl, tag_display_name($tag)); - $link->add_class($tag->class); - $link->title = get_string('numberofentries','blog',$tag->ct); - $this->content->text .= '
  • ' . $OUTPUT->link($link) . '
  • '; + $link = html_writer::link($blogurl, tag_display_name($tag), array('class'=>$tag->class, 'title'=>get_string('numberofentries','blog',$tag->ct))); + $this->content->text .= '
  • ' . $link . '
  • '; } $this->content->text .= "\n\n"; diff --git a/blocks/rss_client/managefeeds.php b/blocks/rss_client/managefeeds.php index 4a7f758034..f7f9b7a82d 100644 --- a/blocks/rss_client/managefeeds.php +++ b/blocks/rss_client/managefeeds.php @@ -109,12 +109,10 @@ foreach($feeds as $feed) { $feedtitle = s($feed->title); } - $viewlink = new html_link(); - $viewlink->url = $CFG->wwwroot .'/blocks/rss_client/viewfeed.php?rssid=' . $feed->id . $extraparams; - $viewlink->text = $feedtitle; + $viewlink = html_writer::link($CFG->wwwroot .'/blocks/rss_client/viewfeed.php?rssid=' . $feed->id . $extraparams, $feedtitle); - $feedinfo = '
    ' . $OUTPUT->link($viewlink) . '
    ' . - '
    ' . $OUTPUT->link($feed->url, $feed->url) .'
    ' . + $feedinfo = '
    ' . $viewlink . '
    ' . + '
    ' . html_writer::link($feed->url, $feed->url) .'
    ' . '
    ' . $feed->description . '
    '; $editurl = $CFG->wwwroot .'/blocks/rss_client/editfeed.php?rssid=' . $feed->id . $extraparams; diff --git a/blog/locallib.php b/blog/locallib.php index c718a02cf3..77c94c883e 100644 --- a/blog/locallib.php +++ b/blog/locallib.php @@ -149,7 +149,7 @@ class blog_entry { $fullname = fullname($user, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $COURSE->id))); $by = new object(); - $by->name = $OUTPUT->link(html_link::make(new moodle_url($CFG->wwwroot.'/user/view.php', array('id' => $user->id, 'course' => $COURSE->id)), $fullname)); + $by->name = html_writer::link(new moodle_url($CFG->wwwroot.'/user/view.php', array('id' => $user->id, 'course' => $COURSE->id)), $fullname); $by->date = $template['created']; $topiccell->text .= get_string('bynameondate', 'forum', $by); @@ -158,7 +158,7 @@ class blog_entry { if ($this->uniquehash && $this->content) { if ($externalblog = $DB->get_record('blog_external', array('id' => $this->content))) { $urlparts = parse_url($externalblog->url); - $topiccell->text .= $OUTPUT->container(get_string('retrievedfrom', 'blog') . $OUTPUT->link(html_link::make($urlparts['scheme'].'://'.$urlparts['host'], $externalblog->name)), 'externalblog'); + $topiccell->text .= $OUTPUT->container(get_string('retrievedfrom', 'blog') . html_writer::link($urlparts['scheme'].'://'.$urlparts['host'], $externalblog->name), 'externalblog'); } } @@ -205,7 +205,7 @@ class blog_entry { // Uniquehash is used as a link to an external blog if (!empty($this->uniquehash)) { $contentcell->text .= $OUTPUT->container_start('externalblog'); - $contentcell->text .= $OUTPUT->link(html_link::make($this->uniquehash, get_string('linktooriginalentry', 'blog'))); + $contentcell->text .= html_writer::link($this->uniquehash, get_string('linktooriginalentry', 'blog')); $contentcell->text .= $OUTPUT->container_end(); } @@ -281,11 +281,11 @@ class blog_entry { $contentcell->text .= $OUTPUT->container_start('commands'); if (blog_user_can_edit_entry($this) && empty($this->uniquehash)) { - $contentcell->text .= $OUTPUT->link(html_link::make(new moodle_url($CFG->wwwroot.'/blog/edit.php', array('action' => 'edit', 'entryid' => $this->id)), $stredit)) . ' | '; - $contentcell->text .= $OUTPUT->link(html_link::make(new moodle_url($CFG->wwwroot.'/blog/edit.php', array('action' => 'delete', 'entryid' => $this->id)), $strdelete)) . ' | '; + $contentcell->text .= html_writer::link(new moodle_url($CFG->wwwroot.'/blog/edit.php', array('action' => 'edit', 'entryid' => $this->id)), $stredit) . ' | '; + $contentcell->text .= html_writer::link(new moodle_url($CFG->wwwroot.'/blog/edit.php', array('action' => 'delete', 'entryid' => $this->id)), $strdelete) . ' | '; } - $contentcell->text .= $OUTPUT->link(html_link::make(new moodle_url($CFG->wwwroot.'/blog/index.php', array('entryid' => $this->id)), get_string('permalink', 'blog'))); + $contentcell->text .= html_writer::link(new moodle_url($CFG->wwwroot.'/blog/index.php', array('entryid' => $this->id)), get_string('permalink', 'blog')); $contentcell->text .= $OUTPUT->container_end(); @@ -497,8 +497,8 @@ class blog_entry { $image = $OUTPUT->image("/f/$icon", array('alt'=>$filename, 'class'=>'icon')); if ($return == "html") { - $output .= $OUTPUT->link(html_link::make($ffurl, $OUTPUT->image($image))); - $output .= $OUTPUT->link(html_link::make($ffurl, $filename)); + $output .= html_writer::link($ffurl, $OUTPUT->image($image)); + $output .= html_writer::link($ffurl, $filename); } else if ($return == "text") { $output .= "$strattachment $filename:\n$ffurl\n"; @@ -508,8 +508,8 @@ class blog_entry { $image = $OUTPUT->image($ffurl, array('alt'=>$filename)); $imagereturn .= "
    " . $OUTPUT->image($image); } else { - $imagereturn .= $OUTPUT->link(html_link::make($ffurl, $image)); - $imagereturn .= filter_text($OUTPUT->link(html_link::make($ffurl, $filename))); + $imagereturn .= html_writer::link($ffurl, $image); + $imagereturn .= filter_text(html_writer::link($ffurl, $filename)); } } } diff --git a/course/report/outline/index.php b/course/report/outline/index.php index 2c9c32eb8a..de9b9f0139 100644 --- a/course/report/outline/index.php +++ b/course/report/outline/index.php @@ -109,12 +109,12 @@ $activityicon = $OUTPUT->image($OUTPUT->pix_url('icon', $cm->modname), array('alt'=>$modulename, 'class'=>'icon')); - $activitylink = html_link::make("$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id", format_string($cm->name)); + $attributes = array(); if (!$cm->visible) { - $activitylink->add_class('dimmed'); + $attributes['class'] = 'dimmed'; } - $activitycell->text = $activityicon . $OUTPUT->link($activitylink); + $activitycell->text = $activityicon . html_writer::link("$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id", format_string($cm->name), $attributes);; $reportrow->cells[] = $activitycell; @@ -133,7 +133,7 @@ $blogcell = new html_table_cell(); $blogcell->add_class('blog'); if ($blogcount = blog_get_associated_count($course->id, $cm->id)) { - $blogcell->text = $OUTPUT->link(html_link::make('/blog/index.php?modid='.$cm->id, $blogcount)); + $blogcell->text = html_writer::link('/blog/index.php?modid='.$cm->id, $blogcount); } else { $blogcell->text = '-'; } diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 6f2e0d5b2d..a8f6eaa107 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -568,8 +568,8 @@ class grade_report_grader extends grade_report { $headerrow->cells[] = $studentheader; if ($showuseridnumber) { - $sortidnumberlink = html_link::make(clone($this->baseurl), get_string('idnumber')); - $sortidnumberlink->url->param('sortitemid', 'idnumber'); + // TODO: weird, this is not used anywhere + $sortidnumberlink = html_writer::link(new moodle_url($this->baseurl, array('sortitemid'=>'idnumber')), get_string('idnumber')); $idnumberheader = new html_table_cell(); $idnumberheader->add_classes(array('header', 'c0', 'useridnumber')); @@ -600,7 +600,7 @@ class grade_report_grader extends grade_report { $usercell->text = $OUTPUT->container($OUTPUT->user_picture($user), 'userpic'); } - $usercell->text .= $OUTPUT->link(html_link::make(new moodle_url($CFG->wwwroot.'/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), fullname($user))); + $usercell->text .= html_writer::link(new moodle_url($CFG->wwwroot.'/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), fullname($user)); $userrow->cells[] = $usercell; @@ -1508,14 +1508,11 @@ class grade_report_grader extends grade_report { $strfirstname = $this->get_lang_string('firstname'); $strlastname = $this->get_lang_string('lastname'); - $firstlink = html_link::make(clone($this->baseurl), $strfirstname); - $firstlink->url->param('sortitemid', 'firstname'); - $lastlink = html_link::make(clone($this->baseurl), $strlastname); - $lastlink->url->param('sortitemid', 'lastname'); - $idnumberlink = html_link::make(clone($this->baseurl), get_string('idnumber')); - $idnumberlink->url->param('sortitemid', 'idnumber'); + $firstlink = html_writer::link(new moodle_url($this->baseurl, array('sortitemid'=>'firstname')), $strfirstname); + $lastlink = html_writer::link(new moodle_url($this->baseurl, array('sortitemid'=>'lastname')), $strlastname); + $idnumberlink = html_writer::link(new moodle_url($this->baseurl, array('sortitemid'=>'idnumber')), get_string('idnumber')); - $arrows['studentname'] = $OUTPUT->link($lastlink); + $arrows['studentname'] = $lastlink; if ($this->sortitemid === 'lastname') { if ($this->sortorder == 'ASC') { @@ -1525,7 +1522,7 @@ class grade_report_grader extends grade_report { } } - $arrows['studentname'] .= ' ' . $OUTPUT->link($firstlink); + $arrows['studentname'] .= ' ' . $firstlink; if ($this->sortitemid === 'firstname') { if ($this->sortorder == 'ASC') { @@ -1535,7 +1532,7 @@ class grade_report_grader extends grade_report { } } - $arrows['idnumber'] = $OUTPUT->link($idnumberlink); + $arrows['idnumber'] = $idnumberlink; if ('idnumber' == $this->sortitemid) { if ($this->sortorder == 'ASC') { diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 03fabb3bdb..beb3dfe76f 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -335,6 +335,19 @@ class html_writer { public static function random_id($base='random') { return uniqid($base); } + + /** + * Generates a simple html link + * @param string|moodle_url $url + * @param string $text link txt + * @param array $attributes extra html attributes + * @return string HTML fragment + */ + public static function link($url, $text, array $attributes = null) { + $attributes = (array)$attributes; + $attributes['href'] = $url; + return self::tag('a', $attributes, $text); + } } diff --git a/mod/lesson/renderer.php b/mod/lesson/renderer.php index dc99d9e4a9..e0f94050e8 100644 --- a/mod/lesson/renderer.php +++ b/mod/lesson/renderer.php @@ -161,11 +161,11 @@ class mod_lesson_renderer extends plugin_renderer_base { $output = $this->output->box(get_string('youhaveseen','lesson'), 'generalbox boxaligncenter'); $output .= $this->output->box_start('center'); - $yeslink = html_link::make(new moodle_url($CFG->wwwroot.'/mod/lesson/view.php', array('id'=>$this->page->cm->id, 'pageid'=>$lastpageseenid, 'startlastseen'=>'yes')), get_string('yes')); - $output .= $this->output->span($this->output->link($yeslink), 'lessonbutton standardbutton'); + $yeslink = html_writer::link(new moodle_url($CFG->wwwroot.'/mod/lesson/view.php', array('id'=>$this->page->cm->id, 'pageid'=>$lastpageseenid, 'startlastseen'=>'yes')), get_string('yes')); + $output .= $this->output->span($yeslink, 'lessonbutton standardbutton'); - $nolink = html_link::make(new moodle_url($CFG->wwwroot.'/mod/lesson/view.php', array('id'=>$this->page->cm->id, 'pageid'=>$lesson->firstpageid, 'startlastseen'=>'no')), get_string('no')); - $output .= $this->output->span($this->output->link($nolink), 'lessonbutton standardbutton'); + $nolink = html_writer::link(new moodle_url($CFG->wwwroot.'/mod/lesson/view.php', array('id'=>$this->page->cm->id, 'pageid'=>$lesson->firstpageid, 'startlastseen'=>'no')), get_string('no')); + $output .= $this->output->span($nolink, 'lessonbutton standardbutton'); $output .= $this->output->box_end(); return $output; @@ -332,17 +332,13 @@ class mod_lesson_renderer extends plugin_renderer_base { $links = array(); $importquestionsurl = new moodle_url($CFG->wwwroot.'/mod/lesson/import.php',array('id'=>$this->page->cm->id, 'pageid'=>$prevpageid)); - $links[] = html_link::make($importquestionsurl, get_string('importquestions', 'lesson')); + $links[] = html_writer::link($importquestionsurl, get_string('importquestions', 'lesson')); $manager = lesson_page_type_manager::get($lesson); $links = array_merge($links, $manager->get_add_page_type_links($prevpageid)); $addquestionurl = new moodle_url($CFG->wwwroot.'/mod/lesson/editpage.php', array('id'=>$this->page->cm->id, 'pageid'=>$prevpageid)); - $links[] = html_link::make($addquestionurl, get_string('addaquestionpagehere', 'lesson')); - - foreach ($links as $key=>$link) { - $links[$key] = $this->output->link($link); - } + $links[] = html_writer::link($addquestionurl, get_string('addaquestionpagehere', 'lesson')); return $this->output->box(implode(" | \n", $links), 'addlinks'); } diff --git a/mod/lesson/view.php b/mod/lesson/view.php index fe21fa9562..f32ccdcea1 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -513,9 +513,8 @@ if ($pageid != LESSON_EOL) { $lessoncontent .= get_string("nothighscore", "lesson", $lesson->maxhighscores)."
    "; } } - $link = html_link::make(new moodle_url($CFG->wwwroot.'/mod/lesson/highscores.php', array('id'=>$PAGE->cm->id, 'link'=>'1')), get_string('viewhighscores', 'lesson')); - $link->set_classes(array('centerpadded','lessonbutton','standardbutton')); - $lessoncontent .= $OUTPUT->link($link); + $url = new moodle_url($CFG->wwwroot.'/mod/lesson/highscores.php', array('id'=>$PAGE->cm->id, 'link'=>'1')); + $lessoncontent .= html_writer::link($url, get_string('viewhighscores', 'lesson'), array('class'=>'centerpadded lessonbutton standardbutton')); $lessoncontent .= $OUTPUT->box_end(); } @@ -534,9 +533,8 @@ if ($pageid != LESSON_EOL) { $lastattempt = end($attempts); $USER->modattempts[$lesson->id] = $lastattempt->pageid; - $link = html_link::make(new moodle_url($CFG->wwwroot.'/mod/lesson/view.php', array('id'=>$PAGE->cm->id, 'pageid'=>$pageid)), get_string('reviewlesson', 'lesson')); - $link->set_classes(array('centerpadded','lessonbutton','standardbutton')); - $lessoncontent .= $OUTPUT->link($link); + $url = new moodle_url($CFG->wwwroot.'/mod/lesson/view.php', array('id'=>$PAGE->cm->id, 'pageid'=>$pageid)); + $lessoncontent .= html_writer::link($url, get_string('reviewlesson', 'lesson'), array('class' => 'centerpadded lessonbutton standardbutton')); } elseif ($lesson->modattempts && $canmanage) { $lessoncontent .= $lessonoutput->paragraph(get_string("modattemptsnoteacher", "lesson"), 'centerpadded'); @@ -549,13 +547,11 @@ if ($pageid != LESSON_EOL) { } } - $link = html_link::make(new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)), get_string('returnto', 'lesson', format_string($course->fullname, true))); - $link->set_classes(array('centerpadded','lessonbutton','standardbutton')); - $lessoncontent .= $OUTPUT->link($link); + $url = new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)); + $lessoncontent .= html_writer::link($url, get_string('returnto', 'lesson', format_string($course->fullname, true)), array('class'=>'centerpadded lessonbutton standardbutton')); - $link = html_link::make(new moodle_url($CFG->wwwroot.'/grade/index.php', array('id'=>$course->id)), get_string('viewgrades', 'lesson')); - $link->set_classes(array('centerpadded','lessonbutton','standardbutton')); - $lessoncontent .= $OUTPUT->link($link); + $url = new moodle_url($CFG->wwwroot.'/grade/index.php', array('id'=>$course->id)); + $lessoncontent .= html_writer::link($url, get_string('viewgrades', 'lesson'), array('class'=>'centerpadded lessonbutton standardbutton')); lesson_add_pretend_blocks($PAGE, $cm, $lesson, $timer); echo $lessonoutput->header($lesson, $cm, $currenttab, $extraeditbuttons, $lessonpageid); diff --git a/mod/workshop/renderer.php b/mod/workshop/renderer.php index eb10e6265f..b5bad3786d 100644 --- a/mod/workshop/renderer.php +++ b/mod/workshop/renderer.php @@ -112,12 +112,9 @@ class mod_workshop_renderer extends plugin_renderer_base { $classes .= ' anonymous'; } $o .= $this->output->container_start($classes); // main wrapper - $link = new html_link(); - $link->url = new moodle_url($CFG->wwwroot . '/mod/workshop/submission.php', - array('cmid' => $this->page->context->instanceid, 'id' => $submission->id)); - $link->text = format_string($submission->title); - $link->set_classes('title'); - $o .= $this->output->link($link); + $url = new moodle_url($CFG->wwwroot . '/mod/workshop/submission.php', + array('cmid' => $this->page->context->instanceid, 'id' => $submission->id)); + $o .= html_writer::link($url, format_string($submission->title), array('class'=>'title')); if ($showauthorname) { $author = new stdclass(); $author->id = $submission->authorid; @@ -297,12 +294,9 @@ class mod_workshop_renderer extends plugin_renderer_base { // title $o .= $this->output->container_start('example-title'); - $link = new html_link(); - $link->url = new moodle_url($CFG->wwwroot . '/mod/workshop/exsubmission.php', - array('cmid' => $this->page->context->instanceid, 'id' => $summary->example->id)); - $link->text = format_string($summary->example->title); - $link->set_classes('title'); - $o .= $this->output->link($link); + $url = new moodle_url($CFG->wwwroot . '/mod/workshop/exsubmission.php', + array('cmid' => $this->page->context->instanceid, 'id' => $summary->example->id)); + $o .= html_writer::link($url, format_string($summary->example->title), array('class'=>'title')); // dirty hack to guess if the current user is example manager or not if ($summary->example->weight == 1) { @@ -431,10 +425,7 @@ class mod_workshop_renderer extends plugin_renderer_base { if (is_null($task->link)) { $title = $task->title; } else { - $link = new html_link(); - $link->url = $task->link; - $link->text = $task->title; - $title = $this->output->link($link); + $title = html_writer::link($task->link, $task->text); } $title = $this->output->container($title, 'title'); $details = $this->output->container($task->details, 'details'); @@ -647,12 +638,9 @@ class mod_workshop_renderer extends plugin_renderer_base { if (is_null($participant->submissionid)) { $out = $this->output->container(get_string('nosubmissionfound', 'workshop'), 'info'); } else { - $link = new html_link(); - $link->url = new moodle_url($CFG->wwwroot . '/mod/workshop/submission.php', - array('cmid' => $this->page->context->instanceid, 'id' => $participant->submissionid)); - $link->text = format_string($participant->submissiontitle); - $link->set_classes('title'); - $out = $this->output->link($link); + $url = new moodle_url($CFG->wwwroot . '/mod/workshop/submission.php', + array('cmid' => $this->page->context->instanceid, 'id' => $participant->submissionid)); + $out = html_writer::link($url, format_string($participant->submissiontitle), array('class'=>'title')); } return $out; @@ -690,12 +678,9 @@ class mod_workshop_renderer extends plugin_renderer_base { $grade = get_string('formatpeergradeoverweighted', 'workshop', $a); } } - $link = new html_link(); - $link->text = $grade; - $link->url = new moodle_url($CFG->wwwroot . '/mod/workshop/assessment.php', - array('asid' => $assessment->assessmentid)); - $link->set_classes('grade'); - $grade = $this->output->link($link); + $url = new moodle_url($CFG->wwwroot . '/mod/workshop/assessment.php', + array('asid' => $assessment->assessmentid)); + $grade = html_writer::link($url, $grade, array('class'=>'grade')); if ($shownames) { $userid = $assessment->userid; diff --git a/repository/lib.php b/repository/lib.php index beefe30ea0..cdc1c0cc4e 100644 --- a/repository/lib.php +++ b/repository/lib.php @@ -1049,13 +1049,11 @@ abstract class repository { $url->param('type', $i->options['type']); $url->param('edit', $i->id); - $link = html_link::make($url->out(), $settingsstr); - $settings .= $OUTPUT->link($link); + $settings .= html_writer::link($url, $settingsstr); $url->remove_params('edit'); $url->param('delete', $i->id); - $link = html_link::make($url->out(), $deletestr); - $delete .= $OUTPUT->link($link); + $delete .= html_writer::link($url, $deletestr); $url->remove_params('type'); } diff --git a/user/index.php b/user/index.php index 66e6ff687b..b30dd2d491 100644 --- a/user/index.php +++ b/user/index.php @@ -773,10 +773,7 @@ } if ($user->maildisplay == 1 or ($user->maildisplay == 2 and ($course->id != SITEID) and !isguestuser()) or has_capability('moodle/course:viewhiddenuserfields', $context)) { - $link = new html_link(); - $link->url = "mailto:$user->email"; - $link->text = $user->email; - $row->cells[1]->text .= get_string('email') .': ' . $OUTPUT->link($link) . '
    '; + $row->cells[1]->text .= get_string('email') .': ' . html_writer::link("mailto:$user->email", $user->email) . '
    '; } if (($user->city or $user->country) and (!isset($hiddenfields['city']) or !isset($hiddenfields['country']))) { $row->cells[1]->text .= get_string('city') .': '; @@ -810,31 +807,29 @@ $links = array(); if ($CFG->bloglevel > 0) { - $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/blog/index.php?userid='.$user->id), get_string('blogs','blog')); + $links[] = html_writer::link(new moodle_url($CFG->wwwroot.'/blog/index.php?userid='.$user->id), get_string('blogs','blog')); } if (!empty($CFG->enablenotes) and (has_capability('moodle/notes:manage', $context) || has_capability('moodle/notes:view', $context))) { - $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/notes/index.php?course=' . $course->id. '&user='.$user->id), get_string('notes','notes')); + $links[] = html_writer::link(new moodle_url($CFG->wwwroot.'/notes/index.php?course=' . $course->id. '&user='.$user->id), get_string('notes','notes')); } if (has_capability('moodle/site:viewreports', $context) or has_capability('moodle/user:viewuseractivitiesreport', $usercontext)) { - $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/course/user.php?id='. $course->id .'&user='. $user->id), get_string('activity')); + $links[] = html_writer::link(new moodle_url($CFG->wwwroot.'/course/user.php?id='. $course->id .'&user='. $user->id), get_string('activity')); } if (has_capability('moodle/role:assign', $context) and get_user_roles($context, $user->id, false)) { // I can unassign and user has some role - $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/course/unenrol.php?id='. $course->id .'&user='. $user->id), get_string('unenrol')); + $links[] = html_writer::link(new moodle_url($CFG->wwwroot.'/course/unenrol.php?id='. $course->id .'&user='. $user->id), get_string('unenrol')); } if ($USER->id != $user->id && !session_is_loggedinas() && has_capability('moodle/user:loginas', $context) && ! has_capability('moodle/site:doanything', $context, $user->id, false)) { - $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/course/loginas.php?id='. $course->id .'&user='. $user->id .'&sesskey='. sesskey()), get_string('loginas')); + $links[] = html_writer::link(new moodle_url($CFG->wwwroot.'/course/loginas.php?id='. $course->id .'&user='. $user->id .'&sesskey='. sesskey()), get_string('loginas')); } - $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/user/view.php?id='. $user->id .'&course='. $course->id), get_string('fullprofile') . '...'); + $links[] = html_writer::link(new moodle_url($CFG->wwwroot.'/user/view.php?id='. $user->id .'&course='. $course->id), get_string('fullprofile') . '...'); - foreach ($links as $link) { - $row->cells[2]->text .= $OUTPUT->link($link); - } + $row->cells[2]->text .= implode('', $link); if (!empty($messageselect)) { $row->cells[2]->text .= '
    '; @@ -1009,11 +1004,11 @@ $perpageurl->remove_params('perpage'); if ($perpage == SHOW_ALL_PAGE_SIZE) { $perpageurl->param('perpage', DEFAULT_PAGE_SIZE); - echo $OUTPUT->container($OUTPUT->link(html_link::make($perpageurl, get_string('showperpage', '', DEFAULT_PAGE_SIZE))), array(), 'showall'); + echo $OUTPUT->container(html_writer::link($perpageurl, get_string('showperpage', '', DEFAULT_PAGE_SIZE)), array(), 'showall'); } else if ($matchcount > 0 && $perpage < $matchcount) { $perpageurl->param('perpage', SHOW_ALL_PAGE_SIZE); - echo $OUTPUT->container($OUTPUT->link(html_link::make($perpageurl, get_string('showall', '', $matchcount))), array(), 'showall'); + echo $OUTPUT->container(html_writer::link($perpageurl, get_string('showall', '', $matchcount)), array(), 'showall'); } echo $OUTPUT->footer(); -- 2.39.5