index.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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', 8);
  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. if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') {
  35. $action = 'listing';
  36. }
  37. // interbreadcrumb
  38. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('CourseProgram'));
  39. if(intval($description_type) == 1) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('GeneralDescription'));
  40. if(intval($description_type) == 2) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Objectives'));
  41. if(intval($description_type) == 3) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Topics'));
  42. if(intval($description_type) == 4) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Methodology'));
  43. if(intval($description_type) == 5) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('CourseMaterial'));
  44. if(intval($description_type) == 6) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('HumanAndTechnicalResources'));
  45. if(intval($description_type) == 7) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Assessment'));
  46. if(intval($description_type) == 8) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('ThematicAdvance'));
  47. if(intval($description_type) >= 9) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Others'));
  48. // course description controller object
  49. $course_description_controller = new CourseDescriptionController();
  50. // distpacher actions to controller
  51. switch ($action) {
  52. case 'listing':
  53. $course_description_controller->listing();
  54. break;
  55. case 'history':
  56. $course_description_controller->listing(true);
  57. break;
  58. case 'add' :
  59. if (api_is_allowed_to_edit(null,true)) {
  60. $course_description_controller->add();
  61. }
  62. break;
  63. case 'edit' :
  64. if (api_is_allowed_to_edit(null,true)) {
  65. $course_description_controller->edit($description_type);
  66. }
  67. break;
  68. case 'delete' :
  69. if (api_is_allowed_to_edit(null,true)) {
  70. $course_description_controller->destroy($description_type);
  71. }
  72. break;
  73. default :
  74. $course_description_controller->listing();
  75. }
  76. ?>