]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-21235 new link method in html_write, partinally replaces old html_link, going... MDL-21261
authorPetr Skoda <skodak@moodle.org>
Thu, 14 Jan 2010 22:10:20 +0000 (22:10 +0000)
committerPetr Skoda <skodak@moodle.org>
Thu, 14 Jan 2010 22:10:20 +0000 (22:10 +0000)
12 files changed:
blocks/blog_recent/block_blog_recent.php
blocks/blog_tags/block_blog_tags.php
blocks/rss_client/managefeeds.php
blog/locallib.php
course/report/outline/index.php
grade/report/grader/lib.php
lib/outputcomponents.php
mod/lesson/renderer.php
mod/lesson/view.php
mod/workshop/renderer.php
repository/lib.php
user/index.php

index a64078ba600d0afc628a4474faf2b05c94564b80..b1eb7394e29a86918977bdf44917ebde84106346 100644 (file)
@@ -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');
         }
index e9da3a0b12a7e61574c861751fbd06abfdf042a2..4627265b052f344c8178bbb5238923de6e64beca 100644 (file)
@@ -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 .= '<li>' . $OUTPUT->link($link) . '</li> ';
+                $link = html_writer::link($blogurl, tag_display_name($tag), array('class'=>$tag->class, 'title'=>get_string('numberofentries','blog',$tag->ct)));
+                $this->content->text .= '<li>' . $link . '</li> ';
             }
             $this->content->text .= "\n</ul>\n";
 
index 4a7f7580341e03ec465eb3954044df10462a8922..f7f9b7a82db509515ff4d34a3fc00f8f11dd7b3c 100644 (file)
@@ -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 = '<div class="title">' . $OUTPUT->link($viewlink) . '</div>' .
-        '<div class="url">' . $OUTPUT->link($feed->url, $feed->url) .'</div>' .
+    $feedinfo = '<div class="title">' . $viewlink . '</div>' .
+        '<div class="url">' . html_writer::link($feed->url, $feed->url) .'</div>' .
         '<div class="description">' . $feed->description . '</div>';
 
     $editurl = $CFG->wwwroot .'/blocks/rss_client/editfeed.php?rssid=' . $feed->id . $extraparams;
index c718a02cf374cb40a662a9bd7d2b01770308cb3c..77c94c883edf68e06e3a824ad594d005ab943be7 100644 (file)
@@ -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 .= "<br />" . $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));
                 }
             }
         }
index 2c9c32eb8a8f2d973d8981122f24120805991c9f..de9b9f0139185d1351c47093ea39eef1eabeafb9 100644 (file)
 
             $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;
 
                 $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 = '-';
                 }
index 6f2e0d5b2d2fb3e03cbf0b20a1bba6e50fbbeb76..a8f6eaa10720777ffe0a6f8dba3c7490c6adc4d8 100644 (file)
@@ -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') {
index 03fabb3bdba10f2feb621dd54c01058652e78637..beb3dfe76f090bc54e87814633a0fee71c12cd3b 100644 (file)
@@ -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);
+    }
 }
 
 
index dc99d9e4a9ba302995cbdc112ffa88e44cd63051..e0f94050e81ee5e0be3b08b4da7ebf7499344fc4 100644 (file)
@@ -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');
     }
index fe21fa9562f116d36009fd94ad64b8ca0c376187..f32ccdcea18dbc49326ebc29c4f9b1b393342f77 100644 (file)
@@ -513,9 +513,8 @@ if ($pageid != LESSON_EOL) {
                 $lessoncontent .= get_string("nothighscore", "lesson", $lesson->maxhighscores)."<br />";
             }
         }
-        $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);
index eb10e6265f321fd202906d895ba6d9849b17fa82..b5bad3786d3c3b5b7665ddb5c84dba44321f113e 100644 (file)
@@ -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;
index beefe30ea0ca66a39dc5600df6f0fc1838a3ea86..cdc1c0cc4ea946f401c0c2d6134481449eab8938 100644 (file)
@@ -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');
                 }
index 66e6ff687becdc9d70704415f6f4e151c8f21c11..b30dd2d491527719713acd09448bd63587e5895c 100644 (file)
                     }
                     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) . '<br />';
+                        $row->cells[1]->text .= get_string('email') .': ' . html_writer::link("mailto:$user->email", $user->email) . '<br />';
                     }
                     if (($user->city or $user->country) and (!isset($hiddenfields['city']) or !isset($hiddenfields['country']))) {
                         $row->cells[1]->text .= get_string('city') .': ';
                     $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 .= '<br /><input type="checkbox" name="user'.$user->id.'" /> ';
     $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();