index.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use ChamiloSession as Session;
  4. /**
  5. * Template (front controller in MVC pattern) used for distpaching to
  6. * the controllers depend on the current action
  7. * @author Christian Fasanando <christian1827@gmail.com>
  8. * @package chamilo.dashboard
  9. */
  10. $cidReset = true;
  11. // including files
  12. require_once __DIR__.'/../inc/global.inc.php';
  13. require_once 'dashboard_controller.php';
  14. require_once 'block.class.php';
  15. // protect script
  16. api_block_anonymous_users();
  17. // defining constants
  18. // current section
  19. $this_section = SECTION_DASHBOARD;
  20. Session::erase('this_section'); //for hmtl editor repository
  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. // course description controller object
  31. $dashboard_controller = new DashboardController();
  32. if (isset($_GET['path'])) {
  33. $path = $_GET['path'];
  34. }
  35. // distpacher actions to controller
  36. switch ($action) {
  37. case 'listing':
  38. $dashboard_controller->display();
  39. break;
  40. case 'store_user_block':
  41. $dashboard_controller->store_user_block();
  42. break;
  43. case 'disable_block':
  44. $dashboard_controller->close_user_block($path);
  45. break;
  46. default:
  47. $dashboard_controller->display();
  48. }