mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
"MDL-14129, fix print_error"
This commit is contained in:
parent
fd9f6cd330
commit
bd8ee7c1c4
@ -96,7 +96,8 @@ if (empty($iid)) {
|
||||
unset($content);
|
||||
|
||||
if ($readcount === false) {
|
||||
print_error($cir->get_error(), '', $returnurl);
|
||||
//TODO: need more detailed error info
|
||||
print_error('csvloaderror', '', $returnurl);
|
||||
} else if ($readcount == 0) {
|
||||
print_error('csvemptyfile', 'error', $returnurl);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class enrolment_plugin_authorize
|
||||
break;
|
||||
}
|
||||
if (!empty($authorizeerror)) {
|
||||
print_error($authorizeerror);
|
||||
print_error('authorizeerror');
|
||||
}
|
||||
}
|
||||
$frmenrol->display();
|
||||
|
@ -85,7 +85,7 @@ if ($importcode !== false) {
|
||||
}
|
||||
|
||||
} else {
|
||||
print_error($error);
|
||||
print_error('error', 'gradeimport_xml');
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
|
||||
$string['adminprimarynoedit'] = 'The primary admin cannot be edited by others';
|
||||
$string['authorizeerror'] = 'Authorize Error';
|
||||
$string['blockdoesnotexist'] = 'This block does not exist';
|
||||
$string['blockcannotinistantiate'] = 'Problem in instantiating block object';
|
||||
$string['blockcannotread'] = 'Could not read data for blockid= $a ';
|
||||
@ -174,6 +175,7 @@ $string['csvfewcolumns'] = 'Not enough columns, please verify the delimiter sett
|
||||
$string['csvinvalidcolsnum'] = 'INVALID CSV FILE; Each line must include 49 or 70 fields';
|
||||
$string['csvinvalidcols'] = '<b>INVALID CSV FILE:</b> First line must include "Header Fields" and the file must be type of <br />"Expanded Fields/Comma Separated"<br />or<br /> "Expanded Fields with CAVV Result Code/Comma Separated"';
|
||||
$string['csvweirdcolumns'] = 'Invalid CSV file format - number of columns is not constant!';
|
||||
$string['csvloaderror'] = 'Error occur during loading vcs file!';
|
||||
$string['dbconnectionfailed'] = '<p>Error: Database connection failed.</p>
|
||||
<p>It is possible that the database is overloaded or otherwise not running properly.</p>
|
||||
<p>The site administrator should also check that the database details have been correctly specified in config.php</p>$a';
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
$string['error'] = 'Errors occur';
|
||||
$string['errbadxmlformat'] = 'Error - bad XML format';
|
||||
$string['errduplicateidnumber'] = 'Error - duplicate idnumber';
|
||||
$string['errincorrectidnumber'] = 'Error - incorrect idnumber';
|
||||
|
@ -74,6 +74,7 @@ $string['errorsavingcomment'] = 'Error saving the comment for question $a->name
|
||||
$string['errorupdatingattempt'] = 'Error updating attempt $a->id in the database.';
|
||||
$string['emptyxml'] = 'Unkown error - empty imsmanifest.xml';
|
||||
$string['exportcategory'] = 'Export category';
|
||||
$string['exporterror'] = 'Errors occur during exporting!';
|
||||
$string['filesareasite']= 'the site files area';
|
||||
$string['filesareacourse']= 'the course files area';
|
||||
$string['filestomove']= 'Move / copy files to $a?';
|
||||
@ -125,6 +126,7 @@ $string['questionbank'] = 'Question bank';
|
||||
$string['questioncategory'] = 'Question category';
|
||||
$string['questioncatsfor'] = 'Question Categories for \'$a\'';
|
||||
$string['questiondoesnotexist'] = 'This question does not exist';
|
||||
$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) where saved when context $a was deleted because they are still used by some quizzes or other activities.';
|
||||
|
@ -53,6 +53,7 @@ $string['attempt'] = 'Attempt $a';
|
||||
$string['attemptclosed'] = 'Attempt has not closed yet';
|
||||
$string['attemptduration'] = 'Time taken';
|
||||
$string['attemptedon'] = 'Attempted on';
|
||||
$string['attempterror'] = 'Attempt error';
|
||||
$string['attemptfirst'] = 'First attempt';
|
||||
$string['attemptincomplete'] = 'That attempt (by $a) is not yet completed.';
|
||||
$string['attemptlast'] = 'Last attempt';
|
||||
@ -252,6 +253,7 @@ $string['finishreview'] = 'Finish review';
|
||||
$string['forceregeneration'] = 'force regeneration';
|
||||
$string['formatnotfound'] = 'Import/export format $a not found';
|
||||
$string['formatnotimplemented'] = 'This format has not been correctly implemented, please post a bug report';
|
||||
$string['formulaerror'] = 'Formula errors!';
|
||||
$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:';
|
||||
|
@ -104,15 +104,15 @@
|
||||
$qformat->setContexttofile(!empty($from_form->contexttofile));
|
||||
|
||||
if (! $qformat->exportpreprocess()) { // Do anything before that we need to
|
||||
print_error($txt->exporterror, '', $thispageurl->out());
|
||||
print_error('exporterror', 'question', $thispageurl->out());
|
||||
}
|
||||
|
||||
if (! $qformat->exportprocess()) { // Process the export data
|
||||
print_error($txt->exporterror, '', $thispageurl->out());
|
||||
print_error('exporterror', 'question', $thispageurl->out());
|
||||
}
|
||||
|
||||
if (! $qformat->exportpostprocess()) { // In case anything needs to be done after
|
||||
print_error($txt->exporterror, '', $thispageurl->out());
|
||||
print_error('exporterror', 'question', $thispageurl->out());
|
||||
}
|
||||
echo "<hr />";
|
||||
|
||||
|
@ -143,7 +143,8 @@
|
||||
|
||||
// In case anything needs to be done after
|
||||
if (! $qformat->importpostprocess()) {
|
||||
print_error($txt->importerror, '', $thispageurl->out());
|
||||
//TODO: need more detailed error info
|
||||
print_error('cannotimport', '', $thispageurl->out());
|
||||
}
|
||||
|
||||
echo "<hr />";
|
||||
|
@ -293,40 +293,28 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
|
||||
function validate_form($form) {
|
||||
switch($form->wizardpage) {
|
||||
case 'question':
|
||||
$calculatedmessages = array();
|
||||
if (empty($form->name)) {
|
||||
$calculatedmessages[] = get_string('missingname', 'quiz');
|
||||
print_error('missingname', 'quiz');
|
||||
}
|
||||
if (empty($form->questiontext)) {
|
||||
$calculatedmessages[] = get_string('missingquestiontext', 'quiz');
|
||||
print_error('missingquestiontext', 'quiz');
|
||||
}
|
||||
// Verify formulas
|
||||
foreach ($form->answers as $key => $answer) {
|
||||
if ('' === trim($answer)) {
|
||||
$calculatedmessages[] =
|
||||
get_string('missingformula', 'quiz');
|
||||
print_error('missingformula', 'quiz');
|
||||
}
|
||||
if ($formulaerrors =
|
||||
qtype_calculated_find_formula_errors($answer)) {
|
||||
$calculatedmessages[] = $formulaerrors;
|
||||
if ($formulaerrors = qtype_calculated_find_formula_errors($answer)) {
|
||||
print_error('formulaerror', 'quiz');
|
||||
}
|
||||
if (! isset($form->tolerance[$key])) {
|
||||
$form->tolerance[$key] = 0.0;
|
||||
}
|
||||
if (! is_numeric($form->tolerance[$key])) {
|
||||
$calculatedmessages[] =
|
||||
get_string('tolerancemustbenumeric', 'quiz');
|
||||
print_error('tolerancemustbenumeric', 'quiz');
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($calculatedmessages)) {
|
||||
$errorstring = "The following errors were found:<br />";
|
||||
foreach ($calculatedmessages as $msg) {
|
||||
$errorstring .= $msg . '<br />';
|
||||
}
|
||||
print_error($errorstring);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return parent::validate_form($form);
|
||||
|
@ -316,7 +316,7 @@ class default_questiontype {
|
||||
$result = $this->save_question_options($form);
|
||||
|
||||
if (!empty($result->error)) {
|
||||
print_error($result->error);
|
||||
print_error('questionsaveerror', 'question', '', $result->error);
|
||||
}
|
||||
|
||||
if (!empty($result->notice)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user