index.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Template (front controller in MVC pattern) used for distpaching
  5. * to the controllers depend on the current action
  6. * @author Christian Fasanando <christian1827@gmail.com>
  7. * @package chamilo.course_description
  8. */
  9. $current_course_tool = TOOL_COURSE_DESCRIPTION;
  10. // defining constants
  11. define('ADD_BLOCK', 8);
  12. // current section
  13. $this_section = SECTION_COURSES;
  14. // protect a course script
  15. api_protect_course_script(true);
  16. // get actions
  17. $actions = array('listing', 'add', 'edit', 'delete', 'history');
  18. $action = 'listing';
  19. if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
  20. $action = $_GET['action'];
  21. }
  22. $description_type = '';
  23. if (isset($_GET['description_type'])) {
  24. $description_type = intval($_GET['description_type']);
  25. }
  26. $id = null;
  27. if (isset($_GET['id'])) {
  28. $id = intval($_GET['id']);
  29. }
  30. if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') {
  31. $action = 'listing';
  32. }
  33. // interbreadcrumb
  34. $interbreadcrumb[] = array ("url" => "index.php?".api_get_cidreq(), "name" => get_lang('CourseProgram'));
  35. if ($description_type == 1) {
  36. $interbreadcrumb[] = array("url" => "#", "name" => get_lang('GeneralDescription'));
  37. }
  38. if ($description_type == 2) {
  39. $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Objectives'));
  40. }
  41. if ($description_type == 3) {
  42. $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Topics'));
  43. }
  44. if ($description_type == 4) {
  45. $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Methodology'));
  46. }
  47. if ($description_type == 5) {
  48. $interbreadcrumb[] = array("url" => "#", "name" => get_lang('CourseMaterial'));
  49. }
  50. if ($description_type == 6) {
  51. $interbreadcrumb[] = array("url" => "#", "name" => get_lang('HumanAndTechnicalResources'));
  52. }
  53. if ($description_type == 7) {
  54. $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Assessment'));
  55. }
  56. if ($description_type == 8) {
  57. $interbreadcrumb[] = array("url" => "#", "name" => get_lang('ThematicAdvance'));
  58. }
  59. if ($description_type >= 9) {
  60. $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Others'));
  61. }
  62. // course description controller object
  63. $course_description_controller = new CourseDescriptionController();
  64. // Actions to controller
  65. switch ($action) {
  66. case 'listing':
  67. $course_description_controller->listing();
  68. break;
  69. case 'history':
  70. $course_description_controller->listing(true);
  71. break;
  72. case 'add':
  73. if (api_is_allowed_to_edit(null, true)) {
  74. $course_description_controller->add();
  75. }
  76. break;
  77. case 'edit':
  78. if (api_is_allowed_to_edit(null, true)) {
  79. $course_description_controller->edit($id, $description_type);
  80. }
  81. break;
  82. case 'delete':
  83. if (api_is_allowed_to_edit(null, true)) {
  84. $course_description_controller->destroy($id);
  85. }
  86. break;
  87. default:
  88. $course_description_controller->listing();
  89. }