123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
- $language_file = array ('admin','course_info','coursebackup');
- include ('../inc/global.inc.php');
- if( ! api_is_allowed_to_edit()) {
- api_not_allowed(true);
- }
- $this_section=SECTION_COURSES;
- $interbreadcrumb[] = array ("url" => "../course_info/maintenance.php", "name" => get_lang('Maintenance'));
- $nameTools = get_lang('RecycleCourse');
- Display::display_header($nameTools);
- require_once('classes/CourseBuilder.class.php');
- require_once('classes/CourseArchiver.class.php');
- require_once('classes/CourseRecycler.class.php');
- require_once('classes/CourseSelectForm.class.php');
- api_display_tool_title($nameTools);
-
- if( (isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) || (isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'full_backup' ) ) {
- if(isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) {
- $course = CourseSelectForm::get_posted_course();
- } else {
- $cb = new CourseBuilder();
- $course = $cb->build();
- }
- $cr = new CourseRecycler($course);
- $cr->recycle();
- Display::display_confirmation_message(get_lang('RecycleFinished'));
- } elseif( isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'select_items') {
- $cb = new CourseBuilder();
- $course = $cb->build();
- CourseSelectForm::display_form($course);
- } else {
- $cb = new CourseBuilder();
- $course = $cb->build();
- if( ! $course->has_resources()) {
- echo get_lang('NoResourcesToRecycle');
- } else {
- Display::display_warning_message(get_lang('RecycleWarning'),false);
- ?>
- <form method="post" action="recycle_course.php">
- <input type="radio" class="checkbox" id="recycle_option_1" name="recycle_option" value="full_backup" checked="checked"/>
- <label for="recycle_option_1"><?php echo get_lang('FullRecycle') ?></label>
- <br/>
- <input type="radio" class="checkbox" id="recycle_option_2" name="recycle_option" value="select_items"/>
- <label for="recycle_option_2"><?php echo get_lang('LetMeSelectItems') ?></label>
- <br/>
- <br/>
- <button class="save" type="submit"><?php echo get_lang('RecycleCourse') ?></button>
- </form>
- <?php
- }
- }
- // Display the footer
- Display::display_footer();
- ?>
|