recycle_course.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php // $Id: recycle_course.php 12219 2007-05-01 18:46:59Z yannoo $
  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. {
  35. api_not_allowed(true);
  36. }
  37. // section for the tabs
  38. $this_section=SECTION_COURSES;
  39. // breadcrumbs
  40. $interbreadcrumb[] = array ("url" => "../course_info/maintenance.php", "name" => get_lang('Maintenance'));
  41. // Displaying the header
  42. $nameTools = get_lang('RecycleCourse');
  43. Display::display_header($nameTools);
  44. // include additional libraries
  45. require_once('classes/CourseBuilder.class.php');
  46. require_once('classes/CourseArchiver.class.php');
  47. require_once('classes/CourseRecycler.class.php');
  48. require_once('classes/CourseSelectForm.class.php');
  49. // Display the tool title
  50. api_display_tool_title($nameTools);
  51. /*
  52. ==============================================================================
  53. MAIN CODE
  54. ==============================================================================
  55. */
  56. if( (isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) || (isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'full_backup' ) )
  57. {
  58. if(isset($_POST['action']) && $_POST['action'] == 'course_select_form' )
  59. {
  60. $course = CourseSelectForm::get_posted_course();
  61. }
  62. else
  63. {
  64. $cb = new CourseBuilder();
  65. $course = $cb->build();
  66. }
  67. $cr = new CourseRecycler($course);
  68. $cr->recycle();
  69. Display::display_confirmation_message(get_lang('RecycleFinished'));
  70. }
  71. elseif( isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'select_items')
  72. {
  73. $cb = new CourseBuilder();
  74. $course = $cb->build();
  75. CourseSelectForm::display_form($course);
  76. }
  77. else
  78. {
  79. $cb = new CourseBuilder();
  80. $course = $cb->build();
  81. if( ! $course->has_resources())
  82. {
  83. echo get_lang('NoResourcesToRecycle');
  84. }
  85. else
  86. {
  87. Display::display_warning_message(get_lang('RecycleWarning'),false);
  88. ?>
  89. <form method="post" action="recycle_course.php">
  90. <input type="radio" class="checkbox" id="recycle_option_1" name="recycle_option" value="full_backup" checked="checked"/>
  91. <label for="recycle_option_1"><?php echo get_lang('FullRecycle') ?></label>
  92. <br/>
  93. <input type="radio" class="checkbox" id="recycle_option_2" name="recycle_option" value="select_items"/>
  94. <label for="recycle_option_2"><?php echo get_lang('LetMeSelectItems') ?></label>
  95. <br/>
  96. <br/>
  97. <input type="submit" value="<?php echo get_lang('RecycleCourse') ?>"/>
  98. </form>
  99. <?php
  100. }
  101. }
  102. // Display the footer
  103. Display::display_footer();
  104. ?>