index.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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.dashboard
  7. */
  8. /**
  9. * Init
  10. */
  11. // name of the language file that needs to be included
  12. $language_file = array ('index', 'tracking', 'userInfo', 'admin', 'gradebook');
  13. $cidReset = true;
  14. // including files
  15. require_once '../inc/global.inc.php';
  16. require_once api_get_path(LIBRARY_PATH).'dashboard.lib.php';
  17. require_once api_get_path(LIBRARY_PATH).'app_view.php';
  18. require_once 'dashboard_controller.php';
  19. require_once 'block.class.php';
  20. // protect script
  21. api_block_anonymous_users();
  22. // defining constants
  23. // current section
  24. $this_section = SECTION_DASHBOARD;
  25. unset($_SESSION['this_section']);//for hmtl editor repository
  26. // get actions
  27. $actions = array('listing', 'store_user_block', 'disable_block');
  28. $action = 'listing';
  29. if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
  30. $action = $_GET['action'];
  31. }
  32. // load styles from dashboard plugins
  33. $dashboar_plugin_styles = DashboardManager::get_links_for_styles_from_dashboard_plugins();
  34. $htmlHeadXtra[] = $dashboar_plugin_styles;
  35. // interbreadcrumb
  36. //$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('Dashboard'));
  37. // course description controller object
  38. $dashboard_controller = new DashboardController();
  39. if (isset($_GET['path'])) {
  40. $path = $_GET['path'];
  41. }
  42. // distpacher actions to controller
  43. switch ($action) {
  44. case 'listing':
  45. $dashboard_controller->display();
  46. break;
  47. case 'store_user_block':
  48. $dashboard_controller->store_user_block();
  49. break;
  50. case 'disable_block':
  51. $dashboard_controller->close_user_block($path);
  52. break;
  53. default :
  54. $dashboard_controller->display();
  55. }