]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19789 Upgraded calls to helpbutton, print_simple_box* and notify
authornicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 04:29:16 +0000 (04:29 +0000)
committernicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 04:29:16 +0000 (04:29 +0000)
backup/backup.php
backup/backup_check.html
backup/backup_execute.html
backup/backup_form.html
backup/backuplib.php
backup/bb/restore_bb.php
backup/restore.php
backup/restore_check.html
backup/restore_execute.html
backup/restore_form.html
backup/restorelib.php

index d0d36901c67e3002216dd220cdaa580e7996af52..94a72c1c1aa6be96fee0f893c19d74f4491e0a7b 100644 (file)
 
         if ($courses = get_courses('all','c.shortname','c.id,c.shortname,c.fullname')) {
             echo $OUTPUT->heading(get_string("choosecourse"));
-            print_simple_box_start("center");
+            echo $OUTPUT->box_start();
             foreach ($courses as $course) {
                 echo '<a href="backup.php?id='.$course->id.'">'.format_string($course->fullname).' ('.format_string($course->shortname).')</a><br />'."\n";
             }
-            print_simple_box_end();
+            echo $OUTPUT->box_end();
         } else {
             echo $OUTPUT->heading(get_string("nocoursesyet"));
-            print_continue("$CFG->wwwroot/$CFG->admin/index.php");
+            echo $OUTPUT->continue_button("$CFG->wwwroot/$CFG->admin/index.php");
         }
         echo $OUTPUT->footer();
         exit;
 
     //Print form
     echo $OUTPUT->heading(format_string("$strcoursebackup: $course->fullname ($course->shortname)"));
-    print_simple_box_start("center");
+    echo $OUTPUT->box_start();
 
     //Adjust some php variables to the execution of this script
     @ini_set("max_execution_time","3000");
     } else if ($launch == "execute") {
         include_once("backup_execute.html");
     }
-    print_simple_box_end();
+    echo $OUTPUT->box_end();
 
     //Print footer
     echo $OUTPUT->footer();
index 94d92b623691716def9c87fbe7ea60e28a2d787b..51d46763fc27db877a2e6677d686344de93c72a6 100644 (file)
         $backupprefs->backup_blogs = 0;
         $backupprefs->backuproleassignments = array();
 
-        print_simple_box("<font color=\"red\">".get_string("backupnoneusersinfo")."</font>","center", "70%", '', "20", "noticebox");
+        echo $OUTPUT->box(get_string("backupnoneusersinfo"), "noticebox");
         echo "<hr />";
     }
 
index 1ca0344b411b792af88ce0550ebaa2d3c228f96a..fd16937f5015a5f51592e188765f4319a5b05f1e 100644 (file)
 
     if (empty($to)) {
         //Print final message
-        print_simple_box(get_string("backupfinished"),"center");
+        echo $OUTPUT->box(get_string("backupfinished"));
         $context = get_context_instance(CONTEXT_COURSE, $course->id);
-        print_continue("$CFG->wwwroot/files/index.php?contextid=".$context->id."&amp;filearea=course_backup&amp;itemid=0");    
+        echo $OUTPUT->continue_button("$CFG->wwwroot/files/index.php?contextid=".$context->id."&filearea=course_backup&itemid=0");    
     } else {
-        print_simple_box(get_string('importdataexported'),"CENTER");
+        echo $OUTPUT->box(get_string('importdataexported'));
         if (!empty($preferences->backup_destination)) {
             $filename = $preferences->backup_destination."/".$preferences->backup_name;
         } else {
@@ -88,7 +88,7 @@
         }
         error_log($filename);
         $SESSION->import_preferences = $preferences;
-        print_continue($CFG->wwwroot.'/course/import/activities/index.php?id='.$to.'&fromcourse='.$id.'&filename='.$filename);
+        echo $OUTPUT->continue_button($CFG->wwwroot.'/course/import/activities/index.php?id='.$to.'&fromcourse='.$id.'&filename='.$filename);
     }
 
     $SESSION->backupprefs[$course->id] = null; // unset it so we're clear next time.
index 45d8854ab2aa29a60540bf6d0c17ee01cc81db0d..e3ab9507dd3367af8754184df08afeb9aca1cbec 100644 (file)
@@ -270,7 +270,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
             echo "<tr>";
             echo "<td align=\"right\" colspan=\"2\"><b>";
             echo '<label for="menubackup_site_files">'.get_string ("sitefilesused").'</label>';
