Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'MDL-34733_22' of git://github.com/timhunt/moodle into M…

…OODLE_22_STABLE
  • Loading branch information...
commit faf8ef6f04e3120ab5e7ac48ac099b2727a3a800 2 parents d90e223 + bfa34d8
Dan Poltawski authored

Showing 1 changed file with 13 additions and 1 deletion. Show diff stats Hide diff stats

  1. 14  mod/quiz/renderer.php
14  mod/quiz/renderer.php
@@ -229,7 +229,19 @@ public function review_form($page, $showall, $displayoptions, $content, $attempt
229 229
      * @param $url contains a url for the review link
230 230
      */
231 231
     public function finish_review_link($url) {
232  
-        if ($this->page->pagelayout == 'popup') {
  232
+
  233
+        // This is an ugly hack to fix MDL-34733 without changing the renderer API.
  234
+        global $attemptobj;
  235
+        if (!empty($attemptobj)) {
  236
+            // I think that every page in standard Moodle that ends up calling
  237
+            // this method will actually end up coming down this branch.
  238
+            $inpopup = $attemptobj->get_access_manager(time())->attempt_must_be_in_popup();
  239
+        } else {
  240
+            // Else fall back to old (not very good) heuristic.
  241
+            $inpopup = $this->page->pagelayout == 'popup';
  242
+        }
  243
+
  244
+        if ($inpopup) {
233 245
             // In a 'secure' popup window.
234 246
             $this->page->requires->js_init_call('M.mod_quiz.secure_window.init_close_button',
235 247
                     array($url), quiz_get_js_module());

0 notes on commit faf8ef6

Please sign in to comment.
Something went wrong with that request. Please try again.