index.php 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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', 'accessibility');
  10. // including files
  11. require_once '../inc/global.inc.php';
  12. $current_course_tool = TOOL_COURSE_DESCRIPTION;
  13. require_once api_get_path(LIBRARY_PATH).'course_description.lib.php';
  14. require_once api_get_path(LIBRARY_PATH).'app_view.php';
  15. require_once 'course_description_controller.php';
  16. require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php';
  17. // defining constants
  18. define('ADD_BLOCK', 8);
  19. // current section
  20. $this_section = SECTION_COURSES;
  21. // protect a course script
  22. api_protect_course_script(true);
  23. // get actions
  24. $actions = array('listing', 'add', 'edit', 'delete', 'history');
  25. $action = 'listing';
  26. if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
  27. $action = $_GET['action'];
  28. }
  29. $description_type = '';
  30. if (isset($_GET['description_type'])) {
  31. $description_type = intval($_GET['description_type']);
  32. }
  33. $id = null;
  34. if (isset($_GET['id'])) {
  35. $id = intval($_GET['id']);
  36. }
  37. if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') {
  38. $action = 'listing';
  39. }
  40. // interbreadcrumb
  41. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('CourseProgram'));
  42. if(intval($description_type) == 1) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('GeneralDescription'));
  43. if(intval($description_type) == 2) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Objectives'));
  44. if(intval($description_type) == 3) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Topics'));
  45. if(intval($description_type) == 4) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Methodology'));
  46. if(intval($description_type) == 5) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('CourseMaterial'));
  47. if(intval($description_type) == 6) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('HumanAndTechnicalResources'));
  48. if(intval($description_type) == 7) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Assessment'));
  49. if(intval($description_type) == 8) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('ThematicAdvance'));
  50. if(intval($description_type) >= 9) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Others'));
  51. // course description controller object
  52. $course_description_controller = new CourseDescriptionController();
  53. // distpacher actions to controller
  54. switch ($action) {
  55. case 'listing':
  56. $course_description_controller->listing();
  57. break;
  58. case 'history':
  59. $course_description_controller->listing(true);
  60. break;
  61. case 'add' :
  62. if (api_is_allowed_to_edit(null,true)) {
  63. $course_description_controller->add();
  64. }
  65. break;
  66. case 'edit' :
  67. if (api_is_allowed_to_edit(null,true)) {
  68. $course_description_controller->edit($id, $description_type);
  69. }
  70. break;
  71. case 'delete' :
  72. if (api_is_allowed_to_edit(null,true)) {
  73. $course_description_controller->destroy($id);
  74. }
  75. break;
  76. default :
  77. $course_description_controller->listing();
  78. }