index.php 1.7 KB

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