-            helpbutton('sitefilesused', get_string('sitefilesused'));
+            echo $OUTPUT->help_icon(moodle_help_icon::make('sitefilesused', get_string('sitefilesused')));
             echo "</b></td><td colspan=\"2\">";
             $course_file_options[0] = get_string("no");
             $course_file_options[1] = get_string("yes");
index 97a79ad62ccce81f85b18eed9db9440f1c6535e5..a0f0ae19686f82ea0c19b66c7d80e95697440dff 100644 (file)
     //This function makes all the necesary calls to every mod
     //to export itself and its files !!!
     function backup_module($bf,$preferences,$module) {
-        global $CFG, $DB;
+        global $CFG, $DB, $OUTPUT;
 
         $status = true;
         $statusm = true;
                             $errorstr = 'backup of '.$module.'-'.$object->name.' failed.';
                             add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                             if (!defined('BACKUP_SILENTLY')) {
-                                notify($errorstr);
+                                echo $OUTPUT->notification($errorstr);
                             }
                             $status = false;
                         }
     }
 
     function backup_execute(&$preferences, &$errorstr) {
-        global $CFG, $DB;
+        global $CFG, $DB, $OUTPUT;
         $status = true;
 
         //Check for temp and backup and backup_unique_code directory
             $errorstr = "An error occurred deleting old backup data";
             add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
             if (!defined('BACKUP_SILENTLY')) {
-                notify ($errorstr);
+                echo $OUTPUT->notification($errorstr);
             }
         }
 
                     $errorstr = "An error occurred while backing up general info";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up course start";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up metacourse info";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up course blocks";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up course sections";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up user info";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up messages";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up blogs";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up quiz categories";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                         $errorstr = "An error occurred while backing up log info";
                         add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                         if (!defined('BACKUP_SILENTLY')) {
-                            notify($errorstr);
+                            echo $OUTPUT->notification($errorstr);
                         } else {
                             return false;
                         }
                     $errorstr = "An error occurred while backing up scales";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errostr = "An error occurred while backing up groups";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errostr);
