Skip to content

Commit

Permalink
Fixed some hardcoded strings in GIFT format.
Browse files Browse the repository at this point in the history
  • Loading branch information
thepurpleblob committed Mar 14, 2007
1 parent f7b1762 commit 170ab43
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
7 changes: 7 additions & 0 deletions lang/en_utf8/quiz.php
Expand Up @@ -160,6 +160,7 @@
$string['editquestions'] = 'Edit questions';
$string['editquiz'] = 'Edit Quiz';
$string['editquizquestions'] = 'Edit Quiz 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';
Expand Down Expand Up @@ -211,6 +212,12 @@
$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';
Expand Down
18 changes: 12 additions & 6 deletions question/format/gift/format.php
Expand Up @@ -167,13 +167,15 @@ function readquestion($lines) {
// FIND ANSWER section
$answerstart = strpos($text, "{");
if ($answerstart === false) {
$this->error( 'Could not find a {', $text );
$giftleftbraceerror = get_string( 'giftleftbraceerror', 'quiz' );
$this->error( $giftleftbraceerror, $text );
return false;
}

$answerfinish = strpos($text, "}");
if ($answerfinish === false) {
$this->error( 'Could not find a }', $text );
$giftrightbraceerror = get_string( 'giftrightbraceerror', 'quiz' );
$this->error( $giftrightbraceerror, $text );
return false;
}

Expand Down Expand Up @@ -246,7 +248,8 @@ function readquestion($lines) {
}

if (!isset($question->qtype)) {
$this->error( 'Question type not set', $text );
$giftqtypenotset = get_string('giftqtypenotset','quiz');
$this->error( $giftqtypenotset, $text );
return false;
}

Expand Down Expand Up @@ -318,7 +321,8 @@ function readquestion($lines) {
foreach ($answers as $key => $answer) {
$answer = trim($answer);
if (strpos($answer, "->") === false) {
$this->error('Improperly formatted Matching Question answer', $answer );
$giftmatchingformat = get_string('giftmatchingformat','quiz');
$this->error($giftmatchingformat, $answer );
return false;
break 2;
}
Expand Down Expand Up @@ -409,7 +413,8 @@ function readquestion($lines) {

if (count($answers) == 0) {
// invalid question
$this->error( 'No answers found in Numerical answer', $text );
$giftnonumericalanswers = get_string('giftnonumericalanswers','quiz');
$this->error( $giftnonumericalanswers, $text );
return false;
break;
}
Expand Down Expand Up @@ -466,7 +471,8 @@ function readquestion($lines) {
break;

default:
$this->error( 'No valid question detected', $text );
$giftnovalidquestion = get_string('giftnovalidquestion','quiz');
$this->error( $giftnovalidquestion, $text );
return false;
break;

Expand Down

0 comments on commit 170ab43

Please sign in to comment.