MDL-58790 quiz editing: translate hard-coded new heading string

This commit is contained in:
Tim Hunt
2017-09-26 11:18:28 +01:00
parent 469c46aa3a
commit ce7cb88198
3 changed files with 10 additions and 5 deletions
+7 -3
View File
@@ -993,12 +993,16 @@ class structure {
/**
* Add a section heading on a given page and return the sectionid
* @param int $pagenumber the number of the page where the section heading begins.
* @param string $heading the heading to add.
* @param string|null $heading the heading to add. If not given, a default is used.
*/
public function add_section_heading($pagenumber, $heading = 'Section heading ...') {
public function add_section_heading($pagenumber, $heading = null) {
global $DB;
$section = new \stdClass();
$section->heading = $heading;
if ($heading !== null) {
$section->heading = $heading;
} else {
$section->heading = get_string('newsectionheading', 'quiz');
}
$section->quizid = $this->get_quizid();
$slotsonpage = $DB->get_records('quiz_slots', array('quizid' => $this->get_quizid(), 'page' => $pagenumber), 'slot DESC');
$section->firstslot = end($slotsonpage)->slot;
+1
View File
@@ -510,6 +510,7 @@ $string['newattemptfail'] = 'Error: Could not start a new attempt at the quiz';
$string['newpage'] = 'New page';
$string['newpage_help'] = 'For longer quizzes it makes sense to stretch the quiz over several pages by limiting the number of questions per page. When adding questions to the quiz, page breaks will automatically be inserted according to this setting. However page breaks may later be moved manually on the editing page.';
$string['newpageevery'] = 'Automatically start a new page';
$string['newsectionheading'] = 'New heading';
$string['noanswers'] = 'No answers were selected!';
$string['noattempts'] = 'No attempts have been made on this quiz';
$string['noattemptsfound'] = 'No attempts found.';
@@ -386,7 +386,7 @@ Feature: Edit quiz page - section headings
And I click on the "Remove" page break icon after question "TF1"
And I open the "Page 2" add to quiz menu
And I choose "a new section heading" in the open action menu
Then "TF3" "list_item" should exist in the "Section heading ..." "list_item"
Then "TF3" "list_item" should exist in the "New heading" "list_item"
@javascript
Scenario: Add section works after removing a page break with more than 10 pages
@@ -425,4 +425,4 @@ Feature: Edit quiz page - section headings
And I click on the "Remove" page break icon after question "TF10"
And I open the "Page 10" add to quiz menu
And I choose "a new section heading" in the open action menu
Then "TF10" "list_item" should exist in the "Section heading ..." "list_item"
Then "TF10" "list_item" should exist in the "New heading" "list_item"