"MDL-14129, fix print_error"

This commit is contained in:
dongsheng 2008-05-20 03:09:35 +00:00
parent 4c181e344e
commit 2471ef8650
4 changed files with 10 additions and 10 deletions

View File

@ -20,9 +20,9 @@
// relative path must start with '/', because of backup/restore!!!
if (!$relativepath) {
print_error('No valid arguments supplied or incorrect server configuration');
print_error('invalidarguments');
} else if ($relativepath{0} != '/') {
print_error('No valid arguments supplied, path does not start with slash!');
print_error('pathdoesnotstartslash');
}
$pathname = $CFG->dataroot.'/questionattempt'.$relativepath;
@ -32,7 +32,7 @@
// check for the right number of directories in the path
if (count($args) != 3) {
print_error('Invalid arguments supplied');
print_error('invalidarguments');
}
// security: require login

View File

@ -108,7 +108,7 @@ class question_edit_multianswer_form extends question_edit_form {
$parsableanswerdef .= 'NUMERICAL:';
break;
default:
print_error("questiontype $wrapped->qtype not recognized");
print_error('unknownquestiontype', 'question', '', $wrapped->qtype);
}
$separator= '';
foreach ($wrapped->options->answers as $subanswer) {
@ -252,4 +252,4 @@ class question_edit_multianswer_form extends question_edit_form {
return 'multianswer';
}
}
?>
?>

View File

@ -439,7 +439,7 @@ class embedded_cloze_qtype extends default_questiontype {
echo $feedbackimg;
break;
default:
print_error("Unable to recognize questiontype of question part #$positionkey.");
print_error('unknownquestiontype', 'question');
break;
}
echo "</label>"; // MDL-7497
@ -672,7 +672,7 @@ class embedded_cloze_qtype extends default_questiontype {
$answer = $exploded[1];
// $sequence is an ordered array of the question ids.
if (!$sequence = get_field('question_multianswer', 'sequence', 'question', $state->question)) {
print_error("The cloze question $state->question is missing its options");
print_error('missingoption', 'question', '', $state->question);
}
$sequence = explode(',', $sequence);
// The id of the current question.
@ -799,7 +799,7 @@ function qtype_multianswer_extract_question($text) {
$wrapped->partiallycorrectfeedback = '';
$wrapped->incorrectfeedback = '';
} else {
print_error("Cannot identify qtype $answerregs[2]");
print_error('unknownquestiontype', 'question', '', $answerregs[2]);
return false;
}

View File

@ -54,11 +54,11 @@ class random_qtype extends default_questiontype {
$form->name = '';
$question = parent::save_question($question, $form, $course);
if (!$category = get_record('question_categories', 'id', $question->category)) {
print_error('Could retrieve question category');
print_error('cannotretrieveqcat', 'question');
}
$question->name = $this->question_name($category);
if (!set_field('question', 'name', $question->name, 'id', $question->id)) {
print_error('Could not update random question name');
print_error('cannotupdaterandomqname', 'question');
}
return $question;
}