+                        echo $OUTPUT->notification($errostr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up groupings";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up groupings groups";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up events";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while backing up gradebook";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                         $errorstr = "An error occurred while backing up module info";
                         add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                         if (!defined('BACKUP_SILENTLY')) {
-                            notify($errorstr);
+                            echo $OUTPUT->notification($errorstr);
                         } else {
                             return false;
                         }
                                 $errorstr = "An error occurred while backing up '$module->name'";
                                 add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                                 if (!defined('BACKUP_SILENTLY')) {
-                                    notify($errorstr);
+                                    echo $OUTPUT->notification($errorstr);
                                 } else {
                                     return false;
                                 }
                         $errorstr = "An error occurred while finishing the module backups";
                         add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                         if (!defined('BACKUP_SILENTLY')) {
-                            notify($errorstr);
+                            echo $OUTPUT->notification($errorstr);
                         } else {
                             return false;
                         }
                     $errorstr = "An error occurred while backing up the course format data";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while closing the course backup";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while copying user files";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while copying course files";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                     $errorstr = "An error occurred while copying site files";
                     add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                     if (!defined('BACKUP_SILENTLY')) {
-                        notify($errorstr);
+                        echo $OUTPUT->notification($errorstr);
                     } else {
                         return false;
                     }
                 $errorstr = "An error occurred while zipping the backup";
                 add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                 if (!defined('BACKUP_SILENTLY')) {
-                    notify($errorstr);
+                    echo $OUTPUT->notification($errorstr);
                 } else {
                     return false;
                 }
                 $errorstr = "An error occurred while copying the zip file to the course directory";
                 add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                 if (!defined('BACKUP_SILENTLY')) {
-                    notify($errorstr);
+                    echo $OUTPUT->notification($errorstr);
                 } else {
                     return false;
                 }
                 $errorstr = "An error occurred while cleaning up temporary data";
                 add_to_backup_log(time(),$preferences->backup_course,$errorstr,'manual');
                 if (!defined('BACKUP_SILENTLY')) {
-                    notify($errorstr);
+                    echo $OUTPUT->notification($errorstr);
                 } else {
                     return false;
                 }
index b55780c516857b6d2f8ba3102c6f6c0a5eb50b39..f22361734f5dabd4517a64f67b8cbd723b5816be 100644 (file)
@@ -32,14 +32,14 @@ function choose_bb_xsl($manifest){
 
 
 function blackboard_convert($dir){
-    global $CFG;
+    global $CFG, $OUTPUT;
 
 
     // Check for a Blackboard manifest file
     if (is_readable($dir.'/imsmanifest.xml') && !is_readable($dir.'/moodle.xml')){
 
         if (!function_exists('xslt_create')) {  // XSLT MUST be installed for this to work
-            notify('You need the XSLT library installed in PHP to open this Blackboard file');
+            echo $OUTPUT->notification('You need the XSLT library installed in PHP to open this Blackboard file');
             return false;
         }
 
@@ -52,7 +52,7 @@ function blackboard_convert($dir){
 
         // The XSL file must be in the same directory as the Blackboard files when it is processed
         if (!copy($CFG->dirroot."/backup/bb/$xslt_file", "$dir/$xslt_file")) {
-            notify('Could not copy the XSLT file to '."$dir/$xslt_file");
+            echo $OUTPUT->notification('Could not copy the XSLT file to '."$dir/$xslt_file");
             return false;
         }
 
@@ -66,7 +66,7 @@ function blackboard_convert($dir){
         // The XSL processor will open them as needed.
         $xsltproc = xslt_create();
         if (!xslt_process($xsltproc, 'imsmanifest.xml', "$dir/$xslt_file", "$dir/moodle.xml")) {
-            notify('Failed writing xml file');
+            echo $OUTPUT->notification('Failed writing xml file');
             chdir($startdir);
             return false;
         }
index a2386a245aa960b0afbd5a3c686af7cf2befdbc9..f4ba4db39773e83286bbb5b9396ea13ee318ef98 100644 (file)
     if (!$file) {
         print_header("$site->shortname: $strcourserestore", $site->fullname, $navigation);
         echo $OUTPUT->heading(get_string("nofilesselected"));
-        print_continue("$CFG->wwwroot/$CFG->admin/index.php");
+        echo $OUTPUT->continue_button("$CFG->wwwroot/$CFG->admin/index.php");
         echo $OUTPUT->footer();
         exit;
     }
     if ($cancel) {
         print_header("$site->shortname: $strcourserestore", $site->fullname, $navigation);
         echo $OUTPUT->heading(get_string("restorecancelled"));
-        print_continue("$CFG->wwwroot/course/view.php?id=".$id);
+        echo $OUTPUT->continue_button("$CFG->wwwroot/course/view.php?id=".$id);
         echo $OUTPUT->footer();
         exit;
     }
     }
     //Print form
     echo $OUTPUT->heading("$strcourserestore".((empty($to) ? ': '.basename($file) : '')));
-    print_simple_box_start('center');
+    echo $OUTPUT->box_start();
 
     //Adjust some php variables to the execution of this script
     @ini_set("max_execution_time","3000");
         unset($SESSION->cancontinue);
         include_once("restore_execute.html");
     }
-    print_simple_box_end();
+    echo $OUTPUT->box_end();
 
     //Print footer
     echo $OUTPUT->footer();
index 7cc1293087649cceaf0a46ab54bcc7f62996b571..deb4aaf38082183679d2ccb8f1f283713becf33d 100644 (file)
 
         if ($courses = $mycourses) {
             echo $OUTPUT->heading(get_string("choosecourse"));
-            print_simple_box_start("center");
+            echo $OUTPUT->box_start();
             foreach ($courses as $course) {
                 if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $course->id))) {
                     continue;
                 }
                 echo "<a $optdimmed href=\"restore.php?course_id=$course->id&amp;launch=check&amp;id=$id&amp;file=$file\">".format_string($course->fullname).' ('.format_string($course->shortname).')</a><br />'."\n";
             }
-            print_simple_box_end();
+            echo $OUTPUT->box_end();
         } else {
             echo $OUTPUT->heading(get_string("nocoursesyet"));
-            print_continue("$CFG->wwwroot/$CFG->admin/index.php");
+            echo $OUTPUT->continue_button("$CFG->wwwroot/$CFG->admin/index.php");
         }
     //Checks everything and execute restore
     } else if (($restore->restoreto != RESTORETO_NEW_COURSE and !empty($restore->course_id)) or ($restore->restoreto == RESTORETO_NEW_COURSE)) {
index e80b29e2974a38ed30ab635b85ba9aa34e52417d..6fd307e369a57cfd93171fecc114c5cf07048123 100644 (file)
@@ -58,9 +58,9 @@
 
     if (empty($restore->importing)) {
         //Print final message
-        print_simple_box(get_string("restorefinished"),"center");
+        echo $OUTPUT->box(get_string("restorefinished"));
     } else {
-        print_simple_box(get_string("importdatafinished"),"center");
+        echo $OUTPUT->box(get_string("importdatafinished"));
         $file = $CFG->dataroot . '/' 
             . $SESSION->import_preferences->backup_course 
             . '/backupdata/' . $SESSION->import_preferences->backup_name;
@@ -72,6 +72,6 @@
         }
         unset($SESSION->restore);
     }
