MDL-20204 more html_link converstions
authorPetr Skoda <skodak@moodle.org>
Thu, 11 Feb 2010 18:50:55 +0000 (18:50 +0000)
committerPetr Skoda <skodak@moodle.org>
Thu, 11 Feb 2010 18:50:55 +0000 (18:50 +0000)
23 files changed:
lib/navigationlib.php
lib/weblib.php
message/lib.php
message/send.php
mod/assignment/lib.php
mod/assignment/type/online/assignment.class.php
mod/assignment/type/upload/assignment.class.php
mod/chat/view.php
mod/data/lib.php
mod/forum/lib.php
mod/glossary/lib.php
mod/lesson/essay.php
mod/lesson/lib.php
mod/lesson/locallib.php
mod/lesson/renderer.php
mod/lesson/report.php
mod/quiz/locallib.php
mod/quiz/report/overview/overview_table.php
mod/quiz/report/responses/responses_table.php
mod/survey/lib.php
mod/workshop/renderer.php
question/editlib.php
question/type/questiontype.php

index dadd5a8..d8ca6f3 100644 (file)
@@ -402,48 +402,53 @@ class navigation_node {
             return '';
         }
         if ($shorttext && $this->shorttext!==null) {
-            $content = clean_text($this->shorttext);
+            $content = format_string($this->shorttext);
         } else {
-            $content = clean_text($this->text);
+            $content = format_string($this->text);
         }
         $title = '';
         if ($this->forcetitle || ($this->shorttext!==null && $this->title !== $this->shorttext) || $this->title !== $this->text) {
              $title = $this->title;
         }
 
