delete_course.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This script is about deleting a course.
  5. * It displays a message box ('are you sure you wish to delete this course')
  6. * and deletes the course if the user answers affirmatively
  7. *
  8. * @package chamilo.course_info
  9. */
  10. /**
  11. * Code
  12. */
  13. // Language files that need to be included
  14. $language_file = array('admin', 'course_info');
  15. require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php';
  16. require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
  17. $this_section = SECTION_COURSES;
  18. $current_course_tool = TOOL_COURSE_MAINTENANCE;
  19. api_protect_course_script(true);
  20. $current_course_code = $_course['official_code'];
  21. $current_course_name = $_course['name'];
  22. if (!api_is_allowed_to_edit()) {
  23. api_not_allowed(true);
  24. }
  25. $tool_name = get_lang('DelCourse');
  26. if (isset($_GET['delete']) && $_GET['delete'] == 'yes') {
  27. CourseManager :: delete_course($_course['sysCode']);
  28. $obj_cat = new Category();
  29. $obj_cat->update_category_delete($_course['sysCode']);
  30. // DELETE CONFIRMATION MESSAGE
  31. unset($_course);
  32. unset($_cid);
  33. $noPHP_SELF = true;
  34. $message = '<h2>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h2>';
  35. $message .=get_lang('HasDel');
  36. $message .= '<br /><br /><a href="../../index.php">'.get_lang('BackHome').' '.api_get_setting('siteName').'</a>';
  37. } else {
  38. $message = '<h3>'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') </h3>';
  39. $message .= '<p>'.get_lang('ByDel').'</p><p><a class="btn btn-primary" href="maintenance.php">'.get_lang('No').'</a>&nbsp;<a class="btn" href="'.api_get_self().'?delete=yes">'.get_lang('Yes').'</a></p>';
  40. $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
  41. }
  42. Display :: display_header($tool_name, 'Settings');
  43. echo Display::page_header($tool_name);
  44. Display::display_warning_message($message, false);
  45. /* FOOTER */
  46. Display :: display_footer();