diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php
index 80e6518fdeb..ee3ba16c759 100644
--- a/lang/en_utf8/error.php
+++ b/lang/en_utf8/error.php
@@ -16,8 +16,10 @@ $string['cannotaddnewmodule'] = 'Could not add a new instance of $a';
$string['cannotaddcoursemodule'] = 'Could not add a new course module';
$string['cannotaddcmtosection'] = 'Could not add the new course module to that section';
$string['cannotsaveconfig'] = 'Problem saving config \"$a[0]\" as \"$a[1]\" for plugin \"$a[2]\"';
+$string['cannotsavecomment'] = 'Cannot save comment';
$string['cannotsavefile'] = 'Cannot save the file\"$a[0]\/$a[1]\"!';
$string['cannotcreatebackupdir'] = 'Could not create backupdata folder. The site administrator needs to fix the file permissions';
+$string['cannotcreatedefaultcat'] = 'Error creating a default category for context $a';
$string['cannotcreategroup'] = 'Error creating group';
$string['cannotcreatelangdir'] = 'Cannot create lang dir.';
$string['cannotcreatelangbase'] = 'Error: Could not create base lang directory.';
@@ -47,6 +49,7 @@ $string['cannotfindlang'] = 'Cannot find \"$a\" language pack!';
$string['cannotfindsite'] = 'Cannot find site-level course';
$string['cannotimportgrade'] = 'Grade import error';
$string['cannotnetgeo'] = 'Can not connect to NetGeo server at http://netgeo.caida.org, please check proxy settings or better install MaxMind GeoLite City data file.';
+$string['cannotgetcats'] = 'error getting category record';
$string['cannotgradeuser'] = 'Can not grade this user';
$string['cannotmapfield'] = 'mapping collision detected, 2 fields maps to the same grade item $a';
$string['cannotmarktopic'] = 'Could not mark that topic for this course';
diff --git a/lang/en_utf8/question.php b/lang/en_utf8/question.php
index 3cd0232d9a3..b4a7fa02eb9 100644
--- a/lang/en_utf8/question.php
+++ b/lang/en_utf8/question.php
@@ -4,6 +4,9 @@
$string['adminreport'] = 'Report on possible problems in your question database.';
$string['broken'] = 'This is a \"broken link\", it points to a nonexistent file.';
$string['byandon'] = 'by $a->user on $a->time';
+$string['cannotinsert'] = 'Could not insert entry in question_sessions';
+$string['cannotcreate'] = 'Could not create new entry in question_attempts table';
+$string['cannotsavequiz'] = 'Failed to save the current quiz attempt!';
$string['categorydoesnotexist'] = 'This category does not exist';
$string['categorycurrent'] = 'Current Category';
$string['categorycurrentuse'] = 'Use This Category';
@@ -40,6 +43,7 @@ $string['exportcategory'] = 'Export category';
$string['filesareasite']= 'the site files area';
$string['filesareacourse']= 'the course files area';
$string['filestomove']= 'Move / copy files to $a?';
+$string['formquestionnotinids'] = 'Form contained question that is not in questionids';
$string['fractionsnomax'] = 'One of the answers should have a score of 100%% so it is possible to get full marks for this question.';
$string['getcategoryfromfile'] = 'Get category from file';
$string['getcontextfromfile'] = 'Get context from file';
diff --git a/lib/questionlib.php b/lib/questionlib.php
index d2a7f00883e..d9ecc9683fb 100644
--- a/lib/questionlib.php
+++ b/lib/questionlib.php
@@ -1025,7 +1025,7 @@ function save_question_session(&$question, &$state) {
$session->sumpenalty = $state->sumpenalty;
$session->manualcomment = $state->manualcomment;
if (!insert_record('question_sessions', $session)) {
- print_error('Could not insert entry in question_sessions');
+ print_error('cannotinsert', 'question');
}
} else {
$session->newest = $state->id;
@@ -1102,7 +1102,7 @@ function question_extract_responses($questions, $formdata, $defaultevent=QUESTIO
if (false !== ($quid = question_get_id_from_name_prefix($key))) {
// check if this is a valid id
if (!isset($questions[$quid])) {
- print_error('Form contained question that is not in questionids');
+ print_error('formquestionnotinids', 'question');
}
// Remove the name prefix from the name
@@ -1511,7 +1511,7 @@ function get_question_image($question) {
$img = '';
if (!$category = get_record('question_categories', 'id', $question->category)){
- print_error('invalid category id '.$question->category);
+ print_error('invalidcategory');
}
$coursefilesdir = get_filesdir_from_context(get_context_instance_by_id($category->contextid));
@@ -1555,7 +1555,7 @@ function question_process_comment($question, &$state, &$attempt, $comment, $grad
$comment = trim($comment);
$state->manualcomment = $comment;
if (!set_field('question_sessions', 'manualcomment', $comment, 'attemptid', $attempt->uniqueid, 'questionid', $question->id)) {
- print_error("Cannot save comment");
+ print_error('cannotsavecomment');
}
// Update the attempt if the score has changed.
@@ -1563,7 +1563,7 @@ function question_process_comment($question, &$state, &$attempt, $comment, $grad
$attempt->sumgrades = $attempt->sumgrades - $state->last_graded->grade + $grade;
$attempt->timemodified = time();
if (!update_record('quiz_attempts', $attempt)) {
- print_error('Failed to save the current quiz attempt!');
+ print_error('cannotsavequiz');
}
}
@@ -1639,7 +1639,7 @@ function question_new_attempt_uniqueid($modulename='quiz') {
$attempt = new stdClass;
$attempt->modulename = $modulename;
if (!$id = insert_record('question_attempts', $attempt)) {
- print_error('Could not create new entry in question_attempts table');
+ print_error('cannotcreate', 'question');
}
return $id;
}
@@ -1883,7 +1883,7 @@ function question_make_default_categories($contexts) {
// If it already exists, just return it.
foreach ($contexts as $key => $context) {
if (!$categoryrs = get_recordset_select("question_categories", "contextid = '{$context->id}'", 'sortorder, name', '*', '', 1)) {
- print_error('error getting category record');
+ print_error('cannotgetcats');
} else {
if (!$category = rs_fetch_record($categoryrs)){
// Otherwise, we need to make one
@@ -1896,7 +1896,7 @@ function question_make_default_categories($contexts) {
$category->sortorder = 999; // By default, all categories get this number, and are sorted alphabetically.
$category->stamp = make_unique_id_code();
if (!$category->id = insert_record('question_categories', $category)) {
- print_error('Error creating a default category for context '.print_context_name($context));
+ print_error('cannotcreatedefaultcat', '', '', print_context_name($context));
}
}
}
@@ -2309,7 +2309,7 @@ function get_filesdir_from_context($context){
$courseid = SITEID;
break;
default :
- print_error('Unsupported contextlevel in category record!');
+ print_error('invalidcontext');
}
return $courseid;
}