index.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. *
  8. * @author Christian Fasanando <christian1827@gmail.com>
  9. *
  10. * @package chamilo.dashboard
  11. */
  12. $cidReset = true;
  13. // including files
  14. require_once __DIR__.'/../inc/global.inc.php';
  15. require_once 'dashboard_controller.php';
  16. require_once 'block.class.php';
  17. // protect script
  18. api_block_anonymous_users();
  19. // current section
  20. $this_section = SECTION_DASHBOARD;
  21. Session::erase('this_section'); //for hmtl editor repository
  22. // get actions
  23. $actions = ['listing', 'store_user_block', 'disable_block'];
  24. $action = 'listing';
  25. if (isset($_GET['action']) && in_array($_GET['action'], $actions)) {
  26. $action = $_GET['action'];
  27. }
  28. // load styles from dashboard plugins
  29. $htmlHeadXtra[] = DashboardManager::getStyleSheet();
  30. // course description controller object
  31. $dashboardController = new DashboardController();
  32. if (isset($_GET['path'])) {
  33. $path = $_GET['path'];
  34. }
  35. // distpacher actions to controller
  36. switch ($action) {
  37. case 'listing':
  38. $dashboardController->display();
  39. break;
  40. case 'store_user_block':
  41. $dashboardController->store_user_block();
  42. break;
  43. case 'disable_block':
  44. $dashboardController->close_user_block($path);
  45. break;
  46. default:
  47. $dashboardController->display();
  48. }