-        if ($this->icon!==null) {
+        if ($this->icon !== null) {
             $icon = $OUTPUT->pix_icon($this->icon, '', 'moodle', array('class'=>'icon'));
             $content = $icon.$content; // use CSS for spacing of icons
-        } else if ($this->helpbutton!==null) {
-            $content = sprintf('%s<span class="clearhelpbutton">%s</span>',trim($this->helpbutton),$content);
+        } else if ($this->helpbutton !== null) {
+            $content = sprintf('%s<span class="clearhelpbutton">%s</span>', trim($this->helpbutton), $content);
         }
 
-        if ($content != '' && ((is_object($this->action) && ($this->action instanceof moodle_url || $this->action instanceof html_link)) || is_string($this->action))) {
-            if (!($this->action instanceof html_link)) {
-                $link = new html_link();
-                $link->url = $this->action;
-                $link->text = clean_text($content);
-            } else {
-                $link = $this->action;
+        if ($content === '') {
+            return '';
+        }
+
+        if ($this->action instanceof html_link) {
+            //TODO: to be replaced with something else
+            $link = $this->action;
+            if ($this->hidden) {
+                $link->add_class('dimmed');
             }
+            $content = $OUTPUT->link($link);
+
+        } else if ($this->action instanceof moodle_url) {
+            $attributes = array();
             if ($title !== '') {
-                $link->title = $title;
+                $attributes['title'] = $title;
             }
             if ($this->hidden) {
-                $link->add_class('dimmed');
+                $attributes['class'] = 'dimmed_text';
             }
-            $content = $OUTPUT->link($link);
+            $content = html_writer::link($this->action, $content, $attributes);
 
-        } else {
-            $span = new html_span();
-            $span->contents = $content;
+        } else if (is_string($this->action)) {
+            $attributes = array();
             if ($title !== '') {
-                $span->title = $title;
+                $attributes['title'] = $title;
             }
             if ($this->hidden) {
-                $span->add_class('dimmed_text');
+                $attributes['class'] = 'dimmed_text';
             }
-            $content = $OUTPUT->span($span);
+            $content = html_writer::tag('span', $attributes, $content);
         }
 
         return $content;
index 2bb55d9..bc0774d 100644 (file)
@@ -2470,7 +2470,7 @@ function modgradehelpbutton($courseid){
     $text = '<span class="helplink"><img alt="' . get_string('scales') . '" class="iconhelp" src="' . $OUTPUT->pix_url('help') . '" /></span>';
     $action = new popup_action('click', $link->url, 'ratingscales', array('height' => 400, 'width' => 500));
 
-    return $OUTPUT->link($url, $text, $action, array('title'=>get_string('newwindow')));
+    return $OUTPUT->action_link($url, $text, $action, array('title'=>get_string('newwindow')));
 }
 
 /**
index 6f17da9..f56a25c 100644 (file)
@@ -361,10 +361,9 @@ function message_print_search_results($frm) {
                         'scrollbars' => true,
                         'resizable' => true);
 
-                $link = html_link::make("/message/discussion.php?id=$user->id", fullname($user));
-                $link->add_action(new popup_action('click', $link->url, "message_$user->id", $popupoptions));
-                $link->title = get_string('sendmessageto', 'message', fullname($user));
-                echo $OUTPUT->link($link);
+                $link = new moodle_url("/message/discussion.php?id=$user->id");
+                $action = new popup_action('click', $link, "message_$user->id", $popupoptions);
+                echo $OUTPUT->action_link($link, fullname($user), $action, array('title'=>get_string('sendmessageto', 'message', fullname($user))));
 
                 echo '</td>';
 
@@ -549,10 +548,9 @@ function message_print_user ($user=false, $iscontact=false, $isblocked=false) {
                 'scrollbars' => true,
                 'resizable' => true);
 
-        $link = html_link::make("/message/discussion.php?id=$user->id", fullname($user));
-        $link->add_action(new popup_action('click', $link->url, "message_$user->id", $popupoptions));
-        $link->title = get_string('sendmessageto', 'message', fullname($user));
-        echo $OUTPUT->link($link);
+        $link = new moodle_url("/message/discussion.php?id=$user->id");
+        $action = new popup_action('click', $link, "message_$user->id", $popupoptions);
+        echo $OUTPUT->action_link($link, fullname($user), $action, array('title'=>get_string('sendmessageto', 'message', fullname($user))));
 
     }
 }
@@ -644,10 +642,9 @@ function message_history_link($userid1, $userid2=0, $returnstr=false, $keywords=
             'scrollbars' => true,
             'resizable' => true);
 
-    $link = html_link::make("/message/history.php?user1=$userid1&user2=$userid2$keywords$position", $fulllink);
-    $link->add_action(new popup_action('click', $link->url, "message_history_$userid1", $popupoptions));
-    $link->title = $strmessagehistory;
-    $str = $OUTPUT->link($link);
+    $link = html_link::make("/message/history.php?user1=$userid1&user2=$userid2$keywords$position");
+    $action = new popup_action('click', $link->url, "message_history_$userid1", $popupoptions);
+    $str = $OUTPUT->action_link($link, $fulllink, $action, array('title'=>$strmessagehistory));
 
     $str = '<span class="history">'.$str.'</span>';
 
@@ -1074,10 +1071,9 @@ function message_print_contactlist_user($contact, $incontactlist = true){
             'scrollbars' => true,
             'resizable' => true);
 
-    $link = html_link::make("/message/discussion.php?id=$contact->id", $fullnamelink);
-    $link->add_action(new popup_action('click', $link->url, "message_$contact->id", $popupoptions));
-    $link->title = get_string('sendmessageto', 'message', $fullname);
-    echo $OUTPUT->link($link);
+    $link = html_link::make("/message/discussion.php?id=$contact->id");
+    $action = new popup_action('click', $link, "message_$contact->id", $popupoptions);
+    echo $OUTPUT->action_link($link, $fullnamelink, $action, array('title'=>get_string('sendmessageto', 'message', $fullname)));
 
     echo '</td>';
     echo '<td class="link">&nbsp;'.$strcontact.$strblock.'&nbsp;'.$strhistory.'</td>';
index 16044ba..1443c6d 100644 (file)
@@ -113,10 +113,8 @@ if (has_capability('moodle/site:sendmessage', get_context_instance(CONTEXT_SYSTE
     $mform->display();
     /* TODO: frames are a nono, this has to be redesigned
     echo $OUTPUT->box_start('noframesjslink');
-    $accesslink = new html_link();
-    $accesslink->url = new moodle_url('/message/discussion.php', array('id'=>$userid, 'noframesjs'=>1));
-    $accesslink->text = get_string('noframesjs', 'message');
-    echo $OUTPUT->link($accesslink);
+    $aurl = new moodle_url('/message/discussion.php', array('id'=>$userid, 'noframesjs'=>1));
+    echo $OUTPUT->action_link($aurl, get_string('noframesjs', 'message'), );
     echo $OUTPUT->box_end();
     */
 
index 3edf341..18fab20 100644 (file)
@@ -1344,10 +1344,8 @@ class assignment_base {
                 $popup_url = '/mod/assignment/submissions.php?id='.$this->cm->id
                            . '&userid='.$auser->id.'&mode=single'.'&offset='.$offset++;
 
-                $link = html_link::make($popup_url, $buttontext);
-                $link->add_action(new popup_action('click', $link->url, 'grade'.$auser->id, array('height' => 600, 'width' => 700)));
-                $link->title = $buttontext;
-                $button = $OUTPUT->link($link);
+                $action = new popup_action('click', $popup_url, 'grade'.$auser->id, array('height' => 600, 'width' => 700));
+                $button = $OUTPUT->action_link($popup_url, $buttontext, $action);
 
                 $status  = '<div id="up'.$auser->id.'" class="s'.$auser->status.'">'.$button.'</div>';
 
index 41e7171..f8492d1 100644 (file)
@@ -197,10 +197,9 @@ class assignment_online extends assignment_base {
             return '';
         }
 
-        $link = html_link::make("/mod/assignment/type/online/file.php?id={$this->cm->id}&userid={$submission->userid}", shorten_text(trim(strip_tags(format_text($submission->data1,$submission->data2))), 15));
-        $link->add_action(new popup_action('click', $link->url, 'file'.$userid, array('height' => 450, 'width' => 580)));
-        $link->title = get_string('submission', 'assignment');
-        $popup = $OUTPUT->link($link);
+        $link = new moodle_url("/mod/assignment/type/online/file.php?id={$this->cm->id}&userid={$submission->userid}");
+        $action = new popup_action('click', $link, 'file'.$userid, array('height' => 450, 'width' => 580));
+        $popup = $OUTPUT->action_link($link, shorten_text(trim(strip_tags(format_text($submission->data1,$submission->data2))), 15), $action, array('title'=>get_string('submission', 'assignment')));
 
         $output = '<div class="files">'.
                   '<img src="'.$OUTPUT->pix_url('f/html') . '" class="icon" alt="html" />'.
@@ -216,10 +215,9 @@ class assignment_online extends assignment_base {
             return '';
         }
 
-        $link = html_link::make("/mod/assignment/type/online/file.php?id={$this->cm->id}&userid={$submission->userid}", shorten_text(trim(strip_tags(format_text($submission->data1,$submission->data2))), 15));
-        $link->add_action(new popup_action('click', $link->url, 'file'.$userid, array('height' => 450, 'width' => 580)));
-        $link->title = get_string('submission', 'assignment');
-        $popup = $OUTPUT->link($link);
+        $link = new moodle_url("/mod/assignment/type/online/file.php?id={$this->cm->id}&userid={$submission->userid}");
+        $action = new popup_action('click', $link, 'file'.$userid, array('height' => 450, 'width' => 580));
+        $popup = $OUTPUT->action_link($link, shorten_text(trim(strip_tags(format_text($submission->data1,$submission->data2))), 15), $action, array('title'=>get_string('submission', 'assignment')));
 
         $output = '<div class="files">'.
                   '<img align="middle" src="'.$OUTPUT->pix_url('f/html') . '" height="16" width="16" alt="html" />'.
index aa6eaaa..7537d63 100644 (file)
@@ -273,10 +273,9 @@ class assignment_upload extends assignment_base {
         }
 
         if ($this->notes_allowed() and !empty($submission->data1)) {
-            $link = html_link::make("/mod/assignment/type/upload/notes.php?id=$this->cm->id&userid=$userid", get_string('notes', 'assignment'));
-            $link->add_action(new popup_action('click', $link->url, 'notes', array('height' => 500, 'width' => 780)));
-            $link->title = get_string('notes', 'assignment');
-            $output .= $OUTPUT->link($link);
+            $link = html_link::make("/mod/assignment/type/upload/notes.php?id=$this->cm->id&userid=$userid");
+            $action = new popup_action('click', $link, 'notes', array('height' => 500, 'width' => 780));
+            $output .= $OUTPUT->action_link($link, get_string('notes', 'assignment'), $action, array('title'=>get_string('notes', 'assignment')));
 
             $output .= '&nbsp;';
         }
index 75a2966..41916ae 100644 (file)
         }
 
         echo '<p>';
-        $link = html_link::make($chattarget, $strenterchat);
-        $link->add_action(new popup_action('click', $link->url, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700)));
-        $link->title = get_string('modulename', 'chat');
-        echo $OUTPUT->link($link);
+        echo $OUTPUT->action_link($chattarget, $strenterchat, new popup_action('click', $chattarget, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700)));
 
         echo '</p>';
 
         if ($CFG->enableajax) {
             echo '<p>';
 
-            $link = html_link::make("/mod/chat/gui_ajax/index.php?id=$chat->id$groupparam", get_string('ajax_gui', 'message'));
-            $link->add_action(new popup_action('click', $link->url, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700, 'toolbar' => false, 'resizeable' => false, 'status' => false)));
-            $link->title = get_string('modulename', 'chat');
-            echo $OUTPUT->link($link);
+            $link = new moodle_url("/mod/chat/gui_ajax/index.php?id=$chat->id$groupparam");
+            $action = new popup_action('click', $link, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700, 'toolbar' => false, 'resizeable' => false, 'status' => false));
+            echo $OUTPUT->action_link($link, get_string('ajax_gui', 'message'), $action, array('title'=>get_string('modulename', 'chat')));
             echo '</p>';
         }
 
         if ($CFG->chat_method == 'header_js' && empty($USER->screenreader)) {
             // show frame/js-less alternative
             echo '<p>(';
-            $link = html_link::make("/mod/chat/gui_basic/index.php?id=$chat->id$groupparam", get_string('noframesjs', 'message'));
-            $link->add_action(new popup_action('click', $link->url, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700)));
-            $link->title = get_string('modulename', 'chat');
-            echo $OUTPUT->link($link);
+            $link = new moodle_url("/mod/chat/gui_basic/index.php?id=$chat->id$groupparam");
+            $action = new popup_action('click', $link, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700));
+            echo $OUTPUT->action_link($link, get_string('noframesjs', 'message'), $action, array('title'=>get_string('modulename', 'chat')));
             echo ')</p>';
         }
 
