Index: question/type/match/edit_match_form.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/type/match/edit_match_form.php,v retrieving revision 1.8.2.3 diff -u -r1.8.2.3 edit_match_form.php --- question/type/match/edit_match_form.php 23 Nov 2007 22:12:38 -0000 1.8.2.3 +++ question/type/match/edit_match_form.php 27 Oct 2008 02:25:35 -0000 @@ -23,7 +23,7 @@ $mform->setHelpButton('shuffleanswers', array('matchshuffle', get_string('shuffle','quiz'), 'quiz')); $mform->setDefault('shuffleanswers', 1); - $mform->addElement('static', 'answersinstruct', get_string('choices', 'quiz'), get_string('filloutthreequestions', 'quiz')); + $mform->addElement('static', 'answersinstruct', get_string('choices', 'quiz'), get_string('filloutthreeqsandtwoas', 'qtype_match')); $mform->closeHeaderBefore('answersinstruct'); $repeated = array(); @@ -75,26 +75,31 @@ $answers = $data['subanswers']; $questions = $data['subquestions']; $questioncount = 0; + $answercount = 0; foreach ($questions as $key => $question){ $trimmedquestion = trim($question); $trimmedanswer = trim($answers[$key]); - if ($trimmedanswer != '' && $trimmedquestion != ''){ + if ($trimmedquestion != ''){ $questioncount++; } + if ($trimmedanswer != '' || $trimmedquestion != ''){ + $answercount++; + } if ($trimmedquestion != '' && $trimmedanswer == ''){ $errors['subanswers['.$key.']'] = get_string('nomatchinganswerforq', 'qtype_match', $trimmedquestion); } } - if ($questioncount==0){ - $errors['subquestions[0]'] = get_string('notenoughquestions', 'qtype_match', 3); - $errors['subquestions[1]'] = get_string('notenoughquestions', 'qtype_match', 3); - $errors['subquestions[2]'] = get_string('notenoughquestions', 'qtype_match', 3); - } elseif ($questioncount==1){ - $errors['subquestions[1]'] = get_string('notenoughquestions', 'qtype_match', 3); - $errors['subquestions[2]'] = get_string('notenoughquestions', 'qtype_match', 3); - - } elseif ($questioncount==2){ - $errors['subquestions[2]'] = get_string('notenoughquestions', 'qtype_match', 3); + $numberqanda = new stdClass; + $numberqanda->q = 2; + $numberqanda->a = 3; + if ($questioncount < 1){ + $errors['subquestions[0]'] = get_string('notenoughqsandas', 'qtype_match', $numberqanda); + } + if ($questioncount < 2){ + $errors['subquestions[1]'] = get_string('notenoughqsandas', 'qtype_match', $numberqanda); + } + if ($answercount < 3){ + $errors['subanswers[2]'] = get_string('notenoughqsandas', 'qtype_match', $numberqanda); } return $errors; } Index: lang/en_utf8/qtype_match.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/qtype_match.php,v retrieving revision 1.1 diff -u -r1.1 qtype_match.php --- lang/en_utf8/qtype_match.php 7 Jan 2007 12:46:48 -0000 1.1 +++ lang/en_utf8/qtype_match.php 27 Oct 2008 02:25:35 -0000 @@ -1,5 +1,7 @@ q questions and $a->a answers.'; ?> \ No newline at end of file