Skip to content

Commit

Permalink
Merge branch 'MDL-81733-main' of https://github.com/izendegi/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed May 28, 2024
2 parents 398e690 + c3386a4 commit 06196de
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
6 changes: 4 additions & 2 deletions mod/lesson/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2299,8 +2299,10 @@ public function link_for_activitylink() {
$instancename = $DB->get_field($modname, 'name', array('id' => $module->instance));
if ($instancename) {
return html_writer::link(new moodle_url('/mod/'.$modname.'/view.php',
array('id' => $this->properties->activitylink)), get_string('activitylinkname',
'lesson', $instancename), array('class' => 'centerpadded lessonbutton standardbutton pr-3'));
['id' => $this->properties->activitylink]),
get_string('activitylinkname', 'lesson',
format_string($instancename, true, ['context' => $this->get_context()])),
['class' => 'centerpadded lessonbutton standardbutton pr-3']);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion mod/lesson/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ function definition() {
if ($module = get_coursemodule_from_instance($mod->modname, $mod->instance, $COURSE->id)) {
// Exclude this lesson, if it's already been saved.
if (!isset($this->_cm->id) || $this->_cm->id != $mod->id) {
$modinstances[$mod->id] = $mod->modname.' - '.$module->name;
$modinstances[$mod->id] = get_string('pluginname', $mod->modname).' - '.
format_string($module->name, true, ['context' => $this->context]);
}
}
}
Expand Down
15 changes: 12 additions & 3 deletions mod/lesson/tests/behat/lesson_navigation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ Feature: In a lesson activity, students can navigate through a series of pages i
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | course | idnumber |
| lesson | Test lesson name | C1 | lesson1 |
| activity | name | course | idnumber |
| lesson | Test lesson name | C1 | lesson1 |
| page | <span class="multilang" lang="en">A page (EN)</span><span class="multilang" lang="eu">Orri bat (EU)</span> | C1 | PAGE1 |

Scenario: Student navigation with pages and questions
Given the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
Given the following "mod_lesson > pages" exist:
| lesson | qtype | title | content |
| Test lesson name | content | First page name | First page contents |
Expand All @@ -33,7 +36,11 @@ Feature: In a lesson activity, students can navigate through a series of pages i
| Second page name | Next page | | Next page | 0 |
| Hardest question ever | 2 | Correct answer | End of lesson | 1 |
| Hardest question ever | 1 | Incorrect answer | Second page name | 0 |
When I am on the "Test lesson name" "lesson activity" page logged in as student1
When I am on the "Test lesson name" "lesson activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "Link to next activity" to "Page - A page (EN)"
And I press "Save and display"
And I am on the "Test lesson name" "lesson activity" page logged in as student1
Then I should see "First page contents"
And I press "Next page"
And I should see "Second page contents"
Expand All @@ -60,6 +67,8 @@ Feature: In a lesson activity, students can navigate through a series of pages i
And I press "Continue"
And I should see "Congratulations - end of lesson reached"
And I should see "Your score is 0 (out of 1)."
And I should see "Go to A page (EN)"
And I should not see "Orri bat (EU)"

Scenario: Student reattempts a question until out of attempts
Given the following "mod_lesson > page" exist:
Expand Down

0 comments on commit 06196de

Please sign in to comment.