index 58a69d1..64fea2b 100755 (executable)
@@ -1584,9 +1584,9 @@ function data_print_ratings_mean($recordid, $scale, $link=true) {
 
         echo "$strratings: ";
         if ($link) {
-            $link = html_link::make("/mod/data/report.php?id=$recordid", $mean);
-            $link->add_action(new popup_action('click', $link->url, 'ratings', array('height' => 400, 'width' => 600)));
-            echo $OUTPUT->link($link);
+            $link = new moodle_url("/mod/data/report.php?id=$recordid");
+            $action = new popup_action('click', $link, 'ratings', array('height' => 400, 'width' => 600));
+            echo $OUTPUT->action_link($link, $mean, $action);
         } else {
             echo "$mean ";
         }
index 0ef40ca..47fea59 100644 (file)
@@ -3854,9 +3854,9 @@ function forum_print_ratings($postid, $scale, $aggregatetype, $link=true, $ratin
 
         if ($link) {
 
-            $link = html_link::make("/mod/forum/report.php?id=$postid", $agg);
-            $link->add_action(new popup_action('click', $link->url, 'ratings', array('height' => 400, 'width' => 600)));
-            $strratings .= $OUTPUT->link($link);
+            $link = new moodle_url("/mod/forum/report.php?id=$postid");
+            $action = new popup_action('click', $link, 'ratings', array('height' => 400, 'width' => 600));
+            $strratings .= $OUTPUT->action_link($link, $agg, $action);
         } else {
             $strratings .= "$agg ";
         }
index 3d84e08..aeb456d 100644 (file)
@@ -2146,9 +2146,9 @@ function glossary_print_ratings_mean($entryid, $scale) {
         }
 
         echo "$strratings: ";
-        $link = html_link::make("/mod/glossary/report.php?id=$entryid", $mean);
-        $link->add_action(new popup_action('click', $link->url, "ratings"));
-        echo $OUTPUT->link($link);
+        $link = new moodle_url("/mod/glossary/report.php?id=$entryid");
+        $action = new popup_action('click', $link, "ratings");
+        echo $OUTPUT->action_link($link, $mean, $action);
     }
 }
 
