index.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. // current section
  18. $this_section = SECTION_DASHBOARD;
  19. Session::erase('this_section'); //for hmtl editor repository
  20. // get actions
  21. $actions = array('listing', 'store_user_block', 'disable_block');
  22. $action = 'listing';
  23. if (isset($_GET['action']) && in_array($_GET['action'], $actions)) {
  24. $action = $_GET['action'];
  25. }
  26. // load styles from dashboard plugins
  27. $htmlHeadXtra[] = DashboardManager::get_links_for_styles_from_dashboard_plugins();
  28. // course description controller object
  29. $dashboard_controller = new DashboardController();
  30. if (isset($_GET['path'])) {
  31. $path = $_GET['path'];
  32. }
  33. // distpacher actions to controller
  34. switch ($action) {
  35. case 'listing':
  36. $dashboard_controller->display();
  37. break;
  38. case 'store_user_block':
  39. $dashboard_controller->store_user_block();
  40. break;
  41. case 'disable_block':
  42. $dashboard_controller->close_user_block($path);
  43. break;
  44. default:
  45. $dashboard_controller->display();
  46. }