<?php

$worker->beginPreferences();
project_backup_get_preferences($section_i, $preferences, $count, $worker->getCourse());
if ($count == 0) {
    notice("No backupable modules are installed!");
}
$worker->endPreferences();
if (empty($to_course_id)) {
    //Start the main table
    echo '<table cellpadding="5">';
    //Now print the Backup Name tr
    echo '<tr>';
    echo '<td align="right"><b>' . get_string('name') . ':</b></td>';
    echo '<td>' . $preferences->backup_name . '</td>';
    echo '</tr>';
    //Start the main tr, where all the backup progress is done
    echo '<tr>';
    echo '<td colspan="2">';
    //Start the main ul
    echo '<ul>';
    $worker->execute();
    //Ends th main ul
    echo '</ul>';
    //End the main tr, where all the backup is done
    echo '</td>';
    echo '</tr>';
    //End the main table
    echo '</table>';
} else {
    $worker->setSilent();
<?php

// $backupprefsを自動生成
if (isset($SESSION->backupprefs[$course->id])) {
    unset($SESSION->backupprefs[$course->id]);
}
$backupprefs = new stdClass();
project_backup_get_preferences($section_i, $backupprefs, $count, $course);
// Check site
if (!($site = get_site())) {
    error("Site not found!");
}
if ($count == 0) {
    notice("No backupable modules are installed!");
}
if (!execute_sql("DELETE FROM {$CFG->prefix}backup_ids WHERE backup_code = '{$backupprefs->backup_unique_code}'", false)) {
    error('Couldn\'t delete previous backup ids.');
}
?>

<form id="form" method="post" action="backup.php">
<table cellpadding="5" style="text-align:center;margin-left:auto;margin-right:auto">
<?php 
//Here we check if backup_users = None. Then, we switch off every module
//user info, user_files, logs and exercises, workshop and messages backups. A Warning is showed to
//inform the user.
// TODO: Move this logic to one function to be shared by any (manual, scheduled) backup
if ($backupprefs->backup_users == 2) {
    if ($allmods = get_records('modules')) {
        foreach ($allmods as $mod) {
            /// Reset global user_info settings to "no" (0)