]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19813 Upgraded calls to link_to_popup_window()
authornicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 13:17:07 +0000 (13:17 +0000)
committernicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 13:17:07 +0000 (13:17 +0000)
mod/quiz/locallib.php
mod/quiz/report/overview/overview_table.php
mod/quiz/report/responses/responses_table.php

index eafe14f0081de39f9e164666042d1ba17fb4851c..8166e8d84870750f69e12d7b309bf29f79c55970 100644 (file)
@@ -821,9 +821,16 @@ function quiz_question_preview_button($quiz, $question, $label = false) {
     }
 
     // Build the icon.
-    return link_to_popup_window('/question/preview.php?id=' . $question->id . '&amp;quizid=' . $quiz->id, 'questionpreview',
-            "<img src=\"" . $OUTPUT->old_icon_url('t/preview') . "\" class=\"iconsmall\" alt=\"$strpreviewquestion\" /> $strpreviewlabel",
-            0, 0, $strpreviewquestion, QUESTION_PREVIEW_POPUP_OPTIONS, true);
+    $image = new html_image();
+    $image->src = $OUTPUT->old_icon_url('t/preview');
+    $image->add_class('iconsmall');
+    $image->alt = $strpreviewquestion;
+
+    $link = html_link::make("/question/preview.php?id=$question->id&quizid=$quiz->id", $strpreviewlabel);
+    parse_str(QUESTION_PREVIEW_POPUP_OPTIONS, $options);
+    $link->add_action(new popup_action('click', $link->url, 'questionpreview', $options));
+    $link->title = $strpreviewquestion;
+    return $OUTPUT->link_to_popup($link, $image);
 }
 
 /**
index 5f28958a57808bc0b9cbbd2b54b5ba197362dd09..7917f10edcde3f511bba05e7eb11e1c424eba266 100644 (file)
@@ -206,6 +206,7 @@ class quiz_report_overview_table extends table_sql {
      * @return string the contents of the cell.
      */
     function other_cols($colname, $attempt){
+        global $OUTPUT;
 
         if (preg_match('/^qsgrade([0-9]+)$/', $colname, $matches)){
             $questionid = $matches[1];
@@ -226,11 +227,12 @@ class quiz_report_overview_table extends table_sql {
                         $grade = '<del>'.$oldgrade.'</del><br />'.
                                 $newgrade;
                     }
-                    $linktopopup = link_to_popup_window('/mod/quiz/reviewquestion.php?attempt=' .
-                            $attempt->attempt . '&amp;question=' . $question->id,
-                            'reviewquestion', $grade, 450, 650,
-                            get_string('reviewresponsetoq', 'quiz', $question->formattedname),
-                            'none', true);
+
+                    $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); 
+
                     if (($this->questions[$questionid]->maxgrade != 0)){
                         $fractionofgrade = $stateforqinattempt->grade
                                         / $this->questions[$questionid]->maxgrade;
@@ -241,7 +243,7 @@ class quiz_report_overview_table extends table_sql {
                     } else {
                         return $linktopopup;
                     }
-                    
+
                 } else {
                     return $grade;
                 }
index e89d08ea5f680f0e233d103ee0dfffb6d477126e..2f968b4ba852ce733e0c86bd9418ed64ecc90b3a 100644 (file)
@@ -137,7 +137,7 @@ class quiz_report_responses_table extends table_sql {
         }
     }
     function other_cols($colname, $attempt){
-        global $QTYPES;
+        global $QTYPES, $OUTPUT;
         static $states =array();
         if (preg_match('/^qsanswer([0-9]+)$/', $colname, $matches)){
             if ($attempt->uniqueid == 0) {
@@ -158,16 +158,16 @@ class quiz_report_responses_table extends table_sql {
             } else {
                 $formathtml = false;
             }
-            
+
             $summary =  $QTYPES[$question->qtype]->response_summary($question, $stateforqinattempt,
                                                 QUIZ_REPORT_RESPONSES_MAX_LEN_TO_DISPLAY, $formathtml);
             if (!$this->is_downloading()) {
                 if ($summary){
-                    $summary = link_to_popup_window('/mod/quiz/reviewquestion.php?attempt=' .
-                        $attempt->attempt . '&amp;question=' . $question->id,
-                        'reviewquestion', $summary, 450, 650,
-                        get_string('reviewresponsetoq', 'quiz', $question->formattedname),
-                        'none', true);
+                    $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);
+
                     if (question_state_is_graded($stateforqinattempt)
                                 && ($question->maxgrade > 0)){
                         $grade = $stateforqinattempt->grade