Permalink
Browse files

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

…s no answers (after 1.9 upgrade)
  • Loading branch information...
1 parent 2a03a82 commit 9170dea7d66704fbca88efc753a3d3a6e64ec8c4 Sam Hemelryk committed Dec 14, 2010
View
2 mod/lesson/locallib.php
@@ -2470,6 +2470,8 @@ public function get_jumps() {
foreach ($answers as $answer) {
$jumps[] = $this->get_jump_name($answer->jumpto);
}
+ } else {
+ $jumps[] = $this->get_jump_name($this->properties->nextpageid);
}
return $jumps;
}
View
4 mod/lesson/pagetypes/branchtable.php
@@ -64,6 +64,10 @@ public function get_jumps() {
}
$jumps[] = $this->get_jump_name($answer->jumpto);
}
+ } else {
+ // We get here is the lesson was created on a Moodle 1.9 site and
+ // the lesson contains question pages without any answers.
+ $jumps[] = $this->get_jump_name($this->properties->nextpageid);
}
return $jumps;
}
View
2 mod/lesson/pagetypes/matching.php
@@ -420,6 +420,8 @@ public function get_jumps() {
foreach ($answers as $answer) {
$jumps[] = $this->get_jump_name($answer->jumpto);
}
+ } else {
+ $jumps[] = $this->get_jump_name($this->properties->nextpageid);
}
return $jumps;
}
View
5 mod/lesson/pagetypes/multichoice.php
@@ -57,7 +57,6 @@ public function get_idstring() {
public function get_jumps() {
global $DB;
$jumps = array();
- $params = array ("lessonid" => $this->lesson->id, "pageid" => $this->properties->id);
if ($answers = $this->get_answers()) {
foreach ($answers as $answer) {
if ($answer->answer === '') {
@@ -66,6 +65,10 @@ public function get_jumps() {
}
$jumps[] = $this->get_jump_name($answer->jumpto);
}
+ } else {
+ // We get here is the lesson was created on a Moodle 1.9 site and
+ // the lesson contains question pages without any answers.
+ $jumps[] = $this->get_jump_name($this->properties->nextpageid);
}
return $jumps;
}

0 comments on commit 9170dea

Please sign in to comment.