get_records('modules', array('visible'=>1)) ) {
//Print option to select/deselect everything with 1 click.
echo "";
echo "";
echo ''.get_string("include")."";
echo " | ";
echo "". get_string("all")."/";
echo "". get_string("none")."";
echo " | ";
echo "";
echo ' ';
echo " | ";
echo "". get_string("all")."/";
echo "". get_string("none")."";
echo " | ";
echo "
";
echo "
|
";
$currentrow = 0;
foreach ($allmods as $mod) {
$modname = $mod->name;
$modbackup = $modname."_backup_mods";
//If exists the lib & function
$var = 'exists_'.$modname;
$exvar = 'exists_one_'.$modname;
if (!empty($$var) and !empty($$exvar)) {
//Print the full tr
echo "";
echo " ";
echo " | \n";
$backup_options[0] = get_string("no");
$backup_options[1] = get_string("yes");
$var = "backup_".$modname;
//choose_from_menu($backup_options, $var, $$var, "");
//Print the checkbox
print_checkbox($var, $$var, $$var, get_string("modulenameplural",$modname),'','selectItemInCheckboxByName(\'form1\',\'backup_'.$modname.'\',this.checked)');
echo " | ";
echo " | ";
$var = "backup_user_info_".$modname;
if (empty($to)) {
$backup_user_options[0] = get_string("withoutuserdata");
$backup_user_options[1] = get_string("withuserdata");
//choose_from_menu($backup_user_options, $var, $$var, "");
print_checkbox($var, $$var, $$var, get_string("userdata"),'','selectItemInCheckboxByName(\'form1\',\'backup_user_info_'.$modname.'\',this.checked)');
} else {
echo '';
}
echo " |
\n";
echo ' | |
';
}
}
//Line
echo "
|
\n";
if (empty($to) && !empty($course->metacourse)) {
//Now print the Metacourse tr
echo "";
echo "";
echo '';
echo " | ";
$meta_options[0] = get_string("no");
$meta_options[1] = get_string("yes");
choose_from_menu($meta_options, "backup_metacourse", $backup_metacourse, "");
echo " |
";
}
else {
$hidden_options .= '';
}
if (empty($to)) {
//Now print the Users tr
echo "";
echo "";
echo '';
echo " | ";
$user_options[0] = get_string("all");
$user_options[1] = get_string("course");
$user_options[2] = get_string("none");
choose_from_menu($user_options, "backup_users", $backup_users, "");
echo " |
";
}
else {
$hidden_options .= '';
}
if (empty($to)) {
//Now print the Logs tr
echo "";
echo "";
echo '';
echo " | ";
$log_options[0] = get_string("no");
$log_options[1] = get_string("yes");
choose_from_menu($log_options, "backup_logs", $backup_logs, "");
echo " |
";
}
else {
$hidden_options .= '';
}
if (empty($to)) {
//Now print the User Files tr
echo "";
echo "";
echo '';
echo " | ";
$user_file_options[0] = get_string("no");
$user_file_options[1] = get_string("yes");
choose_from_menu($user_file_options, "backup_user_files", $backup_user_files, "");
echo " |
";
}
else {
$hidden_options .= '';
}
//Now print the Course Files tr
echo "";
echo "";
echo '';
echo " | ";
$course_file_options[0] = get_string("no");
$course_file_options[1] = get_string("yes");
choose_from_menu($course_file_options, "backup_course_files", $backup_course_files, "");
echo " |
";
if ($course->id != SITEID){
//Now print the site Files tr
echo "";
echo "";
echo '';
helpbutton('sitefilesused', get_string('sitefilesused'));
echo " | ";
$course_file_options[0] = get_string("no");
$course_file_options[1] = get_string("yes");
choose_from_menu($course_file_options, "backup_site_files", $backup_site_files, "");
echo " |
";
}
// do you want grade histories to be backed up?
if (empty($CFG->disablegradehistory)) {
echo "";
echo "";
echo '';
echo " | ";
$gradebook_history_options[0] = get_string("no");
$gradebook_history_options[1] = get_string("yes");
choose_from_menu($gradebook_history_options, "backup_gradebook_history", $backup_gradebook_history, "");
echo " |
";
} else {
$hidden_options .= '';
}
if (empty($to) && $course->id == SITEID) {
//If we are in a SITEID backup print the Messages tr
echo "";
echo "";
echo '';
echo " | ";
$mess_options[0] = get_string("no");
$mess_options[1] = get_string("yes");
choose_from_menu($mess_options, "backup_messages", $backup_messages, "");
echo " |
";
}
else {
$hidden_options .= '';
}
if (empty($to) && $course->id == SITEID && !empty($CFG->bloglevel)) {
//If we are in a SITEID backup and blogs are enabled print the Blogs tr
echo "";
echo "";
echo get_string ('blogs','blog').":";
echo " | ";
$blog_options[0] = get_string("no");
$blog_options[1] = get_string("yes");
choose_from_menu($blog_options, "backup_blogs", $backup_blogs, "");
echo " |
";
}
else {
$hidden_options .= '';
}
}
//Now print a place to select which role assignments to back up.
if (empty($to)) {
//Line
echo "
|
\n";
echo "";
echo "";
echo get_string("backuproleassignments");
echo " | ";
$roles = get_all_roles();
foreach ($roles as $role) {
print_checkbox('backupassignments_' . $role->shortname, 1, true, strip_tags(format_string($role->name, true)));
echo " ";
}
echo "". get_string("all")."/";
echo "". get_string("none")."";
echo " |
";
}
$backup_unique_code = time();
//Calculate the backup string
//Calculate the backup unique code to allow simultaneus backups (to define
//the temp-directory name and records in backup temp tables
$backup_name = backup_get_zipfile_name($course, $backup_unique_code);
?>