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();
$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 />";
}
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."&filearea=course_backup&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 {
}
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.
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");
//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;
}
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;
}
// 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;
}
// 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;
}
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();
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&launch=check&id=$id&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)) {
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;
}
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);
?>
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>";
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\"> ";
$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" />';
//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\">";
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
*/
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;
$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);
}
}
}
}
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;
}
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;
$errorstr = 'Error checking backup file. moodle.xml is incorrect or corrupted.';
}
if (!defined('RESTORE_SILENTLY')) {
- notify($errorstr);
+ echo $OUTPUT->notification($errorstr);
} else {
return false;
}
$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");
}
}
function restore_execute(&$restore,$info,$course_header,&$errorstr) {
- global $CFG, $USER, $DB;
+ global $CFG, $USER, $DB, $OUTPUT;
$status = true;
//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.";
}
$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;
$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;
}
} 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.";
}
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;
}
} 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.
}
}
}
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;
}
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;
}
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;
}
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;
}
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;
//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.";
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
$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;
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
/// 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;
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.');
}
}
}
}
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;
}
else {
if (!defined('RESTORE_SILENTLY')) {
- notify("Could not close the restorelog.html file");
+ echo $OUTPUT->notification("Could not close the restorelog.html file");
}
}