index.php 1.5 KB

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