recycle_course.php 3.6 KB

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