This mostly involves moving lang strings around, but I don't have time to do an AMOS script now.
$string['getcontextfromfile'] = 'Get context from file';
$string['changepublishstatuscat'] = '<a href="{$a->caturl}">Category "{$a->name}"</a> in course "{$a->coursename}" will have it\'s sharing status changed from <strong>{$a->changefrom} to {$a->changeto}</strong>.';
$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';
$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';
$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';
$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.';
* @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';
$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,
$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.';
$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';
$string['fractionsaddwrong'] = 'The positive grades you have chosen do not add up to 100%<br />Instead, they add up to {$a}%<br />Do you want to go back and fix this question?';
$string['fractionsnomax'] = 'One of the answers should be 100%, so that it is<br />possible to get a full grade for this question.<br />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';
$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.
$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';
$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';
$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.';
$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';
$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!<br />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)?';
$string['questioninuse'] = 'The question \'{$a->questionname}\' is currently being used in: <br />{$a->quiznames}<br />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'] = '<span class="accesshide">Question </span>{$a->number}<span class="accesshide"> {$a->attributes}</span>';
$string['questionnonavinfo'] = '<span class="accesshide">Information </span>{$a->number}<span class="accesshide"> {$a->attributes}</span>';
$string['questionnotloaded'] = 'Question {$a} has not been loaded from the database';
$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';
$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';
$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'] = '<b>Warning</b>: 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.';
$string['viewallanswers'] = 'View {$a} quiz attempts';
$string['viewallreports'] = 'View reports for {$a} attempts';
$string['warningmissingtype'] = '<b>This question is of a type that has not been installed on your Moodle yet.<br />Please alert your Moodle administrator.</b>';
-$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!';
$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){
$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")));
$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;
$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();
}
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
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.
$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));
$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);
// 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();
protected $firstrow = true;
public function init() {
- $this->strselect = get_string('select', 'quiz');
+ $this->strselect = get_string('select');
}
public function get_name() {
protected function print_choose_category_message($categoryandcontext) {
echo "<p style=\"text-align:center;\"><b>";
- print_string("selectcategoryabove", "quiz");
+ print_string("selectcategoryabove", "question");
echo "</b></p>";
}
echo '<form method="get" action="edit.php" id="displayoptions">';
echo "<fieldset class='invisiblefieldset'>";
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 '<noscript><div class="centerpara"><input type="submit" value="'. get_string('go') .'" />';
echo '</div></noscript></fieldset></form>';
}
$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);
echo '<div class="modulespecificbuttonscontainer">';
if ($caneditall || $canmoveall || $canuseall){
- echo '<strong> '.get_string('withselected', 'quiz').':</strong><br />';
+ echo '<strong> '.get_string('withselected', 'question').':</strong><br />';
if (function_exists('module_specific_buttons')) {
echo module_specific_buttons($this->cm->id,$cmoptions);
}
if ($canmoveall && count($addcontexts)) {
- echo '<input type="submit" name="move" value="'.get_string('moveto', 'quiz')."\" />\n";
+ echo '<input type="submit" name="move" value="'.get_string('moveto')."\" />\n";
question_category_select_menu($addcontexts, false, 0, "$category->id,$category->contextid");
}
// Add an explanation about questions in use
if ($inuse) {
- $questionnames .= '<br />'.get_string('questionsinuse', 'quiz');
+ $questionnames .= '<br />'.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;
}
$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;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * 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
}
/**
- * 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}.
/**
* 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
$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();
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;
}
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());
* Handle parsing error
*/
function error($message, $text='', $questionname='') {
- $importerrorquestion = get_string('importerrorquestion','quiz');
+ $importerrorquestion = get_string('importerrorquestion', 'question');
echo "<div class=\"importerror\">\n";
echo "<strong>$importerrorquestion $questionname</strong>";
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;
}
}
}
if (!$answersvalid) {
- echo $OUTPUT->notification(get_string('matcherror', 'quiz'));
+ echo $OUTPUT->notification(get_string('invalidgrade', 'question'));
++$gradeerrors;
continue;
}
*/
function readquestion($lines) {
- $formatnotimplemented = get_string('formatnotimplemented','quiz');
+ $formatnotimplemented = get_string('formatnotimplemented', 'question');
echo "<p>$formatnotimplemented</p>";
return NULL;
// did we actually process anything
if ($count==0) {
- print_error('noquestions', 'quiz', $continuepath);
+ print_error('noquestions', 'question', $continuepath);
}
// final pre-process on exported data
*/
function writequestion($question) {
// if not overidden, then this is an error.
- $formatnotimplemented = get_string('formatnotimplemented','quiz');
+ $formatnotimplemented = get_string('formatnotimplemented', 'question');
echo "<p>$formatnotimplemented</p>";
return NULL;
}
* @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;
}
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;
}
$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;
}
if (!isset($question->qtype)) {
- $giftqtypenotset = get_string('giftqtypenotset', 'quiz');
+ $giftqtypenotset = get_string('giftqtypenotset', 'qformat_gift');
$this->error($giftqtypenotset, $text);
return false;
}
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;
if (count($answers) == 0) {
// invalid question
- $giftnonumericalanswers = get_string('giftnonumericalanswers','quiz');
+ $giftnonumericalanswers = get_string('giftnonumericalanswers','qformat_gift');
$this->error($giftnonumericalanswers, $text);
return false;
break;
break;
default:
- $this->error(get_string('giftnovalidquestion', 'quiz'), $text);
+ $this->error(get_string('giftnovalidquestion', 'qformat_gift'), $text);
return fale;
break;
* @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';
*
* 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
function importpreprocess() {
global $CFG;
- print_error('cannotimportformat', 'question', "$CFG->wwwroot/mod/quiz/import.php?category=$category->id");
+ print_error('cannotimportformat', 'question');
}
function exportpreprocess() {
// 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;
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);
* @calledfrom type/<typename>/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;
return "<img src=\"$media\" alt=\"$alt\" width=\"$width\" height=\"$height\" />";
}
else {
- require_once("$CFG->dirroot/mod/quiz/format/qti/custommediafilter.php");
+ require_once("$CFG->dirroot/question/format/qti/custommediafilter.php");
return custom_mediaplugin_filter('<a href="' . $media . '"></a>', $courseid, $width, $height);
}
}
}
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;
// 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 {
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;
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;
}
}
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
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;
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;
$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;
}
if (sizeof($errors) > 0) {
- echo "<p>".get_string("errorsdetected", "quiz", sizeof($errors))."</p><ul>";
+ echo "<p>".get_string("errorsdetected", "qformat_webct", sizeof($errors))."</p><ul>";
foreach($errors as $error) {
echo "<li>$error</li>";
}
}
if (sizeof($warnings) > 0) {
- echo "<p>".get_string("warningsdetected", "quiz", sizeof($warnings))."</p><ul>";
+ echo "<p>".get_string("warningsdetected", "qformat_webct", sizeof($warnings))."</p><ul>";
foreach($warnings as $warning) {
echo "<li>$warning</li>";
}
* @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}) :';
// 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 .= "<ul class=\"truefalse\">\n";
$expout .= " <li><input name=\"quest_$id\" type=\"radio\" value=\"$st_true\" />$st_true</li>\n";
$expout .= " <li><input name=\"quest_$id\" type=\"radio\" value=\"$st_false\" />$st_false</li>\n";
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();
// 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(
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);
// 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;
}
}
*/
$string['invalidxml'] = 'Invalid XML file - string expected (use CDATA?)';
+$string['pluginname'] = 'Moodle XML format';
+$string['truefalseimporterror'] = '<b>Warning</b>: 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';
// 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');
$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);
$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);
$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);
}
/**
- * 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.
*/
echo $OUTPUT->header();
} else {
- $strediting = '<a href="edit.php?courseid='.$COURSE->id.'">'.get_string("editquestions", "quiz").'</a> -> '.$streditingquestion;
- $PAGE->navbar->add(get_string('editquestions', 'quiz'), $returnurl);
+ $strediting = '<a href="edit.php?courseid='.$COURSE->id.'">'.get_string('editquestions', 'question').'</a> -> '.$streditingquestion;
+ $PAGE->navbar->add(get_string('editquestions', 'question'), $returnurl);
$PAGE->navbar->add($streditingquestion);
echo $OUTPUT->header();
}
list($options, $selected) =
$this->qtypeobj->dataset_options($this->question, $datasetname);
unset($options['0']); // Mandatory...
- $label = get_string("wildcard", "quiz"). " <strong>$datasetname</strong> ";
+ $label = get_string("wildcard", "qtype_calculated"). " <strong>$datasetname</strong> ";
$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]));
if (!isset($datasetmenus[$datasetname])) {
list($options, $selected) =
$this->qtypeobj->dataset_options($this->question, $datasetname,false);
- $label = get_string("wildcard", "quiz"). " <strong>$datasetname</strong> ";
+ $label = get_string("wildcard", "qtype_calculated"). " <strong>$datasetname</strong> ";
$mform->addElement('select', "dataset[$key]", $label, $options);
// $mform->addRule("dataset[$key]", null, 'required', null, 'client');
if (isset($datadefscat[$datasetname])){
$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', '', '<hr />');
//------------------------------------------------------------------------------------------------------------------------------
//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');
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){
// $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';
$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;
}
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');
$string['correctfeedback'] = 'For any correct response';
$string['dataitemdefined']='with {$a} numerical values already defined is available';
$string['datasetrole']= ' The wild cards <strong>{x..}</strong> 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';
$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 <strong>{$a->name}</strong> 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}';
$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';
$string['sharedwildcard']='Shared wild card <strong>{$a}</strong>';
$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';
$string['trueanswerinsidelimits'] = 'Correct answer : {$a->correct} inside limits of true value {$a->true}';
$string['trueansweroutsidelimits'] = '<span class="error">ERROR Correct answer : {$a->correct} outside limits of true value {$a->true}</span>';
$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';
$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 {<strong>{$a}</strong>}';
$string['wildcardparam'] = 'Wild cards parameters used to generate the values';
$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!';
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)) {
}
if (! is_numeric($form->tolerance[$key])) {
$calculatedmessages[] =
- get_string('tolerancemustbenumeric', 'quiz');
+ get_string('tolerancemustbenumeric', 'qtype_calculated');
}
}
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) {
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 '<input type="submit" onclick="'
. "getElementById('addform').regenerateddefid.value='$defid'; return true;"
- .'" value="'. get_string('generatevalue', 'quiz') . '"/><br/>'
+ .'" value="'. get_string('generatevalue', 'qtype_calculated') . '"/><br/>'
. '<input type="text" size="3" name="calcmin[]" '
. " value=\"$regs[2]\"/> & <input name=\"calcmax[]\" "
. ' type="text" size="3" value="' . $regs[3] .'"/> '
}
$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'];
}
$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) {
}
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) {
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
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');
/// 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);
// 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;
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
}
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;
$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';
$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('...<strong>{={x}+..}</strong>...');
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');
}*/
$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) {
$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;
}
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');
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){
return true;
}
function finished_edit_wizard(&$form) {
- return true ; //isset($form->backtoquiz);
+ return true ;
}
function wizard_pages_number() {
return 1 ;
}
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')
);
}
/*
* 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");
// 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);
}
$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';
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;
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';
$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);
$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.';
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.
}
if (count($subquestions) < 3) {
- $result->notice = get_string('notenoughanswers', 'quiz', 3);
+ $result->notice = get_string('notenoughanswers', 'question', 3);
return $result;
}
$storemess = "<font class=\"error\"> STORED QTYPE ".$question_type_names[$this->savedquestiondisplay->options->questions[$sub]->qtype]."</font >";
}
- $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));
$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' ) {
}
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);
$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'));
}
}
$mform->addElement('header', 'additemhdr', get_string('warningquestionmodified','qtype_multianswer'));
}
if($this->negative_diff > 0) {
- //$this->used_in_quiz
$mform->addElement('static', 'alert1', "<strong>".get_string('questiondeleted','qtype_multianswer')."</strong>",get_string('questionsless','qtype_multianswer',$this->negative_diff));
}
if($this->qtype_change ) {
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');
}
}
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) {
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) {
$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.
}
if ($correctanswer != '' ) {
$feedback = '<div class="correctness">';
- $feedback .= get_string('correctansweris', 'quiz', s($correctanswer));
+ $feedback .= get_string('correctansweris', 'question', s($correctanswer));
$feedback .= '</div>';
}
}
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();\" ";
$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.';
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);
* @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';
$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';
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'] = '<STRONG>Unit 1 displayed </STRONG>';
$string['unitedit'] = 'Edit unit';
* @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.';
defined('MOODLE_INTERNAL') || die();
-require_once($CFG->dirroot . '/mod/quiz/locallib.php');
-
/**
* Unit tests for (some of) ../locallib.php.
$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.
}
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)) {
// 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);
$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}';
function data_preprocessing($question) {
if (empty($question->name)) {
- $question->name = get_string("randomsamatch", "quiz");
+ $question->name = get_string("randomsamatch", "quiz");
}
if (empty($question->questiontext)) {
// 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;
}
}
$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);
$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);