index.php 3.1 KB

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