require_login($course->id);
if (!isteacher($course->id)) {
- print_error('mustbeteacher',$CFG->wwwroot.'/course/view.php?id='.$course->id);
+ print_error('mustbeteacher', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
$strparticipation = get_string('participationreport');
if (!$modules = get_records_sql('SELECT DISTINCT module,name FROM '.$CFG->prefix.'course_modules cm JOIN '.
$CFG->prefix.'modules m ON cm.module = m.id WHERE course = '.$course->id)) {
- print_error('noparticipatorycms',$CFG->wwwroot.'/course/view.php?id='.$course->id);
+ print_error('noparticipatorycms', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
-<?php
+<?php // $Id$
$strparticipation = get_string('participationreport');
$strviews = get_string('views');
if (!$modules = get_records_sql('SELECT DISTINCT module,name FROM '.$CFG->prefix.'course_modules cm JOIN '.
$CFG->prefix.'modules m ON cm.module = m.id WHERE course = '.$course->id)) {
- print_error('noparticipatorycms',$CFG->wwwroot.'/course/view.php?id='.$course->id);
+ print_error('noparticipatorycms','', $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
$string['moodledocslink'] = 'Moodle Docs for this page';
$string['moodleversion'] = 'Moodle Version';
$string['more'] = 'more';
+$string['moreinformation'] = 'More information about this error';
$string['mostrecently'] = 'most recently';
$string['move'] = 'Move';
$string['movecategoryto'] = 'Move category to:';
* @param string $errorcode The name of the string from error.php to print
* @param string $link The url where the user will be prompted to continue. If no url is provided the user will be directed to the site index page.
*/
-function print_error ($errorcode, $link='') {
+function print_error ($errorcode, $module='', $link='') {
- $message = get_string($errorcode, 'error').
- '<p class="code">(<a href="http://docs.moodle.org/en/error/'.$errorcode.'">'.$errorcode.'</a>)</p>';
+ global $CFG;
+
+ if (empty($module) || $module == 'moodle' || $module == 'core') {
+ $module = 'error';
+ $modulelink = 'moodle';
+ } else {
+ $modulelink = $module;
+ }
+
+ if (!empty($CFG->errordocroot)) {
+ $errordocroot = $CFG->errordocroot;
+ } else if (!empty($CFG->docroot)) {
+ $errordocroot = $CFG->docroot;
+ } else {
+ $errordocroot = 'http://docs.moodle.org';
+ }
+
+ $message = '<p class="errormessage">'.get_string($errorcode, $module).'</p>'.
+ '<p class="errorcode">'.
+ '<a href="'.$errordocroot.'/en/error/'.$modulelink.'/'.$errorcode.'">'.
+ get_string('moreinformation').'</a></p>';
error($message, $link);
}