Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

mod-lesson MDL-25632 Set a default jump to display when a question ha…

…s no answers (after 1.9 upgrade)
  • Loading branch information...
commit 9170dea7d66704fbca88efc753a3d3a6e64ec8c4 1 parent 2a03a82
Sam Hemelryk samhemelryk authored
2  mod/lesson/locallib.php
@@ -2470,6 +2470,8 @@ public function get_jumps() {
2470 2470 foreach ($answers as $answer) {
2471 2471 $jumps[] = $this->get_jump_name($answer->jumpto);
2472 2472 }
  2473 + } else {
  2474 + $jumps[] = $this->get_jump_name($this->properties->nextpageid);
2473 2475 }
2474 2476 return $jumps;
2475 2477 }
4 mod/lesson/pagetypes/branchtable.php
@@ -64,6 +64,10 @@ public function get_jumps() {
64 64 }
65 65 $jumps[] = $this->get_jump_name($answer->jumpto);
66 66 }
  67 + } else {
  68 + // We get here is the lesson was created on a Moodle 1.9 site and
  69 + // the lesson contains question pages without any answers.
  70 + $jumps[] = $this->get_jump_name($this->properties->nextpageid);
67 71 }
68 72 return $jumps;
69 73 }
2  mod/lesson/pagetypes/matching.php
@@ -420,6 +420,8 @@ public function get_jumps() {
420 420 foreach ($answers as $answer) {
421 421 $jumps[] = $this->get_jump_name($answer->jumpto);
422 422 }
  423 + } else {
  424 + $jumps[] = $this->get_jump_name($this->properties->nextpageid);
423 425 }
424 426 return $jumps;
425 427 }
5 mod/lesson/pagetypes/multichoice.php
@@ -57,7 +57,6 @@ public function get_idstring() {
57 57 public function get_jumps() {
58 58 global $DB;
59 59 $jumps = array();
60   - $params = array ("lessonid" => $this->lesson->id, "pageid" => $this->properties->id);
61 60 if ($answers = $this->get_answers()) {
62 61 foreach ($answers as $answer) {
63 62 if ($answer->answer === '') {
@@ -66,6 +65,10 @@ public function get_jumps() {
66 65 }
67 66 $jumps[] = $this->get_jump_name($answer->jumpto);
68 67 }
  68 + } else {
  69 + // We get here is the lesson was created on a Moodle 1.9 site and
  70 + // the lesson contains question pages without any answers.
  71 + $jumps[] = $this->get_jump_name($this->properties->nextpageid);
69 72 }
70 73 return $jumps;
71 74 }

0 comments on commit 9170dea

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