index.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action
  5. * @author Christian Fasanando <christian1827@gmail.com>
  6. * @package chamilo.course_description
  7. */
  8. // name of the language file that needs to be included
  9. $language_file = array ('course_description', 'pedaSuggest', 'accessibility');
  10. // including files
  11. require_once '../inc/global.inc.php';
  12. require_once api_get_path(LIBRARY_PATH).'course_description.lib.php';
  13. require_once api_get_path(LIBRARY_PATH).'app_view.php';
  14. require_once 'course_description_controller.php';
  15. require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
  16. require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php';
  17. // defining constants
  18. define('ADD_BLOCK', 9);
  19. define('THEMATIC_ADVANCE', 8);
  20. // current section
  21. $this_section = SECTION_COURSES;
  22. // protect a course script
  23. api_protect_course_script(true);
  24. // get actions
  25. $actions = array('listing', 'add', 'edit', 'delete', 'history');
  26. $action = 'listing';
  27. if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
  28. $action = $_GET['action'];
  29. }
  30. $description_type = '';
  31. if (isset($_GET['description_type'])) {
  32. $description_type = intval($_GET['description_type']);
  33. }
  34. // interbreadcrumb
  35. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('CourseProgram'));
  36. if(intval($description_type) == 1) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('GeneralDescription'));
  37. if(intval($description_type) == 2) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Objectives'));
  38. if(intval($description_type) == 3) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Topics'));
  39. if(intval($description_type) == 4) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Methodology'));
  40. if(intval($description_type) == 5) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('CourseMaterial'));
  41. if(intval($description_type) == 6) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('HumanAndTechnicalResources'));
  42. if(intval($description_type) == 7) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Assessment'));
  43. if(intval($description_type) == 8) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('ThematicAdvance'));
  44. if(intval($description_type) >= 9) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Others'));
  45. // course description controller object
  46. $course_description_controller = new CourseDescriptionController();
  47. // distpacher actions to controller
  48. switch ($action) {
  49. case 'listing':
  50. $course_description_controller->listing();
  51. break;
  52. case 'history':
  53. $course_description_controller->listing(true);
  54. break;
  55. case 'add' :
  56. if (api_is_allowed_to_edit(null,true)) {
  57. $course_description_controller->add();
  58. }
  59. break;
  60. case 'edit' :
  61. if (api_is_allowed_to_edit(null,true)) {
  62. $course_description_controller->edit($description_type);
  63. }
  64. break;
  65. case 'delete' :
  66. if (api_is_allowed_to_edit(null,true)) {
  67. $course_description_controller->destroy($description_type);
  68. }
  69. break;
  70. default :
  71. $course_description_controller->listing();
  72. }
  73. ?>