MDL-19789 Upgraded calls to helpbutton, print_simple_box* and notify

This commit is contained in:
nicolasconnault
2009-08-18 04:29:16 +00:00
parent db636fd5cd
commit 9549b98659
11 changed files with 102 additions and 102 deletions
+5 -5
View File
@@ -73,14 +73,14 @@
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;
@@ -108,7 +108,7 @@
//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");
@@ -126,7 +126,7 @@
} else if ($launch == "execute") {
include_once("backup_execute.html");
}
print_simple_box_end();
echo $OUTPUT->box_end();
//Print footer
echo $OUTPUT->footer();
+1 -1
View File
@@ -119,7 +119,7 @@
$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 />";
}
+4 -4
View File
@@ -76,11 +76,11 @@
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.
+1 -1
View 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");
+31 -31
View File
@@ -2267,7 +2267,7 @@
//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;
@@ -2285,7 +2285,7 @@
$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;
}
@@ -2970,7 +2970,7 @@
}
function backup_execute(&$preferences, &$errorstr) {
global $CFG, $DB;
global $CFG, $DB, $OUTPUT;
$status = true;
//Check for temp and backup and backup_unique_code directory
@@ -2994,7 +2994,7 @@
$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);
}
}
@@ -3017,7 +3017,7 @@
$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;
}
@@ -3035,7 +3035,7 @@
$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;
}
@@ -3050,7 +3050,7 @@
$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;
}
@@ -3065,7 +3065,7 @@
$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;
}
@@ -3080,7 +3080,7 @@
$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;
}
@@ -3101,7 +3101,7 @@
$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;
}
@@ -3118,7 +3118,7 @@
$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;
}
@@ -3135,7 +3135,7 @@
$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;
}
@@ -3153,7 +3153,7 @@
$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;
}
@@ -3170,7 +3170,7 @@
$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;
}
@@ -3187,7 +3187,7 @@
$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;
}
@@ -3203,7 +3203,7 @@
$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;
}
@@ -3219,7 +3219,7 @@
$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;
}
@@ -3235,7 +3235,7 @@
$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;
}
@@ -3251,7 +3251,7 @@
$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;
}
@@ -3267,7 +3267,7 @@
$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;
}
@@ -3294,7 +3294,7 @@
$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;
}
@@ -3313,7 +3313,7 @@
$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;
}
@@ -3329,7 +3329,7 @@
$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;
}
@@ -3346,7 +3346,7 @@
$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;
}
@@ -3359,7 +3359,7 @@
$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;
}
@@ -3386,7 +3386,7 @@
$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;
}
@@ -3404,7 +3404,7 @@
$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;
}
@@ -3421,7 +3421,7 @@
$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;
}
@@ -3437,7 +3437,7 @@
$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;
}
@@ -3453,7 +3453,7 @@
$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;
}
@@ -3469,7 +3469,7 @@
$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;
}
+4 -4
View 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;
}
+4 -4
View File
@@ -105,7 +105,7 @@
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;
}
@@ -114,7 +114,7 @@
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;
}
@@ -136,7 +136,7 @@
}
//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");
@@ -171,7 +171,7 @@
unset($SESSION->cancontinue);
include_once("restore_execute.html");
}
print_simple_box_end();
echo $OUTPUT->box_end();
//Print footer
echo $OUTPUT->footer();
+3 -3
View File
@@ -238,7 +238,7 @@
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;
@@ -250,10 +250,10 @@
}
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)) {
+3 -3
View 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);
?>
+4 -4
View 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\">";
+42 -42
View 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");
}
}