From 5e8a85aa6471b1b44730b59706f1107fd73fcabb Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 23 Feb 2011 18:53:50 +0000 Subject: [PATCH] MDL-20636 Massively reduce the number of references to quiz in the question code. This mostly involves moving lang strings around, but I don't have time to do an AMOS script now. --- lang/en/question.php | 6 ++ mod/quiz/lang/en/quiz.php | 54 +-------------- question/category.php | 2 +- question/category_class.php | 25 ++++--- question/category_form.php | 8 +-- question/edit.php | 2 +- question/editlib.php | 26 +++---- question/engine/datalib.php | 8 +-- question/engine/lib.php | 2 +- question/engine/renderer.php | 2 +- question/engine/simpletest/helpers.php | 2 +- question/export.php | 4 +- question/format.php | 25 +++---- question/format/gift/format.php | 13 ++-- question/format/gift/lang/en/qformat_gift.php | 16 ++++- question/format/learnwise/format.php | 2 +- question/format/qti_two/format.php | 8 +-- question/format/qti_two/qt_common.php | 3 +- question/format/webct/format.php | 26 +++---- .../format/webct/lang/en/qformat_webct.php | 9 +++ question/format/xhtml/format.php | 4 +- question/format/xml/format.php | 12 ++-- question/format/xml/lang/en/qformat_xml.php | 7 +- question/import.php | 8 +-- question/import_form.php | 2 +- question/move_form.php | 4 +- question/qengine.js | 2 +- question/question.php | 4 +- .../calculated/datasetdefinitions_form.php | 4 +- .../type/calculated/datasetitems_form.php | 13 ++-- .../type/calculated/edit_calculated_form.php | 12 ++-- .../calculated/lang/en/qtype_calculated.php | 19 +++++- question/type/calculated/questiontype.php | 67 ++++++++----------- .../edit_calculatedmulti_form.php | 8 +-- .../type/calculatedmulti/questiontype.php | 4 +- .../edit_calculatedsimple_form.php | 10 +-- .../type/calculatedsimple/questiontype.php | 8 +-- question/type/ddwtos/script.js | 6 +- .../description/lang/en/qtype_description.php | 2 +- question/type/edit_question_form.php | 4 +- question/type/match/edit_match_form.php | 6 +- question/type/match/lang/en/qtype_match.php | 3 +- question/type/match/questiontype.php | 4 +- .../multianswer/edit_multianswer_form.php | 19 +++--- question/type/multianswer/questiontype.php | 6 +- .../multichoice/lang/en/qtype_multichoice.php | 2 +- .../type/numerical/edit_numerical_form.php | 2 +- .../numerical/lang/en/qtype_numerical.php | 6 ++ question/type/opaque/lang/en/qtype_opaque.php | 2 +- .../type/opaque/simpletest/testlocallib.php | 2 - .../edit_oumultiresponse_form.php | 2 +- question/type/questiontype.php | 2 +- question/type/random/edit_random_form.php | 4 +- question/type/random/lang/en/qtype_random.php | 3 +- .../randomsamatch/edit_randomsamatch_form.php | 2 +- question/type/shortanswer/questiontype.php | 2 +- question/type/truefalse/questiontype.php | 4 +- 57 files changed, 247 insertions(+), 267 deletions(-) diff --git a/lang/en/question.php b/lang/en/question.php index 071c2fc42c287..fbfb40522d3d7 100644 --- a/lang/en/question.php +++ b/lang/en/question.php @@ -137,6 +137,7 @@ $string['getcontextfromfile'] = 'Get context from file'; $string['changepublishstatuscat'] = 'Category "{$a->name}" in course "{$a->coursename}" will have it\'s sharing status changed from {$a->changefrom} to {$a->changeto}.'; $string['chooseqtypetoadd'] = 'Choose a question type to add'; +$string['editquestions'] = 'Edit questions'; $string['ignorebroken'] = 'Ignore broken links'; $string['impossiblechar'] = 'Impossible character {$a} detected as parenthesis character'; $string['importcategory'] = 'Import category'; @@ -152,11 +153,13 @@ $string['invalidcategoryidtomove'] = 'Invalid category id to move!'; $string['invalidconfirm'] = 'Confirmation string was incorrect'; $string['invalidcontextinhasanyquestions'] = 'Invalid context passed to question_context_has_any_questions.'; +$string['invalidpenalty'] = 'Invalid penalty'; $string['invalidwizardpage'] = 'Incorrect or no wizard page specified!'; $string['lastmodifiedby'] = 'Last modified by'; $string['linkedfiledoesntexist'] = 'Linked file {$a} doesn\'t exist'; $string['makechildof'] = 'Make child of \'{$a}\''; $string['maketoplevelitem'] = 'Move to top level'; +$string['matcherror'] = 'Grades do not match grade options - question skipped'; $string['matchgrades'] = 'Match grades'; $string['matchgradeserror'] = 'Error if grade not listed'; $string['matchgradesnearest'] = 'Nearest grade if not listed'; @@ -186,6 +189,7 @@ $string['nopermissionadd'] = 'You don\'t have permission to add questions here.'; $string['nopermissionmove'] = 'You don\'t have permission to move questions from here. You must save the question in this category or save it as a new question.'; $string['noprobs'] = 'No problems found in your question database.'; +$string['notenoughanswers'] = 'This type of question requires at least {$a} answers'; $string['notenoughdatatoeditaquestion'] = 'Neither a question id, nor a category id and question type, was specified.'; $string['notenoughdatatomovequestions'] = 'You need to provide the question ids of questions you want to move.'; $string['notflagged'] = 'Not flagged'; @@ -211,12 +215,14 @@ $string['questioncatsfor'] = 'Question categories for \'{$a}\''; $string['questiondoesnotexist'] = 'This question does not exist'; $string['questionname'] = 'Question name'; +$string['questionno'] = 'Question {$a}'; $string['questionsaveerror'] = 'Errors occur during saving question - ({$a})'; $string['questionsmovedto'] = 'Questions still in use moved to "{$a}" in the parent course category.'; $string['questionsrescuedfrom'] = 'Questions saved from context {$a}.'; $string['questionsrescuedfrominfo'] = 'These questions (some of which may be hidden) were saved when context {$a} was deleted because they are still used by some quizzes or other activities.'; $string['questiontype'] = 'Question type'; $string['questionuse'] = 'Use question in this activity'; +$string['reviewresponse'] = 'Review response'; $string['saveflags'] = 'Save the state of the flags'; $string['selectacategory'] = 'Select a category:'; $string['selectaqtypefordescription'] = 'Select a question type to see its description.'; diff --git a/mod/quiz/lang/en/quiz.php b/mod/quiz/lang/en/quiz.php index 420fca6ac6061..f964d47fafc1a 100644 --- a/mod/quiz/lang/en/quiz.php +++ b/mod/quiz/lang/en/quiz.php @@ -24,7 +24,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['acceptederror'] = 'Accepted error'; $string['accessnoticesheader'] = 'You can preview this quiz, but if this were a real attempt, you would be blocked because:'; $string['action'] = 'Action'; $string['adaptive'] = 'Adaptive mode'; @@ -108,7 +107,6 @@ $string['blackboard'] = 'Blackboard'; $string['blackboard_six'] = 'Blackboard V6+'; $string['bothattempts'] = 'Show students with and without attempts'; -$string['braceerror'] = 'Could not find {...} around answers'; $string['browsersecurity'] = 'Browser security'; $string['browsersecurity_help'] = 'If "Full screen pop-up with some JavaScript security" is selected, @@ -217,13 +215,11 @@ $string['datasetnumber'] = 'Number'; $string['daysavailable'] = 'Days available'; $string['decimaldigits'] = 'Decimal digits in grades'; -$string['decimalformat'] = 'decimals'; $string['decimalplaces'] = 'Decimal places in grades'; $string['decimalplaces_help'] = 'This setting specifies the number of digits shown after the decimal point when displaying grades or grades. It only effects the display of grades, not the grades stored in the database, nor the internal calculations, which are carried out to full accuracy.'; $string['decimalplacesquestion'] = 'Decimal places in question grades'; $string['decimalplacesquestion_help'] = 'This setting specifies the number of digits shown after the decimal point when displaying the grades for individual questions.'; $string['decimalpoints'] = 'Decimal points'; -$string['decimals'] = 'with {$a}'; $string['default'] = 'Default'; $string['defaultgrade'] = 'Default question grade'; $string['defaultinfo'] = 'The default category for questions.'; @@ -290,7 +286,6 @@ $string['errorinquestion'] = 'Error in question'; $string['errormissingquestion'] = 'Error: The system is missing the question with id {$a}'; $string['errornotnumbers'] = 'Error - answers must be numeric'; -$string['errorsdetected'] = '{$a} error(s) detected'; $string['errorunexpectedevent'] = 'Unexpected event code {$a->event} found for question {$a->questionid} in attempt {$a->attemptid}.'; $string['essay'] = 'Essay'; $string['essayquestions'] = 'Questions'; @@ -328,23 +323,8 @@ $string['fractionsaddwrong'] = 'The positive grades you have chosen do not add up to 100%
Instead, they add up to {$a}%
Do you want to go back and fix this question?'; $string['fractionsnomax'] = 'One of the answers should be 100%, so that it is
possible to get a full grade for this question.
Do you want to go back and fix this question?'; $string['fromfile'] = 'from file:'; -$string['functiondisabledbysecuremode'] = 'That functionality is currently disabled'; -$string['functiontakesatleasttwo'] = 'The function {$a} must have at least two arguments'; -$string['functiontakesnoargs'] = 'The function {$a} does not take any arguments'; -$string['functiontakesonearg'] = 'The function {$a} must have exactly one argument'; -$string['functiontakesoneortwoargs'] = 'The function {$a} must have either one or two arguments'; -$string['functiontakestwoargs'] = 'The function {$a} must have exactly two arguments'; $string['generalfeedback'] = 'General feedback'; $string['generalfeedback_help'] = 'General feedback is text which is shown after a question has been attempted. Unlike feedback for a specific question which depends on the response given, the same general feedback is always shown.'; -$string['generatevalue'] = 'Generate a new value between'; -$string['geometric'] = 'Geometric'; -$string['gift'] = 'GIFT format'; -$string['giftleftbraceerror'] = 'Could not find a {'; -$string['giftmatchingformat'] = 'Matching question answers are improperly formatted'; -$string['giftnonumericalanswers'] = 'No answers found for numerical question'; -$string['giftnovalidquestion'] = 'No valid question found'; -$string['giftqtypenotset'] = 'Question type is not set'; -$string['giftrightbraceerror'] = 'Could not find a }'; $string['grade'] = 'Grade'; $string['gradeall'] = 'Grade all'; $string['gradeaverage'] = 'Average grade'; @@ -371,7 +351,6 @@ $string['hidebreaks'] = 'Hide page breaks'; $string['hidereordertool'] = 'Hide the reordering tool'; $string['history'] = 'History of responses:'; -$string['illegalformulasyntax'] = 'Illegal formula syntax starting with \'{$a}\''; $string['imagedisplay'] = 'Image to display'; $string['import'] = 'Import'; $string['import_help'] = 'This function allows you to import questions from external text files. @@ -389,7 +368,6 @@ $string['importingquestions'] = 'Importing {$a} questions from file'; $string['importmaxerror'] = 'There is an error in the question. There are too many answers.'; $string['importmax10error'] = 'There is an error in the question. You may not have more than ten answers'; -$string['importminerror'] = 'There is an error in the question. There are not enough answers for this question type'; $string['importparseerror'] = 'Error(s) found parsing the import file. No questions have been imported. To import any good questions try again setting \'Stop on error\' to \'No\''; $string['importquestions'] = 'Import questions from file'; $string['inactiveoverridehelp'] = '* Student does not have the correct group or role to attempt the quiz'; @@ -420,7 +398,6 @@ $string['listitems'] = 'Listing of items in quiz'; $string['literal'] = 'Literal'; $string['loadingquestionsfailed'] = 'Loading questions failed: {$a}'; -$string['loguniform'] = 'digits, from a loguniform distribution'; $string['makecopy'] = 'Save as new question'; $string['managetypes'] = 'Manage question types and servers'; $string['manualgrading'] = 'Grading'; @@ -430,22 +407,13 @@ $string['match'] = 'Matching'; $string['matchanswer'] = 'Matching answer'; $string['matchanswerno'] = 'Matching answer {$a}'; -$string['matcherror'] = 'Grades do not match grade options - question skipped'; -$string['matchgrades'] = 'Match grades'; -$string['matchgradeserror'] = 'Error if grade not listed'; -$string['matchgradesnearest'] = 'Nearest grade if not listed'; $string['messageprovider:confirmation'] = 'Confirmation of your own quiz submissions'; $string['messageprovider:submission'] = 'Notification of quiz submissions'; $string['max'] = 'Max'; $string['min'] = 'Min'; $string['minutes'] = 'Minutes'; -$string['missinganswer'] = 'Too few :ANSWER, :Lx, :Rx statements for question line {$a}. You must define at last 2 possible answers'; $string['missingcorrectanswer'] = 'Correct answer must be specified'; -$string['missingformula'] = 'Missing formula'; $string['missingitemtypename'] = 'Missing name'; -$string['missingname'] = 'Missing question name'; -$string['missingquestion'] = 'Missing question label after line {$a}'; -$string['missingquestiontext'] = 'Missing question text'; $string['missingword'] = 'Missing word format'; $string['modulename'] = 'Quiz'; $string['modulename_help'] = 'The quiz module enables the teacher to design and set quizzes consisting of multiple choice, true-false, matching and other question types. Each attempt is automatically marked, and the teacher can choose whether to give feedback and/or show correct answers.'; @@ -475,8 +443,6 @@ $string['nodatasubmitted'] = 'No data was submitted.'; $string['noessayquestionsfound'] = 'No manually graded questions found'; $string['nogradewarning'] = 'This quiz is not graded, so you cannot set overall feedback that differs by grade.'; -$string['nomatchinganswer'] = 'You must specify an answer matching the question \'{$a}\'.'; -$string['nominal'] = 'Nominal'; $string['nomoreattempts'] = 'No more attempts are allowed'; $string['none'] = 'None'; $string['noopen'] = 'No open date'; @@ -498,7 +464,6 @@ $string['noscript'] = 'JavaScript must be enabled to continue!'; $string['notavailable'] = 'This quiz is not currently available'; $string['notavailabletostudents'] = 'Note: This quiz is not currently available to your students'; -$string['notenoughanswers'] = 'This type of question requires at least {$a} answers'; $string['notenoughrandomquestions'] = 'There are not enough questions in category {$a->category} to create the question {$a->name} ({$a->id}).'; $string['notenoughsubquestions'] = 'Not enough sub-questions have been defined!
Do you want to go back and fix this question?'; $string['notimedependentitems'] = 'Time dependent items are not currently supported by the quiz module. As a work around, set a time limit for the whole quiz. Do you wish to choose a different item (or use the current item regardless)?'; @@ -576,8 +541,6 @@ $string['questioninuse'] = 'The question \'{$a->questionname}\' is currently being used in:
{$a->quiznames}
The question will not be deleted from these quizzes but only from the category list.'; $string['questionmissing'] = 'Question for this session is missing'; $string['questionname'] = 'Question name'; -$string['questionnametoolong'] = 'Question name too long at line {$a} (255 char. max). It has been truncated.'; -$string['questionno'] = 'Question {$a}'; $string['questionnonav'] = 'Question {$a->number} {$a->attributes}'; $string['questionnonavinfo'] = 'Information {$a->number} {$a->attributes}'; $string['questionnotloaded'] = 'Question {$a} has not been loaded from the database'; @@ -647,7 +610,6 @@ $string['regradenotallowed'] = 'You do not have permission to regrade this quiz'; $string['regradingquestion'] = 'Regrading "{$a}".'; $string['regradingquiz'] = 'Regrading quiz "{$a}"'; -$string['relative'] = 'Relative'; $string['remove'] = 'Remove'; $string['removeallquizattempts'] = 'Delete all quiz attempts'; $string['removeemptypage'] = 'Remove empty page'; @@ -762,8 +724,6 @@ $string['shufflequestionsselected'] = 'Shuffle questions has been set, so some actions relating to pages are not available. To change the shuffle option, {$a}.'; $string['shufflewithin'] = 'Shuffle within questions'; $string['shufflewithin_help'] = 'If enabled, the parts making up each question will be randomly shuffled each time a student attempts the quiz, provided the option is also enabled in the question settings. This setting only applies to questions that have multiple parts, such as multiple choice or matching questions.'; -$string['significantfigures'] = 'with {$a}'; -$string['significantfiguresformat'] = 'significant figures'; $string['singleanswer'] = 'Choose one answer.'; $string['sortage'] = 'Sort by age'; $string['sortalpha'] = 'Sort by name'; @@ -800,21 +760,17 @@ $string['timetaken'] = 'Time taken'; $string['tofile'] = 'to file'; $string['tolerance'] = 'Tolerance'; -$string['tolerancetype'] = 'Tolerance type'; $string['toomanyrandom'] = 'The number of random questions required is more than are still available in the category!'; $string['top'] = 'Top'; $string['totalpointsx'] = 'Total of grades: {$a}'; $string['totalquestionsinrandomqcategory'] = 'Total of {$a} questions in category.'; $string['true'] = 'True'; $string['truefalse'] = 'True/false'; -$string['truefalseimporterror'] = 'Warning: The true/false question \'{$a->questiontext}\' could not be imported properly. It was not clear whether the correct answer is true or false. The question has been imported assuming that the answer is \'{$a->answer}\'. If this is not correct, you will need to edit the question.'; $string['type'] = 'Type'; $string['unfinished'] = 'open'; $string['ungraded'] = 'Ungraded'; -$string['uniform'] = 'decimals, from a uniform distribution'; $string['unit'] = 'Unit'; $string['unknowntype'] = 'Question type not supported at line {$a}. The question will be ignored'; -$string['unsupportedformulafunction'] = 'The function {$a} is not supported'; $string['unusedcategorydeleted'] = 'This category has been deleted because, after deleting the course, its questions weren\'t used any more.'; $string['updatesettings'] = 'Update quiz settings'; $string['updatingatttemptgrades'] = 'Updating attempt grades.'; @@ -829,22 +785,14 @@ $string['viewallanswers'] = 'View {$a} quiz attempts'; $string['viewallreports'] = 'View reports for {$a} attempts'; $string['warningmissingtype'] = 'This question is of a type that has not been installed on your Moodle yet.
Please alert your Moodle administrator.
'; -$string['warningsdetected'] = '{$a} warning(s) detected'; -$string['webct'] = 'WebCT format'; $string['wheregrade'] = 'Where\'s my grade?'; $string['wildcard'] = 'Wild card'; $string['windowclosing'] = 'This window will close shortly.'; $string['withselected'] = 'With selected'; $string['withsummary'] = 'with summary statistics'; -$string['wronggrade'] = 'Wrong grade (after line {$a}) :'; $string['wronguse'] = 'You can not use this page like that'; -$string['xhtml'] = 'XHTML format'; -$string['xml'] = 'Moodle XML format'; -$string['xmlimportnoname'] = 'Missing question name in XML file'; -$string['xmlimportnoquestion'] = 'Missing question text in XML file'; -$string['xmltypeunsupported'] = 'Question type {$a} is not supported by XML import'; +$string['xhtml'] = 'XHTML'; $string['youcannotwait'] = 'This quiz closes before you will be allowed to start another attempt.'; $string['youmustwait'] = 'You must wait before you may re-attempt this quiz. You will be allowed to start another attempt after {$a}.'; $string['youneedtoenrol'] = 'You need to enrol in this course before you can attempt this quiz'; $string['yourfinalgradeis'] = 'Your final grade for this quiz is {$a}.'; -$string['zerosignificantfiguresnotallowed'] = 'The correct answer cannot have zero significant figures!'; diff --git a/question/category.php b/question/category.php index 03154dcd7b6b3..2c6e0e11ed24a 100644 --- a/question/category.php +++ b/question/category.php @@ -60,7 +60,7 @@ $qcobject = new question_category_object($pagevars['cpage'], $thispageurl, $contexts->having_one_edit_tab_cap('categories'), $param->edit, $pagevars['cat'], $param->delete, $contexts->having_cap('moodle/question:add')); -$streditingcategories = get_string('editcategories', 'quiz'); +$streditingcategories = get_string('editcategories', 'question'); if ($param->left || $param->right || $param->moveup || $param->movedown|| $param->moveupcontext || $param->movedowncontext){ require_sesskey(); foreach ($qcobject->editlists as $list){ diff --git a/question/category_class.php b/question/category_class.php index 35d07968f44c8..e9de26bc7b7c9 100644 --- a/question/category_class.php +++ b/question/category_class.php @@ -98,7 +98,7 @@ public function item_html($extraargs = array()){ $str = $extraargs['str']; $category = $this->item; - $editqestions = get_string('editquestions', 'quiz'); + $editqestions = get_string('editquestions', 'question'); /// Each section adds html to be displayed as part of this list item $questionbankurl = new moodle_url("/question/edit.php", ($this->parentlist->pageurl->params() + array('category'=>"$category->id,$category->contextid"))); @@ -157,25 +157,24 @@ public function question_category_object($page, $pageurl, $contexts, $currentcat $this->tab = str_repeat(' ', $this->tabsize); $this->str->course = get_string('course'); - $this->str->category = get_string('category', 'quiz'); - $this->str->categoryinfo = get_string('categoryinfo', 'quiz'); - $this->str->questions = get_string('questions', 'quiz'); + $this->str->category = get_string('category', 'question'); + $this->str->categoryinfo = get_string('categoryinfo', 'question'); + $this->str->questions = get_string('questions', 'question'); $this->str->add = get_string('add'); $this->str->delete = get_string('delete'); $this->str->moveup = get_string('moveup'); $this->str->movedown = get_string('movedown'); $this->str->edit = get_string('editthiscategory', 'question'); $this->str->hide = get_string('hide'); - $this->str->publish = get_string('publish', 'quiz'); $this->str->order = get_string('order'); - $this->str->parent = get_string('parent', 'quiz'); + $this->str->parent = get_string('parent', 'question'); $this->str->add = get_string('add'); $this->str->action = get_string('action'); - $this->str->top = get_string('top', 'quiz'); - $this->str->addcategory = get_string('addcategory', 'quiz'); - $this->str->editcategory = get_string('editcategory', 'quiz'); + $this->str->top = get_string('top'); + $this->str->addcategory = get_string('addcategory', 'question'); + $this->str->editcategory = get_string('editcategory', 'question'); $this->str->cancel = get_string('cancel'); - $this->str->editcategories = get_string('editcategories', 'quiz'); + $this->str->editcategories = get_string('editcategories', 'question'); $this->str->page = get_string('page'); $this->pageurl = $pageurl; @@ -354,7 +353,7 @@ public function display_move_form($questionsincategory, $category){ $vars = new stdClass(); $vars->name = $category->name; $vars->count = $questionsincategory; - echo $OUTPUT->box(get_string('categorymove', 'quiz', $vars), 'generalbox boxaligncenter'); + echo $OUTPUT->box(get_string('categorymove', 'question', $vars), 'generalbox boxaligncenter'); $this->moveform->display(); } @@ -371,7 +370,7 @@ public function move_questions($oldcat, $newcat){ public function add_category($newparent, $newcategory, $newinfo, $return = false) { global $DB; if (empty($newcategory)) { - print_error('categorynamecantbeblank', 'quiz'); + print_error('categorynamecantbeblank', 'question'); } list($parentid, $contextid) = explode(',', $newparent); //moodle_form makes sure select element output is legal no need for further cleaning @@ -404,7 +403,7 @@ public function add_category($newparent, $newcategory, $newinfo, $return = false public function update_category($updateid, $newparent, $newname, $newinfo) { global $CFG, $DB; if (empty($newname)) { - print_error('categorynamecantbeblank', 'quiz'); + print_error('categorynamecantbeblank', 'question'); } // Get the record we are updating. diff --git a/question/category_form.php b/question/category_form.php index c1bedac7e1990..4fd71ee9e19c4 100644 --- a/question/category_form.php +++ b/question/category_form.php @@ -45,7 +45,7 @@ function definition() { $contexts = $this->_customdata['contexts']; $currentcat = $this->_customdata['currentcat']; //-------------------------------------------------------------------------------- - $mform->addElement('header', 'categoryheader', get_string('addcategory', 'quiz')); + $mform->addElement('header', 'categoryheader', get_string('addcategory', 'question')); $questioncategoryel = $mform->addElement('questioncategory', 'parent', get_string('parentcategory', 'question'), array('contexts'=>$contexts, 'top'=>true, 'currentcat'=>$currentcat, 'nochildrenof'=>$currentcat)); @@ -57,14 +57,14 @@ function definition() { $mform->addElement('text','name', get_string('name'),'maxlength="254" size="50"'); $mform->setDefault('name', ''); - $mform->addRule('name', get_string('categorynamecantbeblank', 'quiz'), 'required', null, 'client'); + $mform->addRule('name', get_string('categorynamecantbeblank', 'question'), 'required', null, 'client'); $mform->setType('name', PARAM_MULTILANG); - $mform->addElement('textarea', 'info', get_string('categoryinfo', 'quiz'), array('rows'=> '10', 'cols'=>'45')); + $mform->addElement('textarea', 'info', get_string('categoryinfo', 'question'), array('rows'=> '10', 'cols'=>'45')); $mform->setDefault('info', ''); $mform->setType('info', PARAM_MULTILANG); //-------------------------------------------------------------------------------- - $this->add_action_buttons(false, get_string('addcategory', 'quiz')); + $this->add_action_buttons(false, get_string('addcategory', 'question')); //-------------------------------------------------------------------------------- $mform->addElement('hidden', 'id', 0); $mform->setType('id', PARAM_INT); diff --git a/question/edit.php b/question/edit.php index ecb3438d989dd..34fc61f4d8582 100644 --- a/question/edit.php +++ b/question/edit.php @@ -61,7 +61,7 @@ // TODO log this page view. $context = $contexts->lowest(); -$streditingquestions = get_string('editquestions', "quiz"); +$streditingquestions = get_string('editquestions', 'question'); $PAGE->set_title($streditingquestions); $PAGE->set_heading($COURSE->fullname); echo $OUTPUT->header(); diff --git a/question/editlib.php b/question/editlib.php index ba34c4c8dd02f..b11aced5539cf 100644 --- a/question/editlib.php +++ b/question/editlib.php @@ -389,7 +389,7 @@ class question_bank_checkbox_column extends question_bank_column_base { protected $firstrow = true; public function init() { - $this->strselect = get_string('select', 'quiz'); + $this->strselect = get_string('select'); } public function get_name() { @@ -1193,7 +1193,7 @@ public function display($tabname, $page, $perpage, $sortorder, protected function print_choose_category_message($categoryandcontext) { echo "

"; - print_string("selectcategoryabove", "quiz"); + print_string("selectcategoryabove", "question"); echo "

"; } @@ -1245,9 +1245,9 @@ protected function display_options($recurse = 1, $showhidden = false, $showquest echo '
'; echo "
"; echo html_writer::input_hidden_params($this->baseurl, array('recurse', 'showhidden', 'showquestiontext')); - $this->display_category_form_checkbox('recurse', get_string('recurse', 'quiz')); - $this->display_category_form_checkbox('showhidden', get_string('showhidden', 'quiz')); - $this->display_category_form_checkbox('qbshowtext', get_string('showquestiontext', 'quiz')); + $this->display_category_form_checkbox('recurse', get_string('includesubcategories', 'question')); + $this->display_category_form_checkbox('showhidden', get_string('showhidden', 'question')); + $this->display_category_form_checkbox('qbshowtext', get_string('showquestiontext', 'question')); echo '
'; } @@ -1301,9 +1301,9 @@ protected function display_question_list($contexts, $pageurl, $categoryandcontex $cmoptions = new stdClass(); $cmoptions->hasattempts = !empty($this->quizhasattempts); - $strselectall = get_string("selectall", "quiz"); - $strselectnone = get_string("selectnone", "quiz"); - $strdelete = get_string("delete"); + $strselectall = get_string('selectall'); + $strselectnone = get_string('selectnone'); + $strdelete = get_string('delete'); list($categoryid, $contextid) = explode(',', $categoryandcontext); $catcontext = get_context_instance_by_id($contextid); @@ -1362,7 +1362,7 @@ protected function display_question_list($contexts, $pageurl, $categoryandcontex echo '
'; if ($caneditall || $canmoveall || $canuseall){ - echo ' '.get_string('withselected', 'quiz').':
'; + echo ' '.get_string('withselected', 'question').':
'; if (function_exists('module_specific_buttons')) { echo module_specific_buttons($this->cm->id,$cmoptions); @@ -1374,7 +1374,7 @@ protected function display_question_list($contexts, $pageurl, $categoryandcontex } if ($canmoveall && count($addcontexts)) { - echo '\n"; + echo '\n"; question_category_select_menu($addcontexts, false, 0, "$category->id,$category->contextid"); } @@ -1538,12 +1538,12 @@ public function process_actions_needing_ui() { // Add an explanation about questions in use if ($inuse) { - $questionnames .= '
'.get_string('questionsinuse', 'quiz'); + $questionnames .= '
'.get_string('questionsinuse', 'question'); } $baseurl = new moodle_url('edit.php', $this->baseurl->params()); $deleteurl = new moodle_url($baseurl, array('deleteselected'=>$questionlist, 'confirm'=>md5($questionlist), 'sesskey'=>sesskey())); - echo $OUTPUT->confirm(get_string("deletequestionscheck", "quiz", $questionnames), $deleteurl, $baseurl); + echo $OUTPUT->confirm(get_string('deletequestionscheck', 'question', $questionnames), $deleteurl, $baseurl); return true; } @@ -1660,7 +1660,7 @@ function question_edit_setup($edittab, $baseurl, $requirecmid = false, $requirec $catparts = explode(',', $pagevars['cat']); if (!$catparts[0] || (FALSE !== array_search($catparts[1], $contextlistarr)) || !$DB->count_records_select("question_categories", "id = ? AND contextid = ?", array($catparts[0], $catparts[1]))) { - print_error('invalidcategory', 'quiz'); + print_error('invalidcategory', 'question'); } } else { $category = $defaultcategory; diff --git a/question/engine/datalib.php b/question/engine/datalib.php index df733ea7d801a..c20370a3ea664 100644 --- a/question/engine/datalib.php +++ b/question/engine/datalib.php @@ -16,7 +16,7 @@ // along with Moodle. If not, see . /** - * Code for loading and saving quiz attempts to and from the database. + * Code for loading and saving question attempts to and from the database. * * @package moodlecore * @subpackage questionengine @@ -311,9 +311,9 @@ public function load_questions_usages_latest_steps(qubaid_condition $qubaids, $s } /** - * Load summary information about the state of each question in a group of attempts. - * This is used by the quiz manual grading report, to show how many attempts - * at each question need to be graded. + * Load summary information about the state of each question in a group of + * attempts. This is used, for example, by the quiz manual grading report, + * to show how many attempts at each question need to be graded. * * @param qubaid_condition $qubaids used to restrict which usages are included * in the query. See {@link qubaid_condition}. diff --git a/question/engine/lib.php b/question/engine/lib.php index 93716ac1af20f..4b6cf6401af93 100644 --- a/question/engine/lib.php +++ b/question/engine/lib.php @@ -586,7 +586,7 @@ public static function initialise_js() { /** * Exception thrown when the system detects that a student has done something * out-of-order to a question. This can happen, for example, if they click - * the back button in a quiz, then try to submit a different response. + * the browser's back button in a quiz, then try to submit a different response. * * @copyright 2010 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/question/engine/renderer.php b/question/engine/renderer.php index dacabd3e00b54..c076d50fcc6d2 100644 --- a/question/engine/renderer.php +++ b/question/engine/renderer.php @@ -336,7 +336,7 @@ protected function response_history(question_attempt $qa, qbehaviour_renderer $b $url = new moodle_url($options->questionreviewlink, array('slot' => $qa->get_slot(), 'step' => $i)); $stepno = $this->output->action_link($url, $stepno, new popup_action('click', $url, 'reviewquestion', array('width' => 450, 'height' => 650)), - array('title' => get_string('reviewresponse', 'quiz'))); + array('title' => get_string('reviewresponse', 'question'))); } $user = new stdClass(); $user->id = $step->get_user_id(); diff --git a/question/engine/simpletest/helpers.php b/question/engine/simpletest/helpers.php index 985e4fcc1607d..bc8999562f080 100644 --- a/question/engine/simpletest/helpers.php +++ b/question/engine/simpletest/helpers.php @@ -278,7 +278,7 @@ public static function make_a_description_question() { self::initialise_a_question($description); $description->name = 'Description question'; $description->questiontext = 'This text tells you a bit about the next few questions in this quiz.'; - $description->generalfeedback = 'This is what this seciton of the quiz should have taught you.'; + $description->generalfeedback = 'This is what this section of the quiz should have taught you.'; $description->qtype = question_bank::get_qtype('description'); return $description; diff --git a/question/export.php b/question/export.php index fa97d131314a8..b4f98630a3ca8 100644 --- a/question/export.php +++ b/question/export.php @@ -43,9 +43,7 @@ } list($catid, $catcontext) = explode(',', $pagevars['cat']); -if (!$category = $DB->get_record("question_categories", array("id" => $catid, 'contextid' => $catcontext))) { - print_error('nocategory','quiz'); -} +$category = $DB->get_record('question_categories', array("id" => $catid, 'contextid' => $catcontext), '*', MUST_EXIST); /// Header $PAGE->set_url($thispageurl->out()); diff --git a/question/format.php b/question/format.php index 53d4036287a83..a45b2e3884115 100644 --- a/question/format.php +++ b/question/format.php @@ -205,7 +205,7 @@ function set_can_access_backupdata($canaccess) { * Handle parsing error */ function error($message, $text='', $questionname='') { - $importerrorquestion = get_string('importerrorquestion','quiz'); + $importerrorquestion = get_string('importerrorquestion', 'question'); echo "
\n"; echo "$importerrorquestion $questionname"; @@ -282,25 +282,25 @@ function importprocess($category) { set_time_limit(0); // STAGE 1: Parse the file - echo $OUTPUT->notification(get_string('parsingquestions','quiz'), 'notifysuccess'); + echo $OUTPUT->notification(get_string('parsingquestions', 'question'), 'notifysuccess'); if (! $lines = $this->readdata($this->filename)) { - echo $OUTPUT->notification(get_string('cannotread','quiz')); + echo $OUTPUT->notification(get_string('cannotread', 'question')); return false; } if (!$questions = $this->readquestions($lines, $context)) { // Extract all the questions - echo $OUTPUT->notification(get_string('noquestionsinfile','quiz')); + echo $OUTPUT->notification(get_string('noquestionsinfile', 'question')); return false; } // STAGE 2: Write data to database - echo $OUTPUT->notification(get_string('importingquestions', 'quiz', + echo $OUTPUT->notification(get_string('importingquestions', 'question', $this->count_questions($questions)), 'notifysuccess'); // check for errors before we continue if ($this->stoponerror and ($this->importerrors>0)) { - echo $OUTPUT->notification(get_string('importparseerror','quiz')); + echo $OUTPUT->notification(get_string('importparseerror', 'question')); return true; } @@ -326,7 +326,7 @@ function importprocess($category) { } } if (!$answersvalid) { - echo $OUTPUT->notification(get_string('matcherror', 'quiz')); + echo $OUTPUT->notification(get_string('invalidgrade', 'question')); ++$gradeerrors; continue; } @@ -598,7 +598,7 @@ function defaultquestion() { */ function readquestion($lines) { - $formatnotimplemented = get_string('formatnotimplemented','quiz'); + $formatnotimplemented = get_string('formatnotimplemented', 'question'); echo "

$formatnotimplemented

"; return NULL; @@ -737,7 +737,7 @@ function exportprocess() { // did we actually process anything if ($count==0) { - print_error('noquestions', 'quiz', $continuepath); + print_error('noquestions', 'question', $continuepath); } // final pre-process on exported data @@ -837,7 +837,7 @@ function exportpostprocess() { */ function writequestion($question) { // if not overidden, then this is an error. - $formatnotimplemented = get_string('formatnotimplemented','quiz'); + $formatnotimplemented = get_string('formatnotimplemented', 'question'); echo "

$formatnotimplemented

"; return NULL; } @@ -847,10 +847,11 @@ function writequestion($question) { * @return string file path */ function question_get_export_dir() { + // TODO is this still used. global $USER; if ($this->canaccessbackupdata) { - $dirname = get_string("exportfilename","quiz"); - $path = $this->course->id.'/backupdata/'.$dirname; // backupdata is protected directory + $dirname = get_string('exportfilename', 'question'); + $path = $this->course->id . '/backupdata/' . $dirname; // backupdata is protected directory } else { $path = 'temp/questionexport/' . $USER->id; } diff --git a/question/format/gift/format.php b/question/format/gift/format.php index 030473021d765..8e96191b23ab2 100644 --- a/question/format/gift/format.php +++ b/question/format/gift/format.php @@ -134,8 +134,7 @@ function escapedchar_post($string) { function check_answer_count($min, $answers, $text) { $countanswers = count($answers); if ($countanswers < $min) { - $importminerror = get_string('importminerror', 'quiz'); - $this->error($importminerror, $text); + $this->error(get_string('importminerror', 'qformat_gift'), $text); return false; } @@ -227,7 +226,7 @@ function readquestion($lines) { $answertext = ''; $answerlength = 0; } else if (!(($answerstart !== false) and ($answerfinish !== false))) { - $this->error(get_string('braceerror', 'quiz'), $text); + $this->error(get_string('braceerror', 'qformat_gift'), $text); return false; } else { $answerlength = $answerfinish - $answerstart; @@ -307,7 +306,7 @@ function readquestion($lines) { } if (!isset($question->qtype)) { - $giftqtypenotset = get_string('giftqtypenotset', 'quiz'); + $giftqtypenotset = get_string('giftqtypenotset', 'qformat_gift'); $this->error($giftqtypenotset, $text); return false; } @@ -398,7 +397,7 @@ function readquestion($lines) { foreach ($answers as $key => $answer) { $answer = trim($answer); if (strpos($answer, "->") === false) { - $giftmatchingformat = get_string('giftmatchingformat','quiz'); + $giftmatchingformat = get_string('giftmatchingformat','qformat_gift'); $this->error($giftmatchingformat, $answer); return false; break 2; @@ -490,7 +489,7 @@ function readquestion($lines) { if (count($answers) == 0) { // invalid question - $giftnonumericalanswers = get_string('giftnonumericalanswers','quiz'); + $giftnonumericalanswers = get_string('giftnonumericalanswers','qformat_gift'); $this->error($giftnonumericalanswers, $text); return false; break; @@ -552,7 +551,7 @@ function readquestion($lines) { break; default: - $this->error(get_string('giftnovalidquestion', 'quiz'), $text); + $this->error(get_string('giftnovalidquestion', 'qformat_gift'), $text); return fale; break; diff --git a/question/format/gift/lang/en/qformat_gift.php b/question/format/gift/lang/en/qformat_gift.php index 605c28d3dbad6..bc1c1a0d29c7f 100644 --- a/question/format/gift/lang/en/qformat_gift.php +++ b/question/format/gift/lang/en/qformat_gift.php @@ -24,7 +24,17 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['nohandler'] = 'No handler for question type {$a}'; -$string['gift'] = 'GIFT format'; -$string['gift_help'] = 'GIFT format enables multiple-choice, true-false, short answer, matching, missing word, numerical and essay questions to be imported or exported via text file.'; +$string['braceerror'] = 'Could not find {...} around answers'; +$string['gift'] = 'Gift format'; +$string['gift_help'] = 'Gift format enables multiple-choice, true-false, short answer, matching, missing word, numerical and essay questions to be imported or exported via text file.'; $string['gift_link'] = 'qformat/gift'; +$string['gift'] = 'GIFT format'; +$string['giftleftbraceerror'] = 'Could not find a {'; +$string['giftmatchingformat'] = 'Matching question answers are improperly formatted'; +$string['giftnonumericalanswers'] = 'No answers found for numerical question'; +$string['giftnovalidquestion'] = 'No valid question found'; +$string['giftqtypenotset'] = 'Question type is not set'; +$string['giftrightbraceerror'] = 'Could not find a }'; +$string['importminerror'] = 'There is an error in the question. There are not enough answers for this question type'; +$string['nohandler'] = 'No handler for question type {$a}'; +$string['pluginname'] = 'Gift format'; diff --git a/question/format/learnwise/format.php b/question/format/learnwise/format.php index d4d81e2afbe02..4e700538cd661 100644 --- a/question/format/learnwise/format.php +++ b/question/format/learnwise/format.php @@ -33,7 +33,7 @@ * * Alton College, Hampshire, UK - Tom Flannaghan, Andrew Walker * - * Imports learnwise multiple choice quizzes (single and multiple answers) + * Imports learnwise multiple choice questions (single and multiple answers) * currently ignores the deduct attribute for multiple answer questions * deductions are currently simply found by dividing the award for the incorrect * answer by the total number of options diff --git a/question/format/qti_two/format.php b/question/format/qti_two/format.php index 881e5e6ce08da..1e6238a5c3930 100644 --- a/question/format/qti_two/format.php +++ b/question/format/qti_two/format.php @@ -136,7 +136,7 @@ function indent_xhtml($source, $indenter = ' ') { function importpreprocess() { global $CFG; - print_error('cannotimportformat', 'question', "$CFG->wwwroot/mod/quiz/import.php?category=$category->id"); + print_error('cannotimportformat', 'question'); } function exportpreprocess() { @@ -266,7 +266,7 @@ function exportprocess() { // create a directory for the exports (if not already existing) if (!$export_dir = make_upload_directory($this->question_get_export_dir().'/'.$this->filename)) { - print_error('cannotcreatepath', 'quiz', '', $export_dir); + print_error('cannotcreatepath', 'question', '', $export_dir); } $path = $CFG->dataroot.'/'.$this->question_get_export_dir().'/'.$this->filename; @@ -561,9 +561,9 @@ function writequestion($question, $shuffleanswers = null, $courselevel = false, case TRUEFALSE: $qanswers = $question->options->answers; $answers[0] = (array)$qanswers['true']; - $answers[0]['answer'] = get_string("true", "quiz"); + $answers[0]['answer'] = get_string('true', 'qtype_truefalse'); $answers[1] = (array)$qanswers['false']; - $answers[1]['answer'] = get_string("false", "quiz"); + $answers[1]['answer'] = get_string('false', 'qtype_truefalse'); if (!empty($shuffleanswers)) { $answers = $this->shuffle_things($answers); diff --git a/question/format/qti_two/qt_common.php b/question/format/qti_two/qt_common.php index b3753c9493e90..a2d60cbdb456b 100644 --- a/question/format/qti_two/qt_common.php +++ b/question/format/qti_two/qt_common.php @@ -36,7 +36,6 @@ * @calledfrom type//editquestion.php */ function get_course_media_files($courseid) { -// this code lifted from mod/quiz/question.php and modified throw new coding_exception('qti_two not converted to new fil api yet, sorry'); /*global $CFG; $images = null; @@ -146,7 +145,7 @@ function get_media_tag($file, $courseid = 0, $alt = 'media file', $width = 0, $h return "\"$alt\""; } else { - require_once("$CFG->dirroot/mod/quiz/format/qti/custommediafilter.php"); + require_once("$CFG->dirroot/question/format/qti/custommediafilter.php"); return custom_mediaplugin_filter('', $courseid, $width, $height); } } diff --git a/question/format/webct/format.php b/question/format/webct/format.php index 5bec434bd244c..2897f961c5a6a 100644 --- a/question/format/webct/format.php +++ b/question/format/webct/format.php @@ -266,7 +266,7 @@ function readquestions ($lines) { } if (strlen($question->name) > 255) { $question->name = substr($question->name,0,250)."..."; - $warnings[] = get_string("questionnametoolong", "quiz", $nQuestionStartLine); + $warnings[] = get_string("questionnametoolong", "qformat_webct", $nQuestionStartLine); } if (!isset($question->defaultmark)) { $question->defaultmark = 1; @@ -278,11 +278,11 @@ function readquestions ($lines) { // Perform sanity checks $QuestionOK = TRUE; if (strlen($question->questiontext) == 0) { - $warnings[] = get_string("missingquestion", "quiz", $nQuestionStartLine); + $warnings[] = get_string("missingquestion", "qformat_webct", $nQuestionStartLine); $QuestionOK = FALSE; } if (sizeof($question->answer) < 1) { // a question must have at least 1 answer - $errors[] = get_string("missinganswer", "quiz", $nQuestionStartLine); + $errors[] = get_string("missinganswer", "qformat_webct", $nQuestionStartLine); $QuestionOK = FALSE; } else { @@ -320,7 +320,7 @@ function readquestions ($lines) { case SHORTANSWER: if ($maxfraction != 1) { $maxfraction = $maxfraction * 100; - $errors[] = "'$question->name': ".get_string("wronggrade", "quiz", $nLineCounter).' '.get_string("fractionsnomax", "quiz", $maxfraction); + $errors[] = "'$question->name': ".get_string("wronggrade", "qformat_webct", $nLineCounter).' '.get_string("fractionsnomax", "question", $maxfraction); $QuestionOK = FALSE; } break; @@ -329,14 +329,14 @@ function readquestions ($lines) { if ($question->single) { if ($maxfraction != 1) { $maxfraction = $maxfraction * 100; - $errors[] = "'$question->name': ".get_string("wronggrade", "quiz", $nLineCounter).' '.get_string("fractionsnomax", "quiz", $maxfraction); + $errors[] = "'$question->name': ".get_string("wronggrade", "qformat_webct", $nLineCounter).' '.get_string("fractionsnomax", "question", $maxfraction); $QuestionOK = FALSE; } } else { $totalfraction = round($totalfraction,2); if ($totalfraction != 1) { $totalfraction = $totalfraction * 100; - $errors[] = "'$question->name': ".get_string("wronggrade", "quiz", $nLineCounter).' '.get_string("fractionsaddwrong", "quiz", $totalfraction); + $errors[] = "'$question->name': ".get_string("wronggrade", "qformat_webct", $nLineCounter).' '.get_string("fractionsaddwrong", "question", $totalfraction); $QuestionOK = FALSE; } } @@ -422,10 +422,6 @@ function readquestions ($lines) { if (preg_match("~^:TYPE:C~i",$line)) { // Calculated Question - /* $warnings[] = get_string("calculatedquestion", "quiz", $nLineCounter); - unset($question); - $ignore_rest_of_question = TRUE; // Question Type not handled by Moodle - */ $question = $this->defaultquestion(); $question->qtype = CALCULATED; $question->answers = array(); // No problem as they go as :FORMULA: from webct @@ -453,7 +449,7 @@ function readquestions ($lines) { if (preg_match("~^:TYPE:P~i",$line)) { // Paragraph Question - $warnings[] = get_string("paragraphquestion", "quiz", $nLineCounter); + $warnings[] = get_string("paragraphquestion", "qformat_webct", $nLineCounter); unset($question); $ignore_rest_of_question = TRUE; // Question Type not handled by Moodle continue; @@ -461,7 +457,7 @@ function readquestions ($lines) { if (preg_match("~^:TYPE:~i",$line)) { // Unknow Question - $warnings[] = get_string("unknowntype", "quiz", $nLineCounter); + $warnings[] = get_string("unknowntype", "qformat_webct", $nLineCounter); unset($question); $ignore_rest_of_question = TRUE; // Question Type not handled by Moodle continue; @@ -475,7 +471,7 @@ function readquestions ($lines) { $name = trim($webct_options[1]); if (strlen($name) > 255) { $name = substr($name,0,250)."..."; - $warnings[] = get_string("questionnametoolong", "quiz", $nLineCounter); + $warnings[] = get_string("questionnametoolong", "qformat_webct", $nLineCounter); } $question->name = $name; continue; @@ -656,7 +652,7 @@ function readquestions ($lines) { } if (sizeof($errors) > 0) { - echo "

".get_string("errorsdetected", "quiz", sizeof($errors))."

    "; + echo "

    ".get_string("errorsdetected", "qformat_webct", sizeof($errors))."

      "; foreach($errors as $error) { echo "
    • $error
    • "; } @@ -665,7 +661,7 @@ function readquestions ($lines) { } if (sizeof($warnings) > 0) { - echo "

      ".get_string("warningsdetected", "quiz", sizeof($warnings))."

        "; + echo "

        ".get_string("warningsdetected", "qformat_webct", sizeof($warnings))."

          "; foreach($warnings as $warning) { echo "
        • $warning
        • "; } diff --git a/question/format/webct/lang/en/qformat_webct.php b/question/format/webct/lang/en/qformat_webct.php index a93c8500800dc..3542958ae0906 100644 --- a/question/format/webct/lang/en/qformat_webct.php +++ b/question/format/webct/lang/en/qformat_webct.php @@ -24,6 +24,15 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +$string['errorsdetected'] = '{$a} error(s) detected'; +$string['missinganswer'] = 'Too few :ANSWER, :Lx, :Rx statements for question line {$a}. You must define at last 2 possible answers'; +$string['missingquestion'] = 'Missing question label after line {$a}'; +$string['paragraphquestion'] = 'Paragraph question'; +$string['pluginname'] = 'WebCT format'; +$string['questionnametoolong'] = 'Question name too long at line {$a} (255 char. max). It has been truncated.'; +$string['unknowntype'] = 'Unknown type'; +$string['warningsdetected'] = '{$a} warning(s) detected'; $string['webct'] = 'WebCT format'; $string['webct_help'] = 'WebCT format enables multiple-choice and short answer questions saved in WebCT\'s text-based format to be imported.'; $string['webct_link'] = 'qformat/webct'; +$string['wronggrade'] = 'Wrong grade (after line {$a}) :'; diff --git a/question/format/xhtml/format.php b/question/format/xhtml/format.php index 44a30cd1f7ee8..34da5404efdb7 100644 --- a/question/format/xhtml/format.php +++ b/question/format/xhtml/format.php @@ -76,8 +76,8 @@ function writequestion($question) { // selection depends on question type switch($question->qtype) { case TRUEFALSE: - $st_true = get_string( 'true','quiz' ); - $st_false = get_string( 'false','quiz' ); + $st_true = get_string('true', 'qtype_truefalse'); + $st_false = get_string('false', 'qtype_truefalse'); $expout .= "
            \n"; $expout .= "
          • $st_true
          • \n"; $expout .= "
          • $st_false
          • \n"; diff --git a/question/format/xml/format.php b/question/format/xml/format.php index c94a8cb045301..4e5af07bfe366 100644 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -152,8 +152,8 @@ function import_headers($question) { global $CFG; // get some error strings - $error_noname = get_string('xmlimportnoname','quiz'); - $error_noquestion = get_string('xmlimportnoquestion','quiz'); + $error_noname = get_string('xmlimportnoname','qformat_xml'); + $error_noquestion = get_string('xmlimportnoquestion','qformat_xml'); // this routine initialises the question object $qo = $this->defaultquestion(); @@ -161,7 +161,7 @@ function import_headers($question) { // Question name $qo->name = $this->getpath($question, array('#', 'name', 0, '#', 'text', 0, '#'), '', true, - get_string('xmlimportnoname', 'quiz')); + get_string('xmlimportnoname', 'qformat_xml')); $qo->questiontext = $this->getpath($question, array('#', 'questiontext', 0, '#', 'text', 0, '#'), '', true); $qo->questiontextformat = $this->trans_format($this->getpath( @@ -514,8 +514,8 @@ function import_truefalse($question) { if ($warning) { $a = new stdClass(); $a->questiontext = $qo->questiontext; - $a->answer = get_string($qo->correctanswer ? 'true' : 'false', 'quiz'); - echo $OUTPUT->notification(get_string('truefalseimporterror', 'quiz', $a)); + $a->answer = get_string($qo->correctanswer ? 'true' : 'false', 'qtype_truefalse'); + echo $OUTPUT->notification(get_string('truefalseimporterror', 'qformat_xml', $a)); } $this->import_hints($qo, $question); @@ -954,7 +954,7 @@ function readquestions($lines) { // to handle it. if (!$qo = $this->try_importing_using_qtypes( $question, null, null, $questiontype)) { - $this->error(get_string('xmltypeunsupported', 'quiz', $questiontype)); + $this->error(get_string('xmltypeunsupported', 'qformat_xml', $questiontype)); $qo = null; } } diff --git a/question/format/xml/lang/en/qformat_xml.php b/question/format/xml/lang/en/qformat_xml.php index bbdf381121ca5..87856fee2d385 100644 --- a/question/format/xml/lang/en/qformat_xml.php +++ b/question/format/xml/lang/en/qformat_xml.php @@ -25,7 +25,12 @@ */ $string['invalidxml'] = 'Invalid XML file - string expected (use CDATA?)'; +$string['pluginname'] = 'Moodle XML format'; +$string['truefalseimporterror'] = 'Warning: The true/false question \'{$a->questiontext}\' could not be imported properly. It was not clear whether the correct answer is true or false. The question has been imported assuming that the answer is \'{$a->answer}\'. If this is not correct, you will need to edit the question.'; $string['unsupportedexport'] = 'Question type {$a} is not supported by XML export'; $string['xml'] = 'Moodle XML format'; -$string['xml_help'] = 'This is a Moodle-specific format for importing and exporting questions for use in quiz activities.'; +$string['xml_help'] = 'This is a Moodle-specific format for importing and exporting questions.'; $string['xml_link'] = 'qformat/xml'; +$string['xmlimportnoname'] = 'Missing question name in XML file'; +$string['xmlimportnoquestion'] = 'Missing question text in XML file'; +$string['xmltypeunsupported'] = 'Question type {$a} is not supported by XML import'; diff --git a/question/import.php b/question/import.php index 68e5dcc34dd92..357932d2453a9 100644 --- a/question/import.php +++ b/question/import.php @@ -35,12 +35,12 @@ // get display strings $txt = new stdClass(); -$txt->importerror = get_string('importerror','quiz'); +$txt->importerror = get_string('importerror', 'question'); $txt->importquestions = get_string('importquestions', 'question'); list($catid, $catcontext) = explode(',', $pagevars['cat']); -if (!$category = $DB->get_record("question_categories", array("id" => $catid))) { - print_error('nocategory','quiz'); +if (!$category = $DB->get_record("question_categories", array('id' => $catid))) { + print_error('nocategory', 'question'); } $PAGE->set_pagelayout('standard'); @@ -94,7 +94,7 @@ $formatfile = 'format/' . $form->format . '/format.php'; if (!is_readable($formatfile)) { - throw new moodle_exception('formatnotfound', 'quiz', '', $form->format); + throw new moodle_exception('formatnotfound', 'question', '', $form->format); } require_once($formatfile); diff --git a/question/import_form.php b/question/import_form.php index da1f23192a603..ae1615a5b43f4 100644 --- a/question/import_form.php +++ b/question/import_form.php @@ -121,7 +121,7 @@ protected function validate_uploaded_file($data, $errors) { $formatfile = 'format/' . $data['format'] . '/format.php'; if (!is_readable($formatfile)) { - throw new moodle_exception('formatnotfound', 'quiz', '', $data['format']); + throw new moodle_exception('formatnotfound', 'question', '', $data['format']); } require_once($formatfile); diff --git a/question/move_form.php b/question/move_form.php index 9101ca11d7182..07df4fecb9f32 100644 --- a/question/move_form.php +++ b/question/move_form.php @@ -43,9 +43,9 @@ function definition() { $currentcat = $this->_customdata['currentcat']; $contexts = $this->_customdata['contexts']; - $mform->addElement('questioncategory', 'category', get_string('category','quiz'), compact('contexts', 'currentcat')); + $mform->addElement('questioncategory', 'category', get_string('category', 'question'), compact('contexts', 'currentcat')); - $this->add_action_buttons(true, get_string('categorymoveto', 'quiz')); + $this->add_action_buttons(true, get_string('categorymoveto', 'question')); $mform->addElement('hidden', 'delete', $currentcat); $mform->setType('delete', PARAM_INT); diff --git a/question/qengine.js b/question/qengine.js index d8cc3f613cac5..0e448f8eb704f 100644 --- a/question/qengine.js +++ b/question/qengine.js @@ -165,7 +165,7 @@ M.core_question_engine.init_form = function(Y, form) { } /** - * Event handler to stop the quiz form being submitted more than once. + * Event handler to stop a question form being submitted more than once. * @param e the form submit event. * @param form the form element. */ diff --git a/question/question.php b/question/question.php index 03d4afc50ad91..ecd22a244ad24 100644 --- a/question/question.php +++ b/question/question.php @@ -322,8 +322,8 @@ echo $OUTPUT->header(); } else { - $strediting = ''.get_string("editquestions", "quiz").' -> '.$streditingquestion; - $PAGE->navbar->add(get_string('editquestions', 'quiz'), $returnurl); + $strediting = ''.get_string('editquestions', 'question').' -> '.$streditingquestion; + $PAGE->navbar->add(get_string('editquestions', 'question'), $returnurl); $PAGE->navbar->add($streditingquestion); echo $OUTPUT->header(); } diff --git a/question/type/calculated/datasetdefinitions_form.php b/question/type/calculated/datasetdefinitions_form.php index b2c64ace7ed8b..69e1a39437a51 100644 --- a/question/type/calculated/datasetdefinitions_form.php +++ b/question/type/calculated/datasetdefinitions_form.php @@ -95,7 +95,7 @@ function definition() { list($options, $selected) = $this->qtypeobj->dataset_options($this->question, $datasetname); unset($options['0']); // Mandatory... - $label = get_string("wildcard", "quiz"). " $datasetname "; + $label = get_string("wildcard", "qtype_calculated"). " $datasetname "; $mform->addElement('select', "dataset[$key]", $label, $options); if (isset($datadefscat[$datasetname])){ $mform->addElement('static', "there is a category", get_string('sharedwildcard', 'qtype_calculated',$datasetname ), get_string('dataitemdefined','qtype_calculated', $datadefscat[$datasetname])); @@ -112,7 +112,7 @@ function definition() { if (!isset($datasetmenus[$datasetname])) { list($options, $selected) = $this->qtypeobj->dataset_options($this->question, $datasetname,false); - $label = get_string("wildcard", "quiz"). " $datasetname "; + $label = get_string("wildcard", "qtype_calculated"). " $datasetname "; $mform->addElement('select', "dataset[$key]", $label, $options); // $mform->addRule("dataset[$key]", null, 'required', null, 'client'); if (isset($datadefscat[$datasetname])){ diff --git a/question/type/calculated/datasetitems_form.php b/question/type/calculated/datasetitems_form.php index 439d8fb8d46c3..4acbd45e69f30 100644 --- a/question/type/calculated/datasetitems_form.php +++ b/question/type/calculated/datasetitems_form.php @@ -172,13 +172,13 @@ function definition() { $mform->addElement('static', 'answercomment['.($this->noofitems+$key1).']', $answer->answer); $mform->addElement('text', 'tolerance['.$key.']', get_string('tolerance', 'qtype_calculated')); $mform->setAdvanced('tolerance['.$key.']',true); - $mform->addElement('select', 'tolerancetype['.$key.']', get_string('tolerancetype', 'quiz'), $this->qtypeobj->tolerance_types()); + $mform->addElement('select', 'tolerancetype['.$key.']', get_string('tolerancetype', 'qtype_numerical'), $this->qtypeobj->tolerance_types()); $mform->setAdvanced('tolerancetype['.$key.']',true); $mform->addElement('select', 'correctanswerlength['.$key.']', get_string('correctanswershows', 'qtype_calculated'), range(0, 9)); $mform->setAdvanced('correctanswerlength['.$key.']',true); - $answerlengthformats = array('1' => get_string('decimalformat', 'quiz'), '2' => get_string('significantfiguresformat', 'quiz')); + $answerlengthformats = array('1' => get_string('decimalformat', 'qtype_numerical'), '2' => get_string('significantfiguresformat', 'quiz')); $mform->addElement('select', 'correctanswerformat['.$key.']', get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats); $mform->setAdvanced('correctanswerformat['.$key.']',true); $mform->addElement('static', 'dividertolerance', '', '
            '); @@ -300,8 +300,8 @@ function definition() { //------------------------------------------------------------------------------------------------------------------------------ //non standard name for button element needed so not using add_action_buttons if ( !($this->noofitems==0) ){ - $mform->addElement('submit', 'backtoquiz', get_string('savechanges')); - $mform->closeHeaderBefore('backtoquiz'); + $mform->addElement('submit', 'savechanges', get_string('savechanges')); + $mform->closeHeaderBefore('savechanges'); } //hidden elements $mform->addElement('hidden', 'id'); @@ -444,12 +444,11 @@ function set_data($question){ function validation($data, $files) { $errors = array(); - if (isset($data['backtoquiz']) && ($this->noofitems==0) ){ + if (isset($data['savechanges']) && ($this->noofitems==0) ){ $errors['warning'] = get_string('warning', 'mnet'); } if ($this->outsidelimit){ - // if(!isset($errors['warning'])) $errors['warning']=' '; - $errors['outsidelimits'] = get_string('oneanswertrueansweroutsidelimits','qtype_calculated'); + $errors['outsidelimits'] = get_string('oneanswertrueansweroutsidelimits','qtype_calculated'); } $numbers = $data['number']; foreach ($numbers as $key => $number){ diff --git a/question/type/calculated/edit_calculated_form.php b/question/type/calculated/edit_calculated_form.php index c6a4c96dc33ab..848275f473cdb 100644 --- a/question/type/calculated/edit_calculated_form.php +++ b/question/type/calculated/edit_calculated_form.php @@ -75,9 +75,9 @@ function get_per_answer_fields(&$mform, $label, $gradeoptions, &$repeatedoptions // $repeated = parent::get_per_answer_fields($mform, $label, $gradeoptions, $repeatedoptions, $answersoption); $repeated = array(); $repeated[] =& $mform->createElement('header', 'answerhdr', $label); - $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'), array('size' => 50)); + $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'question'), array('size' => 50)); $repeated[] =& $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions); - $repeated[] =& $mform->createElement('editor', 'feedback', get_string('feedback', 'quiz'), null, $this->editoroptions); + $repeated[] =& $mform->createElement('editor', 'feedback', get_string('feedback', 'question'), null, $this->editoroptions); $repeatedoptions['answer']['type'] = PARAM_RAW; $repeatedoptions['fraction']['default'] = 0; $answersoption = 'answers'; @@ -86,17 +86,17 @@ function get_per_answer_fields(&$mform, $label, $gradeoptions, &$repeatedoptions $addrepeated = array(); $addrepeated[] =& $mform->createElement('text', 'tolerance', get_string('tolerance', 'qtype_calculated')); - $addrepeated[] =& $mform->createElement('select', 'tolerancetype', get_string('tolerancetype', 'quiz'), $this->qtypeobj->tolerance_types()); + $addrepeated[] =& $mform->createElement('select', 'tolerancetype', get_string('tolerancetype', 'qtype_numerical'), $this->qtypeobj->tolerance_types()); $repeatedoptions['tolerance']['type'] = PARAM_NUMBER; $repeatedoptions['tolerance']['default'] = 0.01; $addrepeated[] =& $mform->createElement('select', 'correctanswerlength', get_string('correctanswershows', 'qtype_calculated'), range(0, 9)); $repeatedoptions['correctanswerlength']['default'] = 2; - $answerlengthformats = array('1' => get_string('decimalformat', 'quiz'), '2' => get_string('significantfiguresformat', 'quiz')); + $answerlengthformats = array('1' => get_string('decimalformat', 'qtype_numerical'), '2' => get_string('significantfiguresformat', 'quiz')); $addrepeated[] =& $mform->createElement('select', 'correctanswerformat', get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats); array_splice($repeated, 3, 0, $addrepeated); - $repeated[1]->setLabel(get_string('correctanswerformula', 'quiz').'='); + $repeated[1]->setLabel(get_string('correctanswerformula', 'qtype_calculated').'='); return $repeated; } @@ -279,7 +279,7 @@ function validation($data, $files) { if ($trimmedanswer!=''){ if ('2' == $data['correctanswerformat'][$key] && '0' == $data['correctanswerlength'][$key]) { - $errors['correctanswerlength['.$key.']'] = get_string('zerosignificantfiguresnotallowed','quiz'); + $errors['correctanswerlength['.$key.']'] = get_string('zerosignificantfiguresnotallowed', 'qtype_calculated'); } if (!is_numeric($data['tolerance'][$key])){ $errors['tolerance['.$key.']'] = get_string('mustbenumeric', 'qtype_calculated'); diff --git a/question/type/calculated/lang/en/qtype_calculated.php b/question/type/calculated/lang/en/qtype_calculated.php index 2c80fcce25f79..79ace601eed34 100644 --- a/question/type/calculated/lang/en/qtype_calculated.php +++ b/question/type/calculated/lang/en/qtype_calculated.php @@ -49,6 +49,7 @@ $string['correctfeedback'] = 'For any correct response'; $string['dataitemdefined']='with {$a} numerical values already defined is available'; $string['datasetrole']= ' The wild cards {x..} will be substituted by a numerical value from their dataset'; +$string['decimals'] = 'with {$a}'; $string['deleteitem'] = 'Delete item'; $string['deletelastitem'] = 'Delete last item'; $string['editingcalculated'] = 'Editing a Calculated question'; @@ -61,8 +62,16 @@ $string['forceregeneration'] = 'force regeneration'; $string['forceregenerationall'] = 'forceregeneration of all wildcards'; $string['forceregenerationshared'] = 'forceregeneration of only non-shared wildcards'; +$string['functiondisabledbysecuremode'] = 'That functionality is currently disabled'; +$string['functiontakesatleasttwo'] = 'The function {$a} must have at least two arguments'; +$string['functiontakesnoargs'] = 'The function {$a} does not take any arguments'; +$string['functiontakesonearg'] = 'The function {$a} must have exactly one argument'; +$string['functiontakesoneortwoargs'] = 'The function {$a} must have either one or two arguments'; +$string['functiontakestwoargs'] = 'The function {$a} must have exactly two arguments'; +$string['generatevalue'] = 'Generate a new value between'; $string['getnextnow'] = 'Get new \'Item to Add\' now'; $string['hexanotallowed'] = 'Dataset {$a->name} hexadecimal format value $a->value is not allowed' ; +$string['illegalformulasyntax'] = 'Illegal formula syntax starting with \'{$a}\''; $string['incorrectfeedback'] = 'For any incorrect response'; $string['item(s)'] = 'item(s)'; $string['itemno'] = 'Item {$a}'; @@ -76,9 +85,13 @@ $string['keptlocal3'] = 'a link from the same question private set of links as before'; $string['lastitem(s)'] = 'last items(s)'; $string['loguniform'] = 'Loguniform'; +$string['loguniformbit'] = 'digits, from a loguniform distribution'; $string['makecopynextpage'] = 'Next page (new question)'; $string['mandatoryhdr'] = 'Mandatory wild cards present in answers'; $string['minmax'] = 'Range of Values'; +$string['missingformula'] = 'Missing formula'; +$string['missingname'] = 'Missing question name'; +$string['missingquestiontext'] = 'Missing question text'; $string['mustbenumeric'] = 'You must enter a number here.'; $string['mustnotbenumeric'] = 'This can\'t be a number.'; $string['newcategory1'] = 'will use a new shared dataset'; @@ -106,6 +119,8 @@ $string['sharedwildcard']='Shared wild card {$a}'; $string['sharedwildcardname']='Shared wild card '; $string['sharedwildcards']='Shared wild cards'; +$string['significantfigures'] = 'with {$a}'; +$string['significantfiguresformat'] = 'significant figures'; $string['synchronize']='Synchronize the data from shared datasets with other questions in a quiz'; $string['synchronizeno']='Do not synchronize'; $string['synchronizeyes']='Synchronize'; @@ -114,6 +129,7 @@ $string['trueanswerinsidelimits'] = 'Correct answer : {$a->correct} inside limits of true value {$a->true}'; $string['trueansweroutsidelimits'] = 'ERROR Correct answer : {$a->correct} outside limits of true value {$a->true}'; $string['uniform'] = 'Uniform'; +$string['uniformbit'] = 'decimals, from a uniform distribution'; $string['updatecategory'] = 'Update the category'; $string['updatedatasetparam'] = 'Update the datasets parameters'; $string['updatetolerancesparam'] = 'Update the answers tolerance parameters'; @@ -126,6 +142,7 @@ $string['setwildcardvalues'] = 'set(s) of wild card(s) values'; $string['showitems'] = 'Display'; $string['updatewildcardvalues'] = 'Update the wild card(s) values'; +$string['unsupportedformulafunction'] = 'The function {$a} is not supported'; $string['useadvance'] = 'Use the advance button to see the errors'; $string['wildcard'] = 'Wild card {{$a}}'; $string['wildcardparam'] = 'Wild cards parameters used to generate the values'; @@ -133,4 +150,4 @@ $string['wildcards'] = 'Wild cards {a}...{z}'; $string['wildcardvalues'] = 'Wild card(s) values'; $string['wildcardvaluesgenerated'] = 'Wild card(s) values generated'; - +$string['zerosignificantfiguresnotallowed'] = 'The correct answer cannot have zero significant figures!'; diff --git a/question/type/calculated/questiontype.php b/question/type/calculated/questiontype.php index 3df4ef528980c..bd74a65b49d47 100644 --- a/question/type/calculated/questiontype.php +++ b/question/type/calculated/questiontype.php @@ -452,16 +452,16 @@ function validate_form($form) { case 'question': $calculatedmessages = array(); if (empty($form->name)) { - $calculatedmessages[] = get_string('missingname', 'quiz'); + $calculatedmessages[] = get_string('missingname', 'qtype_calculated'); } if (empty($form->questiontext)) { - $calculatedmessages[] = get_string('missingquestiontext', 'quiz'); + $calculatedmessages[] = get_string('missingquestiontext', 'qtype_calculated'); } // Verify formulas foreach ($form->answers as $key => $answer) { if ('' === trim($answer)) { $calculatedmessages[] = - get_string('missingformula', 'quiz'); + get_string('missingformula', 'qtype_calculated'); } if ($formulaerrors = qtype_calculated_find_formula_errors($answer)) { @@ -472,7 +472,7 @@ function validate_form($form) { } if (! is_numeric($form->tolerance[$key])) { $calculatedmessages[] = - get_string('tolerancemustbenumeric', 'quiz'); + get_string('tolerancemustbenumeric', 'qtype_calculated'); } } @@ -492,10 +492,10 @@ function validate_form($form) { return true; } function finished_edit_wizard(&$form) { - return isset($form->backtoquiz); + return isset($form->savechanges); } function wizard_pages_number() { - return 3 ; + return 3; } // This gets called by editquestion.php after the standard question is saved function print_next_wizard_page(&$question, &$form, $course) { @@ -1025,15 +1025,15 @@ function custom_generator_tools($datasetdef) { for ($i = 0 ; $i<10 ; ++$i) { $lengthoptions[$i] = get_string(($regs[1] == 'uniform' ? 'decimals' - : 'significantfigures'), 'quiz', $i); + : 'significantfigures'), 'qtype_calculated', $i); } $menu1 = html_writer::select($lengthoptions, 'calclength[]', $regs[4], null); - $options = array('uniform' => get_string('uniform', 'quiz'), 'loguniform' => get_string('loguniform', 'quiz')); + $options = array('uniform' => get_string('uniformbit', 'qtype_calculated'), 'loguniform' => get_string('loguniformbit', 'qtype_calculated')); $menu2 = html_writer::select($options, 'calcdistribution[]', $regs[1], null); return '
            ' + .'" value="'. get_string('generatevalue', 'qtype_calculated') . '"/>
            ' . ' & ' @@ -1321,8 +1321,8 @@ function comment_on_datasetitems($qtypeobj, $questionid, $questiontext, $answers } $answers = fullclone($answers); - $strmin = get_string('min', 'quiz'); - $strmax = get_string('max', 'quiz'); + $strmin = get_string('min'); + $strmax = get_string('max'); $errors = ''; $delimiter = ': '; $virtualqtype = $qtypeobj->get_virtual_qtype();//& $QTYPES['numerical']; @@ -1377,8 +1377,8 @@ function multichoice_comment_on_datasetitems($questionid, $questiontext, $answer } $answers = fullclone($answers); - $strmin = get_string('min', 'quiz'); - $strmax = get_string('max', 'quiz'); + $strmin = get_string('min'); + $strmax = get_string('max'); $errors = ''; $delimiter = ': '; foreach ($answers as $key => $answer) { @@ -1450,9 +1450,9 @@ function multichoice_comment_on_datasetitems($questionid, $questiontext, $answer } function tolerance_types() { - return array('1' => get_string('relative', 'quiz'), - '2' => get_string('nominal', 'quiz'), - '3' => get_string('geometric', 'quiz')); + return array('1' => get_string('relative', 'qtype_numerical'), + '2' => get_string('nominal', 'qtype_numerical'), + '3' => get_string('geometric', 'qtype_numerical')); } function dataset_options($form, $name, $mandatory=true,$renameabledatasets=false) { @@ -1795,7 +1795,7 @@ function pick_question_dataset($question, $datasetitem) { return $dataset; } - function dataset_options_from_database($form, $name,$prefix='',$langfile='quiz') { + function dataset_options_from_database($form, $name,$prefix='',$langfile='qtype_calculated') { global $CFG, $DB; $type = 1 ; // only type = 1 (i.e. old 'LITERAL') has ever been used @@ -1895,9 +1895,9 @@ function print_dataset_definitions_category($form) { global $CFG, $DB; $datasetdefs = array(); $lnamemax = 22; - $namestr =get_string('name', 'quiz'); - $minstr=get_string('min', 'quiz'); - $maxstr=get_string('max', 'quiz'); + $namestr =get_string('name'); + $minstr=get_string('min'); + $maxstr=get_string('max'); $rangeofvaluestr=get_string('minmax','qtype_calculated'); $questionusingstr = get_string('usedinquestion','qtype_calculated'); $itemscountstr = get_string('itemscount','qtype_calculated'); @@ -2050,17 +2050,6 @@ function find_math_equations($text) { /// Returns the possible dataset names found in the text as an array /// The array has the dataset name for both key and value $equations = array(); - /* $qtext = ""; - $qtextremaining = $numericalquestion->questiontext ; - while (preg_match('~\{=([^[:space:]}]*)}~', $qtextremaining, $regs1)) { - // while (preg_match('~\{=|%=([^[:space:]}]*)}~', $qtextremaining, $regs1)) { - $qtextsplits = explode($regs1[0], $qtextremaining, 2); - $qtext =$qtext.$qtextsplits[0]; - $qtextremaining = $qtextsplits[1]; - if (empty($regs1[1])) { - $str = ''; - } else { - */ while (preg_match('~\{=([^[:space:]}]*)}~', $text, $regs)) { $equations[] = $regs[1]; $text = str_replace($regs[0], '', $text); @@ -2302,14 +2291,14 @@ function qtype_calculated_find_formula_errors($formula) { // Simple parenthesis case '': if ((isset($regs[4])&& $regs[4]) || strlen($regs[3])==0) { - return get_string('illegalformulasyntax', 'quiz', $regs[0]); + return get_string('illegalformulasyntax', 'qtype_calculated', $regs[0]); } break; // Zero argument functions case 'pi': if ($regs[3]) { - return get_string('functiontakesnoargs', 'quiz', $regs[2]); + return get_string('functiontakesnoargs', 'qtype_calculated', $regs[2]); } break; @@ -2322,33 +2311,33 @@ function qtype_calculated_find_formula_errors($formula) { case 'octdec': case 'rad2deg': case 'sin': case 'sinh': case 'sqrt': case 'tan': case 'tanh': if (!empty($regs[4]) || empty($regs[3])) { - return get_string('functiontakesonearg','quiz',$regs[2]); + return get_string('functiontakesonearg','qtype_calculated',$regs[2]); } break; // Functions that take one or two arguments case 'log': case 'round': if (!empty($regs[5]) || empty($regs[3])) { - return get_string('functiontakesoneortwoargs','quiz',$regs[2]); + return get_string('functiontakesoneortwoargs','qtype_calculated',$regs[2]); } break; // Functions that must have two arguments case 'atan2': case 'fmod': case 'pow': if (!empty($regs[5]) || empty($regs[4])) { - return get_string('functiontakestwoargs', 'quiz', $regs[2]); + return get_string('functiontakestwoargs', 'qtype_calculated', $regs[2]); } break; // Functions that take two or more arguments case 'min': case 'max': if (empty($regs[4])) { - return get_string('functiontakesatleasttwo','quiz',$regs[2]); + return get_string('functiontakesatleasttwo','qtype_calculated',$regs[2]); } break; default: - return get_string('unsupportedformulafunction','quiz',$regs[2]); + return get_string('unsupportedformulafunction','qtype_calculated',$regs[2]); } // Exchange the function call with '1' and then chack for @@ -2363,7 +2352,7 @@ function qtype_calculated_find_formula_errors($formula) { } if (preg_match("~[^$safeoperatorchar.0-9eE]+~", $formula, $regs)) { - return get_string('illegalformulasyntax', 'quiz', $regs[0]); + return get_string('illegalformulasyntax', 'qtype_calculated', $regs[0]); } else { // Formula just might be valid return false; diff --git a/question/type/calculatedmulti/edit_calculatedmulti_form.php b/question/type/calculatedmulti/edit_calculatedmulti_form.php index cfc08f6d38225..e8aa0c5cf5cc3 100644 --- a/question/type/calculatedmulti/edit_calculatedmulti_form.php +++ b/question/type/calculatedmulti/edit_calculatedmulti_form.php @@ -72,9 +72,9 @@ function get_per_answer_fields(&$mform, $label, $gradeoptions, &$repeatedoptions $repeated = array(); $repeated[] =& $mform->createElement('header', 'answerhdr', $label); // if ($this->editasmultichoice == 1){ - $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'), array('size' => 50)); + $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'question'), array('size' => 50)); $repeated[] =& $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions); - $repeated[] =& $mform->createElement('editor', 'feedback', get_string('feedback', 'quiz'), null, $this->editoroptions); + $repeated[] =& $mform->createElement('editor', 'feedback', get_string('feedback', 'question'), null, $this->editoroptions); $repeatedoptions['answer']['type'] = PARAM_RAW; $repeatedoptions['fraction']['default'] = 0; $answersoption = 'answers'; @@ -90,7 +90,7 @@ function get_per_answer_fields(&$mform, $label, $gradeoptions, &$repeatedoptions $addrepeated[] =& $mform->createElement('select', 'correctanswerlength', get_string('correctanswershows', 'qtype_calculated'), range(0, 9)); $repeatedoptions['correctanswerlength']['default'] = 2; - $answerlengthformats = array('1' => get_string('decimalformat', 'quiz'), '2' => get_string('significantfiguresformat', 'quiz')); + $answerlengthformats = array('1' => get_string('decimalformat', 'qtype_numerical'), '2' => get_string('significantfiguresformat', 'qtype_calculated')); $addrepeated[] =& $mform->createElement('select', 'correctanswerformat', get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats); array_splice($repeated, 3, 0, $addrepeated); $repeated[1]->setLabel('...{={x}+..}...'); @@ -353,7 +353,7 @@ function validation($data, $files) { if ($trimmedanswer!=''){ if ('2' == $data['correctanswerformat'][$key] && '0' == $data['correctanswerlength'][$key]) { - $errors['correctanswerlength['.$key.']'] = get_string('zerosignificantfiguresnotallowed','quiz'); + $errors['correctanswerlength['.$key.']'] = get_string('zerosignificantfiguresnotallowed','qtype_calculated'); } if (!is_numeric($data['tolerance'][$key])){ $errors['tolerance['.$key.']'] = get_string('mustbenumeric', 'qtype_calculated'); diff --git a/question/type/calculatedmulti/questiontype.php b/question/type/calculatedmulti/questiontype.php index 7be14d0f979e0..cc6ffbbea1d6c 100644 --- a/question/type/calculatedmulti/questiontype.php +++ b/question/type/calculatedmulti/questiontype.php @@ -409,8 +409,8 @@ function comment_on_datasetitems($qtypeobj,$questionid,$questiontext, $answers,$ }*/ $answers = fullclone($answers); - $strmin = get_string('min', 'quiz'); - $strmax = get_string('max', 'quiz'); + $strmin = get_string('min'); + $strmax = get_string('max'); $errors = ''; $delimiter = ': '; foreach ($answers as $key => $answer) { diff --git a/question/type/calculatedsimple/edit_calculatedsimple_form.php b/question/type/calculatedsimple/edit_calculatedsimple_form.php index 260394d1083c4..cbaa1c1ca67ef 100644 --- a/question/type/calculatedsimple/edit_calculatedsimple_form.php +++ b/question/type/calculatedsimple/edit_calculatedsimple_form.php @@ -288,14 +288,14 @@ function get_per_answer_fields(&$mform, $label, $gradeoptions, &$repeatedoptions $addrepeated[] =& $mform->createElement('text', 'tolerance', get_string('tolerance', 'qtype_calculated')); $repeatedoptions['tolerance']['type'] = PARAM_NUMBER; $repeatedoptions['tolerance']['default'] = 0.01; - $addrepeated[] =& $mform->createElement('select', 'tolerancetype', get_string('tolerancetype', 'quiz'), $this->qtypeobj->tolerance_types()); + $addrepeated[] =& $mform->createElement('select', 'tolerancetype', get_string('tolerancetype', 'qtype_numerical'), $this->qtypeobj->tolerance_types()); $addrepeated[] =& $mform->createElement('select', 'correctanswerlength', get_string('correctanswershows', 'qtype_calculated'), range(0, 9)); $repeatedoptions['correctanswerlength']['default'] = 2; - $answerlengthformats = array('1' => get_string('decimalformat', 'quiz'), '2' => get_string('significantfiguresformat', 'quiz')); + $answerlengthformats = array('1' => get_string('decimalformat', 'qtype_numerical'), '2' => get_string('significantfiguresformat', 'qtype_numerical')); $addrepeated[] =& $mform->createElement('select', 'correctanswerformat', get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats); array_splice($repeated, 3, 0, $addrepeated); - $repeated[1]->setLabel(get_string('correctanswerformula', 'quiz').'='); + $repeated[1]->setLabel(get_string('correctanswerformula', 'qtype_calculated').'='); return $repeated; } @@ -740,7 +740,7 @@ function validation($data, $files) { if ($trimmedanswer!=''){ if ('2' == $data['correctanswerformat'][$key] && '0' == $data['correctanswerlength'][$key]) { - $errors['correctanswerlength['.$key.']'] = get_string('zerosignificantfiguresnotallowed','quiz'); + $errors['correctanswerlength['.$key.']'] = get_string('zerosignificantfiguresnotallowed','qtype_calculated'); } if (!is_numeric($data['tolerance'][$key])){ $errors['tolerance['.$key.']'] = get_string('mustbenumeric', 'qtype_calculated'); @@ -803,7 +803,7 @@ function validation($data, $files) { if ($maxgrade == false) { $errors['fraction[0]'] = get_string('fractionsnomax', 'question'); } - if (isset($data['backtoquiz']) && ($this->noofitems==0) ){ + if (isset($data['savechanges']) && ($this->noofitems==0) ){ $errors['warning'] = get_string('warning', 'mnet'); } if ($this->outsidelimit){ diff --git a/question/type/calculatedsimple/questiontype.php b/question/type/calculatedsimple/questiontype.php index f52bef339af72..d5dce4c387aa2 100644 --- a/question/type/calculatedsimple/questiontype.php +++ b/question/type/calculatedsimple/questiontype.php @@ -232,7 +232,7 @@ function save_question_options($question) { return true; } function finished_edit_wizard(&$form) { - return true ; //isset($form->backtoquiz); + return true ; } function wizard_pages_number() { return 1 ; @@ -277,9 +277,9 @@ function comment_header($answers) { } function tolerance_types() { - return array('1' => get_string('relative', 'quiz'), - '2' => get_string('nominal', 'quiz'), - // '3' => get_string('geometric', 'quiz') + return array('1' => get_string('relative', 'qtype_numerical'), + '2' => get_string('nominal', 'qtype_numerical'), + // '3' => get_string('geometric', 'qtype_numerical') ); } diff --git a/question/type/ddwtos/script.js b/question/type/ddwtos/script.js index f2c47e5a48c8f..bf84942f3a798 100644 --- a/question/type/ddwtos/script.js +++ b/question/type/ddwtos/script.js @@ -30,12 +30,12 @@ var ddwtos_currentzindex = 10; /* * The way it seems to be, if there are more than one of this type of question - * in a quiz, then this file is shared between them. Therefore it has to cope + * on a page, then this file is shared between them. Therefore it has to cope * with ALL the questions of this type on the page. */ (function() { - // start of App object SHARED BY ALL QUESTIONS OF THIS TYPE IN THE QUIZ ///// + // start of App object by all questions of this type on a page. YAHOO.example.DDApp = { init : function() { var questionspans = YAHOO.util.Dom.getElementsByClassName("ddwtos_questionid_for_javascript"); @@ -43,7 +43,7 @@ var ddwtos_currentzindex = 10; // we need this loop in case of more than one of this qtype on one page for (var i = 0; i < questionspans.length; i++) { // The Questions object should now contain a QuestionDataObject - //object for each question of this type in the quiz. + // object for each question of this type on the page. Questions[questionspans[i].id] = new QuestionDataObject(questionspans[i].id); } diff --git a/question/type/description/lang/en/qtype_description.php b/question/type/description/lang/en/qtype_description.php index 271822afced1f..bde99184a1841 100644 --- a/question/type/description/lang/en/qtype_description.php +++ b/question/type/description/lang/en/qtype_description.php @@ -29,5 +29,5 @@ $string['description_help'] = 'A description is not really a question type. It simply enables text to be displayed without requiring any answers, similar to a label on the course page. The question text is displayed both during the attempt and on the review page. Any general feedback is displayed on the review page only.'; -$string['descriptionsummary'] = 'This is not actually a question. Instead it is a way to add some instructions, rubric or other content to the quiz. This is similar to the way that labels can be used to add content to the course page.'; +$string['descriptionsummary'] = 'This is not actually a question. Instead it is a way to add some instructions, rubric or other content to the activity. This is similar to the way that labels can be used to add content to the course page.'; $string['editingdescription'] = 'Editing a Description'; diff --git a/question/type/edit_question_form.php b/question/type/edit_question_form.php index 5b5c1b778e957..649a0eb95f123 100644 --- a/question/type/edit_question_form.php +++ b/question/type/edit_question_form.php @@ -262,9 +262,9 @@ protected function definition_inner($mform) { protected function get_per_answer_fields(&$mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) { $repeated = array(); $repeated[] = $mform->createElement('header', 'answerhdr', $label); - $repeated[] = $mform->createElement('text', 'answer', get_string('answer', 'quiz'), array('size' => 80)); + $repeated[] = $mform->createElement('text', 'answer', get_string('answer', 'question'), array('size' => 80)); $repeated[] = $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions); - $repeated[] = $mform->createElement('editor', 'feedback', get_string('feedback', 'quiz'), + $repeated[] = $mform->createElement('editor', 'feedback', get_string('feedback', 'question'), array('rows' => 5), $this->editoroptions); $repeatedoptions['answer']['type'] = PARAM_RAW; $repeatedoptions['fraction']['default'] = 0; diff --git a/question/type/match/edit_match_form.php b/question/type/match/edit_match_form.php index 8cddd660b31aa..e2b77f8c02786 100644 --- a/question/type/match/edit_match_form.php +++ b/question/type/match/edit_match_form.php @@ -39,8 +39,8 @@ class qtype_match_edit_form extends question_edit_form { function get_per_answer_fields($mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) { $repeated = array(); $repeated[] = $mform->createElement('header', 'answerhdr', $label); - $repeated[] = $mform->createElement('editor', 'subquestions', get_string('question', 'quiz'), array('rows'=>3), $this->editoroptions); - $repeated[] = $mform->createElement('text', 'subanswers', get_string('answer', 'quiz'), array('size'=>50)); + $repeated[] = $mform->createElement('editor', 'subquestions', get_string('question', 'question'), array('rows'=>3), $this->editoroptions); + $repeated[] = $mform->createElement('text', 'subanswers', get_string('answer', 'question'), array('size'=>50)); $repeatedoptions['subquestions']['type'] = PARAM_RAW; $repeatedoptions['subanswers']['type'] = PARAM_TEXT; $answersoption = 'subquestions'; @@ -60,7 +60,7 @@ protected function definition_inner($mform) { $mform->addElement('static', 'answersinstruct', get_string('availablechoices', 'qtype_match'), get_string('filloutthreeqsandtwoas', 'qtype_match')); $mform->closeHeaderBefore('answersinstruct'); - $this->add_per_answer_fields($mform, get_string('questionno', 'quiz', '{no}'), 0); + $this->add_per_answer_fields($mform, get_string('questionno', 'question', '{no}'), 0); $this->add_combined_feedback_fields(true); $this->add_interactive_settings(true, true); diff --git a/question/type/match/lang/en/qtype_match.php b/question/type/match/lang/en/qtype_match.php index b4025eb79ec20..dc09c95dda05a 100644 --- a/question/type/match/lang/en/qtype_match.php +++ b/question/type/match/lang/en/qtype_match.php @@ -34,9 +34,10 @@ $string['match_help'] = 'Matching questions require the respondent to correctly match a list of names or statements (questions) to another list of names or statements (answers).'; $string['match_link'] = 'question/type/match'; $string['matchsummary'] = 'The answer to each of a number of sub-question must be selected from a list of possibilities.'; +$string['nomatchinganswer'] = 'You must specify an answer matching the question \'{$a}\'.'; $string['nomatchinganswerforq'] = 'You must specify an answer for this question.'; $string['notenoughqsandas'] = 'You must supply at least {$a->q} questions and {$a->a} answers.'; $string['notenoughquestions'] = 'You must supply at least {$a} question and answer pairs.'; $string['shuffle'] = 'Shuffle'; -$string['shuffle_help'] = 'If enabled, the order of the statements (answers) is randomly shuffled for each attempt, provided that "Shuffle within questions" in the quiz settings is also enabled.'; +$string['shuffle_help'] = 'If enabled, the order of the statements (answers) is randomly shuffled for each attempt, provided that "Shuffle within questions" in the activity settings is also enabled.'; $string['pleaseananswerallparts'] = 'Please answer all parts of the question.'; diff --git a/question/type/match/questiontype.php b/question/type/match/questiontype.php index ba228c7942586..f9fbcb806e9f5 100644 --- a/question/type/match/questiontype.php +++ b/question/type/match/questiontype.php @@ -64,7 +64,7 @@ function save_question_options($question) { continue; } if ($questiontext['text'] != '' && trim($question->subanswers[$key]) == '') { - $result->notice = get_string('nomatchinganswer', 'quiz', $questiontext); + $result->notice = get_string('nomatchinganswer', 'qtype_match', $questiontext); } // Update an existing subquestion if possible. @@ -122,7 +122,7 @@ function save_question_options($question) { } if (count($subquestions) < 3) { - $result->notice = get_string('notenoughanswers', 'quiz', 3); + $result->notice = get_string('notenoughanswers', 'question', 3); return $result; } diff --git a/question/type/multianswer/edit_multianswer_form.php b/question/type/multianswer/edit_multianswer_form.php index 27c2b12e78865..0ca189648f445 100644 --- a/question/type/multianswer/edit_multianswer_form.php +++ b/question/type/multianswer/edit_multianswer_form.php @@ -159,7 +159,7 @@ function definition_inner(&$mform) { $storemess = " STORED QTYPE ".$question_type_names[$this->savedquestiondisplay->options->questions[$sub]->qtype].""; } - $mform->addElement('header', 'subhdr'.$sub, get_string('questionno', 'quiz', + $mform->addElement('header', 'subhdr'.$sub, get_string('questionno', 'question', '{#'.$sub.'}').' '.$question_type_names[$this->questiondisplay->options->questions[$sub]->qtype].$storemess); $mform->addElement('static', 'sub_'.$sub."_".'questiontext', get_string('questiondefinition','qtype_multianswer'),array('cols'=>60, 'rows'=>3)); @@ -168,11 +168,11 @@ function definition_inner(&$mform) { $mform->setDefault('sub_'.$sub."_".'questiontext', $this->questiondisplay->options->questions[$sub]->questiontext['text']); } - $mform->addElement('static', 'sub_'.$sub."_".'defaultgrade', get_string('defaultgrade', 'quiz')); + $mform->addElement('static', 'sub_'.$sub."_".'defaultgrade', get_string('defaultgrade', 'question')); $mform->setDefault('sub_'.$sub."_".'defaultgrade',$this->questiondisplay->options->questions[$sub]->defaultgrade); if ($this->questiondisplay->options->questions[$sub]->qtype =='shortanswer' ) { - $mform->addElement('static', 'sub_'.$sub."_".'usecase', get_string('casesensitive', 'quiz')); + $mform->addElement('static', 'sub_'.$sub."_".'usecase', get_string('casesensitive', 'question')); } if ($this->questiondisplay->options->questions[$sub]->qtype =='multichoice' ) { @@ -180,7 +180,7 @@ function definition_inner(&$mform) { } foreach ($this->questiondisplay->options->questions[$sub]->answer as $key =>$ans) { - $mform->addElement('static', 'sub_'.$sub."_".'answer['.$key.']', get_string('answer', 'quiz'), array('cols'=>60, 'rows'=>1)); + $mform->addElement('static', 'sub_'.$sub."_".'answer['.$key.']', get_string('answer', 'question'), array('cols'=>60, 'rows'=>1)); if ($this->questiondisplay->options->questions[$sub]->qtype =='numerical' && $key == 0 ) { $mform->addElement('static', 'sub_'.$sub."_".'tolerance['.$key.']', get_string('acceptederror', 'quiz')) ;//, $gradeoptions); @@ -188,7 +188,7 @@ function definition_inner(&$mform) { $mform->addElement('static', 'sub_'.$sub."_".'fraction['.$key.']', get_string('grade')) ;//, $gradeoptions); - $mform->addElement('static', 'sub_'.$sub."_".'feedback['.$key.']', get_string('feedback', 'quiz')); + $mform->addElement('static', 'sub_'.$sub."_".'feedback['.$key.']', get_string('feedback', 'question')); } } @@ -198,7 +198,6 @@ function definition_inner(&$mform) { $mform->addElement('header', 'additemhdr', get_string('warningquestionmodified','qtype_multianswer')); } if($this->negative_diff > 0) { - //$this->used_in_quiz $mform->addElement('static', 'alert1', "".get_string('questiondeleted','qtype_multianswer')."",get_string('questionsless','qtype_multianswer',$this->negative_diff)); } if($this->qtype_change ) { @@ -296,11 +295,11 @@ function set_data($question) { if ($subquestion->qtype =='shortanswer' ) { switch ($subquestion->usecase) { case '1': - $default_values[$prefix.'usecase']= get_string('caseyes', 'quiz'); + $default_values[$prefix.'usecase']= get_string('caseyes', 'qtype_shortanswer'); break; case '0': default : - $default_values[$prefix.'usecase']= get_string('caseno', 'quiz'); + $default_values[$prefix.'usecase']= get_string('caseno', 'qtype_shortanswer'); } } @@ -344,7 +343,7 @@ function set_data($question) { if ($subquestion->qtype == 'multichoice' ) { $this->_form->setElementError($prefix.'answer[0]' , get_string('notenoughanswers', 'qtype_multichoice', 2)); } else { - $this->_form->setElementError($prefix.'answer[0]' , get_string('notenoughanswers', 'quiz', 1)); + $this->_form->setElementError($prefix.'answer[0]' , get_string('notenoughanswers', 'question', 1)); } } if ($maxgrade == false) { @@ -410,7 +409,7 @@ function validation($data, $files) { if ( $subquestion->qtype =='multichoice' ) { $errors[$prefix.'answer[0]']= get_string('notenoughanswers', 'qtype_multichoice', 2); }else { - $errors[$prefix.'answer[0]'] = get_string('notenoughanswers', 'quiz', 1); + $errors[$prefix.'answer[0]'] = get_string('notenoughanswers', 'question', 1); } } if ($maxgrade == false) { diff --git a/question/type/multianswer/questiontype.php b/question/type/multianswer/questiontype.php index bc2dd6f526614..cc635b1dc65ba 100644 --- a/question/type/multianswer/questiontype.php +++ b/question/type/multianswer/questiontype.php @@ -314,7 +314,7 @@ function print_question_formulation_and_controls(&$question, &$state, $cmoptions $qtextremaining = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course); - $strfeedback = get_string('feedback', 'quiz'); + $strfeedback = get_string('feedback', 'question'); // The regex will recognize text snippets of type {#X} // where the X can be any text not containg } or white-space characters. @@ -368,7 +368,7 @@ function print_question_formulation_and_controls(&$question, &$state, $cmoptions } if ($correctanswer != '' ) { $feedback = '
            '; - $feedback .= get_string('correctansweris', 'quiz', s($correctanswer)); + $feedback .= get_string('correctansweris', 'question', s($correctanswer)); $feedback .= '
            '; } } @@ -409,7 +409,7 @@ function print_question_formulation_and_controls(&$question, &$state, $cmoptions if ($options->readonly && $options->correct_responses) { $strfeedbackwrapped = get_string('correctanswerandfeedback', 'qtype_multianswer'); }else { - $strfeedbackwrapped = get_string('feedback', 'quiz'); + $strfeedbackwrapped = get_string('feedback', 'question'); } $popup = " onmouseover=\"return overlib('$feedback', STICKY, MOUSEOFF, CAPTION, '$strfeedbackwrapped', FGCOLOR, '#FFFFFF');\" ". " onmouseout=\"return nd();\" "; diff --git a/question/type/multichoice/lang/en/qtype_multichoice.php b/question/type/multichoice/lang/en/qtype_multichoice.php index 0aaad11cd5085..838aead70164b 100644 --- a/question/type/multichoice/lang/en/qtype_multichoice.php +++ b/question/type/multichoice/lang/en/qtype_multichoice.php @@ -64,6 +64,6 @@ $string['selectmulti'] = 'Select one or more:'; $string['selectone'] = 'Select one:'; $string['shuffleanswers'] = 'Shuffle the choices?'; -$string['shuffleanswers_help'] = 'If enabled, the order of the answers is randomly shuffled for each attempt, provided that "Shuffle within questions" in the quiz settings is also enabled.'; +$string['shuffleanswers_help'] = 'If enabled, the order of the answers is randomly shuffled for each attempt, provided that "Shuffle within questions" in the activity settings is also enabled.'; $string['singleanswer'] = 'Choose one answer.'; $string['toomanyselected'] = 'You have selected too many options.'; diff --git a/question/type/numerical/edit_numerical_form.php b/question/type/numerical/edit_numerical_form.php index 06cdaf7c093ba..8999c85096bce 100644 --- a/question/type/numerical/edit_numerical_form.php +++ b/question/type/numerical/edit_numerical_form.php @@ -39,7 +39,7 @@ class question_edit_numerical_form extends question_edit_form { function get_per_answer_fields(&$mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) { $repeated = parent::get_per_answer_fields($mform, $label, $gradeoptions, $repeatedoptions, $answersoption); - $tolerance =& $mform->createElement('text', 'tolerance', get_string('acceptederror', 'quiz')); + $tolerance =& $mform->createElement('text', 'tolerance', get_string('acceptederror', 'qtype_numerical')); $repeatedoptions['tolerance']['type'] = PARAM_NUMBER; array_splice($repeated, 3, 0, array($tolerance)); $repeated[1]->setSize(10); diff --git a/question/type/numerical/lang/en/qtype_numerical.php b/question/type/numerical/lang/en/qtype_numerical.php index e7ac9c7018a1b..a1e1b4970e24e 100644 --- a/question/type/numerical/lang/en/qtype_numerical.php +++ b/question/type/numerical/lang/en/qtype_numerical.php @@ -24,6 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +$string['acceptederror'] = 'Accepted error'; $string['addingnumerical'] = 'Adding a Numerical question'; $string['addmoreanswerblanks'] = 'Blanks for {no} More Answers'; $string['addmoreunitblanks'] = 'Blanks for {no} More Units'; @@ -31,10 +32,12 @@ $string['answerno'] = 'Answer {$a}'; $string['decfractionofquestiongrade'] = 'as decimal fraction (0-1) of question grade'; $string['decfractionofresponsegrade'] = 'as decimal fraction (0-1) of response grade'; +$string['decimalformat'] = 'decimals'; $string['editableunittext'] = 'Text input element'; $string['editingnumerical'] = 'Editing a Numerical question'; $string['errornomultiplier'] = 'You must specify a multiplier for this unit.'; $string['errorrepeatedunit'] = 'You cannot have two units with the same name.'; +$string['geometric'] = 'Geometric'; $string['instructions'] = 'Instructions '; $string['leftexample'] = 'LEFT as $1.00'; $string['noneditableunittext'] = 'NON editable text of Unit No1'; @@ -59,12 +62,15 @@ Note that the accepted error is also multiplied, so an allowed error of 100W would become an error of 0.1kW.'; $string['manynumerical'] = 'Only the NUMERICAL ANSWER will be graded using optional units '; +$string['nominal'] = 'Nominal'; $string['onlynumerical'] = 'Only the NUMERICAL ANSWER will be graded, no units allowed'; $string['oneunitshown'] = 'Only the NUMERICAL ANSWER will be graded, Unit1 will be shown'; +$string['relative'] = 'Relative'; $string['rightexample'] = 'RIGHT as 1.00cm'; $string['selectunits'] = 'Select units'; $string['selectunit'] = 'Select one unit'; $string['studentunitanswer'] = 'UNIT ANSWER displayed as a '; +$string['tolerancetype'] = 'Tolerance type'; $string['unitchoice'] = 'Multichoice (radio elements)'; $string['unitdisplay'] = 'Unit 1 displayed '; $string['unitedit'] = 'Edit unit'; diff --git a/question/type/opaque/lang/en/qtype_opaque.php b/question/type/opaque/lang/en/qtype_opaque.php index 5ba75874e3a65..62e9c07e339b0 100644 --- a/question/type/opaque/lang/en/qtype_opaque.php +++ b/question/type/opaque/lang/en/qtype_opaque.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['accessoutofsequence'] = 'You have accessed this page out of sequence. Please do not use the Back button when attempting quizzes.'; +$string['accessoutofsequence'] = 'You have accessed this page out of sequence. Please do not use the Back button when attempting questions.'; $string['addengine'] = 'Add another engine'; $string['addingopaque'] = 'Adding an Opaque question'; $string['cannotaccessfile'] = 'You are not allowed to access this file.'; diff --git a/question/type/opaque/simpletest/testlocallib.php b/question/type/opaque/simpletest/testlocallib.php index 929d9f30fabca..b2c46f8168854 100644 --- a/question/type/opaque/simpletest/testlocallib.php +++ b/question/type/opaque/simpletest/testlocallib.php @@ -27,8 +27,6 @@ defined('MOODLE_INTERNAL') || die(); -require_once($CFG->dirroot . '/mod/quiz/locallib.php'); - /** * Unit tests for (some of) ../locallib.php. diff --git a/question/type/oumultiresponse/edit_oumultiresponse_form.php b/question/type/oumultiresponse/edit_oumultiresponse_form.php index 51e06009fb016..a352f26ff93d1 100644 --- a/question/type/oumultiresponse/edit_oumultiresponse_form.php +++ b/question/type/oumultiresponse/edit_oumultiresponse_form.php @@ -58,7 +58,7 @@ protected function get_per_answer_fields(&$mform, $label, $gradeoptions, &$repea $repeated[] = $mform->createElement('header', 'choicehdr', get_string('choiceno', 'qtype_multichoice', '{no}')); $repeated[] = $mform->createElement('text', 'answer', get_string('answer', 'question'), array('size' => 50)); $repeated[] = $mform->createElement('checkbox', 'correctanswer', get_string('correctanswer', 'qtype_oumultiresponse')); - $repeated[] = $mform->createElement('editor', 'feedback', get_string('feedback', 'quiz'), + $repeated[] = $mform->createElement('editor', 'feedback', get_string('feedback', 'question'), array('rows' => 5), $this->editoroptions); // These are returned by arguments passed by reference. diff --git a/question/type/questiontype.php b/question/type/questiontype.php index e8e394f43ec32..9afec52cf3796 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -355,7 +355,7 @@ function save_question($question, $form) { } if ($question->penalty > 1 or $question->penalty < 0) { - $question->errors['penalty'] = get_string('invalidpenalty', 'quiz'); + $question->errors['penalty'] = get_string('invalidpenalty', 'question'); } if (isset($form->defaultmark)) { diff --git a/question/type/random/edit_random_form.php b/question/type/random/edit_random_form.php index 8c96d18ea1bc3..9b00a1ac80da1 100644 --- a/question/type/random/edit_random_form.php +++ b/question/type/random/edit_random_form.php @@ -53,10 +53,10 @@ public function definition() { // Standard fields at the start of the form. $mform->addElement('header', 'generalheader', get_string("general", 'form')); - $mform->addElement('questioncategory', 'category', get_string('category', 'quiz'), + $mform->addElement('questioncategory', 'category', get_string('category', 'question'), array('contexts' => $this->contexts->having_cap('moodle/question:useall'))); - $mform->addElement('advcheckbox', 'questiontext[text]', get_string('recurse', 'quiz'), null, null, array(0, 1)); + $mform->addElement('advcheckbox', 'questiontext[text]', get_string('includingsubcategories', 'qtype_random'), null, null, array(0, 1)); $mform->addElement('hidden', 'name'); $mform->setType('name', PARAM_ALPHA); diff --git a/question/type/random/lang/en/qtype_random.php b/question/type/random/lang/en/qtype_random.php index 03504d5628fbc..543879c1fd7a5 100644 --- a/question/type/random/lang/en/qtype_random.php +++ b/question/type/random/lang/en/qtype_random.php @@ -26,8 +26,9 @@ $string['configselectmanualquestions'] = 'Can the random question type select a manually graded question when it is making its random choice of a question from a category?'; $string['editingrandom'] = 'Editing a random question'; +$string['includingsubcategories'] = 'Including subcategories'; $string['random'] = 'Random'; -$string['random_help'] = 'A random question is not a question type as such, but is a way of inserting a randomly-chosen question from a specified category into a quiz.'; +$string['random_help'] = 'A random question is not a question type as such, but is a way of inserting a randomly-chosen question from a specified category into an activity.'; $string['randomqname'] = 'Random ({$a})'; $string['randomqplusname'] = 'Random ({$a} and sub-categories)'; $string['selectedby'] = '{$a->questionname} selected by {$a->randomname}'; diff --git a/question/type/randomsamatch/edit_randomsamatch_form.php b/question/type/randomsamatch/edit_randomsamatch_form.php index 42dbd4f6da820..e275cde043204 100644 --- a/question/type/randomsamatch/edit_randomsamatch_form.php +++ b/question/type/randomsamatch/edit_randomsamatch_form.php @@ -55,7 +55,7 @@ function definition_inner(&$mform) { function data_preprocessing($question) { if (empty($question->name)) { - $question->name = get_string("randomsamatch", "quiz"); + $question->name = get_string("randomsamatch", "quiz"); } if (empty($question->questiontext)) { diff --git a/question/type/shortanswer/questiontype.php b/question/type/shortanswer/questiontype.php index e18f2a45067b9..e88fded90f478 100644 --- a/question/type/shortanswer/questiontype.php +++ b/question/type/shortanswer/questiontype.php @@ -118,7 +118,7 @@ public function save_question_options($question) { // Perform sanity checks on fractional grades if ($maxfraction != 1) { - $result->noticeyesno = get_string('fractionsnomax', 'quiz', $maxfraction * 100); + $result->noticeyesno = get_string('fractionsnomax', 'question', $maxfraction * 100); return $result; } } diff --git a/question/type/truefalse/questiontype.php b/question/type/truefalse/questiontype.php index 591dff9973107..39422c065e35c 100644 --- a/question/type/truefalse/questiontype.php +++ b/question/type/truefalse/questiontype.php @@ -54,7 +54,7 @@ public function save_question_options($question) { $answer->id = $DB->insert_record('question_answers', $answer); } - $answer->answer = get_string('true', 'quiz'); + $answer->answer = get_string('true', 'qtype_truefalse'); $answer->fraction = $question->correctanswer; $answer->feedback = $this->import_or_save_files($question->feedbacktrue, $context, 'question', 'answerfeedback', $answer->id); @@ -72,7 +72,7 @@ public function save_question_options($question) { $answer->id = $DB->insert_record('question_answers', $answer); } - $answer->answer = get_string('false', 'quiz'); + $answer->answer = get_string('false', 'qtype_truefalse'); $answer->fraction = 1 - (int)$question->correctanswer; $answer->feedback = $this->import_or_save_files($question->feedbackfalse, $context, 'question', 'answerfeedback', $answer->id);