]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19820 Upgraded calls to link_to_popup_window()
authornicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 13:17:43 +0000 (13:17 +0000)
committernicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 13:17:43 +0000 (13:17 +0000)
question/editlib.php
question/type/questiontype.php

index a598942ae9e826a306875e39611ae276cb859f1d..a51eae87c9e4a0825cef7e95a4996d1593fe7555 100644 (file)
@@ -625,9 +625,16 @@ class question_bank_preview_action_column extends question_bank_action_column_ba
     protected function display_content($question, $rowclasses) {
         global $OUTPUT;
         if (question_has_capability_on($question, 'use')) {
-            link_to_popup_window($this->qbank->preview_question_url($question->id), 'questionpreview',
-                    ' <img src="' . $OUTPUT->old_icon_url('t/preview') . '" class="iconsmall" alt="' . $this->strpreview . '" />',
-                    0, 0, $this->strpreview, QUESTION_PREVIEW_POPUP_OPTIONS);
+            parse_str(QUESTION_PREVIEW_POPUP_OPTIONS, $options);
+            $image = new html_image();
+            $image->src = $OUTPUT->old_icon_url('t/preview');
+            $image->add_class('iconsmall');
+            $image->alt = $this->strpreview;
+
+            $link = html_link::make($this->qbank->preview_question_url($question->id), $this->strpreview);
+            $link->add_action(new popup_action('click', $link->url, 'questionpreview', $options));
+            $link->title = $this->strpreview;
+            echo $OUTPUT->link_to_popup($link, $image);
         }
     }
 
index 845e11599fcb397684c993e21d4407a7a2230bcf..cb9146680cbd247740a38d03f8853f41a3b475f8 100644 (file)
@@ -910,7 +910,7 @@ class default_questiontype {
         provided the member functions it calls are overridden where required.
         The layout is determined by the template question.html */
 
-        global $CFG;
+        global $CFG, $OUTPUT;
         $isgraded = question_state_is_graded($state->last_graded);
 
         if (isset($question->randomquestionid)) {
@@ -945,10 +945,11 @@ class default_questiontype {
 
         if (!empty($options->questioncommentlink)) {
             $strcomment = get_string('commentorgrade', 'quiz');
-            $commentlink = link_to_popup_window($options->questioncommentlink .
-                    '?attempt=' . $state->attempt . '&amp;question=' . $actualquestionid,
-                    'commentquestion', $strcomment, 480, 750, $strcomment, 'none', true);
-            $commentlink = '<div class="commentlink">'. $commentlink .'</div>';
+
+            $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');
         }
 
         $history = $this->history($question, $state, $number, $cmoptions, $options);
@@ -1055,8 +1056,10 @@ class default_questiontype {
                     '" title="' . $stredit . '">' . $linktext . '</a>';
         } else {
         /// We have to edit in a pop-up.
-            return link_to_popup_window($linkurl . '&amp;inpopup=1', 'editquestion',
-                    $linktext, false, false, $stredit, '', true);
+            $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);                    
         }
     }
 
@@ -1108,10 +1111,11 @@ class default_questiontype {
                         $link = '<b>'.$st->seq_number.'</b>';
                     } else {
                         if(isset($options->questionreviewlink)) {
-                            $link = link_to_popup_window($options->questionreviewlink .
-                                    '&amp;question=' . $question->id . '&amp;state=' . $st->id,
-                                    'reviewquestion', $st->seq_number, 450, 650, $strreviewquestion,
-                                    'none', true);
+                            $link = html_link::make("$options->questionreviewlink?state=$st->id&question=$question->id", $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);
+                            
                         } else {
                             $link = $st->seq_number;
                         }