recycle_course.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php // $Id: recycle_course.php 10204 2006-11-26 20:46:53Z pcool $
  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. /*
  29. ==============================================================================
  30. INIT SECTION
  31. ==============================================================================
  32. */
  33. // name of the language file that needs to be included
  34. $language_file = 'coursebackup';
  35. include ('../inc/global.inc.php');
  36. $nameTools = get_lang('RecycleCourse');
  37. Display::display_header($nameTools);
  38. require_once('classes/CourseBuilder.class.php');
  39. require_once('classes/CourseArchiver.class.php');
  40. require_once('classes/CourseRecycler.class.php');
  41. require_once('classes/CourseSelectForm.class.php');
  42. api_display_tool_title($nameTools);
  43. if( ! api_is_allowed_to_edit())
  44. {
  45. api_not_allowed();
  46. }
  47. /*
  48. ==============================================================================
  49. MAIN CODE
  50. ==============================================================================
  51. */
  52. if( (isset($_POST['action']) && $_POST['action'] == 'course_select_form' ) || (isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'full_backup' ) )
  53. {
  54. if(isset($_POST['action']) && $_POST['action'] == 'course_select_form' )
  55. {
  56. $course = CourseSelectForm::get_posted_course();
  57. }
  58. else
  59. {
  60. $cb = new CourseBuilder();
  61. $course = $cb->build();
  62. }
  63. $cr = new CourseRecycler($course);
  64. $cr->recycle();
  65. echo get_lang('RecycleFinished');
  66. }
  67. elseif( isset($_POST['recycle_option']) && $_POST['recycle_option'] == 'select_items')
  68. {
  69. $cb = new CourseBuilder();
  70. $course = $cb->build();
  71. CourseSelectForm::display_form($course);
  72. }
  73. else
  74. {
  75. $cb = new CourseBuilder();
  76. $course = $cb->build();
  77. if( ! $course->has_resources())
  78. {
  79. echo get_lang('NoResourcesToRecycle');
  80. }
  81. else
  82. {
  83. Display::display_error_message(get_lang('RecycleWarning'));
  84. ?>
  85. <form method="post" action="recycle_course.php">
  86. <input type="radio" class="checkbox" id="recycle_option_1" name="recycle_option" value="full_backup" checked="checked"/>
  87. <label for="recycle_option_1"><?php echo get_lang('FullRecycle') ?></label>
  88. <br/>
  89. <input type="radio" class="checkbox" id="recycle_option_2" name="recycle_option" value="select_items"/>
  90. <label for="recycle_option_2"><?php echo get_lang('LetMeSelectItems') ?></label>
  91. <br/>
  92. <br/>
  93. <input type="submit" value="<?php echo get_lang('RecycleCourse') ?>"/>
  94. </form>
  95. <?php
  96. }
  97. }
  98. /*
  99. ==============================================================================
  100. FOOTER
  101. ==============================================================================
  102. */
  103. Display::display_footer();
  104. ?>