index 5d95673..7090259 100644 (file)
@@ -331,16 +331,16 @@ switch ($mode) {
 
                     // link for each essay
                     $url = new moodle_url('/mod/lesson/essay.php', array('id'=>$cm->id,'mode'=>'grade','attemptid'=>$essay->id,'sesskey'=>sesskey()));
-                    $link = html_link::make($url, userdate($essay->timeseen, get_string('strftimedatetime')).' '.format_string($pages[$essay->pageid]->title,true));
+                    $attributes = array();
                     // Different colors for all the states of an essay (graded, if sent, not graded)
                     if (!$essayinfo->graded) {
-                        $link->set_classes("graded");
+                        $attributes['class'] = "graded";
                     } elseif (!$essayinfo->sent) {
-                        $link->set_classes("sent");
+                        $attributes['class'] = "sent";
                     } else {
-                        $link->set_classes("ungraded");
+                        $attributes['class'] = "ungraded";
                     }
-                    $essaylinks[] = $OUTPUT->link($link);
+                    $essaylinks[] = html_writer::link($url, userdate($essay->timeseen, get_string('strftimedatetime')).' '.format_string($pages[$essay->pageid]->title,true), $attributes);
                 }
             }
             // email link for this user
index 879e371..d9764d7 100644 (file)
@@ -1562,7 +1562,7 @@ class lesson extends lesson_base {
 
     /**
      * Returns the link for the related activity
-     * @return html_link|false
+     * @return array|false
      */
     public function link_for_activitylink() {
         global $DB;
index a255a04..f0632ce 100644 (file)
@@ -450,10 +450,9 @@ function lesson_mediafile_block_contents($cmid, $lesson) {
     $options['width'] = $lesson->mediawidth;
     $options['height'] = $lesson->mediaheight;
 
-    $link = html_link::make('/mod/lesson/mediafile.php?id='.$cmid, get_string('mediafilepopup', 'lesson'));
-    $link->add_action(new popup_action('click', $link->url, 'lessonmediafile', $options));
-    $link->title = get_string('mediafilepopup', 'lesson');
-    $content = $OUTPUT->link($link);
+    $link = new moodle_url('/mod/lesson/mediafile.php?id='.$cmid);
+    $action = new popup_action('click', $link, 'lessonmediafile', $options);
+    $content = $OUTPUT->action_link($link, get_string('mediafilepopup', 'lesson'), $action, array('title'=>get_string('mediafilepopup', 'lesson')));
 
     $content .= $OUTPUT->help_icon("mediafilestudent", get_string("mediafile", "lesson"), "lesson");
 
index a47db13..8d13993 100644 (file)
@@ -390,16 +390,16 @@ class mod_lesson_renderer extends plugin_renderer_base {
 
         if ($printmove) {
             $printmovehtml = new moodle_url('/mod/lesson/lesson.php', array('id'=>$this->page->cm->id, 'action'=>'move', 'pageid'=>$page->id, 'sesskey'=>sesskey()));
-            $actions[] = html_link::make($printmovehtml, '<img src="'.$this->output->pix_url('t/move').'" class="iconsmall" alt="'.get_string('move').'" />');
+            $actions[] = html_writer::link($printmovehtml, '<img src="'.$this->output->pix_url('t/move').'" class="iconsmall" alt="'.get_string('move').'" />');
         }
         $url = new moodle_url('/mod/lesson/editpage.php', array('id'=>$this->page->cm->id, 'pageid'=>$page->id, 'edit'=>1));
-        $actions[] = html_link::make($url, '<img src="'.$this->output->pix_url('t/edit').'" class="iconsmall" alt="'.get_string('update').'" />');
+        $actions[] = html_writer::link($url, '<img src="'.$this->output->pix_url('t/edit').'" class="iconsmall" alt="'.get_string('update').'" />');
 
         $url = new moodle_url('/mod/lesson/view.php', array('id'=>$this->page->cm->id, 'pageid'=>$page->id));
-        $actions[] = html_link::make($url, '<img src="'.$this->output->pix_url('t/preview').'" class="iconsmall" alt="'.get_string('preview').'" />');
+        $actions[] = html_writer::link($url, '<img src="'.$this->output->pix_url('t/preview').'" class="iconsmall" alt="'.get_string('preview').'" />');
 
         $url = new moodle_url('/mod/lesson/lesson.php', array('id'=>$this->page->cm->id, 'action'=>'confirmdelete', 'pageid'=>$page->id, 'sesskey'=>sesskey()));
-        $actions[] = html_link::make($url, '<img src="'.$this->output->pix_url('t/delete').'" class="iconsmall" alt="'.get_string('delete').'" />');
+        $actions[] = html_writer::link($url, '<img src="'.$this->output->pix_url('t/delete').'" class="iconsmall" alt="'.get_string('delete').'" />');
 
         if ($printaddpage) {
             $options = array();
index 6b3eda5..d1a6c49 100644 (file)
@@ -144,8 +144,8 @@ echo $lessonoutput->header($lesson, $cm, $action);
 $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
 if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
     $seeallgradeslink = new moodle_url('/grade/report/grader/index.php', array('id'=>$course->id));
-    $seeallgradeslink = html_link::make($seeallgradeslink, get_string('seeallcoursegrades', 'grades'));
-    echo $OUTPUT->box($OUTPUT->link($seeallgradeslink), 'allcoursegrades');
+    $seeallgradeslink = html_writer::link($seeallgradeslink, get_string('seeallcoursegrades', 'grades'));
+    echo $OUTPUT->box($seeallgradeslink, 'allcoursegrades');
 }
 
 if ($nothingtodisplay) {
index 3a102ce..07fbc6e 100644 (file)
@@ -825,11 +825,11 @@ function quiz_question_preview_button($quiz, $question, $label = false) {
     // Build the icon.
     $image = $OUTPUT->pix_icon('t/preview', $strpreviewquestion);
 
-    $link = new html_link($CFG->wwwroot."/question/preview.php?id=$question->id&quizid=$quiz->id", $image, array('title' => $strpreviewquestion));
+    $link = new moodle_url($CFG->wwwroot."/question/preview.php?id=$question->id&quizid=$quiz->id");
     parse_str(QUESTION_PREVIEW_POPUP_OPTIONS, $options);
-    $link->add_action(new popup_action('click', $link->url, 'questionpreview', $options));
+    $action = new popup_action('click', $link, 'questionpreview', $options);
 
-    return $OUTPUT->link($link);
+    return $OUTPUT->action_link($link, $image, $action, array('title' => $strpreviewquestion));
 }
 
 /**
index 67063c3..cbe3c77 100644 (file)
@@ -229,10 +229,9 @@ class quiz_report_overview_table extends table_sql {
                                 $newgrade;
                     }
 
-                    $link = html_link::make("/mod/quiz/reviewquestion.php?attempt=$attempt->attempt&question=$question->id", $grade);
-                    $link->add_action(new popup_action('click', $link->url, 'reviewquestion', array('height' => 450, 'width' => 650)));
-                    $link->title = get_string('reviewresponsetoq', 'quiz', $question->formattedname);
-                    $linktopopup = $OUTPUT->link($link);
+                    $link = new moodle_url("/mod/quiz/reviewquestion.php?attempt=$attempt->attempt&question=$question->id");
+                    $action = new popup_action('click', $link, 'reviewquestion', array('height' => 450, 'width' => 650));
+                    $linktopopup = $OUTPUT->action-link($link, $grade, $action, array('title'=>get_string('reviewresponsetoq', 'quiz', $question->formattedname)));
 
                     if (($this->questions[$questionid]->maxgrade != 0)){
                         $fractionofgrade = $stateforqinattempt->grade
index 470b050..fd60e14 100644 (file)
@@ -164,10 +164,9 @@ class quiz_report_responses_table extends table_sql {
                                                 QUIZ_REPORT_RESPONSES_MAX_LEN_TO_DISPLAY, $formathtml);
             if (!$this->is_downloading()) {
                 if ($summary){
-                    $link = html_link::make("/mod/quiz/reviewquestion.php?attempt=$attempt->attempt&question=$question->id", $summary);
-                    $link->add_action(new popup_action('click', $link->url, 'reviewquestion', array('height' => 450, 'width' => 650)));
-                    $link->title = $question->formattedname;
-                    $summary = $OUTPUT->link($link);
+                    $link = new moodle_url("/mod/quiz/reviewquestion.php?attempt=$attempt->attempt&question=$question->id");
+                    $action = new popup_action('click', $link, 'reviewquestion', array('height' => 450, 'width' => 650));
+                    $summary = $OUTPUT->action_link($link, $summary, $action, array('title'=>$question->formattedname));
 
                     if (question_state_is_graded($stateforqinattempt)
                                 && ($question->maxgrade > 0)){
index 1819655..36ae54e 100644 (file)
@@ -471,7 +471,7 @@ function survey_print_all_responses($cmid, $results, $courseid) {
 
     foreach ($results as $a) {
         $table->data[] = array($OUTPUT->user_picture($a, array('courseid'=>$courseid)),
-               $OUTPUT->link("report.php?action=student&student=$a->id&id=$cmid", fullname($a)),
+               html_writer::link("report.php?action=student&student=$a->id&id=$cmid", fullname($a)),
                userdate($a->time));
     }
 
index f3080be..4bb7401 100644 (file)
@@ -238,7 +238,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
             $type       = mimeinfo_from_type("type", $type);
             $image      = html_writer::empty_tag('img', array('src'=>$this->output->pix_url(file_mimetype_icon($type)), 'alt'=>$type, 'class'=>'icon'));
 
-            $linkhtml   = html_writer::link($fileurl, $image) . $this->output->link($fileurl, $filename);
+            $linkhtml   = html_writer::link($fileurl, $image) . html_writer::link($fileurl, $filename);
             $linktxt    = "$filename [$fileurl]";
 
             if ($format == "html") {
index 1f2ff4e..f4c86b2 100644 (file)
@@ -628,11 +628,11 @@ class question_bank_preview_action_column extends question_bank_action_column_ba
             // Build the icon.
             $image = $OUTPUT->pix_icon('t/preview', $this->strpreview);
 
-            $link = new html_link($this->qbank->preview_question_url($question->id), $image, array('title' => $this->strpreview));
+            $link = new moodle_url($this->qbank->preview_question_url($question->id));
             parse_str(QUESTION_PREVIEW_POPUP_OPTIONS, $options);
-            $link->add_action(new popup_action('click', $link->url, 'questionpreview', $options));
-        
-            echo $OUTPUT->link($link);
+            $action = new popup_action('click', $link, 'questionpreview', $options);
+
+            echo $OUTPUT->action_link($link, $image, $action, array('title' => $this->strpreview));
         }
     }
 
index 82851ed..bb7427d 100644 (file)
@@ -944,10 +944,9 @@ class default_questiontype {
         if (!empty($options->questioncommentlink)) {
             $strcomment = get_string('commentorgrade', 'quiz');
 
-            $link = html_link::make("$options->questioncommentlink?attempt=$state->attempt&question=$actualquestionid", $strcomment);
-            $link->add_action(new popup_action('click', $link->url, 'commentquestion', array('height' => 480, 'width' => 750)));
-            $link->title = $strcomment;
-            $commentlink = $OUTPUT->container($OUTPUT->link($link), 'commentlink');
+            $link = new moodle_url("$options->questioncommentlink?attempt=$state->attempt&question=$actualquestionid");
+            $action = new popup_action('click', $link->url, 'commentquestion', array('height' => 480, 'width' => 750));
+            $commentlink = $OUTPUT->container($OUTPUT->action_link($link, $strcomment, $action), 'commentlink');
         }
 
         $history = $this->history($question, $state, $number, $cmoptions, $options);
@@ -1055,10 +1054,9 @@ class default_questiontype {
                     '" title="' . $stredit . '">' . $linktext . '</a>';
         } else {
         /// We have to edit in a pop-up.
-            $link = html_link::make($linkurl . '&inpopup=1', $linktext);
-            $link->add_action(new popup_action('click', $link->url, 'editquestion'));
-            $link->title = $stredit;
-            return $OUTPUT->link($link);
+            $link = new moodle_url($linkurl . '&inpopup=1');
+            $action = new popup_action('click', $link, 'editquestion');
+            return $OUTPUT->action_link($link, $linktext, $action ,array('title'=>$stredit));
         }
     }
 
@@ -1119,10 +1117,9 @@ class default_questiontype {
             } else if (isset($options->questionreviewlink)) {
                 $reviewlink = new moodle_url($options->questionreviewlink);
                 $reviewlink->params(array('state'=>$st->id,'question'=>$question->id));
-                $link = html_link::make($reviewlink, $st->seq_number);
-                $link->add_action(new popup_action('click', $link->url, 'reviewquestion', array('height' => 450, 'width' => 650)));
-                $link->title = $strreviewquestion;
-                $link = $OUTPUT->link($link);
+                $link = new moodle_url($reviewlink);
+                $action = new popup_action('click', $link, 'reviewquestion', array('height' => 450, 'width' => 650));
+                $link = $OUTPUT->action_link($link, $st->seq_number, $action, array('title'=>$strreviewquestion));
             } else {
                 $link = $st->seq_number;
             }