-    print_continue("$CFG->wwwroot/course/view.php?id=".$restore->course_id);
+    echo $OUTPUT->continue_button("$CFG->wwwroot/course/view.php?id=".$restore->course_id);
 
 ?>
index 027866164397b4a34131c471e9b0df37f52ea4e1..320af388c2824f5a371fed449e32e6d45d99f215 100644 (file)
@@ -264,7 +264,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
         echo '<label for="shortnamefield">'.get_string ('shortname').'</label>';
         echo "</td>";
         echo "<td><input type=\"text\" id=\"shortnamefield\" name=\"shortname\" maxlength=\"100\"  size=\"20\" value=\"".s($form1->shortname)."\" alt=\"".get_string("shortname")."\"  />" ;
-        helpbutton("courseshortname", get_string("shortname")) ;
+        echo $OUTPUT->help_icon(moodle_help_icon::make("courseshortname", get_string("shortname"))) ;
         if (isset($err["shortname"])) formerr($err["shortname"]);
         echo "</td>";
         echo "</tr>";
@@ -273,7 +273,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
         echo '<label for="fullnamefield">'.get_string ('fullname').'</label>';
         echo "</td>";
         echo "<td><input type=\"text\" id=\"fullnamefield\" name=\"fullname\" maxlength=\"254\" size=\"50\" value=\"".s($form1->fullname)."\" alt=\" ".get_string("fullname")."\"  />" ;
-        helpbutton("coursefullname", get_string("fullname")) ;
+        echo $OUTPUT->help_icon(moodle_help_icon::make("coursefullname", get_string("fullname"))) ;
         if (isset($err["fullname"])) formerr($err["fullname"]);
         echo"</td></tr>";
         echo "<tr valign=\"top\"> ";
@@ -289,7 +289,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
             $yearselector = html_select::make_time_selector('years', "startyear", $form1->startdate);
 
             echo $OUTPUT->select($dayselector) . $OUTPUT->select($monthselector) . $OUTPUT->select($yearselector);
-            helpbutton("coursestartdate", get_string("startdate"));
+            echo $OUTPUT->help_icon(moodle_help_icon::make("coursestartdate", get_string("startdate")));
         } else {
             print_string('notavailable');
             echo '<input type="hidden" name="startyear" value="0" />';
@@ -445,7 +445,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
         //Now print the Groups tr (assume there is no $info->backup_groups)
         echo "<tr>";
         echo "<td align=\"right\" colspan=\"2\"><b>";
-        $helplink = helpbutton('grouprestore', get_string('groups'), '', true, false, '', true);
+        $helplink = $OUTPUT->help_icon(moodle_help_icon::make('grouprestore', get_string('groups')));
         if (empty($CFG->enablegroupings)) {
             echo '<label for="menurestore_groups">'.get_string ("groups").'</label>'.$helplink;
             echo "</b></td><td colspan=\"2\">";
index e64358129c7595eae55e9ac295d887a953f3f225..82382814b09974c2c1882dd792e81ea944136e0c 100644 (file)
@@ -536,7 +536,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             print_table($table);
 
             if ($info->backup_backup_version <= 2005070500) {
-                 notify(get_string('backupnonisowarning'));  // Message informing that this backup may not work!
+                 echo $OUTPUT->notification(get_string('backupnonisowarning'));  // Message informing that this backup may not work!
             }
 
             //Now backup contents in another table
@@ -7784,7 +7784,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
      */
     function restore_precheck($id,$file,&$errorstr,$noredirect=false) {
 
-        global $CFG, $SESSION;
+        global $CFG, $SESSION, $OUTPUT;
 
         //Prepend dataroot to variable to have the absolute path
         $file = $CFG->dataroot."/".$file;
@@ -7840,7 +7840,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                 $errorstr = "An error occurred deleting old data";
                 add_to_backup_log(time(),$preferences->backup_course,$errorstr,'restoreprecheck');
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify($errorstr);
+                    echo $OUTPUT->notification($errorstr);
                 }
             }
         }
