user_portal.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This is the index file displayed when a user is logged in on Chamilo.
  5. *
  6. * It displays:
  7. * - personal course list
  8. * - menu bar
  9. * Search for CONFIGURATION parameters to modify settings
  10. * @package chamilo.main
  11. * @todo Shouldn't the SCRIPTVAL_ and CONFVAL_ constant be moved to the config page? Has anybody any idea what the are used for?
  12. * If these are really configuration settings then we can add those to the dokeos config settings.
  13. * @todo check for duplication of functions with index.php (user_portal.php is orginally a copy of index.php)
  14. * @todo display_digest, shouldn't this be removed and be made into an extension?
  15. */
  16. /**
  17. * INIT SECTION
  18. */
  19. // Language files that should be included.
  20. use \ChamiloSession as Session;
  21. $language_file = array('courses', 'index', 'admin');
  22. $cidReset = true; /* Flag forcing the 'current course' reset,
  23. as we're not inside a course anymore */
  24. if (isset($_SESSION['this_section']))
  25. unset($_SESSION['this_section']); // For HTML editor repository.
  26. /* Included libraries */
  27. require_once './main/inc/global.inc.php';
  28. api_block_anonymous_users(); // Only users who are logged in can proceed.
  29. $nameTools = get_lang('MyCourses');
  30. $this_section = SECTION_COURSES;
  31. $load_dirs = api_get_setting('show_documents_preview');
  32. if ($load_dirs) {
  33. $url = api_get_path(WEB_AJAX_PATH).'document.ajax.php?a=document_preview';
  34. $folder_icon = api_get_path(WEB_IMG_PATH).'icons/22/folder.png';
  35. $close_icon = api_get_path(WEB_IMG_PATH).'loading1.gif';
  36. $htmlHeadXtra[] = '<script>
  37. $(document).ready(function() {
  38. $(".document_preview_container").hide();
  39. $(".document_preview").click(function() {
  40. var my_id = this.id;
  41. var course_id = my_id.split("_")[2];
  42. var session_id = my_id.split("_")[3];
  43. //showing div
  44. $(".document_preview_container").hide();
  45. $("#document_result_" +course_id+"_" + session_id).show();
  46. //Loading
  47. var image = $("img", this);
  48. image.attr("src", "'.$close_icon.'");
  49. $.ajax({
  50. url: "'.$url.'",
  51. data: "course_id="+course_id+"&session_id="+session_id,
  52. success: function(return_value) {
  53. image.attr("src", "'.$folder_icon.'");
  54. $("#document_result_" +course_id+"_" + session_id).html(return_value);
  55. }
  56. });
  57. });
  58. });
  59. </script>';
  60. }
  61. $app->get('/', 'UserPortalController::indexAction');
  62. $app->run();