|
|
|
@ -16,13 +16,13 @@ require_once __DIR__.'/../inc/global.inc.php'; |
|
|
|
$current_course_tool = TOOL_COURSE_MAINTENANCE; |
|
|
|
$current_course_tool = TOOL_COURSE_MAINTENANCE; |
|
|
|
|
|
|
|
|
|
|
|
api_protect_course_script(true); |
|
|
|
api_protect_course_script(true); |
|
|
|
api_check_archive_dir(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check access rights (only teachers are allowed here) |
|
|
|
// Check access rights (only teachers are allowed here) |
|
|
|
if (!api_is_allowed_to_edit()) { |
|
|
|
if (!api_is_allowed_to_edit()) { |
|
|
|
api_not_allowed(true); |
|
|
|
api_not_allowed(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
api_check_archive_dir(); |
|
|
|
api_set_more_memory_and_time_limits(); |
|
|
|
api_set_more_memory_and_time_limits(); |
|
|
|
|
|
|
|
|
|
|
|
// Section for the tabs |
|
|
|
// Section for the tabs |
|
|
|
@ -53,7 +53,6 @@ if (Security::check_token('post') && ( |
|
|
|
) { |
|
|
|
) { |
|
|
|
// Clear token |
|
|
|
// Clear token |
|
|
|
Security::clear_token(); |
|
|
|
Security::clear_token(); |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_POST['action']) && $_POST['action'] == 'course_select_form') { |
|
|
|
if (isset($_POST['action']) && $_POST['action'] == 'course_select_form') { |
|
|
|
$course = CourseSelectForm::get_posted_course(); |
|
|
|
$course = CourseSelectForm::get_posted_course(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
@ -61,12 +60,14 @@ if (Security::check_token('post') && ( |
|
|
|
$course = $cb->build(); |
|
|
|
$course = $cb->build(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$zip_file = CourseArchiver::createBackup($course); |
|
|
|
$zipFile = CourseArchiver::createBackup($course); |
|
|
|
echo Display::return_message(get_lang('BackupCreated'), 'confirm'); |
|
|
|
echo Display::return_message(get_lang('BackupCreated'), 'confirm'); |
|
|
|
echo '<br /> |
|
|
|
echo '<br />'; |
|
|
|
<a class="btn btn-primary btn-large" |
|
|
|
echo Display::url( |
|
|
|
href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.$zip_file.'&'.api_get_cidreq().'"> |
|
|
|
get_lang('Download'), |
|
|
|
'.get_lang('Download').'</a>'; |
|
|
|
api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.$zipFile.'&'.api_get_cidreq(), |
|
|
|
|
|
|
|
['class' => 'btn btn-primary btn-large'] |
|
|
|
|
|
|
|
); |
|
|
|
} elseif (Security::check_token('post') && ( |
|
|
|
} elseif (Security::check_token('post') && ( |
|
|
|
isset($_POST['backup_option']) && |
|
|
|
isset($_POST['backup_option']) && |
|
|
|
$_POST['backup_option'] == 'select_items' |
|
|
|
$_POST['backup_option'] == 'select_items' |
|
|
|
@ -74,17 +75,15 @@ if (Security::check_token('post') && ( |
|
|
|
) { |
|
|
|
) { |
|
|
|
// Clear token |
|
|
|
// Clear token |
|
|
|
Security::clear_token(); |
|
|
|
Security::clear_token(); |
|
|
|
|
|
|
|
|
|
|
|
$cb = new CourseBuilder('partial'); |
|
|
|
$cb = new CourseBuilder('partial'); |
|
|
|
$course = $cb->build(); |
|
|
|
$course = $cb->build(); |
|
|
|
|
|
|
|
if ($course->has_resources()) { |
|
|
|
// Add token to Course select form |
|
|
|
// Add token to Course select form |
|
|
|
$hiddenFields['sec_token'] = Security::get_token(); |
|
|
|
$hiddenFields['sec_token'] = Security::get_token(); |
|
|
|
CourseSelectForm::display_form($course, $hiddenFields); |
|
|
|
CourseSelectForm::display_form($course, $hiddenFields); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$cb = new CourseBuilder(); |
|
|
|
echo Display::return_message(get_lang('NoResourcesToBackup'), 'warning'); |
|
|
|
$course = $cb->build(); |
|
|
|
} |
|
|
|
if (!$course->has_resources()) { |
|
|
|
|
|
|
|
echo get_lang('NoResourcesToBackup'); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$form = new FormValidator( |
|
|
|
$form = new FormValidator( |
|
|
|
'create_backup_form', |
|
|
|
'create_backup_form', |
|
|
|
@ -121,6 +120,5 @@ if (Security::check_token('post') && ( |
|
|
|
echo '</div>'; |
|
|
|
echo '</div>'; |
|
|
|
echo '</div>'; |
|
|
|
echo '</div>'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Display::display_footer(); |
|
|
|
Display::display_footer(); |
|
|
|
|