@@ -7852,7 +7852,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (! $status = backup_copy_file($file,$CFG->dataroot."/temp/backup/".$backup_unique_code."/".basename($file))) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Error copying backup file. Invalid name or bad perms.");
+                    echo $OUTPUT->notification("Error copying backup file. Invalid name or bad perms.");
                 } else {
                     $errorstr = "Error copying backup file. Invalid name or bad perms";
                     return false;
@@ -7867,7 +7867,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (! $status = restore_unzip ($CFG->dataroot."/temp/backup/".$backup_unique_code."/".basename($file))) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Error unzipping backup file. Invalid zip file.");
+                    echo $OUTPUT->notification("Error unzipping backup file. Invalid zip file.");
                 } else {
                     $errorstr = "Error unzipping backup file. Invalid zip file.";
                     return false;
@@ -7897,7 +7897,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                     $errorstr = 'Error checking backup file. moodle.xml is incorrect or corrupted.';
                 }
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify($errorstr);
+                    echo $OUTPUT->notification($errorstr);
                 } else {
                     return false;
                 }
@@ -7939,7 +7939,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             $message->serverrelease = $CFG->release;
             $message->backupversion = $info->backup_moodle_version;
             $message->backuprelease = $info->backup_moodle_release;
-            print_simple_box(get_string('noticenewerbackup','',$message), "center", "70%", '', "20", "noticebox");
+            echo $OUTPUT->box(get_string('noticenewerbackup','',$message), "noticebox");
 
         }
 
@@ -8057,7 +8057,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
     }
 
     function restore_execute(&$restore,$info,$course_header,&$errorstr) {
-        global $CFG, $USER, $DB;
+        global $CFG, $USER, $DB, $OUTPUT;
 
         $status = true;
 
@@ -8095,7 +8095,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             //First of all, split moodle.xml into handy files
             if (!restore_split_xml ($xml_file, $restore)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Error proccessing moodle.xml file. Process ended.");
+                    echo $OUTPUT->notification("Error proccessing moodle.xml file. Process ended.");
                 } else {
                     $errorstr = "Error proccessing moodle.xml file. Process ended.";
                 }
@@ -8113,7 +8113,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             $oldidnumber = $course_header->course_idnumber;
             if (!$status = restore_create_new_course($restore,$course_header)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Error while creating the new empty course.");
+                    echo $OUTPUT->notification("Error while creating the new empty course.");
                 } else {
                     $errorstr = "Error while creating the new empty course.";
                     return false;
@@ -8169,7 +8169,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                         $restore->restoreto = RESTORETO_NEW_COURSE;
                     } else {
                         if (!defined('RESTORE_SILENTLY')) {
-                            notify("An error occurred while deleting some of the course contents.");
+                            echo $OUTPUT->notification("An error occurred while deleting some of the course contents.");
                         } else {
                             $errrostr = "An error occurred while deleting some of the course contents.";
                             return false;
@@ -8178,7 +8178,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                 }
             } else {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Error opening existing course.");
+                    echo $OUTPUT->notification("Error opening existing course.");
                     $status = false;
                 } else {
                     $errorstr = "Error opening existing course.";
@@ -8194,7 +8194,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_create_users($restore,$xml_file)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore users.");
+                    echo $OUTPUT->notification("Could not restore users.");
                 } else {
                     $errorstr = "Could not restore users.";
                     return false;
@@ -8250,7 +8250,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                     }
                 } else {
                     if (!defined('RESTORE_SILENTLY')) {
-                        notify("No users were found!");
+                        echo $OUTPUT->notification("No users were found!");
                     } // no need to return false here, it's recoverable.
                 }
             }
