From 1343697c8235003a91bf09ad11ab296f106269c7 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Tue, 13 May 2008 06:15:20 +0000 Subject: [PATCH] "MDL-14129, fix print_error" --- course/format/topics/format.php | 2 +- course/import/activities/index.php | 8 ++++---- course/report/log/graph.php | 6 +++--- course/report/log/live.php | 4 ++-- course/report/outline/index.php | 4 ++-- course/report/stats/graph.php | 6 +++--- course/report/stats/index.php | 6 +++--- course/report/stats/report.php | 4 ++-- lang/en_utf8/error.php | 5 +++++ 9 files changed, 25 insertions(+), 20 deletions(-) diff --git a/course/format/topics/format.php b/course/format/topics/format.php index 3dc459d44b..10e37453ac 100644 --- a/course/format/topics/format.php +++ b/course/format/topics/format.php @@ -44,7 +44,7 @@ if (($marker >=0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) { $course->marker = $marker; if (! set_field("course", "marker", $marker, "id", $course->id)) { - print_error("Could not mark that topic for this course"); + print_error("cannotmarktopic"); } } diff --git a/course/import/activities/index.php b/course/import/activities/index.php index 5677d865d7..136d540ac8 100644 --- a/course/import/activities/index.php +++ b/course/import/activities/index.php @@ -13,11 +13,11 @@ $strimportactivities = get_string('importactivities'); if (! ($course = get_record("course", "id", $id)) ) { - print_error("That's an invalid course id"); + print_error("invalidcourseid"); } if (!$site = get_site()){ - print_error("Couldn't get site course"); + print_error("siteisnotdefined", 'debug'); } require_login($course->id); @@ -28,7 +28,7 @@ $syscontext = get_context_instance(CONTEXT_SYSTEM); if (!has_capability('moodle/course:manageactivities', $tocontext)) { - print_error("You need do not have the required permissions to import activities to this course"); + print_error('nopermissiontoimportact'); } // if we're not a course creator , we can only import from our own courses. @@ -38,7 +38,7 @@ if ($from = get_record('course', 'id', $fromcourse)) { if (!has_capability('moodle/course:manageactivities', $fromcontext)) { - print_error("You need to have the required permissions in the course you are importing data from, as well"); + print_error('nopermissiontoimportact'); } if (!empty($filename) && file_exists($CFG->dataroot.'/'.$filename) && !empty($SESSION->import_preferences)) { $restore = backup_to_restore_array($SESSION->import_preferences); diff --git a/course/report/log/graph.php b/course/report/log/graph.php index ef7309b18d..c1f414f199 100644 --- a/course/report/log/graph.php +++ b/course/report/log/graph.php @@ -11,7 +11,7 @@ $date = optional_param('date', 0, PARAM_INT); // A time of a day (in GMT) if (! $course = get_record("course", "id", $id)) { - print_error("Course is misconfigured"); + print_error('invalidcourseid'); } require_login($course->id); @@ -19,12 +19,12 @@ if (! (has_capability('moodle/site:viewreports', $context) or ($course->showreports and $USER->id == $user)) ) { - print_error("Sorry, you aren't allowed to see this."); + print_error("nopermissions"); } if ($user) { if (! $user = get_record("user", "id", $user)) { - print_error("Can not find that user"); + print_error("nousers"); } } diff --git a/course/report/log/live.php b/course/report/log/live.php index 732abadf99..859efe0fde 100644 --- a/course/report/log/live.php +++ b/course/report/log/live.php @@ -8,14 +8,14 @@ $page = optional_param('page', 0, PARAM_INT); // which page to show if (! $course = get_record("course", "id", $id) ) { - print_error("That's an invalid course id"); + print_error('invalidcourseid'); } require_login($course); $context = get_context_instance(CONTEXT_COURSE, $course->id); if (!has_capability('moodle/site:viewreports', $context)) { - print_error('You need do not have the required permission to view this report'); + print_error('nopermissions'); } add_to_log($course->id, "course", "report live", "report/log/live.php?id=$course->id", $course->id); diff --git a/course/report/outline/index.php b/course/report/outline/index.php index 628cf0e61c..27c2a2e9a0 100644 --- a/course/report/outline/index.php +++ b/course/report/outline/index.php @@ -8,7 +8,7 @@ $id = required_param('id',PARAM_INT); // course id if (!$course = get_record('course', 'id', $id)) { - print_error('Course id is incorrect.'); + print_error('invalidcourseid'); } require_login($course); @@ -32,7 +32,7 @@ print_heading(format_string($course->fullname)); if (!$logstart = get_field_sql("SELECT MIN(time) FROM {$CFG->prefix}log")) { - print_error('Logs not available'); + print_error('logfilenotavailable'); } echo '
'.get_string('computedfromlogs', 'admin', userdate($logstart)).'
'; diff --git a/course/report/stats/graph.php b/course/report/stats/graph.php index 34e51a9838..732116e91c 100644 --- a/course/report/stats/graph.php +++ b/course/report/stats/graph.php @@ -12,12 +12,12 @@ $roleid = optional_param('roleid',0,PARAM_INT); if (!$course = get_record("course","id",$courseid)) { - print_error("That's an invalid course id"); + print_error("invalidcourseid"); } if (!empty($userid)) { if (!$user = get_record('user','id',$userid)) { - print_error("That's an invalid user id"); + print_error("nousers"); } } @@ -25,7 +25,7 @@ $context = get_context_instance(CONTEXT_COURSE, $course->id); if (!has_capability('moodle/site:viewreports', $context)) { - print_error('You need do not have the required permission to view reports for this course'); + print_error('nopermissions'); } stats_check_uptodate($course->id); diff --git a/course/report/stats/index.php b/course/report/stats/index.php index 7183df393b..3f12f58f88 100644 --- a/course/report/stats/index.php +++ b/course/report/stats/index.php @@ -5,7 +5,7 @@ require_once($CFG->dirroot.'/course/report/stats/lib.php'); if (empty($CFG->enablestats)) { - print_error("Stats is not enabled."); + print_error("statsdisable"); } $courseid = required_param('course', PARAM_INT); @@ -29,12 +29,12 @@ } if (!$course = get_record("course","id",$courseid)) { - print_error("That's an invalid course id"); + print_error("invalidcourseid"); } if (!empty($userid)) { if (!$user = get_record('user','id',$userid)) { - print_error("That's an invalid user id"); + print_error("nousers"); } } diff --git a/course/report/stats/report.php b/course/report/stats/report.php index 6093ac8419..f85a32a967 100644 --- a/course/report/stats/report.php +++ b/course/report/stats/report.php @@ -31,7 +31,7 @@ .' ORDER BY u.lastname, u.firstname ASC'; if (!$us = get_records_sql($sql)) { - print_error('Cannot enter detailed view: No users found for this course.'); + print_error('nousers'); } foreach ($us as $u) { @@ -68,7 +68,7 @@ if (!empty($report) && !empty($time)) { if ($report == STATS_REPORT_LOGINS && $course->id != SITEID) { - print_error('This type of report is only available for the site course'); + print_error('reportnotavailable'); } $param = stats_get_parameters($time,$report,$course->id,$mode); diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php index b6c4f66aef..178117b1d5 100644 --- a/lang/en_utf8/error.php +++ b/lang/en_utf8/error.php @@ -43,6 +43,7 @@ $string['cannotfindinfo'] = 'Cannot find info for: \"$a\"'; $string['cannotfindhelp'] = 'Cannot find \"$a\" language help files'; $string['cannotfindlang'] = 'Cannot find \"$a\" language pack!'; $string['cannotfindsite'] = 'Cannot find site-level course'; +$string['cannotmarktopic'] = 'Could not mark that topic for this course'; $string['cannotmoverolewithid'] = 'Cannot move role with ID $a'; $string['cannotmetacourse'] = 'Could not add the selected course to this meta course!'; $string['cannotoverridebaserole'] = 'Can not override base role capabilities'; @@ -149,6 +150,7 @@ $string['listcantmoveleft'] = 'Failed to move item left, it has no parent.'; $string['listcantmoveright'] = 'Failed to move item right, their is no peer to make it a child of. Move it below another peer and then you can move it right.'; $string['loginasonecourse'] = 'You can not enter this course.
You have to terminate the \"Login as\" session before entering any other course.'; $string['loginasnoenrol'] = 'You can not use enrol or unenrol when in course \"Login as\" session.'; +$string['logfilenotavailable] = 'Logs not available'; $string['messagingdisable'] = 'Messaging is disabled on this site'; $string['missingfield'] = 'Field \"$a\" is missing.'; $string['missingrequiredfield'] = 'Some required field is missing'; @@ -177,6 +179,7 @@ $string['nousers'] = 'No such user!'; $string['nonmeaningfulcontent'] = 'Non meaningful content'; $string['noparticipatorycms'] = 'Sorry, but you have no participatory course modules to report on.'; $string['nopermissions'] = 'Sorry, but you do not currently have permissions to do that ($a)'; +$string['nopermissiontoimportact'] = 'You need do not have the required permissions to import activities to this course'; $string['nopermissiontoviewpage'] = 'You are not allowed to look at this page'; $string['nopermissiontomanagegroup'] = 'You do not have the required permissions to manage groups.'; $string['nosite'] = 'No sites'; @@ -195,6 +198,7 @@ $string['processingstops'] = 'Processing stops here. Remaining records ignored.' $string['remotedownloaderror'] = 'Download of component to your server failed, please verify proxy settings, PHP cURL extension is highly recommended.

You must download the url\">$a->url file manually, copy it to \"$a->dest\" in your server and unzip it there.'; $string['remotedownloadnotallowed'] = 'Download of components to your server isn\'t allowed (allow_url_fopen is disabled).

You must download the url\">$a->url file manually, copy it to \"$a->dest\" in your server and unzip it there.'; $string['restricteduser'] = 'Sorry, but your current account \"$a\" is restricted from doing that.'; +$string['reportnotavailable'] = 'This type of report is only available for the site course'; $string['rpcerror'] = 'RPC enrol/mnet/available_courses: ($a)'; $string['scheduledbackupsdisabled'] = 'Scheduled backups have been disabled by the server admin'; $string['sectionnotexist'] = 'This section does not exist'; @@ -207,6 +211,7 @@ $string['statscatchupmode'] = 'Statistics is currently in catchup mode. So far $ $string['tagnotfound'] = 'The specified tag was not found in the database'; $string['unicodeupgradeerror'] = 'Sorry, but your database is not already in Unicode, and this version of Moodle is not able to migrate your database to Unicode. Please upgrade to Moodle 1.7.x first and perform the Unicode migration from the Admin page. After that is done you should be able to migrate to Moodle $a'; $string['unspecifycourseid'] = 'Must specify course id, short name or idnumber'; +$string['statsdisable'] = 'Stats is not enabled.'; $string['statsnodata'] = 'There is no available data for that combination of course and time period.'; $string['statsdisable'] = 'Stats is not enabled.'; $string['unenrolerror'] = 'An error occurred while trying to unenrol that person.'; -- 2.39.5