user_portal.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. //Temporal hack to redirect calls to the new web/index.php
  17. header('Location: web/userportal');
  18. exit;
  19. /**
  20. * INIT SECTION
  21. */
  22. // Language files that should be included.
  23. use \ChamiloSession as Session;
  24. $language_file = array('courses', 'index', 'admin');
  25. $cidReset = true; /* Flag forcing the 'current course' reset,
  26. as we're not inside a course anymore */
  27. if (isset($_SESSION['this_section']))
  28. unset($_SESSION['this_section']); // For HTML editor repository.
  29. /* Included libraries */
  30. require_once './main/inc/global.inc.php';
  31. api_block_anonymous_users(); // Only users who are logged in can proceed.
  32. $nameTools = get_lang('MyCourses');
  33. $this_section = SECTION_COURSES;
  34. $load_dirs = api_get_setting('show_documents_preview');
  35. if ($load_dirs) {
  36. $url = api_get_path(WEB_AJAX_PATH).'document.ajax.php?a=document_preview';
  37. $folder_icon = api_get_path(WEB_IMG_PATH).'icons/22/folder.png';
  38. $close_icon = api_get_path(WEB_IMG_PATH).'loading1.gif';
  39. $htmlHeadXtra[] = '<script>
  40. $(document).ready(function() {
  41. $(".document_preview_container").hide();
  42. $(".document_preview").click(function() {
  43. var my_id = this.id;
  44. var course_id = my_id.split("_")[2];
  45. var session_id = my_id.split("_")[3];
  46. //showing div
  47. $(".document_preview_container").hide();
  48. $("#document_result_" +course_id+"_" + session_id).show();
  49. //Loading
  50. var image = $("img", this);
  51. image.attr("src", "'.$close_icon.'");
  52. $.ajax({
  53. url: "'.$url.'",
  54. data: "course_id="+course_id+"&session_id="+session_id,
  55. success: function(return_value) {
  56. image.attr("src", "'.$folder_icon.'");
  57. $("#document_result_" +course_id+"_" + session_id).html(return_value);
  58. }
  59. });
  60. });
  61. });
  62. </script>';
  63. }