@@ -8268,7 +8268,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_create_groups($restore,$xml_file)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore groups!");
+                    echo $OUTPUT->notification("Could not restore groups!");
                 } else {
                     $errorstr = "Could not restore groups!";
                     return false;
@@ -8286,7 +8286,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_create_groupings($restore,$xml_file)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore groupings!");
+                    echo $OUTPUT->notification("Could not restore groupings!");
                 } else {
                     $errorstr = "Could not restore groupings!";
                     return false;
@@ -8304,7 +8304,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_create_groupings_groups($restore,$xml_file)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore groups in groupings!");
+                    echo $OUTPUT->notification("Could not restore groups in groupings!");
                 } else {
                     $errorstr = "Could not restore groups in groupings!";
                     return false;
@@ -8326,7 +8326,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                 }
                 if (!$status = restore_create_sections($restore,$xml_file)) {
                     if (!defined('RESTORE_SILENTLY')) {
-                        notify("Error creating sections in the existing course.");
+                        echo $OUTPUT->notification("Error creating sections in the existing course.");
                     } else {
                         $errorstr = "Error creating sections in the existing course.";
                         return false;
@@ -8342,7 +8342,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                 }
                 if (!$status = restore_create_sections($restore,$xml_file)) {
                     if (!defined('RESTORE_SILENTLY')) {
-                        notify("Error creating sections in the existing course.");
+                        echo $OUTPUT->notification("Error creating sections in the existing course.");
                     } else {
                         $errorstr = "Error creating sections in the existing course.";
                         return false;
@@ -8354,7 +8354,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                 //Error
             } else {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Neither a new course or an existing one was specified.");
+                    echo $OUTPUT->notification("Neither a new course or an existing one was specified.");
                     $status = false;
                 } else {
                     $errorstr = "Neither a new course or an existing one was specified.";
@@ -8372,7 +8372,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                 }
                 if (!$status = restore_create_metacourse($restore,$xml_file)) {
                     if (!defined('RESTORE_SILENTLY')) {
-                        notify("Error creating metacourse in the course.");
+                        echo $OUTPUT->notification("Error creating metacourse in the course.");
                     } else {
                         $errorstr = "Error creating metacourse in the course.";
                         return false;
@@ -8394,7 +8394,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_create_questions($restore,$xml_file)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore categories and questions!");
+                    echo $OUTPUT->notification("Could not restore categories and questions!");
                 } else {
                     $errorstr = "Could not restore categories and questions!";
                     return false;
@@ -8412,7 +8412,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_user_files($restore)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore user files!");
+                    echo $OUTPUT->notification("Could not restore user files!");
                 } else {
                     $errorstr = "Could not restore user files!";
                     return false;
@@ -8439,7 +8439,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_course_files($restore)) {
                 if (empty($status)) {
-                    notify("Could not restore course files!");
+                    echo $OUTPUT->notification("Could not restore course files!");
                 } else {
                     $errorstr = "Could not restore course files!";
                     return false;
@@ -8467,7 +8467,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_site_files($restore)) {
                 if (empty($status)) {
-                    notify("Could not restore site files!");
+                    echo $OUTPUT->notification("Could not restore site files!");
                 } else {
                     $errorstr = "Could not restore site files!";
                     return false;
@@ -8494,7 +8494,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_create_messages($restore,$xml_file)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore messages!");
+                    echo $OUTPUT->notification("Could not restore messages!");
                 } else {
                     $errorstr = "Could not restore messages!";
                     return false;
@@ -8512,7 +8512,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_create_blogs($restore,$xml_file)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore blogs!");
+                    echo $OUTPUT->notification("Could not restore blogs!");
                 } else {
                     $errorstr = "Could not restore blogs!";
                     return false;
@@ -8530,7 +8530,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_create_scales($restore,$xml_file)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore custom scales!");
+                    echo $OUTPUT->notification("Could not restore custom scales!");
                 } else {
                     $errorstr = "Could not restore custom scales!";
                     return false;
@@ -8548,7 +8548,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_create_events($restore,$xml_file)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore course events!");
+                    echo $OUTPUT->notification("Could not restore course events!");
                 } else {
                     $errorstr = "Could not restore course events!";
                     return false;
@@ -8566,7 +8566,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_create_modules($restore,$xml_file)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore modules!");
+                    echo $OUTPUT->notification("Could not restore modules!");
                 } else {
                     $errorstr = "Could not restore modules!";
                     return false;
@@ -8589,7 +8589,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                 $course_header->blockinfo = !empty($course_header->blockinfo) ? $course_header->blockinfo : NULL;
                 if (!$status = restore_create_blocks($restore, $info->backup_block_format, $course_header->blockinfo, $xml_file)) {
                     if (!defined('RESTORE_SILENTLY')) {
-                        notify('Error while creating the course blocks');
+                        echo $OUTPUT->notification('Error while creating the course blocks');
                     } else {
                         $errorstr = "Error while creating the course blocks";
                         return false;
@@ -8612,7 +8612,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                 if (!$status = restore_set_format_data($restore, $xml_file)) {
                         $error = "Error while setting the course format data";
                     if (!defined('RESTORE_SILENTLY')) {
-                        notify($error);
+                        echo $OUTPUT->notification($error);
                     } else {
                         $errorstr=$error;
                         return false;
@@ -8631,7 +8631,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_create_logs($restore,$xml_file)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not restore logs!");
+                    echo $OUTPUT->notification("Could not restore logs!");
                 } else {
                     $errorstr = "Could not restore logs!";
                     return false;
@@ -8651,7 +8651,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_check_instances($restore)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not adjust instances in course_modules!");
+                    echo $OUTPUT->notification("Could not adjust instances in course_modules!");
                 } else {
                     $errorstr = "Could not adjust instances in course_modules!";
                     return false;
@@ -8669,7 +8669,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_refresh_events($restore)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not refresh events for activities!");
+                    echo $OUTPUT->notification("Could not refresh events for activities!");
                 } else {
                     $errorstr = "Could not refresh events for activities!";
                     return false;
@@ -8687,7 +8687,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_decode_content_links($restore)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not decode content links!");
+                    echo $OUTPUT->notification("Could not decode content links!");
                 } else {
                     $errorstr = "Could not decode content links!";
                     return false;
@@ -8706,7 +8706,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             }
             if (!$status = restore_convert_wiki2markdown($restore)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not convert wiki texts to markdown!");
+                    echo $OUTPUT->notification("Could not convert wiki texts to markdown!");
                 } else {
                     $errorstr = "Could not convert wiki texts to markdown!";
                     return false;
@@ -8725,7 +8725,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                 }
                 if (!$status = restore_create_gradebook($restore,$xml_file)) {
                     if (!defined('RESTORE_SILENTLY')) {
-                        notify("Could not restore gradebook!");
+                        echo $OUTPUT->notification("Could not restore gradebook!");
                     } else {
                         $errorstr = "Could not restore gradebook!";
                         return false;
@@ -8746,7 +8746,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
             /// force full refresh of grading data before migration == crete all items first
                 if (!$status = restore_migrate_old_gradebook($restore,$xml_file)) {
                     if (!defined('RESTORE_SILENTLY')) {
-                        notify("Could not migrate gradebook!");
+                        echo $OUTPUT->notification("Could not migrate gradebook!");
                     } else {
                         $errorstr = "Could not migrade gradebook!";
                         return false;
@@ -8795,7 +8795,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                             role_assign($legacyteacher->id, $USER->id, 0, $newcontext->id);
                         }
                     } else {
-                        notify('Could not find a legacy teacher role. You might need your moodle admin to assign a role with editing privilages to this course.');
+                        echo $OUTPUT->notification('Could not find a legacy teacher role. You might need your moodle admin to assign a role with editing privilages to this course.');
                     }
                 }
             }
@@ -8839,7 +8839,7 @@ WHERE
             }
             if (!$status = clean_temp_data ($restore)) {
                 if (!defined('RESTORE_SILENTLY')) {
-                    notify("Could not clean up temporary data from files and database");
+                    echo $OUTPUT->notification("Could not clean up temporary data from files and database");
                 } else {
                     $errorstr = "Could not clean up temporary data from files and database";
                     return false;
@@ -8858,7 +8858,7 @@ WHERE
         }
         else {
             if (!defined('RESTORE_SILENTLY')) {
-                notify("Could not close the restorelog.html file");
+                echo $OUTPUT->notification("Could not close the restorelog.html file");
             }
         }