index.php 2.9 KB

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