";
@@ -2168,7 +2168,7 @@ function exercise_print_league_table($exercise) {
// print an order table of (student) submissions in grade order, only print the student's best submission when
// there are multiple submissions
if (! $course = get_record("course", "id", $exercise->course)) {
- error("Print league table: Course is misconfigured");
+ print_error("Print league table: Course is misconfigured");
}
$groupid = get_current_group($course->id);
$nentries = $exercise->showleaguetable;
@@ -2196,7 +2196,7 @@ function exercise_print_league_table($exercise) {
continue;
}
if (!$user = get_record("user", "id", $submission->userid)) {
- error("Print league table: user not found");
+ print_error("Print league table: user not found");
}
if ($exercise->anonymous and isstudent($course->id)) {
$table->data[] = array(exercise_print_submission_title($exercise, $submission),
@@ -2224,10 +2224,10 @@ function exercise_print_submission_assessments($exercise, $submission) {
// Returns a list of grades for this submission
if (! $course = get_record("course", "id", $exercise->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("exercise", $exercise->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
$str = '';
@@ -2342,16 +2342,16 @@ function exercise_print_teacher_assessment_form($exercise, $assessment, $submiss
global $CFG, $USER, $EXERCISE_SCALES, $EXERCISE_EWEIGHTS;
if (! $course = get_record("course", "id", $exercise->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("exercise", $exercise->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
$timenow = time();
if(!$submissionowner = get_record("user", "id", $submission->userid)) {
- error("Print teacher assessment form: User record not found");
+ print_error("Print teacher assessment form: User record not found");
}
echo "
@@ -2406,7 +2406,7 @@ function exercise_print_teacher_assessment_form($exercise, $assessment, $submiss
// get the assignment elements...
if (!$elementsraw = get_records("exercise_elements", "exerciseid", $exercise->id, "elementno ASC")) {
- error("Teacher assessment form: Elements not found");
+ print_error("Teacher assessment form: Elements not found");
}
foreach ($elementsraw as $element) {
$elements[] = $element; // to renumber index 0,1,2...
@@ -2817,7 +2817,7 @@ function exercise_print_teacher_table($course) {
$table->cellspacing = 0;
if (!$teachers = get_course_teachers($course->id, "u.firstname, u.lastname")) {
- error("No teachers on this course!");
+ print_error("No teachers on this course!");
}
for ($j = 0; $j < count($exercises); $j++) {
$grand[$j] = 0;
@@ -2861,10 +2861,10 @@ function exercise_print_upload_form($exercise) {
global $CFG;
if (! $course = get_record("course", "id", $exercise->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("exercise", $exercise->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
echo "";
diff --git a/mod/exercise/submissions.php b/mod/exercise/submissions.php
index 68d5bb4d9b3..e3aa4c7ced4 100644
--- a/mod/exercise/submissions.php
+++ b/mod/exercise/submissions.php
@@ -32,15 +32,15 @@
// get some essential stuff...
if (! $cm = get_coursemodule_from_id('exercise', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $exercise = get_record("exercise", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
require_login($course->id, false, $cm);
@@ -59,10 +59,10 @@
if ($action == 'adminamendtitle' ) {
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
if (empty($sid)) {
- error("Admin Amend Title: submission id missing");
+ print_error("Admin Amend Title: submission id missing");
}
$submission = get_record("exercise_submissions", "id", $sid);
@@ -92,14 +92,14 @@
elseif ($action == 'adminclearlate' ) {
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
if (empty($sid)) {
- error("Admin clear late flag: submission id missing");
+ print_error("Admin clear late flag: submission id missing");
}
if (!$submission = get_record("exercise_submissions", "id", $sid)) {
- error("Admin clear late flag: can not get submission record");
+ print_error("Admin clear late flag: can not get submission record");
}
if (set_field("exercise_submissions", "late", 0, "id", $sid)) {
print_heading(get_string("clearlateflag", "exercise")." ".get_string("ok"));
@@ -115,18 +115,18 @@
elseif ($action == 'adminconfirmdelete' ) {
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
if (empty($sid)) {
- error("Admin confirm delete: submission id missing");
+ print_error("Admin confirm delete: submission id missing");
}
if (!$submission = get_record("exercise_submissions", "id", $sid)) {
- error("Admin delete: can not get submission record");
+ print_error("Admin delete: can not get submission record");
}
if (isteacher($course->id, $submission->userid)) {
if (!isteacheredit($course->id)) {
- error("Only teacher with editing permissions can delete teacher submissions.");
+ print_error("Only teacher with editing permissions can delete teacher submissions.");
}
if ($assessments = exercise_get_assessments($submission)) {
echo " ".get_string("deletesubmissionwarning", "exercise", count($assessments)).
@@ -142,14 +142,14 @@
elseif ($action == 'admindelete' ) {
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
if (empty($sid)) {
- error("Admin delete: submission id missing");
+ print_error("Admin delete: submission id missing");
}
if (!$submission = get_record("exercise_submissions", "id", $sid)) {
- error("Admin delete: can not get submission record");
+ print_error("Admin delete: can not get submission record");
}
print_string("deleting", "exercise");
// first get any assessments...
@@ -176,13 +176,13 @@
elseif ($action == 'adminlateflag' ) {
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
if (empty($sid)) {
- error("Admin confirm late flag: submission id missing");
+ print_error("Admin confirm late flag: submission id missing");
}
if (!$submission = get_record("exercise_submissions", "id", $sid)) {
- error("Admin confirm late flag: can not get submission record");
+ print_error("Admin confirm late flag: can not get submission record");
}
notice_yesno(get_string("clearlateflag","exercise")."?",
@@ -195,7 +195,7 @@
elseif ($action == 'adminlist' ) {
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
echo " Exercise Version-> $module->version ";
@@ -209,10 +209,10 @@
elseif ($action == 'adminupdatetitle' ) {
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
if (empty($sid)) {
- error("Admin Update Title: submission id missing");
+ print_error("Admin Update Title: submission id missing");
}
if (set_field("exercise_submissions", "title", $title, "id", $sid)) {
@@ -304,7 +304,7 @@
exit;
}
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
exercise_list_unassessed_student_submissions($exercise, $USER);
print_continue("view.php?id=$cm->id");
@@ -331,7 +331,7 @@
$form = (object)$_POST;
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
// save the number of league table entries from the form...
@@ -355,7 +355,7 @@
$form = (object)$_POST;
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
// save the weights from the form...
@@ -379,7 +379,7 @@
elseif ($action == 'userconfirmdelete' ) {
if (empty($sid)) {
- error("User Confirm Delete: submission id missing");
+ print_error("User Confirm Delete: submission id missing");
}
notice_yesno(get_string("confirmdeletionofthisitem","exercise", get_string("submission", "exercise")),
@@ -391,11 +391,11 @@
elseif ($action == 'userdelete' ) {
if (empty($sid)) {
- error("User Delete: submission id missing");
+ print_error("User Delete: submission id missing");
}
if (!$submission = get_record("exercise_submissions", "id", $sid)) {
- error("User Delete: can not get submission record");
+ print_error("User Delete: can not get submission record");
}
print_string("deleting", "exercise");
// first get any assessments...
@@ -422,7 +422,7 @@
else {
- error("Fatal Error: Unknown Action: ".$action."\n");
+ print_error("Fatal Error: Unknown Action: ".$action."\n");
}
diff --git a/mod/exercise/upload.php b/mod/exercise/upload.php
index 8a6796c0733..d7ec94ed852 100644
--- a/mod/exercise/upload.php
+++ b/mod/exercise/upload.php
@@ -11,15 +11,15 @@
// get some esential stuff...
if (! $cm = get_coursemodule_from_id('exercise', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $exercise = get_record("exercise", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
require_login($course->id, false, $cm);
@@ -71,7 +71,7 @@
$newsubmission->late = 1;
}
if (!$newsubmission->id = insert_record("exercise_submissions", $newsubmission)) {
- error("exercise upload: Failure to create new submission record!");
+ print_error("exercise upload: Failure to create new submission record!");
}
$dir = exercise_file_area_name($exercise, $newsubmission);
if ($um->save_files($dir)) {
@@ -81,7 +81,7 @@
// upload manager will print errors.
// clear resubmit flags
if (!set_field("exercise_submissions", "resubmit", 0, "exerciseid", $exercise->id, "userid", $USER->id)) {
- error("Exercise Upload: unable to reset resubmit flag");
+ print_error("Exercise Upload: unable to reset resubmit flag");
}
}
// upload manager will print errors.
diff --git a/mod/exercise/view.php b/mod/exercise/view.php
index 5ee7fc7addc..5bad9a8aace 100644
--- a/mod/exercise/view.php
+++ b/mod/exercise/view.php
@@ -25,15 +25,15 @@
// get some esential stuff...
if (! $cm = get_coursemodule_from_id('exercise', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $exercise = get_record("exercise", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
require_login($course->id, false, $cm);
@@ -136,7 +136,7 @@
elseif ($action == 'makeleaguetableavailable') {
if (!isteacheredit($course->id)) {
- error("Only teachers with editing permissions can do this.");
+ print_error("Only teachers with editing permissions can do this.");
}
set_field("exercise", "phase", 3, "id", "$exercise->id");
@@ -155,7 +155,7 @@
elseif ($action == 'openexercise') {
if (!isteacheredit($course->id)) {
- error("Only teachers with editing permissions can do this.");
+ print_error("Only teachers with editing permissions can do this.");
}
// move to phase 2, check that teacher has made enough submissions
@@ -177,7 +177,7 @@
elseif ($action == 'setupassignment') {
if (!isteacher($course->id)) {
- error("Only teachers with editing permissions can do this.");
+ print_error("Only teachers with editing permissions can do this.");
}
set_field("exercise", "phase", 1, "id", "$exercise->id");
@@ -312,7 +312,7 @@
elseif ($action == 'submitassignment') {
if (!has_capability('mod/exercise:assess', $context)) {
- error("Only teachers with editing permissions can do this.");
+ print_error("Only teachers with editing permissions can do this.");
}
exercise_print_assignment_info($exercise);
@@ -332,7 +332,7 @@
elseif ($action == 'teachersview') {
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
/// Check to see if groups are being used in this exercise
@@ -404,7 +404,7 @@
/*************** no man's land **************************************/
else {
- error("Fatal Error: Unknown Action: ".$action."\n");
+ print_error("Fatal Error: Unknown Action: ".$action."\n");
}
print_footer($course);
diff --git a/mod/forum/discuss.php b/mod/forum/discuss.php
index fd3d5bd7a96..3f019815a3d 100644
--- a/mod/forum/discuss.php
+++ b/mod/forum/discuss.php
@@ -14,11 +14,11 @@
$postid = optional_param('postid', 0, PARAM_INT); // Used for tracking read posts if user initiated.
if (!$discussion = get_record('forum_discussions', 'id', $d)) {
- error("Discussion ID was incorrect or no longer exists");
+ print_error("Discussion ID was incorrect or no longer exists");
}
if (!$course = get_record('course', 'id', $discussion->course)) {
- error("Course ID is incorrect - discussion is faulty");
+ print_error("Course ID is incorrect - discussion is faulty");
}
if (!$forum = get_record('forum', 'id', $discussion->forum)) {
@@ -26,7 +26,7 @@
}
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
require_course_login($course, true, $cm);
@@ -38,7 +38,7 @@
if (!($USER->id == $discussion->userid || (($discussion->timestart == 0
|| $discussion->timestart <= time())
&& ($discussion->timeend == 0 || $discussion->timeend > time())))) {
- error('Discussion ID was incorrect or no longer exists', "$CFG->wwwroot/mod/forum/view.php?f=$forum->id");
+ print_error('Discussion ID was incorrect or no longer exists', '', "$CFG->wwwroot/mod/forum/view.php?f=$forum->id");
}
}
@@ -49,19 +49,19 @@
require_capability('mod/forum:movediscussions', $modcontext);
if ($forum->type == 'single') {
- error('Cannot move discussion from a simple single discussion forum', $return);
+ print_error('Cannot move discussion from a simple single discussion forum', '', $return);
}
if (!$forumto = get_record('forum', 'id', $move)) {
- error('You can\'t move to that forum - it doesn\'t exist!', $return);
+ print_error('You can\'t move to that forum - it doesn\'t exist!', '', $return);
}
if (!$cmto = get_coursemodule_from_instance('forum', $forumto->id, $course->id)) {
- error('Target forum not found in this course.', $return);
+ print_error('Target forum not found in this course.', '', $return);
}
if (!coursemodule_visible_for_user($cmto)) {
- error('Forum not visible', $return);
+ print_error('Forum not visible', '', $return);
}
if (!forum_move_attachments($discussion, $forumto->id)) {
@@ -77,8 +77,8 @@
// the regeneration of the feeds since the discussions have been
// moved.
if (!forum_rss_delete_file($forum) || !forum_rss_delete_file($forumto)) {
- error('Could not purge the cached RSS feeds for the source and/or'.
- 'destination forum(s) - check your file permissionsforums', $return);
+ print_error('Could not purge the cached RSS feeds for the source and/or'.
+ 'destination forum(s) - check your file permissionsforums', '', $return);
}
redirect($return.'&moved=-1&sesskey='.sesskey());
@@ -109,12 +109,12 @@
}
if (! $post = forum_get_post_full($parent)) {
- error("Discussion no longer exists", "$CFG->wwwroot/mod/forum/view.php?f=$forum->id");
+ print_error("Discussion no longer exists", '', "$CFG->wwwroot/mod/forum/view.php?f=$forum->id");
}
if (!forum_user_can_view_post($post, $course, $cm, $forum, $discussion)) {
- error('You do not have permissions to view this post', "$CFG->wwwroot/mod/forum/view.php?id=$forum->id");
+ print_error('You do not have permissions to view this post', '', "$CFG->wwwroot/mod/forum/view.php?id=$forum->id");
}
if ($mark == 'read' or $mark == 'unread') {
diff --git a/mod/forum/index.php b/mod/forum/index.php
index 282a3ae8ba9..b567c69efea 100644
--- a/mod/forum/index.php
+++ b/mod/forum/index.php
@@ -9,11 +9,11 @@
if ($id) {
if (! $course = get_record('course', 'id', $id)) {
- error("Course ID is incorrect");
+ print_error("Course ID is incorrect");
}
} else {
if (! $course = get_site()) {
- error("Could not find a top-level course!");
+ print_error("Could not find a top-level course!");
}
}
diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index b3872402d4f..178058e42b2 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -63,7 +63,7 @@ function forum_add_instance($forum) {
$discussion->mailnow = false;
if (! forum_add_discussion($discussion, $discussion->intro)) {
- error('Could not add the discussion for this forum');
+ print_error('Could not add the discussion for this forum');
}
}
@@ -114,11 +114,11 @@ function forum_update_instance($forum) {
notify('Warning! There is more than one discussion in this forum - using the most recent');
$discussion = array_pop($discussions);
} else {
- error('Could not find the discussion in this forum');
+ print_error('Could not find the discussion in this forum');
}
}
if (! $post = get_record('forum_posts', 'id', $discussion->firstpost)) {
- error('Could not find the first post in this forum discussion');
+ print_error('Could not find the first post in this forum discussion');
}
$post->subject = $forum->name;
@@ -126,18 +126,18 @@ function forum_update_instance($forum) {
$post->modified = $forum->timemodified;
if (! update_record('forum_posts', ($post))) {
- error('Could not update the first post');
+ print_error('Could not update the first post');
}
$discussion->name = $forum->name;
if (! update_record('forum_discussions', ($discussion))) {
- error('Could not update the discussion');
+ print_error('Could not update the discussion');
}
}
if (!update_record('forum', $forum)) {
- error('Can not update forum');
+ print_error('Can not update forum');
}
$forum = stripslashes_recursive($forum);
@@ -791,7 +791,7 @@ function forum_make_mail_text($course, $forum, $discussion, $post, $userfrom, $u
if (!isset($userto->viewfullnames[$forum->id])) {
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
$viewfullnames = has_capability('moodle/site:viewfullnames', $modcontext, $userto->id);
@@ -941,7 +941,7 @@ function forum_user_complete($course, $user, $mod, $forum) {
if ($posts = forum_get_user_posts($forum->id, $user->id)) {
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
$discussions = get_records('forum_discussions', 'forum', $forum->id); // TODO: improve
@@ -1508,7 +1508,7 @@ function forum_get_readable_forums($userid, $courseid=0) {
global $CFG, $USER;
if (!$forummod = get_record('modules', 'name', 'forum')) {
- error('The forum module is not installed');
+ print_error('The forum module is not installed');
}
if ($courseid) {
@@ -2206,7 +2206,7 @@ function forum_make_mail_post($course, $forum, $discussion, $post, $userfrom, $u
if (!isset($userto->viewfullnames[$forum->id])) {
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
$viewfullnames = has_capability('moodle/site:viewfullnames', $modcontext, $userto->id);
@@ -2246,7 +2246,7 @@ function forum_make_mail_post($course, $forum, $discussion, $post, $userfrom, $u
$groups = $userfrom->groups[$forum->id];
} else {
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
$group = groups_get_all_groups($course->id, $userfrom->id, $cm->groupingid);
}
@@ -2682,7 +2682,7 @@ function forum_print_discussion_header(&$post, $forum, $group=-1, $datestring=""
if (empty($modcontext)) {
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $forum->course)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
}
@@ -3858,7 +3858,7 @@ function forum_user_can_post_discussion($forum, $currentgroup=-1, $groupmode=-1,
if (!$cm) {
debugging('missing cm', DEBUG_DEVELOPER);
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $forum->course)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -3931,7 +3931,7 @@ function forum_user_can_post($forum, $user=NULL, $cm=NULL, $context=NULL) {
if (!$cm) {
debugging('missing cm', DEBUG_DEVELOPER);
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $forum->course)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -4047,7 +4047,7 @@ function forum_user_can_see_post($forum, $discussion, $post, $user=NULL, $cm=NUL
if (!$cm) {
debugging('missing cm', DEBUG_DEVELOPER);
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $forum->course)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
}
@@ -4107,7 +4107,7 @@ function forum_print_latest_discussions($course, $forum, $maxdiscussions=5, $dis
if (!$cm) {
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $forum->course)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -5635,7 +5635,7 @@ function forum_check_throttling($forum) {
}
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $forum->course)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
if(!has_capability('mod/forum:throttlingapplies', $modcontext)) {
@@ -5657,7 +5657,7 @@ function forum_check_throttling($forum) {
$a->blockperiod = get_string('secondstotime'.$forum->blockperiod);
if ($forum->blockafter <= $numposts) {
- error(get_string('forumblockingtoomanyposts','error',$a),$CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id);
+ print_error('forumblockingtoomanyposts', 'error', $CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id, $a);
}
if ($forum->warnafter <= $numposts) {
notify(get_string('forumblockingalmosttoomanyposts','forum',$a));
@@ -5890,14 +5890,14 @@ function forum_convert_to_roles($forum, $forummodid, $teacherroles=array(),
$mod->groupmode = 0;
if (!$cmid = add_course_module($mod)) {
- error('Could not create new course module instance for the teacher forum');
+ print_error('Could not create new course module instance for the teacher forum');
} else {
$mod->coursemodule = $cmid;
if (!$sectionid = add_mod_to_section($mod)) {
- error('Could not add converted teacher forum instance to section 0 in the course');
+ print_error('Could not add converted teacher forum instance to section 0 in the course');
} else {
if (!set_field('course_modules', 'section', $sectionid, 'id', $cmid)) {
- error('Could not update course module with section id');
+ print_error('Could not update course module with section id');
}
}
}
@@ -5905,7 +5905,7 @@ function forum_convert_to_roles($forum, $forummodid, $teacherroles=array(),
// Change the forum type to general.
$forum->type = 'general';
if (!update_record('forum', $forum)) {
- error('Could not change forum from type teacher to type general');
+ print_error('Could not change forum from type teacher to type general');
}
$context = get_context_instance(CONTEXT_MODULE, $cmid);
diff --git a/mod/forum/markposts.php b/mod/forum/markposts.php
index aca13d43553..8c460356875 100644
--- a/mod/forum/markposts.php
+++ b/mod/forum/markposts.php
@@ -11,11 +11,11 @@
$returnpage = optional_param('returnpage', 'index.php', PARAM_FILE); // Page to return to.
if (! $forum = get_record("forum", "id", $f)) {
- error("Forum ID was incorrect");
+ print_error("Forum ID was incorrect");
}
if (! $course = get_record("course", "id", $forum->course)) {
- error("Forum doesn't belong to a course!");
+ print_error("Forum doesn't belong to a course!");
}
if (!($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id))) {
@@ -66,7 +66,7 @@
// add_to_log($course->id, "forum", "mark unread", "view.php?f=$forum->id", $forum->id, $cm->id);
// redirect($returnto, get_string("nowtracking", "forum", $info), 1);
// } else {
-// error("Could not start tracking that forum", $_SERVER["HTTP_REFERER"]);
+// print_error("Could not start tracking that forum", '', $_SERVER["HTTP_REFERER"]);
// }
}
diff --git a/mod/forum/post.php b/mod/forum/post.php
index 7d42ba5040a..803ab30353b 100644
--- a/mod/forum/post.php
+++ b/mod/forum/post.php
@@ -29,25 +29,25 @@
if (!empty($forum)) { // User is starting a new discussion in a forum
if (! $forum = get_record('forum', 'id', $forum)) {
- error('The forum number was incorrect');
+ print_error('The forum number was incorrect');
}
} else if (!empty($reply)) { // User is writing a new reply
if (! $parent = forum_get_post_full($reply)) {
- error('Parent post ID was incorrect');
+ print_error('Parent post ID was incorrect');
}
if (! $discussion = get_record('forum_discussions', 'id', $parent->discussion)) {
- error('This post is not part of a discussion!');
+ print_error('This post is not part of a discussion!');
}
if (! $forum = get_record('forum', 'id', $discussion->forum)) {
- error('The forum number was incorrect');
+ print_error('The forum number was incorrect');
}
}
if (! $course = get_record('course', 'id', $forum->course)) {
- error('The course number was incorrect');
+ print_error('The course number was incorrect');
}
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) { // For the logs
- error('Could not get the course module for the forum instance.');
+ print_error('Could not get the course module for the forum instance.');
} else {
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
}
@@ -69,13 +69,13 @@
if (!empty($forum)) { // User is starting a new discussion in a forum
if (! $forum = get_record("forum", "id", $forum)) {
- error("The forum number was incorrect ($forum)");
+ print_error("The forum number was incorrect ($forum)");
}
if (! $course = get_record("course", "id", $forum->course)) {
- error("The course number was incorrect ($forum->course)");
+ print_error("The course number was incorrect ($forum->course)");
}
if (! $cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
- error("Incorrect course module");
+ print_error("Incorrect course module");
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
@@ -91,7 +91,7 @@
}
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $coursecontext)) {
- error(get_string("activityiscurrentlyhidden"));
+ print_error("activityiscurrentlyhidden");
}
if (isset($_SERVER["HTTP_REFERER"])) {
@@ -125,19 +125,19 @@
} else if (!empty($reply)) { // User is writing a new reply
if (! $parent = forum_get_post_full($reply)) {
- error("Parent post ID was incorrect");
+ print_error("Parent post ID was incorrect");
}
if (! $discussion = get_record("forum_discussions", "id", $parent->discussion)) {
- error("This post is not part of a discussion!");
+ print_error("This post is not part of a discussion!");
}
if (! $forum = get_record("forum", "id", $discussion->forum)) {
- error("The forum number was incorrect ($discussion->forum)");
+ print_error("The forum number was incorrect ($discussion->forum)");
}
if (! $course = get_record("course", "id", $discussion->course)) {
- error("The course number was incorrect ($discussion->course)");
+ print_error("The course number was incorrect ($discussion->course)");
}
if (! $cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
- error("Incorrect cm");
+ print_error("Incorrect cm");
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
@@ -162,7 +162,7 @@
}
}
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $coursecontext)) {
- error(get_string("activityiscurrentlyhidden"));
+ print_error("activityiscurrentlyhidden");
}
// Load up the $post variable.
@@ -186,37 +186,37 @@
} else if (!empty($edit)) { // User is editing their own post
if (! $post = forum_get_post_full($edit)) {
- error("Post ID was incorrect");
+ print_error("Post ID was incorrect");
}
if ($post->parent) {
if (! $parent = forum_get_post_full($post->parent)) {
- error("Parent post ID was incorrect ($post->parent)");
+ print_error("Parent post ID was incorrect ($post->parent)");
}
}
if (! $discussion = get_record("forum_discussions", "id", $post->discussion)) {
- error("This post is not part of a discussion! ($edit)");
+ print_error("This post is not part of a discussion! ($edit)");
}
if (! $forum = get_record("forum", "id", $discussion->forum)) {
- error("The forum number was incorrect ($discussion->forum)");
+ print_error("The forum number was incorrect ($discussion->forum)");
}
if (! $course = get_record("course", "id", $discussion->course)) {
- error("The course number was incorrect ($discussion->course)");
+ print_error("The course number was incorrect ($discussion->course)");
}
if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
- error('Could not get the course module for the forum instance.');
+ print_error('Could not get the course module for the forum instance.');
} else {
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
}
if (!($forum->type == 'news' && !$post->parent && $discussion->timestart > time())) {
if (((time() - $post->created) > $CFG->maxeditingtime) and
!has_capability('mod/forum:editanypost', $modcontext)) {
- error( get_string("maxtimehaspassed", "forum", format_time($CFG->maxeditingtime)) );
+ print_error('maxtimehaspassed', 'forum', '', format_time($CFG->maxeditingtime));
}
}
if (($post->userid <> $USER->id) and
!has_capability('mod/forum:editanypost', $modcontext)) {
- error("You can't edit other people's posts!");
+ print_error("You can't edit other people's posts!");
}
@@ -233,19 +233,19 @@
}else if (!empty($delete)) { // User is deleting a post
if (! $post = forum_get_post_full($delete)) {
- error("Post ID was incorrect");
+ print_error("Post ID was incorrect");
}
if (! $discussion = get_record("forum_discussions", "id", $post->discussion)) {
- error("This post is not part of a discussion!");
+ print_error("This post is not part of a discussion!");
}
if (! $forum = get_record("forum", "id", $discussion->forum)) {
- error("The forum number was incorrect ($discussion->forum)");
+ print_error("The forum number was incorrect ($discussion->forum)");
}
if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $forum->course)) {
- error('Could not get the course module for the forum instance.');
+ print_error('Could not get the course module for the forum instance.');
}
if (!$course = get_record('course', 'id', $forum->course)) {
- error('Incorrect course');
+ print_error('Incorrect course');
}
require_login($course, false, $cm);
@@ -253,7 +253,7 @@
if ( !(($post->userid == $USER->id && has_capability('mod/forum:deleteownpost', $modcontext))
|| has_capability('mod/forum:deleteanypost', $modcontext)) ) {
- error("You can't delete this post!");
+ print_error("You can't delete this post!");
}
@@ -266,7 +266,7 @@
forum_go_back_to("discuss.php?d=$post->discussion"));
} else if ($replycount && !has_capability('mod/forum:deleteanypost', $modcontext)) {
- error(get_string("couldnotdeletereplies", "forum"),
+ print_error("couldnotdeletereplies", "forum",
forum_go_back_to("discuss.php?d=$post->discussion"));
} else {
@@ -297,7 +297,7 @@
redirect(forum_go_back_to($discussionurl));
} else {
- error("An error occurred while deleting record $post->id");
+ print_error("An error occurred while deleting record $post->id");
}
}
@@ -308,7 +308,7 @@
if ($replycount) {
if (!has_capability('mod/forum:deleteanypost', $modcontext)) {
- error(get_string("couldnotdeletereplies", "forum"),
+ print_error("couldnotdeletereplies", "forum",
forum_go_back_to("discuss.php?d=$post->discussion"));
}
print_header();
@@ -342,27 +342,27 @@
} else if (!empty($prune)) { // Pruning
if (!$post = forum_get_post_full($prune)) {
- error("Post ID was incorrect");
+ print_error("Post ID was incorrect");
}
if (!$discussion = get_record("forum_discussions", "id", $post->discussion)) {
- error("This post is not part of a discussion!");
+ print_error("This post is not part of a discussion!");
}
if (!$forum = get_record("forum", "id", $discussion->forum)) {
- error("The forum number was incorrect ($discussion->forum)");
+ print_error("The forum number was incorrect ($discussion->forum)");
}
if ($forum->type == 'single') {
- error('Discussions from this forum cannot be split');
+ print_error('Discussions from this forum cannot be split');
}
if (!$post->parent) {
- error('This is already the first post in the discussion');
+ print_error('This is already the first post in the discussion');
}
if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $forum->course)) { // For the logs
- error('Could not get the course module for the forum instance.');
+ print_error('Could not get the course module for the forum instance.');
} else {
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
}
if (!has_capability('mod/forum:splitdiscussions', $modcontext)) {
- error("You can't split discussions!");
+ print_error("You can't split discussions!");
}
if (!empty($name)) { // User has confirmed the prune
@@ -380,7 +380,7 @@
$newdiscussion->timeend = $discussion->timeend;
if (!$newid = insert_record('forum_discussions', $newdiscussion)) {
- error('Could not create new discussion');
+ print_error('Could not create new discussion');
}
$newpost = new object();
@@ -389,7 +389,7 @@
$newpost->subject = $name;
if (!update_record("forum_posts", $newpost)) {
- error('Could not update the original post');
+ print_error('Could not update the original post');
}
forum_change_discussionid($post->id, $newid);
@@ -424,7 +424,7 @@
print_footer($course);
die;
} else {
- error("No operation specified");
+ print_error("No operation specified");
}
@@ -434,7 +434,7 @@
}
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) { // For the logs
- error('Could not get the course module for the forum instance.');
+ print_error('Could not get the course module for the forum instance.');
}
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -474,13 +474,13 @@
if ( !(($realpost->userid == $USER->id && (has_capability('mod/forum:replypost', $modcontext)
|| has_capability('mod/forum:startdiscussion', $modcontext))) ||
has_capability('mod/forum:editanypost', $modcontext)) ) {
- error("You can not update this post");
+ print_error("You can not update this post");
}
$updatepost = $fromform; //realpost
$updatepost->forum = $forum->id;
if (!forum_update_post($updatepost, $message)) {
- error(get_string("couldnotupdate", "forum"), $errordestination);
+ print_error("couldnotupdate", "forum", $errordestination);
}
// MDL-11818
@@ -488,7 +488,7 @@
$forum->intro = $updatepost->message;
$forum->timemodified = time();
if (!update_record("forum", $forum)) {
- error(get_string("couldnotupdate", "forum"), $errordestination);
+ print_error("couldnotupdate", "forum", $errordestination);
}
}
@@ -554,7 +554,7 @@
redirect(forum_go_back_to("$discussionurl#p$fromform->id"), $message.$subscribemessage, $timemessage);
} else {
- error(get_string("couldnotadd", "forum"), $errordestination);
+ print_error("couldnotadd", "forum", $errordestination);
}
exit;
@@ -597,7 +597,7 @@
redirect(forum_go_back_to("view.php?f=$fromform->forum"), $message.$subscribemessage, $timemessage);
} else {
- error(get_string("couldnotadd", "forum"), $errordestination);
+ print_error("couldnotadd", "forum", $errordestination);
}
exit;
@@ -620,7 +620,7 @@
if ($post->discussion) {
if (! $toppost = get_record("forum_posts", "discussion", $post->discussion, "parent", 0)) {
- error("Could not find top parent of post $post->id");
+ print_error("Could not find top parent of post $post->id");
}
} else {
$toppost->subject = ($forum->type == "news") ? get_string("addanewtopic", "forum") :
@@ -664,10 +664,10 @@
// checkup
if (!empty($parent) && !forum_user_can_see_post($forum, $discussion, $post, null, $cm)) {
- error("You cannot reply to this post");
+ print_error("You cannot reply to this post");
}
if (empty($parent) && empty($edit) && !forum_user_can_post_discussion($forum, -1, -1, $cm, $modcontext)) {
- error("You cannot start a new discussion in this forum");
+ print_error("You cannot start a new discussion in this forum");
}
if ($forum->type == 'qanda'
@@ -681,7 +681,7 @@
if (!empty($parent)) {
if (! $discussion = get_record('forum_discussions', 'id', $parent->discussion)) {
- error('This post is not part of a discussion!');
+ print_error('This post is not part of a discussion!');
}
forum_print_post($parent, $discussion, $forum, $cm, $course, false, false, false);
diff --git a/mod/forum/rate.php b/mod/forum/rate.php
index 7ad6b57effb..5d08ce716ff 100644
--- a/mod/forum/rate.php
+++ b/mod/forum/rate.php
@@ -9,15 +9,15 @@
$forumid = required_param('forumid', PARAM_INT); // The forum the rated posts are from
if (!$forum = get_record('forum', 'id', $forumid)) {
- error("Course ID was incorrect");
+ print_error("Course ID was incorrect");
}
if (!$course = get_record('course', 'id', $forum->course)) {
- error("Course ID was incorrect");
+ print_error("Course ID was incorrect");
}
if (!$cm = get_coursemodule_from_instance('forum', $forum->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
} else {
$forum->cmidnumber = $cm->id; //MDL-12961
}
@@ -25,11 +25,11 @@
require_login($course, false, $cm);
if (isguestuser()) {
- error("Guests are not allowed to rate entries.");
+ print_error("Guests are not allowed to rate entries.");
}
if (!$forum->assessed) {
- error("Rating of items not allowed!");
+ print_error("Rating of items not allowed!");
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -50,7 +50,7 @@
WHERE fp.id = '$postid' AND fp.discussion = fd.id AND fd.forum = $forum->id";
if (!$post = get_record_sql($sql)) {
- error("Incorrect postid - $postid");
+ print_error("Incorrect postid - $postid");
}
$discussionid = $post->discussion;
@@ -71,7 +71,7 @@
$oldrating->rating = $rating;
$oldrating->time = time();
if (! update_record('forum_ratings', $oldrating)) {
- error("Could not update an old rating ($post->id = $rating)");
+ print_error("Could not update an old rating ($post->id = $rating)");
}
forum_update_grades($forum, $post->userid);
}
@@ -84,7 +84,7 @@
$newrating->rating = $rating;
if (! insert_record('forum_ratings', $newrating)) {
- error("Could not insert a new rating ($postid = $rating)");
+ print_error("Could not insert a new rating ($postid = $rating)");
}
forum_update_grades($forum, $post->userid);
}
@@ -97,7 +97,7 @@
}
} else {
- error("This page was not accessed correctly");
+ print_error("This page was not accessed correctly");
}
?>
diff --git a/mod/forum/report.php b/mod/forum/report.php
index ede8b138f83..1ed70073d53 100644
--- a/mod/forum/report.php
+++ b/mod/forum/report.php
@@ -9,37 +9,37 @@
$sort = optional_param('sort', '', PARAM_ALPHA);
if (! $post = get_record('forum_posts', 'id', $id)) {
- error("Post ID was incorrect");
+ print_error("Post ID was incorrect");
}
if (! $discussion = get_record('forum_discussions', 'id', $post->discussion)) {
- error("Discussion ID was incorrect");
+ print_error("Discussion ID was incorrect");
}
if (! $forum = get_record('forum', 'id', $discussion->forum)) {
- error("Forum ID was incorrect");
+ print_error("Forum ID was incorrect");
}
if (! $course = get_record('course', 'id', $forum->course)) {
- error("Course ID was incorrect");
+ print_error("Course ID was incorrect");
}
if (! $cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
require_login($course, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!$forum->assessed) {
- error("This activity does not use ratings");
+ print_error("This activity does not use ratings");
}
if (!has_capability('mod/forum:viewrating', $context)) {
- error("You do not have the capability to view post ratings");
+ print_error("You do not have the capability to view post ratings");
}
if (!has_capability('mod/forum:viewanyrating', $context) and $USER->id != $post->userid) {
- error("You can only look at results for posts that you made");
+ print_error("You can only look at results for posts that you made");
}
switch ($sort) {
@@ -58,7 +58,7 @@
print_header("$strratings: ".format_string($post->subject));
if (!$ratings = forum_get_ratings($post->id, $sqlsort)) {
- error("No ratings for this post: \"".format_string($post->subject)."\"");
+ print_error("No ratings for this post: \"".format_string($post->subject)."\"");
} else {
echo " ";
diff --git a/mod/forum/search.php b/mod/forum/search.php
index dcdc15ba1e6..0f02417a070 100644
--- a/mod/forum/search.php
+++ b/mod/forum/search.php
@@ -85,7 +85,7 @@
}
if (! $course = get_record("course", "id", $id)) {
- error("Course id is incorrect.");
+ print_error("Course id is incorrect.");
}
require_course_login($course);
@@ -182,14 +182,14 @@
// Replace the simple subject with the three items forum name -> thread name -> subject
// (if all three are appropriate) each as a link.
if (! $discussion = get_record('forum_discussions', 'id', $post->discussion)) {
- error('Discussion ID was incorrect');
+ print_error('Discussion ID was incorrect');
}
if (! $forum = get_record('forum', 'id', "$discussion->forum")) {
- error("Could not find forum $discussion->forum");
+ print_error("Could not find forum $discussion->forum");
}
if (!$cm = get_coursemodule_from_instance('forum', $forum->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
$post->subject = highlight($strippedsearch, $post->subject);
diff --git a/mod/forum/settracking.php b/mod/forum/settracking.php
index 92238d73015..0835cd0b387 100644
--- a/mod/forum/settracking.php
+++ b/mod/forum/settracking.php
@@ -9,11 +9,11 @@
$returnpage = optional_param('returnpage', 'index.php', PARAM_FILE); // Page to return to.
if (! $forum = get_record("forum", "id", $id)) {
- error("Forum ID was incorrect");
+ print_error("Forum ID was incorrect");
}
if (! $course = get_record("course", "id", $forum->course)) {
- error("Forum doesn't belong to a course!");
+ print_error("Forum doesn't belong to a course!");
}
if (!($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id))) {
@@ -48,7 +48,7 @@
add_to_log($course->id, "forum", "stop tracking", "view.php?f=$forum->id", $forum->id, $cm->id);
redirect($returnto, get_string("nownottracking", "forum", $info), 1);
} else {
- error("Could not stop tracking that forum", $_SERVER["HTTP_REFERER"]);
+ print_error("Could not stop tracking that forum", $_SERVER["HTTP_REFERER"]);
}
} else { // subscribe
@@ -56,7 +56,7 @@
add_to_log($course->id, "forum", "start tracking", "view.php?f=$forum->id", $forum->id, $cm->id);
redirect($returnto, get_string("nowtracking", "forum", $info), 1);
} else {
- error("Could not start tracking that forum", $_SERVER["HTTP_REFERER"]);
+ print_error("Could not start tracking that forum", $_SERVER["HTTP_REFERER"]);
}
}
diff --git a/mod/forum/subscribe.php b/mod/forum/subscribe.php
index 26c96b88ce6..8938ce97d2f 100644
--- a/mod/forum/subscribe.php
+++ b/mod/forum/subscribe.php
@@ -10,11 +10,11 @@
$user = optional_param('user',0,PARAM_INT);
if (! $forum = get_record("forum", "id", $id)) {
- error("Forum ID was incorrect");
+ print_error("Forum ID was incorrect");
}
if (! $course = get_record("course", "id", $forum->course)) {
- error("Forum doesn't belong to a course!");
+ print_error("Forum doesn't belong to a course!");
}
if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
@@ -26,10 +26,10 @@
if ($user) {
if (!has_capability('mod/forum:managesubscriptions', $context)) {
- error('You do not have the permission to subscribe/unsubscribe other people!');
+ print_error('You do not have the permission to subscribe/unsubscribe other people!');
}
if (!$user = get_record("user", "id", $user)) {
- error("User ID was incorrect");
+ print_error("User ID was incorrect");
}
} else {
$user = $USER;
@@ -39,7 +39,7 @@
and !forum_is_subscribed($user->id, $forum->id)
and !has_capability('moodle/site:accessallgroups', $context)) {
if (!mygroupid($course->id)) {
- error('Sorry, but you must be a group member to subscribe.');
+ print_error('Sorry, but you must be a group member to subscribe.');
}
}
@@ -86,22 +86,22 @@
add_to_log($course->id, "forum", "unsubscribe", "view.php?f=$forum->id", $forum->id, $cm->id);
redirect($returnto, get_string("nownotsubscribed", "forum", $info), 1);
} else {
- error("Could not unsubscribe you from that forum", $_SERVER["HTTP_REFERER"]);
+ print_error("Could not unsubscribe you from that forum", '', $_SERVER["HTTP_REFERER"]);
}
} else { // subscribe
if ($forum->forcesubscribe == FORUM_DISALLOWSUBSCRIBE &&
!has_capability('mod/forum:managesubscriptions', $context)) {
- error(get_string('disallowsubscribe', 'forum'),$_SERVER["HTTP_REFERER"]);
+ print_error('disallowsubscribe', 'forum', $_SERVER["HTTP_REFERER"]);
}
if (!has_capability('mod/forum:viewdiscussion', $context)) {
- error("Could not subscribe you to that forum", $_SERVER["HTTP_REFERER"]);
+ print_error("Could not subscribe you to that forum", '', $_SERVER["HTTP_REFERER"]);
}
if (forum_subscribe($user->id, $forum->id) ) {
add_to_log($course->id, "forum", "subscribe", "view.php?f=$forum->id", $forum->id, $cm->id);
redirect($returnto, get_string("nowsubscribed", "forum", $info), 1);
} else {
- error("Could not subscribe you to that forum", $_SERVER["HTTP_REFERER"]);
+ print_error("Could not subscribe you to that forum", '', $_SERVER["HTTP_REFERER"]);
}
}
diff --git a/mod/forum/subscribers.php b/mod/forum/subscribers.php
index 6e0fbf179b9..061610c0100 100644
--- a/mod/forum/subscribers.php
+++ b/mod/forum/subscribers.php
@@ -8,11 +8,11 @@
$edit = optional_param('edit',-1,PARAM_BOOL); // Turn editing on and off
if (! $forum = get_record("forum", "id", $id)) {
- error("Forum ID is incorrect");
+ print_error("Forum ID is incorrect");
}
if (! $course = get_record("course", "id", $forum->course)) {
- error("Could not find this course!");
+ print_error("Could not find this course!");
}
if (! $cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
@@ -24,7 +24,7 @@
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!has_capability('mod/forum:viewsubscribers', $context)) {
- error('You do not have the permission to view forum subscribers');
+ print_error('You do not have the permission to view forum subscribers');
}
unset($SESSION->fromdiscussion);
@@ -101,13 +101,13 @@
foreach ($frm->addselect as $addsubscriber) {
if (! forum_subscribe($addsubscriber, $id)) {
- error("Could not add subscriber with id $addsubscriber to this forum!");
+ print_error("Could not add subscriber with id $addsubscriber to this forum!");
}
}
} else if (!empty($frm->remove) and !empty($frm->removeselect)) {
foreach ($frm->removeselect as $removesubscriber) {
if (! forum_unsubscribe($removesubscriber, $id)) {
- error("Could not remove subscriber with id $removesubscriber from this forum!");
+ print_error("Could not remove subscriber with id $removesubscriber from this forum!");
}
}
} else if (!empty($frm->showall)) {
diff --git a/mod/forum/user.php b/mod/forum/user.php
index e84205a1f4c..3362310c51f 100644
--- a/mod/forum/user.php
+++ b/mod/forum/user.php
@@ -17,11 +17,11 @@
}
if (! $user = get_record("user", "id", $id)) {
- error("User ID is incorrect");
+ print_error("User ID is incorrect");
}
if (! $course = get_record("course", "id", $course)) {
- error("Course id is incorrect.");
+ print_error("Course id is incorrect.");
}
$syscontext = get_context_instance(CONTEXT_SYSTEM);
@@ -98,7 +98,7 @@
if (!isset($discussions[$post->discussion])) {
if (! $discussion = get_record('forum_discussions', 'id', $post->discussion)) {
- error('Discussion ID was incorrect');
+ print_error('Discussion ID was incorrect');
}
$discussions[$post->discussion] = $discussion;
} else {
@@ -107,7 +107,7 @@
if (!isset($forums[$discussion->forum])) {
if (! $forum = get_record('forum', 'id', $discussion->forum)) {
- error("Could not find forum $discussion->forum");
+ print_error("Could not find forum $discussion->forum");
}
$forums[$discussion->forum] = $forum;
} else {
@@ -116,7 +116,7 @@
if (!isset($cms[$forum->id])) {
if (!$cm = get_coursemodule_from_instance('forum', $forum->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
$cms[$forum->id] = $cm;
unset($cm); // do not use cm directly, it would break caching
diff --git a/mod/forum/view.php b/mod/forum/view.php
index e79ac11a744..40b71148f0c 100644
--- a/mod/forum/view.php
+++ b/mod/forum/view.php
@@ -18,13 +18,13 @@
if ($id) {
if (! $cm = get_coursemodule_from_id('forum', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $forum = get_record("forum", "id", $cm->instance)) {
- error("Forum ID was incorrect");
+ print_error("Forum ID was incorrect");
}
$strforums = get_string("modulenameplural", "forum");
$strforum = get_string("modulename", "forum");
@@ -33,23 +33,23 @@
} else if ($f) {
if (! $forum = get_record("forum", "id", $f)) {
- error("Forum ID was incorrect or no longer exists");
+ print_error("Forum ID was incorrect or no longer exists");
}
if (! $course = get_record("course", "id", $forum->course)) {
- error("Forum is misconfigured - don't know what course it's from");
+ print_error("Forum is misconfigured - don't know what course it's from");
}
$strforums = get_string("modulenameplural", "forum");
$strforum = get_string("modulename", "forum");
if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
- error("Course Module missing");
+ print_error("Course Module missing");
}
$buttontext = update_module_button($cm->id, $course->id, $strforum);
} else {
- error('Must specify a course module or a forum ID');
+ print_error('Must specify a course module or a forum ID');
}
if (!$buttontext) {
@@ -210,11 +210,11 @@
notify("Warning! There is more than one discussion in this forum - using the most recent");
$discussion = array_pop($discussions);
} else {
- error("Could not find the discussion in this forum");
+ print_error("Could not find the discussion in this forum");
}
}
if (! $post = forum_get_post_full($discussion->firstpost)) {
- error("Could not find the first post in this forum");
+ print_error("Could not find the first post in this forum");
}
if ($mode) {
set_user_preference("forum_displaymode", $mode);
diff --git a/mod/glossary/approve.php b/mod/glossary/approve.php
index 8f717061e94..5d03612522f 100644
--- a/mod/glossary/approve.php
+++ b/mod/glossary/approve.php
@@ -10,15 +10,15 @@
$hook = optional_param('hook','ALL', PARAM_CLEAN);
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
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
if (! update_record("glossary_entries", $newentry)) {
- error("Could not update your glossary");
+ print_error("Could not update your glossary");
} else {
add_to_log($course->id, "glossary", "approve entry", "showentry.php?id=$cm->id&eid=$eid", "$eid",$cm->id);
}
diff --git a/mod/glossary/comment.php b/mod/glossary/comment.php
index c9c7e0592e0..fa6e690137f 100644
--- a/mod/glossary/comment.php
+++ b/mod/glossary/comment.php
@@ -7,7 +7,7 @@ require_once('comment_form.php');
$action = optional_param('action','add', PARAM_ACTION);
if (isguest()) {
- error('Guests are not allowed to post comments!');
+ print_error('Guests are not allowed to post comments!');
}
switch ($action) {
@@ -21,7 +21,7 @@ switch ($action) {
glossary_comment_edit();
die;
default:
- error('Incorrect action specified');
+ print_error('Incorrect action specified');
}
/**
@@ -33,23 +33,23 @@ function glossary_comment_add() {
$eid = optional_param('eid', 0, PARAM_INT); // Entry ID
if (!$entry = get_record('glossary_entries', 'id', $eid)) {
- error('Entry is incorrect');
+ print_error('Entry is incorrect');
}
if (!$glossary = get_record('glossary', 'id', $entry->glossaryid)) {
- error('Incorrect glossary');
+ print_error('Incorrect glossary');
}
if (!$cm = get_coursemodule_from_instance('glossary', $glossary->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
if (!$course = get_record('course', 'id', $cm->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
require_login($course->id, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
/// Both the configuration and capability must allow comments
if (!$glossary->allowcomments or !has_capability('mod/glossary:comment', $context)) {
- error('You can\'t add comments to this glossary!');
+ print_error('You can\'t add comments to this glossary!');
}
$mform = new mod_glossary_comment_form();
@@ -70,7 +70,7 @@ function glossary_comment_add() {
$newcomment->userid = $USER->id;
if (!$newcomment->id = insert_record('glossary_comments', $newcomment)) {
- error('Could not insert this new comment');
+ print_error('Could not insert this new comment');
} else {
add_to_log($course->id, 'glossary', 'add comment', "comments.php?id=$cm->id&eid=$entry->id", "$newcomment->id", $cm->id);
}
@@ -94,28 +94,28 @@ function glossary_comment_delete() {
$confirm = optional_param('confirm', 0, PARAM_BOOL); // delete confirmation
if (!$comment = get_record('glossary_comments', 'id', $cid)) {
- error('Comment is incorrect');
+ print_error('Comment is incorrect');
}
if (!$entry = get_record('glossary_entries', 'id', $comment->entryid)) {
- error('Entry is incorrect');
+ print_error('Entry is incorrect');
}
if (!$glossary = get_record('glossary', 'id', $entry->glossaryid)) {
- error('Incorrect glossary');
+ print_error('Incorrect glossary');
}
if (!$cm = get_coursemodule_from_instance('glossary', $glossary->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
if (!$course = get_record('course', 'id', $cm->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
require_login($course->id, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (($comment->userid <> $USER->id) and !has_capability('mod/glossary:managecomments', $context)) {
- error('You can\'t delete other people\'s comments!');
+ print_error('You can\'t delete other people\'s comments!');
}
if (!$glossary->allowcomments and !has_capability('mod/glossary:managecomments', $context)) {
- error('You can\'t delete comments in this glossary!');
+ print_error('You can\'t delete comments in this glossary!');
}
if (data_submitted() and $confirm) {
@@ -147,32 +147,32 @@ function glossary_comment_edit() {
$cid = optional_param('cid', 0, PARAM_INT); // Comment ID
if (!$comment = get_record('glossary_comments', 'id', $cid)) {
- error('Comment is incorrect');
+ print_error('Comment is incorrect');
}
if (!$entry = get_record('glossary_entries', 'id', $comment->entryid)) {
- error('Entry is incorrect');
+ print_error('Entry is incorrect');
}
if (!$glossary = get_record('glossary', 'id', $entry->glossaryid)) {
- error('Incorrect glossary');
+ print_error('Incorrect glossary');
}
if (!$cm = get_coursemodule_from_instance('glossary', $glossary->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
if (!$course = get_record('course', 'id', $cm->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
require_login($course->id, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!$glossary->allowcomments and !has_capability('mod/glossary:managecomments', $context)) {
- error('You can\'t edit comments in this glossary!');
+ print_error('You can\'t edit comments in this glossary!');
}
if (($comment->userid <> $USER->id) and !has_capability('mod/glossary:managecomments', $context)) {
- error('You can\'t edit other people\'s comments!');
+ print_error('You can\'t edit other people\'s comments!');
}
$ineditperiod = ((time() - $comment->timemodified < $CFG->maxeditingtime) || $glossary->editalways);
if ((!has_capability('mod/glossary:comment', $context) or !$ineditperiod) and !has_capability('mod/glossary:managecomments', $context)) {
- error('You can\'t edit this. Time expired!');
+ print_error('You can\'t edit this. Time expired!');
}
$mform = new mod_glossary_comment_form();
@@ -189,7 +189,7 @@ function glossary_comment_edit() {
$updatedcomment->timemodified = time();
if (!update_record('glossary_comments', $updatedcomment)) {
- error('Could not update this comment');
+ print_error('Could not update this comment');
} else {
add_to_log($course->id, 'glossary', 'update comment', "comments.php?id=$cm->id&eid=$entry->id", "$updatedcomment->id",$cm->id);
}
diff --git a/mod/glossary/comments.php b/mod/glossary/comments.php
index cf13f26c1d5..ca3c03087d3 100644
--- a/mod/glossary/comments.php
+++ b/mod/glossary/comments.php
@@ -10,19 +10,19 @@
global $USER, $CFG;
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $entry = get_record("glossary_entries", "id", $eid)) {
- error("Entry is incorrect");
+ print_error("Entry is incorrect");
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
diff --git a/mod/glossary/deleteentry.php b/mod/glossary/deleteentry.php
index e3a8ab01137..b1a62d1b25a 100644
--- a/mod/glossary/deleteentry.php
+++ b/mod/glossary/deleteentry.php
@@ -17,15 +17,15 @@
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $entry = get_record("glossary_entries","id", $entry)) {
- error("Entry ID was incorrect");
+ print_error("Entry ID was incorrect");
}
require_login($course->id, false, $cm);
@@ -33,7 +33,7 @@
$manageentries = has_capability('mod/glossary:manageentries', $context);
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
- error("Glossary is incorrect");
+ print_error("Glossary is incorrect");
}
@@ -45,11 +45,11 @@
navmenu($course, $cm));
if (($entry->userid != $USER->id) and !$manageentries) { // guest id is never matched, no need for special check here
- error("You can't delete other people's entries!");
+ print_error("You can't delete other people's entries!");
}
$ineditperiod = ((time() - $entry->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
if (!$ineditperiod and !$manageentries) {
- error("You can't delete this. Time expired!");
+ print_error("You can't delete this. Time expired!");
}
/// If data submitted, then process and store.
@@ -63,7 +63,7 @@
$dbentry->glossaryid = $entry->sourceglossaryid;
$dbentry->sourceglossaryid = 0;
if (! update_record('glossary_entries', $dbentry)) {
- error("Could not update your glossary");
+ print_error("Could not update your glossary");
}
} else {
diff --git a/mod/glossary/edit.php b/mod/glossary/edit.php
index 7a2734ffd30..3f304b8e013 100644
--- a/mod/glossary/edit.php
+++ b/mod/glossary/edit.php
@@ -14,34 +14,34 @@ $mode = optional_param('mode', '', PARAM_ALPHA); // categories if by catego
$hook = optional_param('hook', '', PARAM_ALPHANUM); // CategoryID
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
require_login($course->id, false, $cm);
if ( isguest() ) {
- error("Guests are not allowed to edit glossaries", $_SERVER["HTTP_REFERER"]);
+ print_error("Guests are not allowed to edit glossaries", $_SERVER["HTTP_REFERER"]);
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if ($e) { // if entry is specified
if (!$entry = get_record("glossary_entries", "id", $e)) {
- error("Incorrect entry id");
+ print_error("Incorrect entry id");
}
$ineditperiod = ((time() - $entry->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
if (!has_capability('mod/glossary:manageentries', $context) and !($entry->userid == $USER->id and ($ineditperiod and has_capability('mod/glossary:write', $context)))) {
//expired edit time is the most probable cause here
- error(get_string('erredittimeexpired', 'glossary'), "view.php?id=$cm->id&mode=entry&hook=$e");
+ print_error('erredittimeexpired', 'glossary', "view.php?id=$cm->id&mode=entry&hook=$e");
}
} else { // new entry
require_capability('mod/glossary:write', $context);
@@ -98,7 +98,7 @@ if ($mform->is_cancelled()){
"view.php?id=$cm->id&mode=entry&hook=$todb->id",
$todb->id, $cm->id);
} else {
- error("Could not update your glossary");
+ print_error("Could not update your glossary");
}
} else {
@@ -117,7 +117,7 @@ if ($mform->is_cancelled()){
add_to_log($course->id, "glossary", "add entry",
"view.php?id=$cm->id&mode=entry&hook=$todb->id", $todb->id,$cm->id);
} else {
- error("Could not insert this new entry");
+ print_error("Could not insert this new entry");
}
}
@@ -174,9 +174,9 @@ if ($mform->is_cancelled()){
$ineditperiod = ((time() - $fromdb->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
if ((!$ineditperiod || $USER->id != $fromdb->userid) and !has_capability('mod/glossary:manageentries', $context)) {
if ( $USER->id != $fromdb->userid ) {
- error(get_string('errcannoteditothers', 'glossary'));
+ print_error('errcannoteditothers', 'glossary');
} elseif (!$ineditperiod) {
- error(get_string('erredittimeexpired', 'glossary'));
+ print_error('erredittimeexpired', 'glossary');
}
die;
}
diff --git a/mod/glossary/editcategories.php b/mod/glossary/editcategories.php
index ca1b584b9ff..d0da1fea404 100644
--- a/mod/glossary/editcategories.php
+++ b/mod/glossary/editcategories.php
@@ -17,25 +17,25 @@
$action = strtolower($action);
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if ($hook > 0) {
if ($category = get_record("glossary_categories","id",$hook)) {
//Check it belongs to the same glossary
if ($category->glossaryid != $glossary->id) {
- error("Glossary is incorrect");
+ print_error("Glossary is incorrect");
}
} else {
- error("Category is incorrect");
+ print_error("Category is incorrect");
}
}
@@ -68,7 +68,7 @@
$cat->usedynalink = $usedynalink;
if ( !update_record("glossary_categories", $cat) ) {
- error("Weird error. The category was not updated.");
+ print_error("Weird error. The category was not updated.");
redirect("editcategories.php?id=$cm->id");
} else {
add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id);
@@ -158,7 +158,7 @@
$cat->glossaryid = $glossary->id;
if ( ! $cat->id = insert_record("glossary_categories", $cat) ) {
- error("Weird error. The category was not inserted.");
+ print_error("Weird error. The category was not inserted.");
redirect("editcategories.php?id=$cm->id");
} else {
diff --git a/mod/glossary/export.php b/mod/glossary/export.php
index 0f91fabf214..ae77f1497eb 100644
--- a/mod/glossary/export.php
+++ b/mod/glossary/export.php
@@ -10,15 +10,15 @@
$cat = optional_param('cat',0, PARAM_ALPHANUM);
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
require_login($course->id, false, $cm);
diff --git a/mod/glossary/exportentry.php b/mod/glossary/exportentry.php
index 5013abd96d6..05e2a098200 100644
--- a/mod/glossary/exportentry.php
+++ b/mod/glossary/exportentry.php
@@ -27,11 +27,11 @@
require_capability('mod/glossary:export', $context);
if (! $course = get_record('course', 'id', $cm->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
if (! $glossary = get_record('glossary', 'id', $cm->instance)) {
- error('Course module is incorrect');
+ print_error('Course module is incorrect');
}
$strglossaries = get_string('modulenameplural', 'glossary');
@@ -66,7 +66,7 @@
$dbentry->sourceglossaryid = $glossary->id;
if (! update_record('glossary_entries', $dbentry)) {
- error('Could not export the entry to the main glossary');
+ print_error('Could not export the entry to the main glossary');
} else {
print_simple_box_start('center', '60%');
echo ''.$entryexported.' ';
diff --git a/mod/glossary/exportfile.php b/mod/glossary/exportfile.php
index b88059b5ce2..6df185d19cc 100644
--- a/mod/glossary/exportfile.php
+++ b/mod/glossary/exportfile.php
@@ -12,15 +12,15 @@
$cat = optional_param('cat',0, PARAM_ALPHANUM);
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
require_login($course->id, false, $cm);
diff --git a/mod/glossary/import.php b/mod/glossary/import.php
index 56edc02a42a..26bf0b8bb12 100644
--- a/mod/glossary/import.php
+++ b/mod/glossary/import.php
@@ -16,15 +16,15 @@
$hook = optional_param('hook', 'ALL', PARAM_ALPHANUM);
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
require_login($course->id, false, $cm);
@@ -147,7 +147,7 @@
// to each other, so we have to update one of them twice.
if (! $currmodule = get_record("modules", "name", 'glossary')) {
- error("Glossary module doesn't exist");
+ print_error("Glossary module doesn't exist");
}
$mod->module = $currmodule->id;
$mod->course = $course->id;
@@ -155,21 +155,21 @@
$mod->section = 0;
if (! $mod->coursemodule = add_course_module($mod) ) {
- error("Could not add a new course module");
+ print_error("Could not add a new course module");
}
if (! $sectionid = add_mod_to_section($mod) ) {
- error("Could not add the new course module to that section");
+ print_error("Could not add the new course module to that section");
}
//We get the section's visible field status
$visible = get_field("course_sections","visible","id",$sectionid);
if (! set_field("course_modules", "visible", $visible, "id", $mod->coursemodule)) {
- error("Could not update the course module with the correct visibility");
+ print_error("Could not update the course module with the correct visibility");
}
if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
- error("Could not update the course module with the correct section");
+ print_error("Could not update the course module with the correct section");
}
add_to_log($course->id, "course", "add mod",
"../mod/$mod->modulename/view.php?id=$mod->coursemodule",
diff --git a/mod/glossary/index.php b/mod/glossary/index.php
index 6b53b9e2669..5537e15d8b1 100644
--- a/mod/glossary/index.php
+++ b/mod/glossary/index.php
@@ -11,7 +11,7 @@
$id = required_param('id', PARAM_INT); // course
if (! $course = get_record("course", "id", $id)) {
- error("Course ID is incorrect");
+ print_error("Course ID is incorrect");
}
require_course_login($course);
diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php
index 7b41ebb02fa..ef27bfc5c66 100644
--- a/mod/glossary/lib.php
+++ b/mod/glossary/lib.php
@@ -49,7 +49,7 @@ function glossary_add_instance($glossary) {
//Check displayformat is a valid one
$formats = get_list_of_plugins('mod/glossary/formats','TEMPLATE');
if (!in_array($glossary->displayformat, $formats)) {
- error("This format doesn't exist!");
+ print_error("This format doesn't exist!");
}
if ($returnid = insert_record("glossary", $glossary)) {
@@ -92,7 +92,7 @@ function glossary_update_instance($glossary) {
//Check displayformat is a valid one
$formats = get_list_of_plugins('mod/glossary/formats','TEMPLATE');
if (!in_array($glossary->displayformat, $formats)) {
- error("This format doesn't exist!");
+ print_error("This format doesn't exist!");
}
if ($return = update_record("glossary", $glossary)) {
@@ -1644,13 +1644,13 @@ function glossary_print_dynaentry($courseid, $entries, $displayformat = -1) {
if ( $entries ) {
foreach ( $entries as $entry ) {
if (! $glossary = get_record('glossary', 'id', $entry->glossaryid)) {
- error('Glossary ID was incorrect or no longer exists');
+ print_error('Glossary ID was incorrect or no longer exists');
}
if (! $course = get_record('course', 'id', $glossary->course)) {
- error('Glossary is misconfigured - don\'t know what course it\'s from');
+ print_error('Glossary is misconfigured - don\'t know what course it\'s from');
}
if (!$cm = get_coursemodule_from_instance('glossary', $entry->glossaryid, $glossary->course) ) {
- error('Glossary is misconfigured - don\'t know what course module it is');
+ print_error('Glossary is misconfigured - don\'t know what course module it is');
}
//If displayformat is present, override glossary->displayformat
diff --git a/mod/glossary/print.php b/mod/glossary/print.php
index 779cafc7a49..278659aaa20 100644
--- a/mod/glossary/print.php
+++ b/mod/glossary/print.php
@@ -15,15 +15,15 @@
$sortkey = optional_param('sortkey','UPDATE', PARAM_ALPHA); // Sorting key
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if ( !$entriesbypage = $glossary->entbypage ) {
diff --git a/mod/glossary/rate.php b/mod/glossary/rate.php
index 3d086b7f76c..c323e72c1c2 100644
--- a/mod/glossary/rate.php
+++ b/mod/glossary/rate.php
@@ -9,27 +9,27 @@
$glossaryid = required_param('glossaryid', PARAM_INT); // The forum the rated posts are from
if (!$glossary = get_record('glossary', 'id', $glossaryid)) {
- error("Incorrect glossary id");
+ print_error("Incorrect glossary id");
}
if (!$course = get_record('course', 'id', $glossary->course)) {
- error("Course ID was incorrect");
+ print_error("Course ID was incorrect");
}
if (!$cm = get_coursemodule_from_instance('glossary', $glossary->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
require_login($course, false, $cm);
if (isguestuser()) {
- error("Guests are not allowed to rate entries.");
+ print_error("Guests are not allowed to rate entries.");
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!$glossary->assessed) {
- error("Rating of items not allowed!");
+ print_error("Rating of items not allowed!");
}
if ($glossary->assessed == 2) {
@@ -52,7 +52,7 @@
}
if ($entry->glossaryid != $glossary->id) {
- error("This is not valid entry!");
+ print_error("This is not valid entry!");
}
if ($glossary->assesstimestart and $glossary->assesstimefinish) {
@@ -77,7 +77,7 @@
$oldrating->rating = $rating;
$oldrating->time = time();
if (! update_record("glossary_ratings", $oldrating)) {
- error("Could not update an old rating ($entry = $rating)");
+ print_error("Could not update an old rating ($entry = $rating)");
}
glossary_update_grades($glossary, $entry->userid);
}
@@ -90,7 +90,7 @@
$newrating->rating = $rating;
if (! insert_record("glossary_ratings", $newrating)) {
- error("Could not insert a new rating ($entry->id = $rating)");
+ print_error("Could not insert a new rating ($entry->id = $rating)");
}
glossary_update_grades($glossary, $entry->userid);
}
@@ -99,7 +99,7 @@
redirect($returnurl, get_string("ratingssaved", "glossary"));
} else {
- error("This page was not accessed correctly");
+ print_error("This page was not accessed correctly");
}
?>
diff --git a/mod/glossary/report.php b/mod/glossary/report.php
index 93496ca6379..b89d56d3bd1 100644
--- a/mod/glossary/report.php
+++ b/mod/glossary/report.php
@@ -9,30 +9,30 @@
$sort = optional_param('sort', '', PARAM_ALPHA);
if (! $entry = get_record('glossary_entries', 'id', $id)) {
- error("Entry ID was incorrect");
+ print_error("Entry ID was incorrect");
}
if (! $glossary = get_record('glossary', 'id', $entry->glossaryid)) {
- error("Glossary ID was incorrect");
+ print_error("Glossary ID was incorrect");
}
if (! $course = get_record('course', 'id', $glossary->course)) {
- error("Course ID was incorrect");
+ print_error("Course ID was incorrect");
}
if (! $cm = get_coursemodule_from_instance('glossary', $glossary->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
require_login($course, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!$glossary->assessed) {
- error("This activity does not use ratings");
+ print_error("This activity does not use ratings");
}
if (!has_capability('mod/glossary:manageentries', $context) and $USER->id != $entry->userid) {
- error("You can only look at results for your own entries");
+ print_error("You can only look at results for your own entries");
}
switch ($sort) {
@@ -51,7 +51,7 @@
print_header("$strratings: $entry->concept");
if (!$ratings = glossary_get_ratings($entry->id, $sqlsort)) {
- error("No ratings for this entry: \"$entry->concept\"");
+ print_error("No ratings for this entry: \"$entry->concept\"");
} else {
echo "";
diff --git a/mod/glossary/showentry.php b/mod/glossary/showentry.php
index 9d4338badb8..1650643fe5c 100644
--- a/mod/glossary/showentry.php
+++ b/mod/glossary/showentry.php
@@ -16,7 +16,7 @@
$glossary = get_record('glossary','id',$entry->glossaryid);
$entry->glossaryname = format_string($glossary->name,true);
if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id)) {
- error("Could not determine which course module this belonged to!");
+ print_error("Could not determine which course module this belonged to!");
}
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'));
@@ -27,7 +27,7 @@
} else if ($concept) {
$entries = glossary_get_entries_search($concept, $courseid);
} else {
- error('No valid entry specified');
+ print_error('No valid entry specified');
}
if ($entries) {
diff --git a/mod/glossary/view.php b/mod/glossary/view.php
index 166afef13b1..efac7625e88 100644
--- a/mod/glossary/view.php
+++ b/mod/glossary/view.php
@@ -21,27 +21,27 @@
if (!empty($id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else if (!empty($g)) {
if (! $glossary = get_record("glossary", "id", $g)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $glossary->course)) {
- error("Could not determine which course this belonged to!");
+ print_error("Could not determine which course this belonged to!");
}
if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id, $course->id)) {
- error("Could not determine which course module this belonged to!");
+ print_error("Could not determine which course module this belonged to!");
}
$id = $cm->id;
} else {
- error("Must specify glossary ID or course module ID");
+ print_error("Must specify glossary ID or course module ID");
}
require_course_login($course->id, true, $cm);
diff --git a/mod/hotpot/attempt.php b/mod/hotpot/attempt.php
index 790d92b9b32..b64e8bc0bf6 100644
--- a/mod/hotpot/attempt.php
+++ b/mod/hotpot/attempt.php
@@ -6,19 +6,19 @@
// get attempt, hotpot, course and course_module records
if (! $attempt = get_record("hotpot_attempts", "id", $attemptid)) {
- error("Hot Potatoes attempt record $attemptid could not be accessed: ".$db->ErrorMsg());
+ print_error("Hot Potatoes attempt record $attemptid could not be accessed: ".$db->ErrorMsg());
}
if ($attempt->userid != $USER->id) {
- error("User ID is incorrect");
+ print_error("User ID is incorrect");
}
if (! $hotpot = get_record("hotpot", "id", $attempt->hotpot)) {
- error("Hot Potatoes ID is incorrect (attempt id = $attempt->id)");
+ print_error("Hot Potatoes ID is incorrect (attempt id = $attempt->id)");
}
if (! $course = get_record("course", "id", $hotpot->course)) {
- error("Course ID is incorrect (hotpot id = $hotpot->id)");
+ print_error("Course ID is incorrect (hotpot id = $hotpot->id)");
}
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
- error("Course Module ID is incorrect");
+ print_error("Course Module ID is incorrect");
}
// make sure this user is enrolled in this course
@@ -82,7 +82,7 @@
$attempt->id = insert_record("hotpot_attempts", $attempt);
if (empty($attempt->id)) {
- error("Could not insert attempt record: ".$db->ErrorMsg(), $next_url);
+ print_error("Could not insert attempt record: ".$db->ErrorMsg(), '', $next_url);
}
// add attempt details record, if necessary
@@ -91,7 +91,7 @@
$details->attempt = $attempt->id;
$details->details = $attempt->details;
if (! insert_record("hotpot_details", $details, false)) {
- error("Could not insert attempt details record: ".$db->ErrorMsg(), $next_url);
+ print_error("Could not insert attempt details record: ".$db->ErrorMsg(), '', $next_url);
}
}
} else {
@@ -112,7 +112,7 @@
// update the attempt record
if (! update_record("hotpot_attempts", $attempt)) {
- error("Could not update attempt record: ".$db->ErrorMsg(), $next_url);
+ print_error("Could not update attempt record: ".$db->ErrorMsg(), '', $next_url);
}
// update grades for this user
@@ -134,7 +134,7 @@
$details->attempt = $attempt->id;
$details->details = $attempt->details;
if (! insert_record("hotpot_details", $details)) {
- error("Could not insert attempt details record: ".$db->ErrorMsg(), $next_url);
+ print_error("Could not insert attempt details record: ".$db->ErrorMsg(), '', $next_url);
}
}
}
@@ -214,8 +214,8 @@ function hotpot_set_attempt_details(&$attempt) {
}
if (!$ok) {
return;
- // error('Quiz type is missing or invalid');
- // error(get_string('error_invalidquiztype', 'hotpot'));
+ // print_error('Quiz type is missing or invalid');
+ // print_error('error_invalidquiztype', 'hotpot');
//
// script finishes here if quiztype is invalid
//
diff --git a/mod/hotpot/grade.php b/mod/hotpot/grade.php
index 1afda285f85..0b7e9eef476 100644
--- a/mod/hotpot/grade.php
+++ b/mod/hotpot/grade.php
@@ -5,15 +5,15 @@
$id = required_param('id', PARAM_INT); // Course module ID
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
- error("hotpot ID was incorrect");
+ print_error("hotpot ID was incorrect");
}
if (! $course = get_record("course", "id", $hotpot->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
require_login($course->id, false, $cm);
diff --git a/mod/hotpot/index.php b/mod/hotpot/index.php
index 7077710f8da..88870004c43 100644
--- a/mod/hotpot/index.php
+++ b/mod/hotpot/index.php
@@ -8,7 +8,7 @@
$id = required_param('id', PARAM_INT); // course
if (! $course = get_record("course", "id", $id)) {
- error("Course ID is incorrect");
+ print_error("Course ID is incorrect");
}
require_login($course->id);
@@ -163,7 +163,7 @@
if ($attempt->details) {
hotpot_add_attempt_details($attempt);
if (! update_record('hotpot_attempts', $attempt)) {
- error("Could not update attempt record: ".$db->ErrorMsg(), $next_url);
+ print_error("Could not update attempt record: ".$db->ErrorMsg(), '', $next_url);
}
}
$attemptcount++;
diff --git a/mod/hotpot/lib.php b/mod/hotpot/lib.php
index ea663bed829..fcea20a8d20 100644
--- a/mod/hotpot/lib.php
+++ b/mod/hotpot/lib.php
@@ -455,7 +455,7 @@ function hotpot_is_visible(&$cm) {
if (!isset($cm->sectionvisible)) {
if (! $section = get_record('course_sections', 'id', $cm->section)) {
- error('Course module record contains invalid section');
+ print_error('Course module record contains invalid section');
}
$cm->sectionvisible = $section->visible;
}
@@ -569,7 +569,7 @@ function hotpot_add_chain(&$hotpot) {
$hotpot->reference = addslashes($hotpot->reference);
if (!$hotpot->instance = insert_record("hotpot", $hotpot)) {
- error("Could not add a new instance of $hotpot->modulename", "view.php?id=$hotpot->course");
+ print_error("Could not add a new instance of $hotpot->modulename", '', "view.php?id=$hotpot->course");
}
// store (hotpot table) id of start of chain
@@ -582,14 +582,14 @@ function hotpot_add_chain(&$hotpot) {
}
if (! $hotpot->coursemodule = add_course_module($hotpot)) {
- error("Could not add a new course module");
+ print_error("Could not add a new course module");
}
if (! $sectionid = add_mod_to_section($hotpot) ) {
- error("Could not add the new course module to that section");
+ print_error("Could not add the new course module to that section");
}
if (! set_field("course_modules", "section", $sectionid, "id", $hotpot->coursemodule)) {
- error("Could not update the course module with the correct section");
+ print_error("Could not update the course module with the correct section");
}
add_to_log($hotpot->course, "course", "add mod",
@@ -868,7 +868,7 @@ function hotpot_update_chain(&$hotpot) {
// update $thishotpot, if required
if ($require_update && !update_record("hotpot", $thishotpot)) {
- error("Could not update the $hotpot->modulename", "view.php?id=$hotpot->course");
+ print_error("Could not update the $hotpot->modulename", '', "view.php?id=$hotpot->course");
}
}
} // end foreach $ids
@@ -1586,7 +1586,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
// check xmlize functions are available
if (! function_exists("xmlize")) {
- error('xmlize functions are not available');
+ print_error('xmlize functions are not available');
}
$this->read_file = $read_file;
@@ -1611,7 +1611,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
if (empty($this->course) || empty($this->reference)) {
$this->error = get_string('error_nocourseorfilename', 'hotpot');
if ($this->report_errors) {
- error($this->error);
+ print_error($this->error);
}
return;
}
@@ -1647,7 +1647,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
if (!file_exists($this->filepath) || !is_readable($this->filepath)) {
$this->error = get_string('error_couldnotopensourcefile', 'hotpot', $this->filepath);
if ($this->report_errors) {
- error($this->error, $this->course_homeurl);
+ print_error($this->error, '', $this->course_homeurl);
}
return;
}
@@ -1754,7 +1754,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
if (!file_exists($this->template_filepath) || !is_readable($this->template_filepath)) {
$this->error = get_string('error_couldnotopentemplate', 'hotpot', $this->template_dir);
if ($this->report_errors) {
- error($this->error, $this->course_homeurl);
+ print_error($this->error, '', $this->course_homeurl);
}
return;
}
@@ -2206,7 +2206,7 @@ function hotpot_add_response(&$attempt, &$question, &$response) {
if (!$question->id = get_field('hotpot_questions', 'id', 'hotpot', $attempt->hotpot, 'md5key', $question->md5key, 'name', $question->name)) {
// add question record
if (!$question->id = insert_record('hotpot_questions', $question)) {
- error("Could not add question record (attempt_id=$attempt->id): ".$db->ErrorMsg(), $next_url);
+ print_error("Could not add question record (attempt_id=$attempt->id): ".$db->ErrorMsg(), '', $next_url);
}
}
@@ -2231,7 +2231,7 @@ function hotpot_add_response(&$attempt, &$question, &$response) {
// add response record
if(!$response->id = insert_record('hotpot_responses', $response)) {
- error("Could not add response record (attempt_id=$attempt->id, question_id=$question->id): ".$db->ErrorMsg(), $next_url);
+ print_error("Could not add response record (attempt_id=$attempt->id, question_id=$question->id): ".$db->ErrorMsg(), '', $next_url);
}
// we can stop looping now
@@ -2385,7 +2385,7 @@ function hotpot_string_id($str) {
// try and add the new string record
if (!$id = insert_record('hotpot_strings', $record)) {
global $db;
- error("Could not add string record for '".htmlspecialchars($str)."': ".$db->ErrorMsg());
+ print_error("Could not add string record for '".htmlspecialchars($str)."': ".$db->ErrorMsg());
}
}
}
diff --git a/mod/hotpot/report.php b/mod/hotpot/report.php
index bc233a3e7da..d7b2c2a1f4b 100644
--- a/mod/hotpot/report.php
+++ b/mod/hotpot/report.php
@@ -10,24 +10,24 @@
if ($id) {
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else {
if (! $hotpot = get_record("hotpot", "id", $hp)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $hotpot->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
}
@@ -331,7 +331,7 @@
/// Open the selected hotpot report and display it
if (! is_readable("report/$mode/report.php")) {
- error("Report not known (".clean_text($mode).")", $course_homeurl);
+ print_error("Report not known (".clean_text($mode).")", '', $course_homeurl);
}
include("report/default.php"); // Parent class
@@ -340,7 +340,7 @@
$report = new hotpot_report();
if (! $report->display($hotpot, $cm, $course, $users, $attempts, $questions, $formdata)) {
- error("Error occurred during report processing!", $course_homeurl);
+ print_error("Error occurred during report processing!", '', $course_homeurl);
}
if ($formdata['reportformat']=='htm') {
diff --git a/mod/hotpot/review.php b/mod/hotpot/review.php
index 0eef8953cf2..583cf178574 100644
--- a/mod/hotpot/review.php
+++ b/mod/hotpot/review.php
@@ -9,27 +9,27 @@
if ($id) {
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else {
if (! $hotpot = get_record("hotpot", "id", $hp)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $hotpot->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
}
if (! $attempt = get_record("hotpot_attempts", "id", $attempt)) {
- error("Attempt ID was incorrect");
+ print_error("Attempt ID was incorrect");
}
require_login($course, true, $cm);
@@ -37,13 +37,13 @@
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!has_capability('mod/hotpot:viewreport',$context)) {
if (!$hotpot->review) {
- error(get_string("noreview", "quiz"));
+ print_error("noreview", "quiz");
}
//if (time() < $hotpot->timeclose) {
- // error(get_string("noreviewuntil", "quiz", userdate($hotpot->timeclose)));
+ // print_error("noreviewuntil", "quiz", '', userdate($hotpot->timeclose));
//}
if ($attempt->userid != $USER->id) {
- error("This is not your attempt!");
+ print_error("This is not your attempt!");
}
}
add_to_log($course->id, "hotpot", "review", "review.php?id=$cm->id&attempt=$attempt->id", "$hotpot->id", "$cm->id");
diff --git a/mod/hotpot/show.php b/mod/hotpot/show.php
index a87d3318cff..23d7b1dca09 100644
--- a/mod/hotpot/show.php
+++ b/mod/hotpot/show.php
@@ -11,7 +11,7 @@
require_login($params->course);
if (!has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $params->course))) {
- error("You are not allowed to view this page!");
+ print_error("You are not allowed to view this page!");
}
if (has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
$params->location = optional_param('location', HOTPOT_LOCATION_COURSEFILES, PARAM_INT);
diff --git a/mod/hotpot/template/default.php b/mod/hotpot/template/default.php
index b570e4b3400..307199c0fd6 100644
--- a/mod/hotpot/template/default.php
+++ b/mod/hotpot/template/default.php
@@ -6,7 +6,7 @@ class hotpot_xml_template_default {
// try and open the template file
if (!file_exists($filepath) || !is_readable($filepath)) {
$msg = 'Could not open the '.$this->parent->template_dir.' template file "'.$filepath.'"';
- error($msg, $this->parent->course_homeurl);
+ print_error($msg, '', $this->parent->course_homeurl);
}
// read in the template and close the file
$this->$tag = file_get_contents($filepath);
@@ -40,7 +40,7 @@ class hotpot_xml_template_default {
}
} else {
$msg = 'Template block expand method not found: "'.$method.'"';
- error($msg, $this->parent->course_homeurl);
+ print_error($msg, '', $this->parent->course_homeurl);
}
}
}
diff --git a/mod/hotpot/view.php b/mod/hotpot/view.php
index c04afd7d933..b5d8e405f10 100644
--- a/mod/hotpot/view.php
+++ b/mod/hotpot/view.php
@@ -13,24 +13,24 @@
if ($id) {
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else {
if (! $hotpot = get_record("hotpot", "id", $hp)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $hotpot->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
}
@@ -113,7 +113,7 @@
}
// open and parse the source file
if(!$hp = new hotpot_xml_quiz($hotpot)) {
- error("Quiz is unavailable at the moment");
+ print_error("Quiz is unavailable at the moment");
}
$get_js = optional_param('js', '', PARAM_ALPHA);
$get_css = optional_param('css', '', PARAM_ALPHA);
@@ -146,7 +146,7 @@
$attemptid = hotpot_add_attempt($hotpot->id);
if (! is_numeric($attemptid)) {
- error('Could not insert attempt record: '.$db->ErrorMsg);
+ print_error('Could not insert attempt record: '.$db->ErrorMsg);
}
}
$hp->adjust_media_urls();
diff --git a/mod/journal/edit.php b/mod/journal/edit.php
index 79ed2eada6e..136d96f3dd8 100644
--- a/mod/journal/edit.php
+++ b/mod/journal/edit.php
@@ -5,21 +5,21 @@
$id = required_param('id', PARAM_INT); // Course Module ID
if (! $cm = get_coursemodule_from_id('journal', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
require_login($course->id, false, $cm);
if (isguest()) {
- error("Guests are not allowed to edit journals", $_SERVER["HTTP_REFERER"]);
+ print_error("Guests are not allowed to edit journals", '', $_SERVER["HTTP_REFERER"]);
}
if (! $journal = get_record("journal", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
$entry = get_record("journal_entries", "userid", $USER->id, "journal", $journal->id);
@@ -39,7 +39,7 @@
$newentry->format = $form->format;
$newentry->modified = $timenow;
if (! update_record("journal_entries", $newentry)) {
- error("Could not update your journal");
+ print_error("Could not update your journal");
}
add_to_log($course->id, "journal", "update entry", "view.php?id=$cm->id", "$newentry->id", $cm->id);
} else {
@@ -49,7 +49,7 @@
$newentry->format = $form->format;
$newentry->modified = $timenow;
if (! $newentry->id = insert_record("journal_entries", $newentry)) {
- error("Could not insert a new journal entry");
+ print_error("Could not insert a new journal entry");
}
add_to_log($course->id, "journal", "add entry", "view.php?id=$cm->id", "$newentry->id", $cm->id);
}
diff --git a/mod/journal/index.php b/mod/journal/index.php
index 0a9a90791d8..4a06991c9a0 100644
--- a/mod/journal/index.php
+++ b/mod/journal/index.php
@@ -6,7 +6,7 @@
$id = required_param('id', PARAM_INT); // course
if (! $course = get_record("course", "id", $id)) {
- error("Course ID is incorrect");
+ print_error("Course ID is incorrect");
}
require_course_login($course);
diff --git a/mod/journal/lib.php b/mod/journal/lib.php
index 90e9c9aa471..47c48f20ad8 100644
--- a/mod/journal/lib.php
+++ b/mod/journal/lib.php
@@ -506,7 +506,7 @@ function journal_print_feedback($course, $entry, $grades) {
global $CFG;
if (! $teacher = get_record('user', 'id', $entry->teacher)) {
- error('Weird journal error');
+ print_error('Weird journal error');
}
echo '';
diff --git a/mod/journal/report.php b/mod/journal/report.php
index 441f9d86f76..58762c6656c 100644
--- a/mod/journal/report.php
+++ b/mod/journal/report.php
@@ -6,21 +6,21 @@
$id = required_param('id', PARAM_INT); // course module
if (! $cm = get_coursemodule_from_id('journal', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course module is misconfigured");
+ print_error("Course module is misconfigured");
}
require_login($course->id, false, $cm);
if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
+ print_error("Only teachers can look at this page");
}
if (! $journal = get_record("journal", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
// make some easy ways to access the entries.
diff --git a/mod/journal/view.php b/mod/journal/view.php
index 7dad3fcd826..0283f5f68bd 100644
--- a/mod/journal/view.php
+++ b/mod/journal/view.php
@@ -6,23 +6,23 @@
$id = required_param('id', PARAM_INT); // Course Module ID
if (! $cm = get_coursemodule_from_id('journal', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
require_login($course->id, true, $cm);
if (! $journal = get_record("journal", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
add_to_log($course->id, "journal", "view", "view.php?id=$cm->id", $journal->id, $cm->id);
if (! $cw = get_record("course_sections", "id", $cm->section)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
$strjournal = get_string("modulename", "journal");
diff --git a/mod/label/view.php b/mod/label/view.php
index 74a8b301126..f450a55dd3f 100644
--- a/mod/label/view.php
+++ b/mod/label/view.php
@@ -7,26 +7,26 @@
if ($id) {
if (! $cm = get_coursemodule_from_id('label', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $label = get_record("label", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else {
if (! $label = get_record("label", "id", $l)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $label->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("label", $label->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
}
diff --git a/mod/lams/index.php b/mod/lams/index.php
index 94fae61b814..97789e928d6 100644
--- a/mod/lams/index.php
+++ b/mod/lams/index.php
@@ -8,7 +8,7 @@
$id = required_param('id', PARAM_INT); // course
if (! $course = get_record("course", "id", $id)) {
- error("Course ID is incorrect");
+ print_error("Course ID is incorrect");
}
require_login($course->id);
diff --git a/mod/lams/view.php b/mod/lams/view.php
index 527c7ab159d..c3755a10cd6 100644
--- a/mod/lams/view.php
+++ b/mod/lams/view.php
@@ -10,15 +10,15 @@ require_once("constants.php");
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
if (! $cm = get_coursemodule_from_id('lams', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $lams = get_record("lams", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
require_login($course, true, $cm);
diff --git a/mod/lesson/action/addbranchtable.php b/mod/lesson/action/addbranchtable.php
index 3fb28ef18e0..7b1ffba6dde 100644
--- a/mod/lesson/action/addbranchtable.php
+++ b/mod/lesson/action/addbranchtable.php
@@ -20,7 +20,7 @@
$jump[LESSON_EOL] = get_string("endoflesson", "lesson");
if (!optional_param('firstpage', 0, PARAM_INT)) {
if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
- error("Add page: first page not found");
+ print_error("Add page: first page not found");
}
while (true) {
if ($apageid) {
diff --git a/mod/lesson/action/addcluster.php b/mod/lesson/action/addcluster.php
index baf5aa0b6ad..fc8025ea247 100644
--- a/mod/lesson/action/addcluster.php
+++ b/mod/lesson/action/addcluster.php
@@ -16,11 +16,11 @@
if ($pageid == 0) {
if (!$page = get_record("lesson_pages", "prevpageid", 0, "lessonid", $lesson->id)) {
- error("Error: Add cluster: page record not found");
+ print_error("Error: Add cluster: page record not found");
}
} else {
if (!$page = get_record("lesson_pages", "id", $pageid)) {
- error("Error: Add cluster: page record not found");
+ print_error("Error: Add cluster: page record not found");
}
}
$newpage = new stdClass;
@@ -36,12 +36,12 @@
$newpage->title = get_string("clustertitle", "lesson");
$newpage->contents = get_string("clustertitle", "lesson");
if (!$newpageid = insert_record("lesson_pages", $newpage)) {
- error("Insert page: new page not inserted");
+ print_error("Insert page: new page not inserted");
}
// update the linked list...
if ($pageid != 0) {
if (!set_field("lesson_pages", "nextpageid", $newpageid, "id", $pageid)) {
- error("Add cluster: unable to update link");
+ print_error("Add cluster: unable to update link");
}
}
@@ -51,7 +51,7 @@
if ($page->nextpageid) {
// the new page is not the last page
if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $page->nextpageid)) {
- error("Insert page: unable to update previous link");
+ print_error("Insert page: unable to update previous link");
}
}
// ..and the single "answer"
@@ -61,7 +61,7 @@
$newanswer->timecreated = $timenow;
$newanswer->jumpto = LESSON_CLUSTERJUMP;
if(!$newanswerid = insert_record("lesson_answers", $newanswer)) {
- error("Add cluster: answer record not inserted");
+ print_error("Add cluster: answer record not inserted");
}
lesson_set_message(get_string('addedcluster', 'lesson'), 'notifysuccess');
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
diff --git a/mod/lesson/action/addendofbranch.php b/mod/lesson/action/addendofbranch.php
index 5decb9f2f9f..83c02501727 100644
--- a/mod/lesson/action/addendofbranch.php
+++ b/mod/lesson/action/addendofbranch.php
@@ -15,17 +15,17 @@
// the new page is not the first page (end of branch always comes after an existing page)
if (!$page = get_record("lesson_pages", "id", $pageid)) {
- error("Add end of branch: page record not found");
+ print_error("Add end of branch: page record not found");
}
// chain back up to find the (nearest branch table)
$btpageid = $pageid;
if (!$btpage = get_record("lesson_pages", "id", $btpageid)) {
- error("Add end of branch: btpage record not found");
+ print_error("Add end of branch: btpage record not found");
}
while (($btpage->qtype != LESSON_BRANCHTABLE) AND ($btpage->prevpageid > 0)) {
$btpageid = $btpage->prevpageid;
if (!$btpage = get_record("lesson_pages", "id", $btpageid)) {
- error("Add end of branch: btpage record not found");
+ print_error("Add end of branch: btpage record not found");
}
}
if ($btpage->qtype == LESSON_BRANCHTABLE) {
@@ -38,16 +38,16 @@
$newpage->title = get_string("endofbranch", "lesson");
$newpage->contents = get_string("endofbranch", "lesson");
if (!$newpageid = insert_record("lesson_pages", $newpage)) {
- error("Insert page: new page not inserted");
+ print_error("Insert page: new page not inserted");
}
// update the linked list...
if (!set_field("lesson_pages", "nextpageid", $newpageid, "id", $pageid)) {
- error("Add end of branch: unable to update link");
+ print_error("Add end of branch: unable to update link");
}
if ($page->nextpageid) {
// the new page is not the last page
if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $page->nextpageid)) {
- error("Insert page: unable to update previous link");
+ print_error("Insert page: unable to update previous link");
}
}
// ..and the single "answer"
@@ -57,7 +57,7 @@
$newanswer->timecreated = $timenow;
$newanswer->jumpto = $btpageid;
if(!$newanswerid = insert_record("lesson_answers", $newanswer)) {
- error("Add end of branch: answer record not inserted");
+ print_error("Add end of branch: answer record not inserted");
}
lesson_set_message(get_string('addedanendofbranch', 'lesson'), 'notifysuccess');
diff --git a/mod/lesson/action/addendofcluster.php b/mod/lesson/action/addendofcluster.php
index be1d261d9ff..23a085259b9 100644
--- a/mod/lesson/action/addendofcluster.php
+++ b/mod/lesson/action/addendofcluster.php
@@ -15,7 +15,7 @@
// the new page is not the first page (end of cluster always comes after an existing page)
if (!$page = get_record("lesson_pages", "id", $pageid)) {
- error("Error: Could not find page");
+ print_error("Error: Could not find page");
}
// could put code in here to check if the user really can insert an end of cluster
@@ -29,16 +29,16 @@
$newpage->title = get_string("endofclustertitle", "lesson");
$newpage->contents = get_string("endofclustertitle", "lesson");
if (!$newpageid = insert_record("lesson_pages", $newpage)) {
- error("Insert page: end of cluster page not inserted");
+ print_error("Insert page: end of cluster page not inserted");
}
// update the linked list...
if (!set_field("lesson_pages", "nextpageid", $newpageid, "id", $pageid)) {
- error("Add end of cluster: unable to update link");
+ print_error("Add end of cluster: unable to update link");
}
if ($page->nextpageid) {
// the new page is not the last page
if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $page->nextpageid)) {
- error("Insert end of cluster: unable to update previous link");
+ print_error("Insert end of cluster: unable to update previous link");
}
}
// ..and the single "answer"
@@ -48,7 +48,7 @@
$newanswer->timecreated = $timenow;
$newanswer->jumpto = LESSON_NEXTPAGE;
if(!$newanswerid = insert_record("lesson_answers", $newanswer)) {
- error("Add end of cluster: answer record not inserted");
+ print_error("Add end of cluster: answer record not inserted");
}
lesson_set_message(get_string('addedendofcluster', 'lesson'), 'notifysuccess');
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
\ No newline at end of file
diff --git a/mod/lesson/action/confirmdelete.php b/mod/lesson/action/confirmdelete.php
index 586312a6326..580d44bd928 100644
--- a/mod/lesson/action/confirmdelete.php
+++ b/mod/lesson/action/confirmdelete.php
@@ -10,7 +10,7 @@
$pageid = required_param('pageid', PARAM_INT);
if (!$thispage = get_record("lesson_pages", "id", $pageid)) {
- error("Confirm delete: the page record not found");
+ print_error("Confirm delete: the page record not found");
}
print_heading(get_string("deletingpage", "lesson", format_string($thispage->title)));
// print the jumps to this page
@@ -19,7 +19,7 @@
echo "\n";
foreach ($answers as $answer) {
if (!$title = get_field("lesson_pages", "title", "id", $answer->pageid)) {
- error("Confirm delete: page title not found");
+ print_error("Confirm delete: page title not found");
}
echo $title." \n";
}
diff --git a/mod/lesson/action/continue.php b/mod/lesson/action/continue.php
index e23fc86d369..e0c13f34be4 100644
--- a/mod/lesson/action/continue.php
+++ b/mod/lesson/action/continue.php
@@ -22,7 +22,7 @@
$timer = new stdClass;
if (!has_capability('mod/lesson:manage', $context)) {
if (!$timer = get_records_select('lesson_timer', "lessonid = $lesson->id AND userid = $USER->id", 'starttime')) {
- error('Error: could not find records');
+ print_error('Error: could not find records');
} else {
$timer = array_pop($timer); // this will get the latest start time record
}
@@ -43,14 +43,14 @@
$timer->lessontime = time();
if (!update_record("lesson_timer", $timer)) {
- error("Error: could not update lesson_timer table");
+ print_error("Error: could not update lesson_timer table");
}
}
// record answer (if necessary) and show response (if none say if answer is correct or not)
$pageid = required_param('pageid', PARAM_INT);
if (!$page = get_record("lesson_pages", "id", $pageid)) {
- error("Continue: Page record not found");
+ print_error("Continue: Page record not found");
}
// set up some defaults
$answerid = 0;
@@ -69,7 +69,7 @@
$useranswer = clean_param($useranswer, PARAM_RAW);
if (!$answers = get_records("lesson_answers", "pageid", $pageid, "id")) {
- error("Continue: No answers found");
+ print_error("Continue: No answers found");
}
$correctanswer = false;
foreach ($answers as $answer) {
@@ -94,7 +94,7 @@
$useranswer = stripslashes(clean_param($useranswer, PARAM_RAW));
$userresponse = addslashes($useranswer);
if (!$answers = get_records("lesson_answers", "pageid", $pageid, "id")) {
- error("Continue: No answers found");
+ print_error("Continue: No answers found");
}
$i=0;
foreach ($answers as $answer) {
@@ -197,7 +197,7 @@
}
$answerid = required_param('answerid', PARAM_INT);
if (!$answer = get_record("lesson_answers", "id", $answerid)) {
- error("Continue: answer record not found");
+ print_error("Continue: answer record not found");
}
if (lesson_iscorrect($pageid, $answer->jumpto)) {
$correctanswer = true;
@@ -230,7 +230,7 @@
$userresponse = implode(",", $useranswers);
// get the answers in a set order, the id order
if (!$answers = get_records("lesson_answers", "pageid", $pageid, "id")) {
- error("Continue: No answers found");
+ print_error("Continue: No answers found");
}
$ncorrect = 0;
$nhits = 0;
@@ -345,7 +345,7 @@
}
$answerid = required_param('answerid', PARAM_INT);
if (!$answer = get_record("lesson_answers", "id", $answerid)) {
- error("Continue: answer record not found");
+ print_error("Continue: answer record not found");
}
if (lesson_iscorrect($pageid, $answer->jumpto)) {
$correctanswer = true;
@@ -374,7 +374,7 @@
}
if (!$answers = get_records("lesson_answers", "pageid", $pageid, "id")) {
- error("Continue: No answers found");
+ print_error("Continue: No answers found");
}
$ncorrect = 0;
@@ -455,7 +455,7 @@
}
$studentanswer = $userresponse = $useranswer;
if (!$answers = get_records("lesson_answers", "pageid", $pageid, "id")) {
- error("Continue: No answers found");
+ print_error("Continue: No answers found");
}
foreach ($answers as $answer) {
if (strpos($answer->answer, ':')) {
@@ -511,7 +511,7 @@
$branch->timeseen = time();
if (!insert_record("lesson_branch", $branch)) {
- error("Error: could not insert row into lesson_branch table");
+ print_error("Error: could not insert row into lesson_branch table");
}
// this is called when jumping to random from a branch table
@@ -571,7 +571,7 @@
$attempt->retry = $nretakes - 1; // they are going through on review, $nretakes will be too high
}
if (!$newattemptid = insert_record("lesson_attempts", $attempt)) {
- error("Continue: attempt not inserted");
+ print_error("Continue: attempt not inserted");
}
// "number of attempts remaining" message if $lesson->maxattempts > 1
// displaying of message(s) is at the end of page for more ergonomic display
@@ -721,7 +721,7 @@
}
} elseif ($newpageid != LESSON_CLUSTERJUMP && $pageid != 0 && $newpageid > 0) { // going to check to see if the page that the user is going to view next, is a cluster page. If so, dont display, go into the cluster. The $newpageid > 0 is used to filter out all of the negative code jumps.
if (!$page = get_record("lesson_pages", "id", $newpageid)) {
- error("Error: could not find page");
+ print_error("Error: could not find page");
}
if ($page->qtype == LESSON_CLUSTER) {
$newpageid = lesson_cluster_jump($lesson->id, $USER->id, $page->id);
diff --git a/mod/lesson/action/delete.php b/mod/lesson/action/delete.php
index 48aa1a84371..b747b50477d 100644
--- a/mod/lesson/action/delete.php
+++ b/mod/lesson/action/delete.php
@@ -10,7 +10,7 @@
$pageid = required_param('pageid', PARAM_INT);
if (!$thispage = get_record("lesson_pages", "id", $pageid)) {
- error("Delete: page record not found");
+ print_error("Delete: page record not found");
}
// first delete all the associated records...
@@ -24,32 +24,32 @@
if (!$thispage->prevpageid) {
// this is the first page...
if (!$page = get_record("lesson_pages", "id", $thispage->nextpageid)) {
- error("Delete: next page not found");
+ print_error("Delete: next page not found");
}
if (!set_field("lesson_pages", "prevpageid", 0, "id", $page->id)) {
- error("Delete: unable to set prevpage link");
+ print_error("Delete: unable to set prevpage link");
}
} elseif (!$thispage->nextpageid) {
// this is the last page...
if (!$page = get_record("lesson_pages", "id", $thispage->prevpageid)) {
- error("Delete: prev page not found");
+ print_error("Delete: prev page not found");
}
if (!set_field("lesson_pages", "nextpageid", 0, "id", $page->id)) {
- error("Delete: unable to set nextpage link");
+ print_error("Delete: unable to set nextpage link");
}
} else {
// page is in the middle...
if (!$prevpage = get_record("lesson_pages", "id", $thispage->prevpageid)) {
- error("Delete: prev page not found");
+ print_error("Delete: prev page not found");
}
if (!$nextpage = get_record("lesson_pages", "id", $thispage->nextpageid)) {
- error("Delete: next page not found");
+ print_error("Delete: next page not found");
}
if (!set_field("lesson_pages", "nextpageid", $nextpage->id, "id", $prevpage->id)) {
- error("Delete: unable to set next link");
+ print_error("Delete: unable to set next link");
}
if (!set_field("lesson_pages", "prevpageid", $prevpage->id, "id", $nextpage->id)) {
- error("Delete: unable to set prev link");
+ print_error("Delete: unable to set prev link");
}
}
lesson_set_message(get_string('deletedpage', 'lesson').': '.format_string($thispage->title, true), 'notifysuccess');
diff --git a/mod/lesson/action/editpage.php b/mod/lesson/action/editpage.php
index dbf47605934..aee538b99b6 100644
--- a/mod/lesson/action/editpage.php
+++ b/mod/lesson/action/editpage.php
@@ -12,7 +12,7 @@
$redirect = optional_param('redirect', '', PARAM_ALPHA);
if (!$page = get_record("lesson_pages", "id", $pageid)) {
- error("Edit page: page record not found");
+ print_error("Edit page: page record not found");
}
$page->qtype = optional_param('qtype', $page->qtype, PARAM_INT);
@@ -34,12 +34,12 @@
}
$jump[LESSON_EOL] = get_string("endoflesson", "lesson");
if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
- error("Edit page: first page not found");
+ print_error("Edit page: first page not found");
}
while (true) {
if ($apageid) {
if (!$apage = get_record("lesson_pages", "id", $apageid)) {
- error("Edit page: apage record not found");
+ print_error("Edit page: apage record not found");
}
// removed != LESSON_ENDOFBRANCH...
if (trim($page->title)) { // ...nor nuffin pages
diff --git a/mod/lesson/action/insertpage.php b/mod/lesson/action/insertpage.php
index e4217dd73e0..aeda9b80c86 100644
--- a/mod/lesson/action/insertpage.php
+++ b/mod/lesson/action/insertpage.php
@@ -21,7 +21,7 @@
if ($form->pageid) {
// the new page is not the first page
if (!$page = get_record("lesson_pages", "id", $form->pageid)) {
- error("Insert page: page record not found");
+ print_error("Insert page: page record not found");
}
$newpage->lessonid = clean_param($lesson->id, PARAM_INT);
$newpage->prevpageid = clean_param($form->pageid, PARAM_INT);
@@ -48,16 +48,16 @@
$newpage->title = addslashes($newpage->title);
$newpageid = insert_record("lesson_pages", $newpage);
if (!$newpageid) {
- error("Insert page: new page not inserted");
+ print_error("Insert page: new page not inserted");
}
// update the linked list (point the previous page to this new one)
if (!set_field("lesson_pages", "nextpageid", $newpageid, "id", $newpage->prevpageid)) {
- error("Insert page: unable to update next link");
+ print_error("Insert page: unable to update next link");
}
if ($page->nextpageid) {
// new page is not the last page
if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $page->nextpageid)) {
- error("Insert page: unable to update previous link");
+ print_error("Insert page: unable to update previous link");
}
}
} else {
@@ -90,7 +90,7 @@
$newpage->title = addslashes($newpage->title);
$newpageid = insert_record("lesson_pages", $newpage);
if (!$newpageid) {
- error("Insert page: new first page not inserted");
+ print_error("Insert page: new first page not inserted");
}
} else {
// there are existing pages put this at the start
@@ -119,11 +119,11 @@
$newpage->title = addslashes($newpage->title);
$newpageid = insert_record("lesson_pages", $newpage);
if (!$newpageid) {
- error("Insert page: first page not inserted");
+ print_error("Insert page: first page not inserted");
}
// update the linked list
if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $newpage->nextpageid)) {
- error("Insert page: unable to update link");
+ print_error("Insert page: unable to update link");
}
}
}
@@ -140,7 +140,7 @@
}
$newanswerid = insert_record("lesson_answers", $newanswer);
if (!$newanswerid) {
- error("Insert Page: answer record not inserted");
+ print_error("Insert Page: answer record not inserted");
}
} else {
if ($form->qtype == LESSON_MATCHING) {
@@ -166,7 +166,7 @@
}
$newanswerid = insert_record("lesson_answers", $newanswer);
if (!$newanswerid) {
- error("Insert Page: answer record $i not inserted");
+ print_error("Insert Page: answer record $i not inserted");
}
} else {
if ($form->qtype == LESSON_MATCHING) {
@@ -176,7 +176,7 @@
$newanswer->timecreated = $timenow;
$newanswerid = insert_record("lesson_answers", $newanswer);
if (!$newanswerid) {
- error("Insert Page: answer record $i not inserted");
+ print_error("Insert Page: answer record $i not inserted");
}
}
} else {
diff --git a/mod/lesson/action/move.php b/mod/lesson/action/move.php
index fb296e75302..0eca9f1c506 100644
--- a/mod/lesson/action/move.php
+++ b/mod/lesson/action/move.php
@@ -12,7 +12,7 @@
print_heading(get_string("moving", "lesson", format_string($title)));
if (!$page = get_record_select("lesson_pages", "lessonid = $lesson->id AND prevpageid = 0")) {
- error("Move: first page not found");
+ print_error("Move: first page not found");
}
echo " \n";
@@ -29,7 +29,7 @@
}
if ($page->nextpageid) {
if (!$page = get_record("lesson_pages", "id", $page->nextpageid)) {
- error("Teacher view: Next page not found!");
+ print_error("Teacher view: Next page not found!");
}
} else {
// last page reached
diff --git a/mod/lesson/action/moveit.php b/mod/lesson/action/moveit.php
index 2e2d0959165..08172e0707c 100644
--- a/mod/lesson/action/moveit.php
+++ b/mod/lesson/action/moveit.php
@@ -10,7 +10,7 @@
$pageid = required_param('pageid', PARAM_INT); // page to move
if (!$page = get_record("lesson_pages", "id", $pageid)) {
- error("Moveit: page not found");
+ print_error("Moveit: page not found");
}
$after = required_param('after', PARAM_INT); // target page
@@ -23,7 +23,7 @@
// (when the pages are in a ring this will in effect be the first page)
if ($page->nextpageid) {
if (!$after = get_field("lesson_pages", "id", "lessonid", $lesson->id, "nextpageid", 0)) {
- error("Moveit: last page id not found");
+ print_error("Moveit: last page id not found");
}
} else {
// the page being moved is the last page, so the new last page will be
@@ -35,66 +35,66 @@
} else {
// the current first page remains the first page
if (!$newfirstpageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
- error("Moveit: current first page id not found");
+ print_error("Moveit: current first page id not found");
}
}
// the rest is all unconditional...
// second step. join pages into a ring
if (!$firstpageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
- error("Moveit: firstpageid not found");
+ print_error("Moveit: firstpageid not found");
}
if (!$lastpageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "nextpageid", 0)) {
- error("Moveit: lastpage not found");
+ print_error("Moveit: lastpage not found");
}
if (!set_field("lesson_pages", "prevpageid", $lastpageid, "id", $firstpageid)) {
- error("Moveit: unable to update link");
+ print_error("Moveit: unable to update link");
}
if (!set_field("lesson_pages", "nextpageid", $firstpageid, "id", $lastpageid)) {
- error("Moveit: unable to update link");
+ print_error("Moveit: unable to update link");
}
// third step. remove the page to be moved
if (!$prevpageid = get_field("lesson_pages", "prevpageid", "id", $pageid)) {
- error("Moveit: prevpageid not found");
+ print_error("Moveit: prevpageid not found");
}
if (!$nextpageid = get_field("lesson_pages", "nextpageid", "id", $pageid)) {
- error("Moveit: nextpageid not found");
+ print_error("Moveit: nextpageid not found");
}
if (!set_field("lesson_pages", "nextpageid", $nextpageid, "id", $prevpageid)) {
- error("Moveit: unable to update link");
+ print_error("Moveit: unable to update link");
}
if (!set_field("lesson_pages", "prevpageid", $prevpageid, "id", $nextpageid)) {
- error("Moveit: unable to update link");
+ print_error("Moveit: unable to update link");
}
// fourth step. insert page to be moved in new place...
if (!$nextpageid = get_field("lesson_pages", "nextpageid", "id", $after)) {
- error("Movit: nextpageid not found");
+ print_error("Movit: nextpageid not found");
}
if (!set_field("lesson_pages", "nextpageid", $pageid, "id", $after)) {
- error("Moveit: unable to update link");
+ print_error("Moveit: unable to update link");
}
if (!set_field("lesson_pages", "prevpageid", $pageid, "id", $nextpageid)) {
- error("Moveit: unable to update link");
+ print_error("Moveit: unable to update link");
}
// ...and set the links in the moved page
if (!set_field("lesson_pages", "prevpageid", $after, "id", $pageid)) {
- error("Moveit: unable to update link");
+ print_error("Moveit: unable to update link");
}
if (!set_field("lesson_pages", "nextpageid", $nextpageid, "id", $pageid)) {
- error("Moveit: unable to update link");
+ print_error("Moveit: unable to update link");
}
// fifth step. break the ring
if (!$newlastpageid = get_field("lesson_pages", "prevpageid", "id", $newfirstpageid)) {
- error("Moveit: newlastpageid not found");
+ print_error("Moveit: newlastpageid not found");
}
if (!set_field("lesson_pages", "prevpageid", 0, "id", $newfirstpageid)) {
- error("Moveit: unable to update link");
+ print_error("Moveit: unable to update link");
}
if (!set_field("lesson_pages", "nextpageid", 0, "id", $newlastpageid)) {
- error("Moveit: unable to update link");
+ print_error("Moveit: unable to update link");
}
lesson_set_message(get_string('movedpage', 'lesson'), 'notifysuccess');
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
diff --git a/mod/lesson/action/updatepage.php b/mod/lesson/action/updatepage.php
index d54e179f621..7b978ccfbd7 100644
--- a/mod/lesson/action/updatepage.php
+++ b/mod/lesson/action/updatepage.php
@@ -48,7 +48,7 @@
$page->title = addslashes($page->title);
if (!update_record("lesson_pages", $page)) {
- error("Update page: page not updated");
+ print_error("Update page: page not updated");
}
if ($page->qtype == LESSON_ENDOFBRANCH || $page->qtype == LESSON_ESSAY || $page->qtype == LESSON_CLUSTER || $page->qtype == LESSON_ENDOFCLUSTER) {
// there's just a single answer with a jump
@@ -66,13 +66,13 @@
foreach ($answers as $answer) {
if ($answer->id != clean_param($form->answerid[0], PARAM_INT)) {
if (!delete_records("lesson_answers", "id", $answer->id)) {
- error("Update page: unable to delete answer record");
+ print_error("Update page: unable to delete answer record");
}
}
}
}
if (!update_record("lesson_answers", $oldanswer)) {
- error("Update page: EOB not updated");
+ print_error("Update page: EOB not updated");
}
} else {
// it's an "ordinary" page
@@ -107,7 +107,7 @@
$oldanswer->score = clean_param($form->score[$i], PARAM_INT);
}
if (!update_record("lesson_answers", $oldanswer)) {
- error("Update page: answer $i not updated");
+ print_error("Update page: answer $i not updated");
}
} else {
// it's a new answer
@@ -133,7 +133,7 @@
}
$newanswerid = insert_record("lesson_answers", $newanswer);
if (!$newanswerid) {
- error("Update page: answer record not inserted");
+ print_error("Update page: answer record not inserted");
}
}
} else {
@@ -142,7 +142,7 @@
if ($form->answerid[$i]) {
// need to delete blanked out answer
if (!delete_records("lesson_answers", "id", clean_param($form->answerid[$i], PARAM_INT))) {
- error("Update page: unable to delete answer record");
+ print_error("Update page: unable to delete answer record");
}
}
} else {
@@ -159,13 +159,13 @@
$oldanswer->timemodified = $timenow;
$oldanswer->answer = NULL;
if (!update_record("lesson_answers", $oldanswer)) {
- error("Update page: answer $i not updated");
+ print_error("Update page: answer $i not updated");
}
}
} elseif (!empty($form->answerid[$i])) {
// need to delete blanked out answer
if (!delete_records("lesson_answers", "id", clean_param($form->answerid[$i], PARAM_INT))) {
- error("Update page: unable to delete answer record");
+ print_error("Update page: unable to delete answer record");
}
}
}
diff --git a/mod/lesson/backuplib.php b/mod/lesson/backuplib.php
index a7259d840f9..451f9e46662 100644
--- a/mod/lesson/backuplib.php
+++ b/mod/lesson/backuplib.php
@@ -175,7 +175,7 @@
// move to the next (logical) page
if ($page->nextpageid) {
if (!$page = get_record("lesson_pages", "id", $page->nextpageid)) {
- error("Lesson Backup: Next page not found!");
+ print_error("Lesson Backup: Next page not found!");
}
} else {
// last page reached
diff --git a/mod/lesson/edit.php b/mod/lesson/edit.php
index a267e1b7ed4..e92507ea710 100644
--- a/mod/lesson/edit.php
+++ b/mod/lesson/edit.php
@@ -24,13 +24,13 @@
if ($firstpage = get_record('lesson_pages', 'lessonid', $lesson->id, 'prevpageid', 0)) {
if (!$pages = get_records('lesson_pages', 'lessonid', $lesson->id)) {
- error('Could not find lesson pages');
+ print_error('Could not find lesson pages');
}
}
if ($pageid) {
if (!$singlepage = get_record('lesson_pages', 'id', $pageid)) {
- error('Could not find page ID: '.$pageid);
+ print_error('Could not find page ID: '.$pageid);
}
}
diff --git a/mod/lesson/essay.php b/mod/lesson/essay.php
index bdccd0653fc..2bda00e150c 100644
--- a/mod/lesson/essay.php
+++ b/mod/lesson/essay.php
@@ -65,16 +65,16 @@
$attemptid = required_param('attemptid', PARAM_INT);
if (!$attempt = get_record('lesson_attempts', 'id', $attemptid)) {
- error('Error: could not find attempt');
+ print_error('Error: could not find attempt');
}
if (!$page = get_record('lesson_pages', 'id', $attempt->pageid)) {
- error('Error: could not find lesson page');
+ print_error('Error: could not find lesson page');
}
if (!$user = get_record('user', 'id', $attempt->userid)) {
- error('Error: could not find users');
+ print_error('Error: could not find users');
}
if (!$answer = get_record('lesson_answers', 'lessonid', $lesson->id, 'pageid', $page->id)) {
- error('Error: could not find answer');
+ print_error('Error: could not find answer');
}
break;
case 'update':
@@ -86,10 +86,10 @@
$attemptid = required_param('attemptid', PARAM_INT);
if (!$attempt = get_record('lesson_attempts', 'id', $attemptid)) {
- error('Error: could not find essay');
+ print_error('Error: could not find essay');
}
if (!$grades = get_records_select('lesson_grades', "lessonid = $lesson->id and userid = $attempt->userid", 'completed', '*', $attempt->retry, 1)) {
- error('Error: could not find grades');
+ print_error('Error: could not find grades');
}
$essayinfo = new stdClass;
@@ -108,7 +108,7 @@
$attempt->useranswer = addslashes(serialize($essayinfo));
if (!update_record('lesson_attempts', $attempt)) {
- error('Could not update essay score');
+ print_error('Could not update essay score');
}
// Get grade information
@@ -132,7 +132,7 @@
redirect("$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id");
} else {
- error('Something is wrong with the form data');
+ print_error('Something is wrong with the form data');
}
break;
case 'email': // Sending an email(s) to a single user or all
@@ -142,7 +142,7 @@
if ($userid = optional_param('userid', 0, PARAM_INT)) {
$queryadd = " AND userid = $userid";
if (! $users = get_records('user', 'id', $userid)) {
- error('Error: could not find users');
+ print_error('Error: could not find users');
}
} else {
$queryadd = '';
@@ -152,13 +152,13 @@
WHERE a.lessonid = '$lesson->id' and
u.id = a.userid
ORDER BY u.lastname")) {
- error('Error: could not find users');
+ print_error('Error: could not find users');
}
}
// Get lesson pages that are essay
if (!$pages = get_records_select('lesson_pages', "lessonid = $lesson->id AND qtype = ".LESSON_ESSAY)) {
- error('Error: could not find lesson pages');
+ print_error('Error: could not find lesson pages');
}
// Get only the attempts that are in response to essay questions
@@ -214,7 +214,7 @@
// Log it
add_to_log($course->id, 'lesson', 'update email essay grade', "essay.php?id=$cm->id", format_string($pages[$attempt->pageid]->title,true).': '.fullname($users[$attempt->userid]), $cm->id);
} else {
- error('Emailing Failed');
+ print_error('Emailing Failed');
}
}
}
diff --git a/mod/lesson/format.php b/mod/lesson/format.php
index c547c7b01f8..7fbf98c6c46 100644
--- a/mod/lesson/format.php
+++ b/mod/lesson/format.php
@@ -92,11 +92,11 @@ class qformat_default {
$newpage->nextpageid = $page->nextpageid;
// insert the page and reset $pageid
if (!$newpageid = insert_record("lesson_pages", $newpage)) {
- error("Format: Could not insert new page!");
+ print_error("Format: Could not insert new page!");
}
// update the linked list
if (!set_field("lesson_pages", "nextpageid", $newpageid, "id", $pageid)) {
- error("Format: unable to update link");
+ print_error("Format: unable to update link");
}
} else {
@@ -108,7 +108,7 @@ class qformat_default {
$newpage->nextpageid = 0; // this is the only page
$newpageid = insert_record("lesson_pages", $newpage);
if (!$newpageid) {
- error("Insert page: new first page not inserted");
+ print_error("Insert page: new first page not inserted");
}
} else {
// there are existing pages put this at the start
@@ -116,11 +116,11 @@ class qformat_default {
$newpage->nextpageid = $page->id;
$newpageid = insert_record("lesson_pages", $newpage);
if (!$newpageid) {
- error("Insert page: first page not inserted");
+ print_error("Insert page: first page not inserted");
}
// update the linked list
if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $page->id)) {
- error("Insert page: unable to update link");
+ print_error("Insert page: unable to update link");
}
}
}
diff --git a/mod/lesson/grade.php b/mod/lesson/grade.php
index 66d2c197e10..740730e3718 100644
--- a/mod/lesson/grade.php
+++ b/mod/lesson/grade.php
@@ -5,15 +5,15 @@
$id = required_param('id', PARAM_INT); // Course module ID
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $lesson = get_record("lesson", "id", $cm->instance)) {
- error("lesson ID was incorrect");
+ print_error("lesson ID was incorrect");
}
if (! $course = get_record("course", "id", $lesson->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
require_login($course->id, false, $cm);
diff --git a/mod/lesson/highscores.php b/mod/lesson/highscores.php
index 858f5eb7a3c..b411a5dec4e 100644
--- a/mod/lesson/highscores.php
+++ b/mod/lesson/highscores.php
@@ -26,7 +26,7 @@
case 'add':
// Ensure that we came from view.php
if (!confirm_sesskey() or !data_submitted("$CFG->wwwroot/mod/lesson/view.php")) {
- error('Incorrect Form Data');
+ print_error('Incorrect Form Data');
}
break;
@@ -55,19 +55,19 @@
}
if (!$grades = get_records_select('lesson_grades', "lessonid = $lesson->id", 'completed')) {
- error('Error: could not find grades');
+ print_error('Error: could not find grades');
}
if (!$newgrade = get_record_sql("SELECT *
FROM {$CFG->prefix}lesson_grades
WHERE lessonid = $lesson->id
AND userid = $USER->id
ORDER BY completed DESC", true)) {
- error('Error: could not find newest grade');
+ print_error('Error: could not find newest grade');
}
// Check for multiple submissions
if (record_exists('lesson_high_scores', 'gradeid', $newgrade->id)) {
- error('Only one posting per grade');
+ print_error('Only one posting per grade');
}
// Find out if we need to delete any records
@@ -116,7 +116,7 @@
$newhighscore->nickname = $name;
if (!insert_record('lesson_high_scores', $newhighscore)) {
- error("Insert of new high score Failed!");
+ print_error("Insert of new high score Failed!");
}
// Log it
@@ -125,7 +125,7 @@
lesson_set_message(get_string('postsuccess', 'lesson'), 'notifysuccess');
redirect("$CFG->wwwroot/mod/lesson/highscores.php?id=$cm->id&link=1");
} else {
- error('Something is wrong with the form data');
+ print_error('Something is wrong with the form data');
}
break;
}
diff --git a/mod/lesson/import.php b/mod/lesson/import.php
index 8e41a64c38a..809e09a2a52 100644
--- a/mod/lesson/import.php
+++ b/mod/lesson/import.php
@@ -16,15 +16,15 @@
$pageid = optional_param('pageid', '', PARAM_INT); // Page ID
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $lesson = get_record("lesson", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
@@ -52,7 +52,7 @@
} else { // Valid file is found
if (! is_readable("$CFG->dirroot/question/format/$form->format/format.php")) {
- error("Format not known ($form->format)");
+ print_error("Format not known ($form->format)");
}
require("format.php"); // Parent class
@@ -62,15 +62,15 @@
$format = new $classname();
if (! $format->importpreprocess()) { // Do anything before that we need to
- error("Error occurred during pre-processing!");
+ print_error("Error occurred during pre-processing!");
}
if (! $format->importprocess($_FILES['newfile']['tmp_name'], $lesson, $pageid)) { // Process the uploaded file
- error("Error occurred during processing!");
+ print_error("Error occurred during processing!");
}
if (! $format->importpostprocess()) { // In case anything needs to be done after
- error("Error occurred during post-processing!");
+ print_error("Error occurred during post-processing!");
}
echo " ";
diff --git a/mod/lesson/importppt.php b/mod/lesson/importppt.php
index a407515be3b..2d61a9daf4e 100644
--- a/mod/lesson/importppt.php
+++ b/mod/lesson/importppt.php
@@ -21,20 +21,20 @@
global $matches;
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
// allows for adaption for multiple modules
if(! $modname = get_field('modules', 'name', 'id', $cm->module)) {
- error("Could not find module name");
+ print_error("Could not find module name");
}
if (! $mod = get_record($modname, "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
require_login($course->id, false, $cm);
@@ -68,10 +68,10 @@
$objects = $mod_create_objects($pageobjects, $mod->id); // function to preps the data to be sent to DB
if(! $mod_save_objects($objects, $mod->id, $pageid)) { // sends it to DB
- error("could not save");
+ print_error("could not save");
}
} else {
- error('could not get data');
+ print_error('could not get data');
}
echo " ";
@@ -324,7 +324,7 @@ function build_list($list, &$i, $depth) {
// set the depth number. So B1 is depth 1 and B2 is depth 2 and so on
$this_depth = substr($class, 1);
if (!is_numeric($this_depth)) {
- error("Depth not parsed!");
+ print_error("Depth not parsed!");
}
}
if ($this_depth < $depth) {
@@ -544,13 +544,13 @@ function lesson_save_objects($branchtables, $lessonid, $after) {
// insert the page
if(!$id = insert_record('lesson_pages', $branchtable->page)) {
- error("insert page");
+ print_error("insert page");
}
// update the link of the page previous to the one we just updated
if ($prevpageid != 0) { // if not the first page
if (!set_field("lesson_pages", "nextpageid", $id, "id", $prevpageid)) {
- error("Insert page: unable to update next link $prevpageid");
+ print_error("Insert page: unable to update next link $prevpageid");
}
}
@@ -558,7 +558,7 @@ function lesson_save_objects($branchtables, $lessonid, $after) {
foreach ($branchtable->answers as $answer) {
$answer->pageid = $id;
if(!insert_record('lesson_answers', $answer)) {
- error("insert answer $id");
+ print_error("insert answer $id");
}
}
@@ -568,7 +568,7 @@ function lesson_save_objects($branchtables, $lessonid, $after) {
// all done with inserts. Now check to update our last page (this is when we import between two lesson pages)
if ($nextpageid != 0) { // if the next page is not the end of lesson
if (!set_field("lesson_pages", "prevpageid", $id, "id", $nextpageid)) {
- error("Insert page: unable to update next link $prevpageid");
+ print_error("Insert page: unable to update next link $prevpageid");
}
}
@@ -582,7 +582,7 @@ function book_save_objects($chapters, $bookid, $pageid='0') {
// nothing fancy, just save them all in order
foreach ($chapters as $chapter) {
if (!$chapter->id = insert_record('book_chapters', $chapter)) {
- error('Could not update your book');
+ print_error('Could not update your book');
}
}
return true;
diff --git a/mod/lesson/index.php b/mod/lesson/index.php
index ea33f44ebca..4433fc6d927 100644
--- a/mod/lesson/index.php
+++ b/mod/lesson/index.php
@@ -14,7 +14,7 @@
$id = required_param('id', PARAM_INT); // course
if (!$course = get_record("course", "id", $id)) {
- error("Course ID is incorrect");
+ print_error("Course ID is incorrect");
}
require_login($course->id);
diff --git a/mod/lesson/lesson.php b/mod/lesson/lesson.php
index 902bae5b209..f4c0e194423 100644
--- a/mod/lesson/lesson.php
+++ b/mod/lesson/lesson.php
@@ -55,7 +55,7 @@
include($CFG->dirroot.'/mod/lesson/action/'.$action.'.php');
break;
default:
- error("Fatal Error: Unknown action\n");
+ print_error("Fatal Error: Unknown action\n");
}
print_footer($course);
diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php
index b6ab81fe8aa..a25a4d03a23 100644
--- a/mod/lesson/locallib.php
+++ b/mod/lesson/locallib.php
@@ -270,26 +270,26 @@ function lesson_print_header($cm, $course, $lesson, $currenttab = '') {
function lesson_get_basics($cmid = 0, $lessonid = 0) {
if ($cmid) {
if (!$cm = get_coursemodule_from_id('lesson', $cmid)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
if (!$course = get_record('course', 'id', $cm->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
if (!$lesson = get_record('lesson', 'id', $cm->instance)) {
- error('Course module is incorrect');
+ print_error('Course module is incorrect');
}
} else if ($lessonid) {
if (!$lesson = get_record('lesson', 'id', $lessonid)) {
- error('Course module is incorrect');
+ print_error('Course module is incorrect');
}
if (!$course = get_record('course', 'id', $lesson->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
if (!$cm = get_coursemodule_from_instance('lesson', $lesson->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
} else {
- error('No course module ID or lesson ID were passed');
+ print_error('No course module ID or lesson ID were passed');
}
return array($cm, $course, $lesson);
@@ -1064,7 +1064,7 @@ function lesson_cluster_jump($lessonid, $userid, $pageid) {
// get the lesson pages
if (!$lessonpages = get_records_select("lesson_pages", "lessonid = $lessonid")) {
- error("Error: could not find records in lesson_pages table");
+ print_error("Error: could not find records in lesson_pages table");
}
// find the start of the cluster
while ($pageid != 0) { // this condition should not be satisfied... should be a cluster page
@@ -1192,7 +1192,7 @@ function lesson_unseen_question_jump($lesson, $user, $pageid) {
// get the lesson pages
if (!$lessonpages = get_records_select("lesson_pages", "lessonid = $lesson")) {
- error("Error: could not find records in lesson_pages table");
+ print_error("Error: could not find records in lesson_pages table");
}
if ($pageid == LESSON_UNSEENBRANCHPAGE) { // this only happens when a student leaves in the middle of an unseen question within a branch series
@@ -1249,12 +1249,12 @@ function lesson_unseen_branch_jump($lessonid, $userid) {
if (!$seenbranches = get_records_select("lesson_branch", "lessonid = $lessonid AND userid = $userid AND retry = $retakes",
"timeseen DESC")) {
- error("Error: could not find records in lesson_branch table");
+ print_error("Error: could not find records in lesson_branch table");
}
// get the lesson pages
if (!$lessonpages = get_records_select("lesson_pages", "lessonid = $lessonid")) {
- error("Error: could not find records in lesson_pages table");
+ print_error("Error: could not find records in lesson_pages table");
}
// this loads all the viewed branch tables into $seen untill it finds the branch table with the flag
@@ -1301,7 +1301,7 @@ function lesson_unseen_branch_jump($lessonid, $userid) {
function lesson_random_question_jump($lessonid, $pageid) {
// get the lesson pages
if (!$lessonpages = get_records_select("lesson_pages", "lessonid = $lessonid")) {
- error("Error: could not find records in lesson_pages table");
+ print_error("Error: could not find records in lesson_pages table");
}
// go up the pages till branch table
diff --git a/mod/lesson/mediafile.php b/mod/lesson/mediafile.php
index fc52550fb25..2839c1713aa 100644
--- a/mod/lesson/mediafile.php
+++ b/mod/lesson/mediafile.php
@@ -19,15 +19,15 @@
$printclose = optional_param('printclose', 0, PARAM_INT);
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
if (! $course = get_record('course', 'id', $cm->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
if (! $lesson = get_record('lesson', 'id', $cm->instance)) {
- error('Course module is incorrect');
+ print_error('Course module is incorrect');
}
require_login($course->id, false, $cm);
@@ -142,7 +142,7 @@
//} else if ($mimetype == "application/x-shockwave-flash") { // It's a flash file
- // error('Flash is not supported yet');
+ // print_error('Flash is not supported yet');
} else if ($mimetype == "audio/x-pn-realaudio") { // It's a realmedia file
diff --git a/mod/lesson/pagelib.php b/mod/lesson/pagelib.php
index 868366fb9f5..c1291bd111b 100644
--- a/mod/lesson/pagelib.php
+++ b/mod/lesson/pagelib.php
@@ -70,7 +70,7 @@ class page_lesson extends page_generic_activity {
$activityname = format_string($this->activityrecord->name);
if ($this->lessonpageid === NULL) {
- error('Programmer error: must set the lesson page ID');
+ print_error('Programmer error: must set the lesson page ID');
}
if (empty($title)) {
$title = "{$this->courserecord->shortname}: $activityname";
diff --git a/mod/lesson/report.php b/mod/lesson/report.php
index a0f0803cfbf..15cf1c82198 100644
--- a/mod/lesson/report.php
+++ b/mod/lesson/report.php
@@ -344,10 +344,10 @@
$try = optional_param('try', NULL, PARAM_INT);
if (! $lessonpages = get_records("lesson_pages", "lessonid", $lesson->id)) {
- error("Could not find Lesson Pages");
+ print_error("Could not find Lesson Pages");
}
if (! $pageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
- error("Could not find first page");
+ print_error("Could not find first page");
}
// now gather the stats into an object
@@ -912,7 +912,7 @@
}
else {
- error("Fatal Error: Unknown Action: ".$action."\n");
+ print_error("Fatal Error: Unknown Action: ".$action."\n");
}
/// Finish the page
diff --git a/mod/lesson/restorelib.php b/mod/lesson/restorelib.php
index 38e4363d7f2..9e35c8b5b9f 100644
--- a/mod/lesson/restorelib.php
+++ b/mod/lesson/restorelib.php
@@ -184,7 +184,7 @@
//Fix the forwards link of the previous page
if ($prevpageid) {
if (!set_field("lesson_pages", "nextpageid", $newid, "id", $prevpageid)) {
- error("Lesson restorelib: unable to update link");
+ print_error("Lesson restorelib: unable to update link");
}
}
$prevpageid = $newid;
@@ -254,7 +254,7 @@
$page = backup_getid($restore->backup_unique_code,"lesson_pages",$answer->jumpto);
if ($page) {
if (!set_field("lesson_answers", "jumpto", $page->new_id, "id", $answer->id)) {
- error("Lesson restorelib: unable to reset jump");
+ print_error("Lesson restorelib: unable to reset jump");
}
}
}
diff --git a/mod/lesson/tabs.php b/mod/lesson/tabs.php
index 3c88a5b0393..4f27e65d09f 100644
--- a/mod/lesson/tabs.php
+++ b/mod/lesson/tabs.php
@@ -12,7 +12,7 @@
/// This file to be included so we can assume config.php has already been included.
if (empty($lesson)) {
- error('You cannot call this script in that way');
+ print_error('You cannot call this script in that way');
}
if (!isset($currenttab)) {
$currenttab = '';
diff --git a/mod/lesson/view.php b/mod/lesson/view.php
index 3243160def9..d1f5705f7db 100644
--- a/mod/lesson/view.php
+++ b/mod/lesson/view.php
@@ -250,7 +250,7 @@
// get the first page
if (!$firstpageid = get_field('lesson_pages', 'id', 'lessonid', $lesson->id,
'prevpageid', 0)) {
- error('Navigation: first page not found');
+ print_error('Navigation: first page not found');
}
lesson_print_header($cm, $course, $lesson);
if ($lesson->timed) {
@@ -309,7 +309,7 @@
}
// start at the first page
if (!$pageid = get_field('lesson_pages', 'id', 'lessonid', $lesson->id, 'prevpageid', 0)) {
- error('Navigation: first page not found');
+ print_error('Navigation: first page not found');
}
/// This is the code for starting a timed test
if(!isset($USER->startlesson[$lesson->id]) && !has_capability('mod/lesson:manage', $context)) {
@@ -321,7 +321,7 @@
$startlesson->lessontime = time();
if (!insert_record('lesson_timer', $startlesson)) {
- error('Error: could not insert row into lesson_timer table');
+ print_error('Error: could not insert row into lesson_timer table');
}
if ($lesson->timed) {
lesson_set_message(get_string('maxtimewarning', 'lesson', $lesson->maxtime), 'center');
@@ -339,10 +339,10 @@
$retries = 0;
}
if (!delete_records('lesson_attempts', 'userid', $USER->id, 'lessonid', $lesson->id, 'retry', $retries)) {
- error('Error: could not delete old attempts');
+ print_error('Error: could not delete old attempts');
}
if (!delete_records('lesson_branch', 'userid', $USER->id, 'lessonid', $lesson->id, 'retry', $retries)) {
- error('Error: could not delete old seen branches');
+ print_error('Error: could not delete old seen branches');
}
}
}
@@ -350,7 +350,7 @@
add_to_log($course->id, 'lesson', 'view', 'view.php?id='. $cm->id, $pageid, $cm->id);
if (!$page = get_record('lesson_pages', 'id', $pageid)) {
- error('Navigation: the page record not found');
+ print_error('Navigation: the page record not found');
}
if ($page->qtype == LESSON_CLUSTER) { //this only gets called when a user starts up a new lesson and the first page is a cluster page
@@ -359,14 +359,14 @@
$pageid = lesson_cluster_jump($lesson->id, $USER->id, $pageid);
// get new page info
if (!$page = get_record('lesson_pages', 'id', $pageid)) {
- error('Navigation: the page record not found');
+ print_error('Navigation: the page record not found');
}
add_to_log($course->id, 'lesson', 'view', 'view.php?id='. $cm->id, $pageid, $cm->id);
} else {
// get the next page
$pageid = $page->nextpageid;
if (!$page = get_record('lesson_pages', 'id', $pageid)) {
- error('Navigation: the page record not found');
+ print_error('Navigation: the page record not found');
}
}
} elseif ($page->qtype == LESSON_ENDOFCLUSTER) { // Check for endofclusters
@@ -408,7 +408,7 @@
break;
}
} else {
- error('Navigation: No answers on EOB');
+ print_error('Navigation: No answers on EOB');
}
}
@@ -425,7 +425,7 @@
$timer = new stdClass;
if(!has_capability('mod/lesson:manage', $context)) {
if (!$timer = get_records_select('lesson_timer', "lessonid = $lesson->id AND userid = $USER->id", 'starttime')) {
- error('Error: could not find records');
+ print_error('Error: could not find records');
} else {
$timer = array_pop($timer); // this will get the latest start time record
}
@@ -464,7 +464,7 @@
if (!has_capability('mod/lesson:manage', $context)) {
$timer->lessontime = time();
if (!update_record('lesson_timer', $timer)) {
- error('Error: could not update lesson_timer table');
+ print_error('Error: could not update lesson_timer table');
}
}
@@ -546,7 +546,7 @@
$retries = count_records('lesson_grades', "lessonid", $lesson->id, "userid", $USER->id);
$retries--;
if (! $attempts = get_records_select("lesson_attempts", "lessonid = $lesson->id AND userid = $USER->id AND pageid = $page->id AND retry = $retries", "timeseen")) {
- error("Previous attempt record could not be found!");
+ print_error("Previous attempt record could not be found!");
}
$attempt = end($attempts);
}
@@ -829,14 +829,14 @@
if (!has_capability('mod/lesson:manage', $context)) {
unset($USER->startlesson[$lesson->id]);
if (!$timer = get_records_select('lesson_timer', "lessonid = $lesson->id AND userid = $USER->id", 'starttime')) {
- error('Error: could not find records');
+ print_error('Error: could not find records');
} else {
$timer = array_pop($timer); // this will get the latest start time record
}
$timer->lessontime = time();
if (!update_record("lesson_timer", $timer)) {
- error("Error: could not update lesson_timer table");
+ print_error("Error: could not update lesson_timer table");
}
}
@@ -889,21 +889,21 @@
if (!$lesson->practice) {
if (isset($USER->modattempts[$lesson->id])) { // if reviewing, make sure update old grade record
if (!$grades = get_records_select("lesson_grades", "lessonid = $lesson->id and userid = $USER->id", "completed")) {
- error("Could not find Grade Records");
+ print_error("Could not find Grade Records");
}
$oldgrade = end($grades);
$grade->id = $oldgrade->id;
if (!$update = update_record("lesson_grades", $grade)) {
- error("Navigation: grade not updated");
+ print_error("Navigation: grade not updated");
}
} else {
if (!$newgradeid = insert_record("lesson_grades", $grade)) {
- error("Navigation: grade not inserted");
+ print_error("Navigation: grade not inserted");
}
}
} else {
if (!delete_records("lesson_attempts", "lessonid", $lesson->id, "userid", $USER->id, "retry", $ntries)) {
- error("Could not delete lesson attempts");
+ print_error("Could not delete lesson attempts");
}
}
} else {
@@ -916,7 +916,7 @@
$grade->completed = time();
if (!$lesson->practice) {
if (!$newgradeid = insert_record("lesson_grades", $grade)) {
- error("Navigation: grade not inserted");
+ print_error("Navigation: grade not inserted");
}
}
echo get_string("eolstudentoutoftimenoanswers", "lesson");
diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php
index bbd185e1acc..31fec0ea51f 100644
--- a/mod/quiz/attempt.php
+++ b/mod/quiz/attempt.php
@@ -28,23 +28,23 @@
if ($id) {
if (! $cm = get_coursemodule_from_id('quiz', $id)) {
- error("There is no coursemodule with id $id");
+ print_error("There is no coursemodule with id $id");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $quiz = get_record("quiz", "id", $cm->instance)) {
- error("The quiz with id $cm->instance corresponding to this coursemodule $id is missing");
+ print_error("The quiz with id $cm->instance corresponding to this coursemodule $id is missing");
}
} else {
if (! $quiz = get_record("quiz", "id", $q)) {
- error("There is no quiz with id $q");
+ print_error("There is no quiz with id $q");
}
if (! $course = get_record("course", "id", $quiz->course)) {
- error("The course with id $quiz->course that the quiz with id $q belongs to is missing");
+ print_error("The course with id $quiz->course that the quiz with id $q belongs to is missing");
}
if (! $cm = get_coursemodule_from_instance("quiz", $quiz->id, $course->id)) {
- error("The course module for the quiz with id $q is missing");
+ print_error("The course module for the quiz with id $q is missing");
}
}
@@ -122,7 +122,7 @@
$messages = $accessmanager->prevent_access() +
$accessmanager->prevent_new_attempt($attemptnumber - 1, $lastattempt);
if (!$canpreview && $messages) {
- error($accessmanager->print_messages($messages, true),
+ print_error($accessmanager->print_messages($messages, true), '',
$CFG->wwwroot . '/mod/quiz/view.php?q=' . $quiz->id);
}
$accessmanager->do_password_check($canpreview);
@@ -187,7 +187,7 @@
/// Restore the question sessions to their most recent states creating new sessions where required.
if (!$states = get_question_states($questions, $quiz, $attempt, $lastattemptid)) {
- error('Could not restore question sessions');
+ print_error('Could not restore question sessions');
}
/// If we are starting a new attempt, save all the newly created states.
@@ -285,7 +285,7 @@
if (!$newattempt) {
$messages = $accessmanager->prevent_access();
if (!$canpreview && $messages) {
- error($accessmanager->print_messages($messages, true),
+ print_error($accessmanager->print_messages($messages, true), '',
$CFG->wwwroot . '/mod/quiz/view.php?q=' . $quiz->id);
}
$accessmanager->do_password_check($canpreview);
diff --git a/mod/quiz/comment.php b/mod/quiz/comment.php
index 721570a42b7..c361577dab1 100644
--- a/mod/quiz/comment.php
+++ b/mod/quiz/comment.php
@@ -13,18 +13,18 @@
$questionid =required_param('question', PARAM_INT); // question id
if (! $attempt = get_record('quiz_attempts', 'uniqueid', $attemptid)) {
- error('No such attempt ID exists');
+ print_error('No such attempt ID exists');
}
if (! $quiz = get_record('quiz', 'id', $attempt->quiz)) {
- error('Course module is incorrect');
+ print_error('Course module is incorrect');
}
if (! $course = get_record('course', 'id', $quiz->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
// Teachers are only allowed to comment and grade on closed attempts
if (!($attempt->timefinish > 0)) {
- error('Attempt has not closed yet');
+ print_error('Attempt has not closed yet');
}
$cm = get_coursemodule_from_instance('quiz', $quiz->id);
@@ -36,7 +36,7 @@
// Load question
if (! $question = get_record('question', 'id', $questionid)) {
- error('Question for this session is missing');
+ print_error('Question for this session is missing');
}
$question->maxgrade = get_field('quiz_question_instances', 'grade', 'quiz', $quiz->id, 'question', $question->id);
// Some of the questions code is optimised to work with several questions
@@ -45,7 +45,7 @@
$questions[$key] = &$question;
// Add additional questiontype specific information to the question objects.
if (!get_question_options($questions)) {
- error("Unable to load questiontype specific question information");
+ print_error("Unable to load questiontype specific question information");
}
// Load state
diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php
index 76f2384c2f6..97fbf0bbcf6 100644
--- a/mod/quiz/edit.php
+++ b/mod/quiz/edit.php
@@ -101,7 +101,7 @@
// Get the course object and related bits.
if (! $course = get_record("course", "id", $quiz->course)) {
- error("This course doesn't exist");
+ print_error("This course doesn't exist");
}
// Log this visit.
@@ -133,7 +133,7 @@
// Avoid duplicate page breaks
$quiz->questions = str_replace(',0,0', ',0', $quiz->questions);
if (!set_field('quiz', 'questions', $quiz->questions, 'id', $quiz->instance)) {
- error('Could not save question list');
+ print_error('Could not save question list');
}
}
}
@@ -150,7 +150,7 @@
// Avoid duplicate page breaks
$quiz->questions = str_replace(',0,0', ',0', $quiz->questions);
if (!set_field('quiz', 'questions', $quiz->questions, 'id', $quiz->instance)) {
- error('Could not save question list');
+ print_error('Could not save question list');
}
}
}
@@ -174,7 +174,7 @@
$randomcount = required_param('randomcount', PARAM_INT);
// load category
if (! $category = get_record('question_categories', 'id', $categoryid)) {
- error('Category ID is incorrect');
+ print_error('Category ID is incorrect');
}
$catcontext = get_context_instance_by_id($category->contextid);
require_capability('moodle/question:useall', $catcontext);
@@ -209,7 +209,7 @@
$question->qtype = RANDOM;
$question = $QTYPES[RANDOM]->save_question($question, $form, $course);
if(!isset($question->id)) {
- error('Could not insert new random question!');
+ print_error('Could not insert new random question!');
}
quiz_add_quiz_question($question->id, $quiz);
}
@@ -220,12 +220,12 @@
if (isset($_REQUEST['questionsperpage'])) {
$quiz->questionsperpage = required_param('questionsperpage', PARAM_INT);
if (!set_field('quiz', 'questionsperpage', $quiz->questionsperpage, 'id', $quiz->id)) {
- error('Could not save number of questions per page');
+ print_error('Could not save number of questions per page');
}
}
$quiz->questions = quiz_repaginate($quiz->questions, $quiz->questionsperpage);
if (!set_field('quiz', 'questions', $quiz->questions, 'id', $quiz->id)) {
- error('Could not save layout');
+ print_error('Could not save layout');
}
}
if (isset($_REQUEST['delete']) and confirm_sesskey()) { /// Remove a question from the quiz
@@ -272,14 +272,14 @@
$quiz->questions = str_replace(',0,0', ',0', $quiz->questions);
}
if (!set_field('quiz', 'questions', $quiz->questions, 'id', $quiz->instance)) {
- error('Could not save question list');
+ print_error('Could not save question list');
}
}
// If rescaling is required save the new maximum
if (isset($_REQUEST['maxgrade'])) {
if (!quiz_set_grade(optional_param('maxgrade', 0), $quiz)) {
- error('Could not set a new maximum grade for the quiz');
+ print_error('Could not set a new maximum grade for the quiz');
}
}
}
@@ -319,7 +319,7 @@
$sumgrades = quiz_print_question_list($quiz, $thispageurl, false, $quiz_showbreaks, $quiz_reordertool);
if (!set_field('quiz', 'sumgrades', $sumgrades, 'id', $quiz->instance)) {
- error('Failed to set sumgrades');
+ print_error('Failed to set sumgrades');
}
print_box_end();
@@ -346,7 +346,7 @@
$sumgrades = quiz_print_question_list($quiz, $thispageurl, true, $quiz_showbreaks, $quiz_reordertool);
if (!set_field('quiz', 'sumgrades', $sumgrades, 'id', $quiz->instance)) {
- error('Failed to set sumgrades');
+ print_error('Failed to set sumgrades');
}
print_box_end();
diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php
index 67f2c0b0c16..1ea548f590b 100644
--- a/mod/quiz/editlib.php
+++ b/mod/quiz/editlib.php
@@ -43,7 +43,7 @@ function quiz_delete_quiz_question($id, &$quiz) {
$quiz->questions = str_replace(',0,0', ',0', $quiz->questions);
// save new questionlist in database
if (!set_field('quiz', 'questions', $quiz->questions, 'id', $quiz->instance)) {
- error('Could not save question list');
+ print_error('Could not save question list');
}
delete_records('quiz_question_instances', 'quiz', $quiz->instance, 'question', $question);
return true;
@@ -86,7 +86,7 @@ function quiz_add_quiz_question($id, &$quiz) {
// Save new questionslist in database
$quiz->questions = implode(",", $questions);
if (!set_field('quiz', 'questions', $quiz->questions, 'id', $quiz->id)) {
- error('Could not save question list');
+ print_error('Could not save question list');
}
// update question grades
diff --git a/mod/quiz/grade.php b/mod/quiz/grade.php
index 04e80234465..dcbe4917553 100644
--- a/mod/quiz/grade.php
+++ b/mod/quiz/grade.php
@@ -5,15 +5,15 @@
$id = required_param('id', PARAM_INT); // Course module ID
if (! $cm = get_coursemodule_from_id('quiz', $id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
if (! $quiz = get_record('quiz', 'id', $cm->instance)) {
- error('quiz ID was incorrect');
+ print_error('quiz ID was incorrect');
}
if (! $course = get_record('course', 'id', $quiz->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
require_login($course->id, false, $cm);
diff --git a/mod/quiz/index.php b/mod/quiz/index.php
index 3193bda57d6..e29ee821bcb 100644
--- a/mod/quiz/index.php
+++ b/mod/quiz/index.php
@@ -11,7 +11,7 @@
$id = required_param('id', PARAM_INT);
if (!$course = get_record("course", "id", $id)) {
- error("Course ID is incorrect");
+ print_error("Course ID is incorrect");
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $id);
require_login($course->id);
diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php
index e98499d8dc3..f570613b166 100644
--- a/mod/quiz/locallib.php
+++ b/mod/quiz/locallib.php
@@ -92,7 +92,7 @@ function quiz_create_attempt($quiz, $attemptnumber, $lastattempt, $timenow, $isp
} else {
/// Build on last attempt.
if (empty($lastattempt)) {
- error(get_string('cannotfindprevattempt', 'quiz'));
+ print_error('cannotfindprevattempt', 'quiz');
}
$attempt = $lastattempt;
}
diff --git a/mod/quiz/pagelib.php b/mod/quiz/pagelib.php
index d6d43b0ac0f..698dd341870 100644
--- a/mod/quiz/pagelib.php
+++ b/mod/quiz/pagelib.php
@@ -20,7 +20,7 @@ class page_quiz extends page_generic_activity {
function init_quick($data) {
if(empty($data->pageid)) {
- error('Cannot quickly initialize page: empty course id');
+ print_error('Cannot quickly initialize page: empty course id');
}
$this->activityname = 'quiz';
parent::init_quick($data);
diff --git a/mod/quiz/quizfile.php b/mod/quiz/quizfile.php
index 44d3b0f9348..049870d54ba 100644
--- a/mod/quiz/quizfile.php
+++ b/mod/quiz/quizfile.php
@@ -20,13 +20,13 @@
$relativepath = get_file_argument('quizfile.php');
if (!$relativepath) {
- error('No valid arguments supplied or incorrect server configuration');
+ print_error('No valid arguments supplied or incorrect server configuration');
}
// extract relative path components
$args = explode('/', trim($relativepath, '/'));
if (count($args) < 3) { // always at least category, question and path
- error('No valid arguments supplied');
+ print_error('No valid arguments supplied');
}
$quizid = (int)array_shift($args);
@@ -34,11 +34,11 @@
$relativepath = implode ('/', $args);
if (!($question = get_record('question', 'id', $questionid))) {
- error('No valid arguments supplied');
+ print_error('No valid arguments supplied');
}
if (!($questioncategory = get_record('question_categories', 'id', $question->category))) {
- error('No valid arguments supplied');
+ print_error('No valid arguments supplied');
}
/////////////////////////////////////
@@ -48,7 +48,7 @@
if ($questioncategory->publish) {
require_login();
if (!isteacherinanycourse()) {
- error('No valid arguments supplied');
+ print_error('No valid arguments supplied');
}
} else {
require_login($questioncategory->course);
@@ -57,10 +57,10 @@
}
} else {
if (!($quiz = get_record('quiz', 'id', $quizid))) {
- error('No valid arguments supplied');
+ print_error('No valid arguments supplied');
}
if (!($course = get_record('course', 'id', $quiz->course))) {
- error('No valid arguments supplied');
+ print_error('No valid arguments supplied');
}
require_login($course->id);
@@ -71,7 +71,7 @@
// and ! ($quiz->review && time() > $quiz->timeclose)
// || !quiz_get_user_attempts($quiz->id, $USER->id) )
//{
- // error("Logged-in user is not allowed to view this quiz");
+ // print_error("Logged-in user is not allowed to view this quiz");
//}
///////////////////////////////////////////////////
@@ -82,14 +82,14 @@
// For now, let's not worry about this. The following check doesn't
// work for randomly selected questions and it gets complicated
//if (!in_array($question->id, explode(',', $quiz->questions), FALSE)) {
- // error("Specified question is not on the specified quiz");
+ // print_error("Specified question is not on the specified quiz");
//}
}
// Have the question check whether it uses this file or not
if (!$QTYPES[$question->qtype]->uses_quizfile($question,
$relativepath)) {
- error("The specified file path is not on the specified question");
+ print_error("The specified file path is not on the specified question");
}
@@ -106,6 +106,6 @@
send_file($pathname, $filename, $lifetime);
} else {
header('HTTP/1.0 404 not found');
- error(get_string('filenotfound', 'error')); //this is not displayed on IIS??
+ print_error('filenotfound', 'error'); //this is not displayed on IIS??
}
?>
diff --git a/mod/quiz/report.php b/mod/quiz/report.php
index 33f01a30747..4b24e6cd3d3 100644
--- a/mod/quiz/report.php
+++ b/mod/quiz/report.php
@@ -12,26 +12,26 @@
if ($id) {
if (! $cm = get_coursemodule_from_id('quiz', $id)) {
- error("There is no coursemodule with id $id");
+ print_error("There is no coursemodule with id $id");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $quiz = get_record("quiz", "id", $cm->instance)) {
- error("The quiz with id $cm->instance corresponding to this coursemodule $id is missing");
+ print_error("The quiz with id $cm->instance corresponding to this coursemodule $id is missing");
}
} else {
if (! $quiz = get_record("quiz", "id", $q)) {
- error("There is no quiz with id $q");
+ print_error("There is no quiz with id $q");
}
if (! $course = get_record("course", "id", $quiz->course)) {
- error("The course with id $quiz->course that the quiz with id $q belongs to is missing");
+ print_error("The course with id $quiz->course that the quiz with id $q belongs to is missing");
}
if (! $cm = get_coursemodule_from_instance("quiz", $quiz->id, $course->id)) {
- error("The course module for the quiz with id $q is missing");
+ print_error("The course module for the quiz with id $q is missing");
}
}
@@ -61,7 +61,7 @@
$mode = clean_param($mode, PARAM_SAFEDIR);
if (! is_readable("report/$mode/report.php")) {
- error("Report not known ($mode)");
+ print_error("Report not known ($mode)");
}
include("report/default.php"); // Parent class
@@ -70,7 +70,7 @@
$report = new quiz_report();
if (! $report->display($quiz, $cm, $course)) { // Run the report!
- error("Error occurred during pre-processing!");
+ print_error("Error occurred during pre-processing!");
}
/// Print footer
diff --git a/mod/quiz/report/analysis/report.php b/mod/quiz/report/analysis/report.php
index 5eae82d89fb..dac42cf6bad 100644
--- a/mod/quiz/report/analysis/report.php
+++ b/mod/quiz/report/analysis/report.php
@@ -142,17 +142,17 @@ class quiz_report extends quiz_default_report {
" AND q.id IN ($questionlist)";
if (!$quizquestions = get_records_sql($sql)) {
- error('No questions found');
+ print_error('No questions found');
}
// Load the question type specific information
if (!get_question_options($quizquestions)) {
- error('Could not load question options');
+ print_error('Could not load question options');
}
// Restore the question sessions to their most recent states
// creating new sessions where required
if (!$states = get_question_states($quizquestions, $quiz, $attempt)) {
- error('Could not restore question sessions');
+ print_error('Could not restore question sessions');
}
$numbers = explode(',', $questionlist);
$statsrow = array();
@@ -488,17 +488,17 @@ class quiz_report extends quiz_default_report {
" AND q.id IN ($questionlist)";
if (!$quizquestions = get_records_sql($sql)) {
- error('No questions found');
+ print_error('No questions found');
}
// Load the question type specific information
if (!get_question_options($quizquestions)) {
- error('Could not load question options');
+ print_error('Could not load question options');
}
// Restore the question sessions to their most recent states
// creating new sessions where required
if (!$states = get_question_states($quizquestions, $quiz, $attempt)) {
- error('Could not restore question sessions');
+ print_error('Could not restore question sessions');
}
$numbers = explode(',', $questionlist);
$statsrow = array();
diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php
index 3298bcd7ee9..de08bf6cd76 100644
--- a/mod/quiz/report/grading/report.php
+++ b/mod/quiz/report/grading/report.php
@@ -43,7 +43,7 @@ class quiz_report extends quiz_default_report {
if (!empty($questionid)) {
if (! $question = get_record('question', 'id', $questionid)) {
- error("Question with id $questionid not found");
+ print_error("Question with id $questionid not found");
}
$question->maxgrade = get_field('quiz_question_instances', 'grade', 'quiz', $quiz->id, 'question', $question->id);
@@ -56,7 +56,7 @@ class quiz_report extends quiz_default_report {
// We need to add additional questiontype specific information to
// the question objects.
if (!get_question_options($questions)) {
- error("Unable to load questiontype specific question information");
+ print_error("Unable to load questiontype specific question information");
}
// This will have extended the question object so that it now holds
// all the information about the questions that may be needed later.
@@ -73,7 +73,7 @@ class quiz_report extends quiz_default_report {
foreach($data->manualgrades as $uniqueid => $response) {
// get our attempt
if (! $attempt = get_record('quiz_attempts', 'uniqueid', $uniqueid)) {
- error('No such attempt ID exists');
+ print_error('No such attempt ID exists');
}
// Load the state for this attempt (The questions array was created earlier)
@@ -311,7 +311,7 @@ class quiz_report extends quiz_default_report {
WHERE sess.newest = state.id AND
sess.attemptid = $attempt->uniqueid AND
sess.questionid = $question->id")) {
- error('Could not find question state');
+ print_error('Could not find question state');
}
return question_state_is_graded($state);
diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php
index 75865a6fb9d..1774e931654 100644
--- a/mod/quiz/report/overview/report.php
+++ b/mod/quiz/report/overview/report.php
@@ -127,7 +127,7 @@ class quiz_report extends quiz_default_report {
" WHERE i.quiz = '$quiz->id' AND q.id = i.question".
" AND q.id IN ($questionlist)";
if (!$questions = get_records_sql($sql)) {
- error('No questions found');
+ print_error('No questions found');
}
$number = 1;
foreach ($questionids as $key => $id) {
diff --git a/mod/quiz/report/regrade/report.php b/mod/quiz/report/regrade/report.php
index 2c0ea4d2b00..8f00b09cbc0 100644
--- a/mod/quiz/report/regrade/report.php
+++ b/mod/quiz/report/regrade/report.php
@@ -31,7 +31,7 @@ class quiz_report extends quiz_default_report {
AND i.question = q.id";
if (! $questions = get_records_sql($sql)) {
- error("Failed to get questions for regrading!");
+ print_error("Failed to get questions for regrading!");
}
get_question_options($questions);
diff --git a/mod/quiz/review.php b/mod/quiz/review.php
index c6bf8deebd1..b6e7cf8c856 100644
--- a/mod/quiz/review.php
+++ b/mod/quiz/review.php
@@ -18,16 +18,16 @@
$showall = optional_param('showall', 0, PARAM_BOOL);
if (!$attempt = quiz_load_attempt($attemptid)) {
- error("No such attempt ID exists");
+ print_error("No such attempt ID exists");
}
if (! $quiz = get_record("quiz", "id", $attempt->quiz)) {
- error("The quiz with id $attempt->quiz belonging to attempt $attempt is missing");
+ print_error("The quiz with id $attempt->quiz belonging to attempt $attempt is missing");
}
if (! $course = get_record("course", "id", $quiz->course)) {
- error("The course with id $quiz->course that the quiz with id $quiz->id belongs to is missing");
+ print_error("The course with id $quiz->course that the quiz with id $quiz->id belongs to is missing");
}
if (! $cm = get_coursemodule_from_instance("quiz", $quiz->id, $course->id)) {
- error("The course module for the quiz with id $quiz->id is missing");
+ print_error("The course module for the quiz with id $quiz->id is missing");
}
/// Check login and get contexts.
@@ -81,7 +81,7 @@
/// Restore the question sessions to their most recent states creating new sessions where required.
if (!$states = get_question_states($questions, $quiz, $attempt)) {
- error('Could not restore question sessions');
+ print_error('Could not restore question sessions');
}
/// Work out appropriate title.
diff --git a/mod/quiz/reviewquestion.php b/mod/quiz/reviewquestion.php
index b1018a2149b..aa1441bcb9e 100644
--- a/mod/quiz/reviewquestion.php
+++ b/mod/quiz/reviewquestion.php
@@ -21,39 +21,39 @@
if ($stateid) {
if (! $state = get_record('question_states', 'id', $stateid)) {
- error('Invalid state id');
+ print_error('Invalid state id');
}
if (! $attempt = get_record('quiz_attempts', 'uniqueid', $state->attempt)) {
- error('No such attempt ID exists');
+ print_error('No such attempt ID exists');
}
} elseif ($attemptid) {
if (! $attempt = get_record('quiz_attempts', 'id', $attemptid)) {
- error('No such attempt ID exists');
+ print_error('No such attempt ID exists');
}
if (! $neweststateid = get_field('question_sessions', 'newest', 'attemptid', $attempt->uniqueid, 'questionid', $questionid)) {
// newest_state not set, probably because this is an old attempt from the old quiz module code
if (! $state = get_record('question_states', 'question', $questionid, 'attempt', $attempt->uniqueid)) {
- error('Invalid question id');
+ print_error('Invalid question id');
}
} else {
if (! $state = get_record('question_states', 'id', $neweststateid)) {
- error('Invalid state id');
+ print_error('Invalid state id');
}
}
} else {
- error('Parameter missing');
+ print_error('Parameter missing');
}
if (! $question = get_record('question', 'id', $state->question)) {
- error('Question for this state is missing');
+ print_error('Question for this state is missing');
}
if (! $quiz = get_record('quiz', 'id', $attempt->quiz)) {
- error('Course module is incorrect');
+ print_error('Course module is incorrect');
}
if (! $course = get_record('course', 'id', $quiz->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
if (! $cm = get_coursemodule_from_instance('quiz', $quiz->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
require_login($course->id, false, $cm);
@@ -66,18 +66,18 @@
// If not even responses are to be shown in review then we
// don't allow any review
if (!($quiz->review & QUIZ_REVIEW_RESPONSES)) {
- error(get_string("noreview", "quiz"));
+ print_error("noreview", "quiz");
}
if ((time() - $attempt->timefinish) > 120) { // always allow review right after attempt
if ((!$quiz->timeclose or time() < $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_OPEN)) {
- error(get_string("noreviewuntil", "quiz", userdate($quiz->timeclose)));
+ print_error("noreviewuntil", "quiz", '', userdate($quiz->timeclose));
}
if ($quiz->timeclose and time() >= $quiz->timeclose and !($quiz->review & QUIZ_REVIEW_CLOSED)) {
- error(get_string("noreview", "quiz"));
+ print_error("noreview", "quiz");
}
}
if ($attempt->userid != $USER->id) {
- error('This is not your attempt!');
+ print_error('This is not your attempt!');
}
}
@@ -101,7 +101,7 @@
$questions[$key] = &$question;
// Add additional questiontype specific information to the question objects.
if (!get_question_options($questions)) {
- error("Unable to load questiontype specific question information");
+ print_error("Unable to load questiontype specific question information");
}
$session = get_record('question_sessions', 'attemptid', $attempt->uniqueid, 'questionid', $question->id);
diff --git a/mod/quiz/tabs.php b/mod/quiz/tabs.php
index 55d3b96f090..a6f9b75c6b6 100644
--- a/mod/quiz/tabs.php
+++ b/mod/quiz/tabs.php
@@ -8,7 +8,7 @@
*/
if (empty($quiz)) {
- error('You cannot call this script in that way');
+ print_error('You cannot call this script in that way');
}
if (!isset($currenttab)) {
$currenttab = '';
diff --git a/mod/quiz/view.php b/mod/quiz/view.php
index 13a33fb8797..c28ebc0ca90 100644
--- a/mod/quiz/view.php
+++ b/mod/quiz/view.php
@@ -13,23 +13,23 @@
if ($id) {
if (! $cm = get_coursemodule_from_id('quiz', $id)) {
- error("There is no coursemodule with id $id");
+ print_error("There is no coursemodule with id $id");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $quiz = get_record("quiz", "id", $cm->instance)) {
- error("The quiz with id $cm->instance corresponding to this coursemodule $id is missing");
+ print_error("The quiz with id $cm->instance corresponding to this coursemodule $id is missing");
}
} else {
if (! $quiz = get_record("quiz", "id", $q)) {
- error("There is no quiz with id $q");
+ print_error("There is no quiz with id $q");
}
if (! $course = get_record("course", "id", $quiz->course)) {
- error("The course with id $quiz->course that the quiz with id $q belongs to is missing");
+ print_error("The course with id $quiz->course that the quiz with id $q belongs to is missing");
}
if (! $cm = get_coursemodule_from_instance("quiz", $quiz->id, $course->id)) {
- error("The course module for the quiz with id $q is missing");
+ print_error("The course module for the quiz with id $q is missing");
}
}
diff --git a/mod/resource/index.php b/mod/resource/index.php
index 807c029d1b3..a611aa9245d 100644
--- a/mod/resource/index.php
+++ b/mod/resource/index.php
@@ -5,7 +5,7 @@
$id = required_param( 'id', PARAM_INT ); // course
if (! $course = get_record("course", "id", $id)) {
- error("Course ID is incorrect");
+ print_error("Course ID is incorrect");
}
require_course_login($course, true);
diff --git a/mod/resource/lib.php b/mod/resource/lib.php
index 3cc8b2d62c0..252426f3a35 100644
--- a/mod/resource/lib.php
+++ b/mod/resource/lib.php
@@ -39,15 +39,15 @@ class resource_base {
if ($cmid) {
if (! $this->cm = get_coursemodule_from_id('resource', $cmid)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $this->course = get_record("course", "id", $this->cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $this->resource = get_record("resource", "id", $this->cm->instance)) {
- error("Resource ID was incorrect");
+ print_error("Resource ID was incorrect");
}
$this->strresource = get_string("modulename", "resource");
@@ -598,7 +598,7 @@ function resource_renamefiles($course, $wdir, $oldname, $name) {
$status .= "wwwroot/mod/resource/view.php?id=$resource->cmid\" target=\"_blank\">$resource->name: $resource->reference ==> $r->reference";
if (!empty($CFG->resource_autofilerename)) {
if (!update_record('resource', $r)) {
- error("Error updating resource with ID $r->id.");
+ print_error("Error updating resource with ID $r->id.");
}
}
}
diff --git a/mod/resource/mod_form.php b/mod/resource/mod_form.php
index ed7a6156904..b3dbe33a5a0 100644
--- a/mod/resource/mod_form.php
+++ b/mod/resource/mod_form.php
@@ -13,7 +13,7 @@ class mod_resource_mod_form extends moodleform_mod {
if($res = get_record('resource', 'id', (int)$this->_instance)) {
$type = $res->type;
} else {
- error('incorrect assignment');
+ print_error('incorrect assignment');
}
} else {
$type = required_param('type', PARAM_ALPHA);
diff --git a/mod/resource/type/directory/resource.class.php b/mod/resource/type/directory/resource.class.php
index 292e4616252..e517f034225 100644
--- a/mod/resource/type/directory/resource.class.php
+++ b/mod/resource/type/directory/resource.class.php
@@ -55,7 +55,7 @@ function display() {
if ($subdir) {
$relativepath = "$relativepath$subdir";
if (stripos($relativepath, 'backupdata') !== FALSE or stripos($relativepath, $CFG->moddata) !== FALSE) {
- error("Access not allowed!");
+ print_error("Access not allowed!");
}
$subs = explode('/', $subdir);
diff --git a/mod/resource/type/file/localfile.php b/mod/resource/type/file/localfile.php
index bf5232d7e80..29b3cae7ff9 100644
--- a/mod/resource/type/file/localfile.php
+++ b/mod/resource/type/file/localfile.php
@@ -8,7 +8,7 @@
require_login();
if (!$CFG->resource_allowlocalfiles) {
- error('You cannot access this script');
+ print_error('You cannot access this script');
}
print_header(get_string('localfilechoose', 'resource'));
diff --git a/mod/resource/view.php b/mod/resource/view.php
index aeb9c392c52..9a344baf71a 100644
--- a/mod/resource/view.php
+++ b/mod/resource/view.php
@@ -8,27 +8,27 @@
if ($r) { // Two ways to specify the resource
if (! $resource = get_record('resource', 'id', $r)) {
- error('Resource ID was incorrect');
+ print_error('Resource ID was incorrect');
}
if (! $cm = get_coursemodule_from_instance('resource', $resource->id, $resource->course)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
} else if ($id) {
if (! $cm = get_coursemodule_from_id('resource', $id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
if (! $resource = get_record('resource', 'id', $cm->instance)) {
- error('Resource ID was incorrect');
+ print_error('Resource ID was incorrect');
}
} else {
- error('No valid parameters!!');
+ print_error('No valid parameters!!');
}
if (! $course = get_record('course', 'id', $cm->course)) {
- error('Incorrect course id');
+ print_error('Incorrect course id');
}
require_course_login($course, true, $cm);
diff --git a/mod/scorm/aicc.php b/mod/scorm/aicc.php
index 64b2de3a26c..a17de5384b4 100755
--- a/mod/scorm/aicc.php
+++ b/mod/scorm/aicc.php
@@ -14,7 +14,7 @@
if (isset($SESSION->scorm_scoid)) {
$scoid = $SESSION->scorm_scoid;
} else {
- error('Invalid script call');
+ print_error('Invalid script call');
}
$mode = 'normal';
if (isset($SESSION->scorm_mode)) {
@@ -32,10 +32,10 @@
if ($sco = scorm_get_sco($scoid, SCO_ONLY)) {
if (!$scorm = get_record('scorm','id',$sco->scorm)) {
- error('Invalid script call');
+ print_error('Invalid script call');
}
} else {
- error('Invalid script call');
+ print_error('Invalid script call');
}
if ($scorm = get_record('scorm','id',$sco->scorm)) {
@@ -129,7 +129,7 @@
echo 'Max_Time_Allowed = '.$userdata->maxtimeallowed."\n";
echo 'Time_Limit_Action = '.$userdata->timelimitaction."\n";
} else {
- error('Sco not found');
+ print_error('Sco not found');
}
}
break;
diff --git a/mod/scorm/api.php b/mod/scorm/api.php
index 97b4c3817e8..c6dd808411f 100644
--- a/mod/scorm/api.php
+++ b/mod/scorm/api.php
@@ -11,26 +11,26 @@
if (!empty($id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $scorm = get_record("scorm", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else if (!empty($a)) {
if (! $scorm = get_record("scorm", "id", $a)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $scorm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
} else {
- error('A required parameter is missing');
+ print_error('A required parameter is missing');
}
require_login($course->id, false, $cm);
@@ -62,7 +62,7 @@
$userdata->$key = $value;
}
} else {
- error('Sco not found');
+ print_error('Sco not found');
}
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe
if (file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php')) {
diff --git a/mod/scorm/datamodel.php b/mod/scorm/datamodel.php
index d7c6d8766ea..c0a4e0c73ff 100755
--- a/mod/scorm/datamodel.php
+++ b/mod/scorm/datamodel.php
@@ -11,26 +11,26 @@
if (!empty($id)) {
if (! $cm = get_record("course_modules", "id", $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $scorm = get_record("scorm", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else if (!empty($a)) {
if (! $scorm = get_record("scorm", "id", $a)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $scorm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
} else {
- error('A required parameter is missing');
+ print_error('A required parameter is missing');
}
require_login($course->id, false, $cm);
diff --git a/mod/scorm/index.php b/mod/scorm/index.php
index 5e4fc4ffc13..72089d765e8 100755
--- a/mod/scorm/index.php
+++ b/mod/scorm/index.php
@@ -7,10 +7,10 @@
if (!empty($id)) {
if (! $course = get_record("course", "id", $id)) {
- error("Course ID is incorrect");
+ print_error("Course ID is incorrect");
}
} else {
- error('A required parameter is missing');
+ print_error('A required parameter is missing');
}
require_course_login($course);
diff --git a/mod/scorm/loadSCO.php b/mod/scorm/loadSCO.php
index fb3804656ff..f6225c44a75 100755
--- a/mod/scorm/loadSCO.php
+++ b/mod/scorm/loadSCO.php
@@ -10,26 +10,26 @@
if (!empty($id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
if (! $course = get_record('course', 'id', $cm->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
if (! $scorm = get_record('scorm', 'id', $cm->instance)) {
- error('Course module is incorrect');
+ print_error('Course module is incorrect');
}
} else if (!empty($a)) {
if (! $scorm = get_record('scorm', 'id', $a)) {
- error('Course module is incorrect');
+ print_error('Course module is incorrect');
}
if (! $course = get_record('course', 'id', $scorm->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
} else {
- error('A required parameter is missing');
+ print_error('A required parameter is missing');
}
require_login($course->id, false, $cm);
diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php
index 6440daa8426..5996e051305 100755
--- a/mod/scorm/locallib.php
+++ b/mod/scorm/locallib.php
@@ -467,7 +467,7 @@ function scorm_course_format_display($user,$course) {
// The module SCORM activity with the least id is the course
$scorm = current($scorms);
if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
$colspan = '';
$headertext = '| '.get_string('name').': '.format_string($scorm->name).'';
diff --git a/mod/scorm/player.php b/mod/scorm/player.php
index d6ca13d317f..7ac0f3f3720 100755
--- a/mod/scorm/player.php
+++ b/mod/scorm/player.php
@@ -17,26 +17,26 @@
if (!empty($id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $scorm = get_record("scorm", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else if (!empty($a)) {
if (! $scorm = get_record("scorm", "id", $a)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $scorm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
} else {
- error('A required parameter is missing');
+ print_error('A required parameter is missing');
}
require_login($course->id, false, $cm);
diff --git a/mod/scorm/report.php b/mod/scorm/report.php
index 661eac7c4c5..f60422ade4f 100755
--- a/mod/scorm/report.php
+++ b/mod/scorm/report.php
@@ -13,30 +13,30 @@
if (!empty($id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
if (! $course = get_record('course', 'id', $cm->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
if (! $scorm = get_record('scorm', 'id', $cm->instance)) {
- error('Course module is incorrect');
+ print_error('Course module is incorrect');
}
} else {
if (!empty($b)) {
if (! $sco = get_record('scorm_scoes', 'id', $b)) {
- error('Scorm activity is incorrect');
+ print_error('Scorm activity is incorrect');
}
$a = $sco->scorm;
}
if (!empty($a)) {
if (! $scorm = get_record('scorm', 'id', $a)) {
- error('Course module is incorrect');
+ print_error('Course module is incorrect');
}
if (! $course = get_record('course', 'id', $scorm->course)) {
- error('Course is misconfigured');
+ print_error('Course is misconfigured');
}
if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
}
}
@@ -44,7 +44,7 @@
require_login($course->id, false, $cm);
if (!has_capability('mod/scorm:viewreport', get_context_instance(CONTEXT_MODULE,$cm->id))) {
- error('You are not allowed to use this script');
+ print_error('You are not allowed to use this script');
}
add_to_log($course->id, 'scorm', 'report', 'report.php?id='.$cm->id, $scorm->id);
@@ -403,7 +403,7 @@
}
print_simple_box_end();
} else {
- error('Missing script parameter');
+ print_error('Missing script parameter');
}
}
diff --git a/mod/scorm/view.php b/mod/scorm/view.php
index cbfe4b16bde..19ecf86d5d7 100755
--- a/mod/scorm/view.php
+++ b/mod/scorm/view.php
@@ -9,26 +9,26 @@
if (!empty($id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $scorm = get_record("scorm", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else if (!empty($a)) {
if (! $scorm = get_record("scorm", "id", $a)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $scorm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
} else {
- error('A required parameter is missing');
+ print_error('A required parameter is missing');
}
require_login($course->id, false, $cm);
diff --git a/mod/survey/download.php b/mod/survey/download.php
index bb8f28cd112..eb966aae06a 100644
--- a/mod/survey/download.php
+++ b/mod/survey/download.php
@@ -9,18 +9,18 @@
$group = optional_param('group', 0, PARAM_INT);
if (! $cm = get_record("course_modules", "id", $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
require_login($course->id, false, $cm);
require_capability('mod/survey:download', get_context_instance(CONTEXT_MODULE, $cm->id)) ;
if (! $survey = get_record("survey", "id", $cm->instance)) {
- error("Survey ID was incorrect");
+ print_error("Survey ID was incorrect");
}
add_to_log($course->id, "survey", "download", "download.php?id=$cm->id&type=$type", "$survey->id", $cm->id);
@@ -99,7 +99,7 @@
// Get and collate all the results in one big array
if (! $aaa = get_records("survey_answers", "survey", "$survey->id", "time ASC")) {
- error("There are no answers for this survey yet.");
+ print_error("There are no answers for this survey yet.");
}
foreach ($aaa as $a) {
@@ -153,7 +153,7 @@
$col = 0;
$row++;
if (! $u = get_record("user", "id", $user)) {
- error("Error finding student # $user");
+ print_error("Error finding student # $user");
}
if ($n = get_record("survey_analysis", "survey", $survey->id, "userid", $user)) {
$notes = $n->notes;
@@ -223,7 +223,7 @@
$col = 0;
$row++;
if (! $u = get_record("user", "id", $user)) {
- error("Error finding student # $user");
+ print_error("Error finding student # $user");
}
if ($n = get_record("survey_analysis", "survey", $survey->id, "userid", $user)) {
$notes = $n->notes;
@@ -283,7 +283,7 @@
foreach ($results as $user => $rest) {
if (! $u = get_record("user", "id", $user)) {
- error("Error finding student # $user");
+ print_error("Error finding student # $user");
}
echo $survey->id."\t";
echo strip_tags(format_string($survey->name,true))."\t";
diff --git a/mod/survey/graph.php b/mod/survey/graph.php
index 62e10d58ccd..4d2e9c5edc7 100644
--- a/mod/survey/graph.php
+++ b/mod/survey/graph.php
@@ -11,11 +11,11 @@
$qid = optional_param('qid', 0, PARAM_INT); // Group ID
if (! $cm = get_coursemodule_from_id('survey', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
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 ) {
- error("Sorry, you aren't allowed to see this.");
+ print_error("Sorry, you aren't allowed to see this.");
} else if ($groupmode and !groups_is_member($group)) {
- error("Sorry, you aren't allowed to see this.");
+ print_error("Sorry, you aren't allowed to see this.");
}
}
if (! $survey = get_record("survey", "id", $cm->instance)) {
- error("Survey ID was incorrect");
+ print_error("Survey ID was incorrect");
}
/// Check to see if groups are being used in this survey
diff --git a/mod/survey/index.php b/mod/survey/index.php
index 217bb13ae8a..26327b212f0 100644
--- a/mod/survey/index.php
+++ b/mod/survey/index.php
@@ -6,7 +6,7 @@
$id = required_param('id', PARAM_INT); // Course Module ID
if (! $course = get_record("course", "id", $id)) {
- error("Course ID is incorrect");
+ print_error("Course ID is incorrect");
}
require_course_login($course);
diff --git a/mod/survey/mod_form.php b/mod/survey/mod_form.php
index 2c0f4696fe1..573f1256bf4 100644
--- a/mod/survey/mod_form.php
+++ b/mod/survey/mod_form.php
@@ -18,7 +18,7 @@ class mod_survey_mod_form extends moodleform_mod {
$mform->addRule('name', null, 'required', null, 'client');
if (!$options = get_records_menu("survey", "template", 0, "name", "id, name")) {
- error('No survey templates found!');
+ print_error('No survey templates found!');
}
foreach ($options as $id => $name) {
diff --git a/mod/survey/report.php b/mod/survey/report.php
index a585b73f546..ea1a154c56d 100644
--- a/mod/survey/report.php
+++ b/mod/survey/report.php
@@ -16,11 +16,11 @@
$qid = implode (',', $qids);
if (! $cm = get_coursemodule_from_id('survey', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
require_login($course->id, false, $cm);
@@ -30,11 +30,11 @@
require_capability('mod/survey:readresponses', $context);
if (! $survey = get_record("survey", "id", $cm->instance)) {
- error("Survey ID was incorrect");
+ print_error("Survey ID was incorrect");
}
if (! $template = get_record("survey", "id", $survey->template)) {
- error("Template ID was incorrect");
+ print_error("Template ID was incorrect");
}
$showscales = ($template->name != 'ciqname');
@@ -257,7 +257,7 @@
case "question":
if (!$question = get_record("survey_questions", "id", $qid)) {
- error("Question doesn't exist");
+ print_error("Question doesn't exist");
}
$question->text = get_string($question->text, "survey");
@@ -317,7 +317,7 @@
case "student":
if (!$user = get_record("user", "id", $student)) {
- error("Student doesn't exist");
+ print_error("Student doesn't exist");
}
print_heading(get_string("analysisof", "survey", fullname($user)));
diff --git a/mod/survey/save.php b/mod/survey/save.php
index 5998987c045..328ab4a2d63 100644
--- a/mod/survey/save.php
+++ b/mod/survey/save.php
@@ -7,17 +7,17 @@
// Make sure this is a legitimate posting
if (!$formdata = data_submitted("$CFG->wwwroot/mod/survey/view.php")) {
- error("You are not supposed to use this script like that.");
+ print_error("You are not supposed to use this script like that.");
}
$id = required_param('id', PARAM_INT); // Course Module ID
if (! $cm = get_coursemodule_from_id('survey', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
require_login($course->id, false, $cm);
@@ -26,7 +26,7 @@
require_capability('mod/survey:participate', $context);
if (! $survey = get_record("survey", "id", $cm->instance)) {
- error("Survey ID was incorrect");
+ print_error("Survey ID was incorrect");
}
add_to_log($course->id, "survey", "submit", "view.php?id=$cm->id", "$survey->id", "$cm->id");
@@ -83,7 +83,7 @@
}
if (! insert_record("survey_answers", $newdata)) {
- error("Encountered a problem trying to store your results. Sorry.");
+ print_error("Encountered a problem trying to store your results. Sorry.");
}
}
diff --git a/mod/survey/view.php b/mod/survey/view.php
index 230ee0061e3..bf1e346d10d 100644
--- a/mod/survey/view.php
+++ b/mod/survey/view.php
@@ -6,11 +6,11 @@
$id = required_param('id', PARAM_INT); // Course Module ID
if (! $cm = get_coursemodule_from_id('survey', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
require_login($course->id, false, $cm);
@@ -20,7 +20,7 @@
require_capability('mod/survey:participate', $context);
if (! $survey = get_record("survey", "id", $cm->instance)) {
- error("Survey ID was incorrect");
+ print_error("Survey ID was incorrect");
}
$trimmedintro = trim($survey->intro);
if (empty($trimmedintro)) {
@@ -29,7 +29,7 @@
}
if (! $template = get_record("survey", "id", $survey->template)) {
- error("Template ID was incorrect");
+ print_error("Template ID was incorrect");
}
$showscales = ($template->name != 'ciqname');
@@ -115,7 +115,7 @@
// Get all the major questions and their proper order
if (! $questions = get_records_list("survey_questions", "id", $survey->questions)) {
- error("Couldn't find any questions in this survey!!");
+ print_error("Couldn't find any questions in this survey!!");
}
$questionorder = explode( ",", $survey->questions);
diff --git a/mod/wiki/admin.php b/mod/wiki/admin.php
index 77c207a3ab6..fea6e1a2dca 100644
--- a/mod/wiki/admin.php
+++ b/mod/wiki/admin.php
@@ -14,26 +14,26 @@
if ($id) {
if (! $cm = get_coursemodule_from_id('wiki', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $wiki = get_record("wiki", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else {
if (! $wiki = get_record("wiki", "id", $a)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $wiki->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("wiki", $wiki->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
}
@@ -58,18 +58,18 @@
/// Is an Action given ?
if(!$action) {
- error(get_string("noadministrationaction","wiki"));
+ print_error("noadministrationaction","wiki");
}
/// Correct Action ?
if(!in_array($action, array("setpageflags", "removepages", "strippages", "checklinks", "revertpages"))) {
- error("Unknown action '$action'","wiki");
+ print_error("Unknown action '$action'","wiki");
}
/// May the User administrate it ?
if (($wiki_entry = wiki_get_entry($wiki, $course, $userid, $groupid)) === false || wiki_can_edit_entry($wiki_entry, $wiki, $USER, $course) === false) {
- error(get_string("notadministratewiki","wiki"));
+ print_error("notadministratewiki","wiki");
}
$canedit = wiki_can_edit_entry($wiki_entry, $wiki, $USER, $course);
@@ -77,7 +77,7 @@
if(in_array($action,array("removepages","strippages","revertpages"))) {
if(!($wiki->wtype=="student" || ($wiki->wtype=="group" and $canedit) || wiki_is_teacher($wiki))) {
add_to_log($course->id, "wiki", "hack", "", $wiki->name.": Tried to trick admin.php with action=$action.");
- error("Hack attack detected !");
+ print_error("Hack attack detected !");
}
}
@@ -214,7 +214,7 @@
}
}
break;
- default: error("No such Wiki-Admin action: $action");
+ default: print_error("No such Wiki-Admin action: $action");
break;
}
}
@@ -228,7 +228,7 @@
if(!$ret) {
redirect($redirect, get_string("pagesremoved","wiki"), 1);
} else {
- error($ret);
+ print_error($ret);
}
exit;
case "strippages":
@@ -240,7 +240,7 @@
if(!$ret) {
redirect($redirect, get_string("pagesstripped","wiki"), 1);
} else {
- error($ret);
+ print_error($ret);
}
exit;
case "checklinks":
@@ -254,7 +254,7 @@
case "setpageflags":
# No confirmation needed
break;
- default: error("No such action '$action' with confirmation");
+ default: print_error("No such action '$action' with confirmation");
}
}
diff --git a/mod/wiki/ewiki/ewiki.php b/mod/wiki/ewiki/ewiki.php
index 6b38174ae73..4ba72c4ae81 100644
--- a/mod/wiki/ewiki/ewiki.php
+++ b/mod/wiki/ewiki/ewiki.php
@@ -299,9 +299,9 @@
// Binary Handling starts here
#### MOODLE CHANGE TO BE COMPATIBLE WITH PHP 4.1
#if(headers_sent($file,$line)) {
- # error("Headers already sent: $file:$line");
+ # print_error("Headers already sent: $file:$line");
if(headers_sent()) {
- error("Headers already sent.");
+ print_error("Headers already sent.");
}
$pf($GLOBALS);
}
diff --git a/mod/wiki/ewiki/plugins/moodle/moodle_binary_store.php b/mod/wiki/ewiki/plugins/moodle/moodle_binary_store.php
index 0d05f959c93..f2ef2b5c921 100644
--- a/mod/wiki/ewiki/plugins/moodle/moodle_binary_store.php
+++ b/mod/wiki/ewiki/plugins/moodle/moodle_binary_store.php
@@ -42,12 +42,12 @@ function moodle_binary_get_path($id, $meta, $course, $wiki, $userid, $groupid) {
global $CFG;
$entry=wiki_get_entry($wiki, $course, $userid, $groupid);
if(!$entry) {
- error("Cannot get entry.");
+ print_error("Cannot get entry.");
}
$dir=make_upload_directory("$course->id/$CFG->moddata/wiki/$wiki->id/$entry->id/".$meta["section"]);
if(substr($id, 0, strlen(EWIKI_IDF_INTERNAL))!=EWIKI_IDF_INTERNAL) {
- error("Binary entry does not start with ".EWIKI_IDF_INTERNAL.substr($id, 0, strlen(EWIKI_IDF_INTERNAL)));
+ print_error("Binary entry does not start with ".EWIKI_IDF_INTERNAL.substr($id, 0, strlen(EWIKI_IDF_INTERNAL)));
}
$id = substr($id,strlen(EWIKI_IDF_INTERNAL));
$id = clean_filename($id);
@@ -61,14 +61,14 @@ function moodle_binary_store_file(&$filename, &$id, &$meta, $ext=".bin") {
# READ-Only
global $_FILES, $CFG, $course, $wiki, $groupid, $userid, $ewiki_title, $cm;
if(!$wiki->ewikiacceptbinary) {
- error("This wiki does not accept binaries");
+ print_error("This wiki does not accept binaries");
return 0;
}
$entry=wiki_get_entry($wiki, $course, $userid, $groupid);
if(!$entry->id) {
- error("Cannot get entry.");
+ print_error("Cannot get entry.");
}
require_once($CFG->dirroot.'/lib/uploadlib.php');
@@ -81,7 +81,7 @@ function moodle_binary_store_file(&$filename, &$id, &$meta, $ext=".bin") {
}
return true;
}
- error($um->print_upload_log(true));
+ print_error($um->print_upload_log(true));
return false;
}
@@ -94,7 +94,7 @@ function moodle_binary_store_get_file($id, &$meta) {
#-- check for file
if(!$wiki->ewikiacceptbinary) {
- error("This wiki does not accept binaries");
+ print_error("This wiki does not accept binaries");
return 0;
}
diff --git a/mod/wiki/ewiki/plugins/moodle/moodle_wikidump.php b/mod/wiki/ewiki/plugins/moodle/moodle_wikidump.php
index 1d9fded5b06..1e857bd7195 100644
--- a/mod/wiki/ewiki/plugins/moodle/moodle_wikidump.php
+++ b/mod/wiki/ewiki/plugins/moodle/moodle_wikidump.php
@@ -239,7 +239,7 @@ function ewiki_page_wiki_dump_send($exportbinaries=0, $exportformats=0, $withvir
$exportdir=$CFG->dataroot."/".$course->id."/".$exportdestinations;
} else {
add_to_log($course->id, "wiki", "hack", "", format_string($wiki->name,true).": Tried to export a wiki as non-teacher into $exportdestinations.");
- error("You are not a teacher !");
+ print_error("You are not a teacher !");
}
} else {
$exportbasedir=tempnam("/tmp","WIKIEXPORT");
@@ -249,7 +249,7 @@ function ewiki_page_wiki_dump_send($exportbinaries=0, $exportformats=0, $withvir
$exportdir=$exportbasedir."/".$wname;
@mkdir($exportdir);
if(!is_dir($exportdir)) {
- error("Cannot create temporary directory $exportdir !");
+ print_error("Cannot create temporary directory $exportdir !");
}
}
@@ -346,12 +346,12 @@ function ewiki_page_wiki_dump_send($exportbinaries=0, $exportformats=0, $withvir
#-- add file
// Let's make sure the file exists and is writable first.
if (!$handle = fopen($exportdir."/".$fn, 'w')) {
- error("Cannot open file ($exportdir/$fn)");
+ print_error("Cannot open file ($exportdir/$fn)");
}
// Write $content to our opened file.
if (fwrite($handle, $content) === FALSE) {
- error("Cannot write to file ($exportdir/$fn)");
+ print_error("Cannot write to file ($exportdir/$fn)");
}
fclose($handle);
@@ -387,12 +387,12 @@ function ewiki_page_wiki_dump_send($exportbinaries=0, $exportformats=0, $withvir
// Let's make sure the file exists and is writable first.
$indexname="index".$html_ext;
if (!$handle = fopen($exportdir."/".$indexname, 'w')) {
- error("Cannot open file ($exportdir/$indexname)");
+ print_error("Cannot open file ($exportdir/$indexname)");
}
// Write $somecontent to our opened file.
if (fwrite($handle, $str_formatted) === FALSE) {
- error("Cannot write to file ($exportdir/$indexname)");
+ print_error("Cannot write to file ($exportdir/$indexname)");
}
fclose($handle);
@@ -418,10 +418,10 @@ function ewiki_page_wiki_dump_send($exportbinaries=0, $exportformats=0, $withvir
Header("X-Content-Type: application/zip");
Header("Content-Location: $archivename");
if(!@readfile("$exportbasedir/$archivename")) {
- error("Cannot read $exportbasedir/$archivename");
+ print_error("Cannot read $exportbasedir/$archivename");
}
if(!deldir($exportbasedir)) {
- error("Cannot delete $exportbasedir");
+ print_error("Cannot delete $exportbasedir");
}
#exit();
return false;
diff --git a/mod/wiki/index.php b/mod/wiki/index.php
index 313891df4ad..20927812ecd 100644
--- a/mod/wiki/index.php
+++ b/mod/wiki/index.php
@@ -9,7 +9,7 @@
$id = required_param('id', PARAM_INT); // course
if (! $course = get_record("course", "id", $id)) {
- error("Course ID is incorrect");
+ print_error("Course ID is incorrect");
}
require_course_login($course);
diff --git a/mod/wiki/lib.php b/mod/wiki/lib.php
index 66a20665617..64e27166457 100644
--- a/mod/wiki/lib.php
+++ b/mod/wiki/lib.php
@@ -29,7 +29,7 @@ function wiki_context($wiki) {
$wiki = $wiki->id;
}
if (! $cm = get_coursemodule_from_instance('wiki', $wiki)) {
- error('Course Module ID was incorrect');
+ print_error('Course Module ID was incorrect');
}
return get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -409,7 +409,7 @@ function wiki_get_default_entry(&$wiki, &$course, $userid=0, $groupid=0) {
// Whatever groups are in the course, pick one
$coursegroups = groups_get_all_groups($course->id);
if(!$coursegroups || count($coursegroups)==0) {
- error("Can't access wiki in group mode when no groups are configured for the course");
+ print_error("Can't access wiki in group mode when no groups are configured for the course");
}
$unkeyed=array_values($coursegroups); // Make sure first item is index 0
$groupid=$unkeyed[0]->id;
@@ -421,7 +421,7 @@ function wiki_get_default_entry(&$wiki, &$course, $userid=0, $groupid=0) {
if (wiki_can_add_entry($wiki, $USER, $course, $userid, $groupid)) {
wiki_add_entry($wiki, $course, $userid, $groupid);
if (($wiki_entry = wiki_get_entry($wiki, $course, $userid, $groupid)) === false) {
- error("Could not add wiki entry.");
+ print_error("Could not add wiki entry.");
}
}
}
@@ -465,7 +465,7 @@ function wiki_get_entry(&$wiki, &$course, $userid=0, $groupid=0) {
// Whatever groups are in the course, pick one
$coursegroups = groups_get_all_groups($course->id);
if(!$coursegroups || count($coursegroups)==0) {
- error("Can't access wiki in group mode when no groups are configured for the course");
+ print_error("Can't access wiki in group mode when no groups are configured for the course");
}
$unkeyed=array_values($coursegroups); // Make sure first item is index 0
$groupid=$unkeyed[0]->id;
@@ -477,7 +477,7 @@ function wiki_get_entry(&$wiki, &$course, $userid=0, $groupid=0) {
if ($groupid and wiki_user_can_access_group_wiki($wiki, $groupid, $course)) {
$wentry = wiki_get_group_entry($wiki, $groupid);
} else {
- error("Cannot access any groups for this wiki");
+ print_error("Cannot access any groups for this wiki");
}
}
/// If mode is 'nogroups', then groupid is zero.
@@ -1684,7 +1684,7 @@ function wiki_obtain_lock($wikiid,$pagename) {
} else {
// Not locked any more. Get rid of the old lock record.
if(!delete_records('wiki_locks','pagename',$pagename,'wikiid', $wikiid)) {
- error('Unable to delete lock record');
+ print_error('Unable to delete lock record');
}
}
}
@@ -1699,7 +1699,7 @@ function wiki_obtain_lock($wikiid,$pagename) {
$newlock->wikiid=$wikiid;
$newlock->pagename=$pagename;
if(!$lockid=insert_record('wiki_locks',$newlock)) {
- error('Unable to insert lock record');
+ print_error('Unable to insert lock record');
}
}
@@ -1734,7 +1734,7 @@ function wiki_release_lock($wikiid,$pagename) {
$lockid=$_SESSION[SESSION_WIKI_LOCKS][$key];
unset($_SESSION[SESSION_WIKI_LOCKS][$key]);
if(!delete_records('wiki_locks','id',$lockid)) {
- error("Unable to delete lock record.");
+ print_error("Unable to delete lock record.");
}
}
}
diff --git a/mod/wiki/overridelock.php b/mod/wiki/overridelock.php
index 0b83b9bed57..1aa088b5094 100644
--- a/mod/wiki/overridelock.php
+++ b/mod/wiki/overridelock.php
@@ -15,36 +15,36 @@ $id=required_param('id',PARAM_INT);
$page=required_param('page',PARAM_RAW);
if (! $cm = get_coursemodule_from_id('wiki', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $wiki = get_record("wiki", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if(!confirm_sesskey()) {
- error("Session key not set");
+ print_error("Session key not set");
}
if(!data_submitted()) {
- error("Only POST requests accepted");
+ print_error("Only POST requests accepted");
}
require_course_login($course, true, $cm);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
if(!has_capability('mod/wiki:overridelock', $modcontext)) {
- error("You do not have the capability to override editing locks");
+ print_error("You do not have the capability to override editing locks");
}
$actions = explode('/', $page,2);
if(count($actions)!=2) {
- error("Unsupported page value");
+ print_error("Unsupported page value");
}
$pagename=addslashes($actions[1]);
if(!delete_records('wiki_locks','pagename',$pagename,'wikiid', $wiki->id)) {
- error('Unable to delete lock record');
+ print_error('Unable to delete lock record');
}
redirect("view.php?id=$id&page=".urlencode($page));
diff --git a/mod/wiki/view.php b/mod/wiki/view.php
index f2439cc1a49..b832e1771b6 100644
--- a/mod/wiki/view.php
+++ b/mod/wiki/view.php
@@ -38,26 +38,26 @@
if ($id) {
if (! $cm = get_coursemodule_from_id('wiki', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $wiki = get_record("wiki", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else {
if (! $wiki = get_record("wiki", "id", $wid)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $wiki->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("wiki", $wiki->id, $course->id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
$id = $cm->id;
$_REQUEST["id"] = $id;
@@ -102,7 +102,7 @@
list($ok,$lock)=wiki_obtain_lock($wiki_entry->id,$pagename);
if(!$ok) {
$strsavenolock=get_string('savenolock','wiki');
- error($strsavenolock,$CFG->wwwroot.'/mod/wiki/view.php?id='.$cm->id.'&page=view/'.urlencode($pagename));
+ print_error($strsavenolock, '', $CFG->wwwroot.'/mod/wiki/view.php?id='.$cm->id.'&page=view/'.urlencode($pagename));
}
}
diff --git a/mod/workshop/assess.php b/mod/workshop/assess.php
index 3a1a8a5dd61..7275ed3639e 100644
--- a/mod/workshop/assess.php
+++ b/mod/workshop/assess.php
@@ -11,16 +11,16 @@
$sid = optional_param('sid', 0, PARAM_INT);
if (! $submission = get_record('workshop_submissions', 'id', $sid)) {
- error("Incorrect submission id");
+ print_error("Incorrect submission id");
}
if (! $workshop = get_record("workshop", "id", $submission->workshopid)) {
- error("Submission is incorrect");
+ print_error("Submission is incorrect");
}
if (! $course = get_record("course", "id", $workshop->course)) {
- error("Workshop is misconfigured");
+ print_error("Workshop is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $course->id)) {
- error("No coursemodule found");
+ print_error("No coursemodule found");
}
require_login($course->id, false, $cm);
@@ -89,7 +89,7 @@
$assessment->generalcomment = '';
$assessment->teachercomment = '';
if (!$assessment->id = insert_record("workshop_assessments", $assessment)) {
- error("Could not insert workshop assessment!");
+ print_error("Could not insert workshop assessment!");
}
// if it's the teacher and the workshop is error banded set all the elements to Yes
if (workshop_is_teacher($workshop) and ($workshop->gradingstrategy == 2)) {
@@ -101,7 +101,7 @@
$element->feedback = '';
$element->grade = 1;
if (!$element->id = insert_record("workshop_grades", $element)) {
- error("Could not insert workshop grade!");
+ print_error("Could not insert workshop grade!");
}
}
// now set the adjustment
@@ -112,7 +112,7 @@
$element->elementno = $i;
$element->grade = 0;
if (!$element->id = insert_record("workshop_grades", $element)) {
- error("Could not insert workshop grade!");
+ print_error("Could not insert workshop grade!");
}
}
}
diff --git a/mod/workshop/assessments.php b/mod/workshop/assessments.php
index 7bb8e974332..db1c8d09cd0 100644
--- a/mod/workshop/assessments.php
+++ b/mod/workshop/assessments.php
@@ -43,23 +43,23 @@
// get some useful stuff...
if ($id) {
if (! $cm = get_coursemodule_from_id('workshop', $id)) {
- error("Course Module ID was incorrect");
+ print_error("Course Module ID was incorrect");
}
if (! $workshop = get_record("workshop", "id", $cm->instance)) {
- error("Course module is incorrect");
+ print_error("Course module is incorrect");
}
} else if ($wid) {
if (! $workshop = get_record("workshop", "id", $wid)) {
- error("Workshop id is incorrect");
+ print_error("Workshop id is incorrect");
}
if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $workshop->course)) {
- error("No coursemodule found");
+ print_error("No coursemodule found");
}
} else {
- error("No id given");
+ print_error("No id given");
}
if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
+ print_error("Course is misconfigured");
}
require_login($course->id, false, $cm);
@@ -80,11 +80,11 @@
print_heading_with_help(get_string("addacomment", "workshop"), "addingacomment", "workshop");
// get assessment record
if (!$assessmentid = $aid) { // comes from link or hidden form variable
- error("Assessment id not given");
+ print_error("Assessment id not given");
}
$assessment = get_record("workshop_assessments", "id", $assessmentid);
if (!$submission = get_record("workshop_submissions", "id", $assessment->submissionid)) {
- error("Submission not found");
+ print_error("Submission not found");
}
?>
|
|