]> git.mjollnir.org Git - moodle.git/commitdiff
Some extensions to print_error to make it more useful for admin pages
authormoodler <moodler>
Fri, 5 Jan 2007 08:18:26 +0000 (08:18 +0000)
committermoodler <moodler>
Fri, 5 Jan 2007 08:18:26 +0000 (08:18 +0000)
lib/weblib.php

index a0adbdf803a0f48f278179ff57310a63d69f72e2..cd21ca38f3e93ca8475c2bc0373643088b4d181f 100644 (file)
@@ -4530,7 +4530,7 @@ function print_scale_menu_helpbutton($courseid, $scale, $return=false) {
  * @param string $message The message to display to the user about the error.
  * @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 error ($message, $link='', $adminroot='') {
+function error ($message, $link='', $adminroot=false) {
 
     global $CFG, $SESSION;
     $message = clean_text($message);   // In case nasties are in here
@@ -4563,17 +4563,21 @@ function error ($message, $link='', $adminroot='') {
             $link = $CFG->wwwroot .'/';
         }
     }
-    print_continue($link);
 
     if ($adminroot) {
         admin_externalpage_print_footer($adminroot);
     } else {
+        print_continue($link);
         print_footer();
     }
     for ($i=0;$i<512;$i++) {  // Padding to help IE work with 404
         echo ' ';
     }
 
+    if ($continue) {
+        return true;
+    }
+
     die;
 }
 
@@ -4585,8 +4589,9 @@ function error ($message, $link='', $adminroot='') {
  * @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.
  * @param object $a Extra words and phrases that might be required in the error string
+ * @param boolean $adminroot Is the page an admin settings page?
  */
-function print_error ($errorcode, $module='', $link='', $a=NULL) {
+function print_error ($errorcode, $module='', $link='', $a=NULL, $adminroot=false) {
 
     global $CFG;
 
@@ -4609,7 +4614,7 @@ function print_error ($errorcode, $module='', $link='', $a=NULL) {
                '<p class="errorcode">'.
                '<a href="'.$errordocroot.'/en/error/'.$modulelink.'/'.$errorcode.'">'.
                  get_string('moreinformation').'</a></p>';
-    error($message, $link);
+    error($message, $link, $adminroot);
 }
 /**
  * Returns a string of html with an image of a help icon linked to a help page on a number of help topics.