recycle_course.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php // $Id: recycle_course.php 19948 2009-04-21 17:27:59Z juliomontoya $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Bart Mollet (bart.mollet@hogent.be)
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. * ==============================================================================
  22. * Delete resources from a course.
  23. *
  24. * @author Bart Mollet <bart.mollet@hogent.be>
  25. * @package dokeos.backup
  26. * ==============================================================================
  27. */
  28. // name of the language file that needs to be included
  29. $language_file = array ('admin','course_info','coursebackup');
  30. // including the global file
  31. include ('../inc/global.inc.php');
  32. // Check access rights (only teachers are allowed here)
  33. if( ! api_is_allowed_to_edit()) {
  34. api_not_allowed(true);
  35. }
  36. // section for the tabs
  37. $this_section=SECTION_COURSES;
  38. // breadcrumbs
  39. $interbreadcrumb[] = array ("url" => "../course_info/maintenance.php", "name" => get_lang('Maintenance'));
  40. // Displaying the header
  41. $nameTools = get_lang('RecycleCourse');
  42. Display::display_header($nameTools);
  43. // include additional libraries
  44. require_once('classes/CourseBuilder.class.php');
  45. require_once('classes/CourseArchiver.class.php');
  46. require_once('classes/CourseRecycler.class.php');
  47. require_once('classes/CourseSelectForm.class.php');
  48. // Display the tool title
  49. api_display_tool_title($nameTools);
  50. /*
  51. ==============================================================================
  52. MAIN CODE
  53. ==============================================================================
  54. */
  55. if( (isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) || (isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'full_backup' ) ) {
  56. if(isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) {
  57. $course = CourseSelectForm::get_posted_course();
  58. } else {
  59. $cb = new CourseBuilder();
  60. $course = $cb->build();
  61. }
  62. $cr = new CourseRecycler($course);
  63. $cr->recycle();
  64. Display::display_confirmation_message(get_lang('RecycleFinished'));
  65. } elseif( isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'select_items') {
  66. $cb = new CourseBuilder();
  67. $course = $cb->build();
  68. CourseSelectForm::display_form($course);
  69. } else {
  70. $cb = new CourseBuilder();
  71. $course = $cb->build();
  72. if( ! $course->has_resources()) {
  73. echo get_lang('NoResourcesToRecycle');
  74. } else {
  75. Display::display_warning_message(get_lang('RecycleWarning'),false);
  76. ?>
  77. <form method="post" action="recycle_course.php">
  78. <input type="radio" class="checkbox" id="recycle_option_1" name="recycle_option" value="full_backup" checked="checked"/>
  79. <label for="recycle_option_1"><?php echo get_lang('FullRecycle') ?></label>
  80. <br/>
  81. <input type="radio" class="checkbox" id="recycle_option_2" name="recycle_option" value="select_items"/>
  82. <label for="recycle_option_2"><?php echo get_lang('LetMeSelectItems') ?></label>
  83. <br/>
  84. <br/>
  85. <button class="save" type="submit"><?php echo get_lang('RecycleCourse') ?></button>
  86. </form>
  87. <?php
  88. }
  89. }
  90. // Display the footer
  91. Display::display_footer();
  92. ?>