"MDL-14129, fix print_error"

This commit is contained in:
dongsheng 2008-06-06 05:50:45 +00:00
parent 646fc29036
commit 8a274bcde4
5 changed files with 17 additions and 17 deletions

View file

@ -10,15 +10,15 @@
$hook = optional_param('hook','ALL', PARAM_CLEAN); $hook = optional_param('hook','ALL', PARAM_CLEAN);
if (! $cm = get_coursemodule_from_id('glossary', $id)) { if (! $cm = get_coursemodule_from_id('glossary', $id)) {
print_error("Course Module ID was incorrect"); print_error('invalidcoursemodule');
} }
if (! $course = get_record("course", "id", $cm->course)) { if (! $course = get_record("course", "id", $cm->course)) {
print_error("Course is misconfigured"); print_error('coursemisconf');
} }
if (! $glossary = get_record("glossary", "id", $cm->instance)) { if (! $glossary = get_record("glossary", "id", $cm->instance)) {
print_error("Course module is incorrect"); print_error('invalidid', 'glossary');
} }
require_login($course->id, false, $cm); require_login($course->id, false, $cm);
@ -31,7 +31,7 @@
$newentry->timemodified = time(); // wee need this date here to speed up recent activity, TODO: use timestamp in approved field instead in 2.0 $newentry->timemodified = time(); // wee need this date here to speed up recent activity, TODO: use timestamp in approved field instead in 2.0
if (! update_record("glossary_entries", $newentry)) { if (! update_record("glossary_entries", $newentry)) {
print_error("Could not update your glossary"); print_error('cantupdateglossary', 'glossary');
} else { } else {
add_to_log($course->id, "glossary", "approve entry", "showentry.php?id=$cm->id&eid=$eid", "$eid",$cm->id); add_to_log($course->id, "glossary", "approve entry", "showentry.php?id=$cm->id&eid=$eid", "$eid",$cm->id);
} }

View file

@ -12,15 +12,15 @@
$cat = optional_param('cat',0, PARAM_ALPHANUM); $cat = optional_param('cat',0, PARAM_ALPHANUM);
if (! $cm = get_coursemodule_from_id('glossary', $id)) { if (! $cm = get_coursemodule_from_id('glossary', $id)) {
print_error("Course Module ID was incorrect"); print_error('invalidcoursemodule');
} }
if (! $course = get_record("course", "id", $cm->course)) { if (! $course = get_record("course", "id", $cm->course)) {
print_error("Course is misconfigured"); print_error('coursemisconf');
} }
if (! $glossary = get_record("glossary", "id", $cm->instance)) { if (! $glossary = get_record("glossary", "id", $cm->instance)) {
print_error("Course module is incorrect"); print_error('invalidid', 'glossary');
} }
require_login($course->id, false, $cm); require_login($course->id, false, $cm);

View file

@ -51,7 +51,7 @@
print_header("$strratings: $entry->concept"); print_header("$strratings: $entry->concept");
if (!$ratings = glossary_get_ratings($entry->id, $sqlsort)) { if (!$ratings = glossary_get_ratings($entry->id, $sqlsort)) {
print_error("No ratings for this entry: \"$entry->concept\""); print_error("ratingno', 'glossary');
} else { } else {
echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\" class=\"generalbox\" style=\"width:100%\">"; echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\" class=\"generalbox\" style=\"width:100%\">";

View file

@ -16,7 +16,7 @@
$glossary = get_record('glossary','id',$entry->glossaryid); $glossary = get_record('glossary','id',$entry->glossaryid);
$entry->glossaryname = format_string($glossary->name,true); $entry->glossaryname = format_string($glossary->name,true);
if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id)) { if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id)) {
print_error("Could not determine which course module this belonged to!"); print_error("invalidcoursemodule");
} }
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id))) { if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id))) {
redirect($CFG->wwwroot.'/course/view.php?id='.$cm->course, get_string('activityiscurrentlyhidden')); redirect($CFG->wwwroot.'/course/view.php?id='.$cm->course, get_string('activityiscurrentlyhidden'));
@ -27,7 +27,7 @@
} else if ($concept) { } else if ($concept) {
$entries = glossary_get_entries_search($concept, $courseid); $entries = glossary_get_entries_search($concept, $courseid);
} else { } else {
print_error('No valid entry specified'); print_error('invalidentry');
} }
if ($entries) { if ($entries) {

View file

@ -21,27 +21,27 @@
if (!empty($id)) { if (!empty($id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) { if (! $cm = get_coursemodule_from_id('glossary', $id)) {
print_error("Course Module ID was incorrect"); print_error('invalidcoursemodule');
} }
if (! $course = get_record("course", "id", $cm->course)) { if (! $course = get_record("course", "id", $cm->course)) {
print_error("Course is misconfigured"); print_error('coursemisconf');
} }
if (! $glossary = get_record("glossary", "id", $cm->instance)) { if (! $glossary = get_record("glossary", "id", $cm->instance)) {
print_error("Course module is incorrect"); print_error('invalidid', 'glossary');
} }
} else if (!empty($g)) { } else if (!empty($g)) {
if (! $glossary = get_record("glossary", "id", $g)) { if (! $glossary = get_record("glossary", "id", $g)) {
print_error("Course module is incorrect"); print_error('invalidid', 'glossary');
} }
if (! $course = get_record("course", "id", $glossary->course)) { if (! $course = get_record("course", "id", $glossary->course)) {
print_error("Could not determine which course this belonged to!"); print_error('invalidcourseid');
} }
if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id, $course->id)) { if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id, $course->id)) {
print_error("Could not determine which course module this belonged to!"); print_error('invalidcoursemodule');
} }
$id = $cm->id; $id = $cm->id;
} else { } else {
print_error("Must specify glossary ID or course module ID"); print_error('invalidid', 'glossary');
} }
require_course_login($course->id, true, $cm); require_course_login($course->id, true, $cm);