index.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 '../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. // get actions
  20. $actions = array('listing', 'store_user_block', 'disable_block');
  21. $action = 'listing';
  22. if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
  23. $action = $_GET['action'];
  24. }
  25. // load styles from dashboard plugins
  26. $dashboar_plugin_styles = DashboardManager::get_links_for_styles_from_dashboard_plugins();
  27. $htmlHeadXtra[] = $dashboar_plugin_styles;
  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. }