"MDL-14129, fix print_error"

This commit is contained in:
dongsheng
2008-06-15 09:14:55 +00:00
parent 25a5f14b8d
commit 83b10e578e
9 changed files with 38 additions and 32 deletions
+1 -1
View File
@@ -299,7 +299,7 @@ $string['nopermissiontorate'] = 'Rating of items not allowed!';
$string['nopermissiontoimportact'] = 'You do not have the required permissions to import activities to this course';
$string['nopermissiontolock'] = 'No permission to lock!';
$string['nopermissiontomkdir'] = 'Cannot create folder. The site administrator needs to fix the file permissions';
$string['nopermissiontoshow'] = 'No permission to show!';
$string['nopermissiontoshow'] = 'No permission to see this!';
$string['nopermissiontounlock'] = 'No permission to unlock!';
$string['nopermissiontoupdateblock'] = 'No permission to update $a!';
$string['nopermissiontoviewpage'] = 'You are not allowed to look at this page';
+6
View File
@@ -58,6 +58,10 @@ $string['attlsm2'] = 'Connected Learning';
$string['attlsm3'] = 'Separate Learning';
$string['attlsmintro'] = 'In discussion ...';
$string['attlsname'] = 'ATTLS (20 item version)';
$string['cannotfindsurveytmpt'] = 'No survey templates found!';
$string['cannotfindquestion'] = 'Question doesn\'t exist';
$string['cannotfindanswer'] = 'There are no answers for this survey yet.';
$string['cannotinsertanswer'] = 'Encountered a problem trying to store your results. Sorry.';
$string['ciq1'] = 'At what moment in class were you most engaged as a learner?';
$string['ciq1short'] = 'Most engaged';
$string['ciq2'] = 'At what moment in class were you most distanced as a learner?';
@@ -176,6 +180,8 @@ $string['howlong'] = 'How long did this survey take you to complete?';
$string['howlongoptions'] = 'under 1 min,1-2 min,2-3 min,3-4 min,4-5-min,5-10 min,more than 10';
$string['ifoundthat'] = 'I found that';
$string['introtext'] = 'Introduction text';
$string['invalidsurveyid'] = 'Survey ID was incorrect';
$string['invalidtmptid'] = 'Invalid template id';
$string['ipreferthat'] = 'I prefer that';
$string['modulename'] = 'Survey';
$string['modulenameplural'] = 'Surveys';
+7 -7
View File
@@ -9,11 +9,11 @@
$group = optional_param('group', 0, PARAM_INT);
if (! $cm = $DB->get_record("course_modules", array("id"=>$id))) {
print_error("Course Module ID was incorrect");
print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
print_error("Course is misconfigured");
print_error('coursemisconf');
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -22,7 +22,7 @@
require_capability('mod/survey:download', $context) ;
if (! $survey = $DB->get_record("survey", array("id"=>$cm->instance))) {
print_error("Survey ID was incorrect");
print_error('invalidsurveyid', 'survey');
}
add_to_log($course->id, "survey", "download", "download.php?id=$cm->id&type=$type", "$survey->id", $cm->id);
@@ -96,7 +96,7 @@
// Get and collate all the results in one big array
if (! $aaa = $DB->get_records("survey_answers", array("survey"=>$survey->id), "time ASC")) {
print_error("There are no answers for this survey yet.");
print_error('cannotfindanswer', 'survey');
}
foreach ($aaa as $a) {
@@ -150,7 +150,7 @@
$col = 0;
$row++;
if (! $u = $DB->get_record("user", array("id"=>$user))) {
print_error("Error finding student # $user");
print_error('invaliduserid');
}
if ($n = $DB->get_record("survey_analysis", array("survey"=>$survey->id, "userid"=>$user))) {
$notes = $n->notes;
@@ -220,7 +220,7 @@
$col = 0;
$row++;
if (! $u = $DB->get_record("user", array("id"=>$user))) {
print_error("Error finding student # $user");
print_error('invaliduserid');
}
if ($n = $DB->get_record("survey_analysis", array("survey"=>$survey->id, "userid"=>$user))) {
$notes = $n->notes;
@@ -280,7 +280,7 @@
foreach ($results as $user => $rest) {
if (! $u = $DB->get_record("user", array("id"=>$user))) {
print_error("Error finding student # $user");
print_error('invaliduserid');
}
echo $survey->id."\t";
echo strip_tags(format_string($survey->name,true))."\t";
+5 -5
View File
@@ -11,11 +11,11 @@
$qid = optional_param('qid', 0, PARAM_INT); // Group ID
if (! $cm = get_coursemodule_from_id('survey', $id)) {
print_error("Course Module ID was incorrect");
print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
print_error("Course is misconfigured");
print_error('coursemisconf');
}
require_login($course->id, false, $cm);
@@ -25,14 +25,14 @@
if (!has_capability('mod/survey:readresponses', $context)) {
if ($type != "student.png" or $sid != $USER->id ) {
print_error("Sorry, you aren't allowed to see this.");
print_error('nopermissiontoshow');
} else if ($groupmode and !groups_is_member($group)) {
print_error("Sorry, you aren't allowed to see this.");
print_error('nopermissiontoshow');
}
}
if (! $survey = $DB->get_record("survey", array("id"=>$cm->instance))) {
print_error("Survey ID was incorrect");
print_error('invalidsurveyid', 'survey');
}
/// Check to see if groups are being used in this survey
+1 -1
View File
@@ -6,7 +6,7 @@
$id = required_param('id', PARAM_INT); // Course Module ID
if (!$course = $DB->get_record('course', array('id'=>$id))) {
print_error("Course ID is incorrect");
print_error('invalidcourseid');
}
require_course_login($course);
+2 -2
View File
@@ -18,7 +18,7 @@ class mod_survey_mod_form extends moodleform_mod {
$mform->addRule('name', null, 'required', null, 'client');
if (!$options = $DB->get_records_menu("survey", array("template"=>0), "name", "id, name")) {
print_error('No survey templates found!');
print_error('cannotfindsurveytmpt', 'survey');
}
foreach ($options as $id => $name) {
@@ -46,4 +46,4 @@ class mod_survey_mod_form extends moodleform_mod {
}
?>
?>
+6 -6
View File
@@ -16,11 +16,11 @@
$qid = implode (',', $qids);
if (! $cm = get_coursemodule_from_id('survey', $id)) {
print_error("Course Module ID was incorrect");
print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
print_error("Course is misconfigured");
print_error('coursemisconf');
}
require_login($course->id, false, $cm);
@@ -30,11 +30,11 @@
require_capability('mod/survey:readresponses', $context);
if (! $survey = $DB->get_record("survey", array("id"=>$cm->instance))) {
print_error("Survey ID was incorrect");
print_error('invalidsurveyid', 'survey');
}
if (! $template = $DB->get_record("survey", array("id"=>$survey->template))) {
print_error("Template ID was incorrect");
print_error('invalidtmptid', 'survey');
}
$showscales = ($template->name != 'ciqname');
@@ -261,7 +261,7 @@
case "question":
if (!$question = $DB->get_record("survey_questions", array("id"=>$qid))) {
print_error("Question doesn't exist");
print_error('cannotfindquestion', 'survey');
}
$question->text = get_string($question->text, "survey");
@@ -321,7 +321,7 @@
case "student":
if (!$user = $DB->get_record("user", array("id"=>$student))) {
print_error("Student doesn't exist");
print_error('invaliduserid');
}
print_heading(get_string("analysisof", "survey", fullname($user)));
+5 -5
View File
@@ -7,17 +7,17 @@
// Make sure this is a legitimate posting
if (!$formdata = data_submitted()) {
print_error("You are not supposed to use this script like that.");
print_error('cannotcallscript');
}
$id = required_param('id', PARAM_INT); // Course Module ID
if (! $cm = get_coursemodule_from_id('survey', $id)) {
print_error("Course Module ID was incorrect");
print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
print_error("Course is misconfigured");
print_error('coursemisconf');
}
require_login($course->id, false, $cm);
@@ -26,7 +26,7 @@
require_capability('mod/survey:participate', $context);
if (! $survey = $DB->get_record("survey", array("id"=>$cm->instance))) {
print_error("Survey ID was incorrect");
print_error('invalidsurveyid', 'survey');
}
add_to_log($course->id, "survey", "submit", "view.php?id=$cm->id", "$survey->id", "$cm->id");
@@ -85,7 +85,7 @@
}
if (! $DB->insert_record("survey_answers", $newdata)) {
print_error("Encountered a problem trying to store your results. Sorry.");
print_error('cannotinsertanswer', 'survey');
}
}
+5 -5
View File
@@ -6,11 +6,11 @@
$id = required_param('id', PARAM_INT); // Course Module ID
if (! $cm = get_coursemodule_from_id('survey', $id)) {
print_error("Course Module ID was incorrect");
print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
print_error("Course is misconfigured");
print_error('coursemisconf');
}
require_login($course->id, false, $cm);
@@ -20,7 +20,7 @@
require_capability('mod/survey:participate', $context);
if (! $survey = $DB->get_record("survey", array("id"=>$cm->instance))) {
print_error("Survey ID was incorrect");
print_error('invalidsurveyid', 'survey');
}
$trimmedintro = trim($survey->intro);
if (empty($trimmedintro)) {
@@ -29,7 +29,7 @@
}
if (! $template = $DB->get_record("survey", array("id"=>$survey->template))) {
print_error("Template ID was incorrect");
print_error('invalidtmptid', 'survey');
}
$showscales = ($template->name != 'ciqname');
@@ -115,7 +115,7 @@
// Get all the major questions and their proper order
if (! $questions = $DB->get_records_list("survey_questions", "id", explode(',', $survey->questions))) {
print_error("Couldn't find any questions in this survey!!");
print_error('cannotfindquestion', 'survey');
}
$questionorder = explode( ",", $survey->questions);