index.php 3.2 KB

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