]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix print_error"
authordongsheng <dongsheng>
Sun, 15 Jun 2008 09:14:55 +0000 (09:14 +0000)
committerdongsheng <dongsheng>
Sun, 15 Jun 2008 09:14:55 +0000 (09:14 +0000)
lang/en_utf8/error.php
lang/en_utf8/survey.php
mod/survey/download.php
mod/survey/graph.php
mod/survey/index.php
mod/survey/mod_form.php
mod/survey/report.php
mod/survey/save.php
mod/survey/view.php

index ffb20d1721ac976c58bb37b152db5f08dc152626..a4d62d8ab772ddc808cc4ee92a8a8c752c163f35 100644 (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';
index 6975ac949544d6ec5a87cb4e6e3de5b05ce0a254..3d68f1f11582b72c29a85b3c7682b5272067ba95 100644 (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';
index 5b3ac438d13c66e0122d7477857cc62192529147..ec3b92ca1c2d86bc67af46a075494da15f7bc10a 100644 (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&amp;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) {
             $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;
             $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;
 
     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";
index c7ad83ed8ecad87c6d62d228d6ca05e0d82fe315..fc159cf7a8e55edaebd9ddb13816e620f767b29a 100644 (file)
     $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);
 
     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
index 9c7ef54d7e5dec557e8f4601147acfc497b6599c..e3c5658a931c53d3322f4b298c23f52959de09a6 100644 (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);
index 3962270b2781fec6c31b58b51a2ccc97d4df4873..86733df0b8ee85f75c7649fefe4e644426fc0bc1 100644 (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 {
 
 
 }
-?>
\ No newline at end of file
+?>
index 9424ba9a410c5ab90468d4eb822f156bacfe2853..7872abdb797e456a4f08e6ec8d169f3ad1eb32ea 100644 (file)
     $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);
     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');
 
       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");
 
 
       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)));
index 6bbbdea4628a2e04874f7abc78aaccb7bf331632..a405d4969fdd473c923f62cacb7905e5a620ed95 100644 (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');
         }
     }
 
index 0cc346c65a5a1dbaac39f2c6d95ae6a0803677fd..4fa6b05eee470025cc7d6193514456801e9abbff 100644 (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');
 
 // 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);