From a06face2ce9d29904feaf43dca72389e14bafa7b Mon Sep 17 00:00:00 2001 From: Josh Ebarvia Date: Wed, 31 May 2017 16:16:23 +0930 Subject: [PATCH] MDL-49484 mod_lesson: Fix lesson page headers when editing --- mod/lesson/lang/en/lesson.php | 18 ++++++++++++++++++ mod/lesson/locallib.php | 8 +++++++- mod/lesson/pagetypes/branchtable.php | 6 +++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/mod/lesson/lang/en/lesson.php b/mod/lesson/lang/en/lesson.php index a331db6329c..bceb4264b1b 100644 --- a/mod/lesson/lang/en/lesson.php +++ b/mod/lesson/lang/en/lesson.php @@ -42,16 +42,23 @@ $string['addaquestionpage'] = 'Add a question page'; $string['addaquestionpagehere'] = 'Add a question page here'; $string['addbranchtable'] = 'Add a content page'; $string['addcluster'] = 'Add a cluster'; +$string['addessay'] = 'Create an Essay question page'; $string['addedabranchtable'] = 'Added a content page'; $string['addedanendofbranch'] = 'Added an end of branch'; $string['addedaquestionpage'] = 'Added a question page'; $string['addedcluster'] = 'Added a cluster'; $string['addedendofcluster'] = 'Added an end of cluster'; +$string['addendofbranch'] = 'Add end of branch'; $string['addendofcluster'] = 'Add an end of cluster'; +$string['addmatching'] = 'Create a Matching question page'; +$string['addmultichoice'] = 'Create a Multichoice question page'; $string['addnewgroupoverride'] = 'Add group override'; $string['addnewuseroverride'] = 'Add user override'; +$string['addnumerical'] = 'Create a Numerical question page'; $string['additionalattemptsremaining'] = 'Completed, You can re-attempt this lesson'; $string['addpage'] = 'Add a page'; +$string['addshortanswer'] = 'Create a Short answer question page'; +$string['addtruefalse'] = 'Create a True/false question page'; $string['allowofflineattempts'] = 'Allow lesson to be attempted offline using the mobile app'; $string['allowofflineattempts_help'] = 'If enabled, a mobile app user can download the lesson and attempt it offline. All the possible answers and correct responses will be downloaded as well. @@ -162,11 +169,22 @@ $string['displayscorewithessays'] = '

You earned {$a->score} out of {$a->tempm $string['displayscorewithoutessays'] = 'Your score is {$a->score} (out of {$a->grade}).'; $string['duplicatepagenamed'] = 'Duplicate page: {$a}'; $string['edit'] = 'Edit'; +$string['editbranchtable'] = 'Editing a content page'; +$string['editcluster'] = 'Editing a cluster'; +$string['editendofcluster'] = 'Editing an end of cluster page'; +$string['editendofbranch'] = 'Editing an end of branch page'; +$string['editessay'] = 'Editing an Essay question page'; $string['editingquestionpage'] = 'Editing {$a} question page'; $string['editlessonsettings'] = 'Edit lesson settings'; +$string['editmatching'] = 'Editing a Matching question page'; +$string['editmultichoice'] = 'Editing a Multichoice question page'; +$string['editnumerical'] = 'Editing a Numerical question page'; $string['editoverride'] = 'Edit override'; $string['editpage'] = 'Edit page contents'; $string['editpagecontent'] = 'Edit page contents'; +$string['editquestion'] = 'Editing a question page'; +$string['editshortanswer'] = 'Editing a Short answer question page'; +$string['edittruefalse'] = 'Editing a True/false question page'; $string['email'] = 'Email'; $string['emailallgradedessays'] = 'Email ALL graded essays'; $string['emailgradedessays'] = 'Email graded essays'; diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index e0b143bbddb..74f584a29ea 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -1247,7 +1247,13 @@ abstract class lesson_add_page_form_base extends moodleform { $mform = $this->_form; $editoroptions = $this->_customdata['editoroptions']; - $mform->addElement('header', 'qtypeheading', get_string('createaquestionpage', 'lesson', get_string($this->qtypestring, 'lesson'))); + if ($this->qtypestring != 'selectaqtype') { + if ($this->_customdata['edit']) { + $mform->addElement('header', 'qtypeheading', get_string('edit'. $this->qtypestring, 'lesson')); + } else { + $mform->addElement('header', 'qtypeheading', get_string('add'. $this->qtypestring, 'lesson')); + } + } if (!empty($this->_customdata['returnto'])) { $mform->addElement('hidden', 'returnto', $this->_customdata['returnto']); diff --git a/mod/lesson/pagetypes/branchtable.php b/mod/lesson/pagetypes/branchtable.php index c7e4342084c..23f9c58de7c 100644 --- a/mod/lesson/pagetypes/branchtable.php +++ b/mod/lesson/pagetypes/branchtable.php @@ -324,7 +324,11 @@ class lesson_add_page_form_branchtable extends lesson_add_page_form_base { $jumptooptions = lesson_page_type_branchtable::get_jumptooptions($firstpage, $lesson); - $mform->setDefault('qtypeheading', get_string('addabranchtable', 'lesson')); + if ($this->_customdata['edit']) { + $mform->setDefault('qtypeheading', get_string('editbranchtable', 'lesson')); + } else { + $mform->setDefault('qtypeheading', get_string('addabranchtable', 'lesson')); + } $mform->addElement('hidden', 'firstpage'); $mform->setType('firstpage', PARAM_BOOL);