index.php 3.0 KB

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