Permalink
Browse files

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

…OODLE_23_STABLE
  • Loading branch information...
2 parents f16751f + d7b7aff commit 70dc5add7dbc013fe8e9e02f9bf1819ff44896df @danpoltawski danpoltawski committed Aug 22, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 mod/quiz/renderer.php
View
@@ -229,7 +229,19 @@ public function review_form($page, $showall, $displayoptions, $content, $attempt
* @param $url contains a url for the review link
*/
public function finish_review_link($url) {
- if ($this->page->pagelayout == 'popup') {
+
+ // This is an ugly hack to fix MDL-34733 without changing the renderer API.
+ global $attemptobj;
+ if (!empty($attemptobj)) {
+ // I think that every page in standard Moodle that ends up calling
+ // this method will actually end up coming down this branch.
+ $inpopup = $attemptobj->get_access_manager(time())->attempt_must_be_in_popup();
+ } else {
+ // Else fall back to old (not very good) heuristic.
+ $inpopup = $this->page->pagelayout == 'popup';
+ }
+
+ if ($inpopup) {
// In a 'secure' popup window.
$this->page->requires->js_init_call('M.mod_quiz.secure_window.init_close_button',
array($url), quiz_get_js_module());

0 comments on commit 70dc5ad

Please sign in to comment.