my_progress.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Reporting page on the user's own progress.
  5. *
  6. * @package chamilo.tracking
  7. */
  8. $cidReset = true;
  9. require_once __DIR__.'/../inc/global.inc.php';
  10. $this_section = SECTION_TRACKING;
  11. $nameTools = get_lang('MyProgress');
  12. api_block_anonymous_users();
  13. $htmlHeadXtra[] = api_get_js('jquery.timelinr-0.9.54.js');
  14. $htmlHeadXtra[] = "<script>
  15. $(function() {
  16. $().timelinr({
  17. containerDiv: '#my_timeline',
  18. autoPlayPause: 2000
  19. })
  20. });
  21. </script>";
  22. $pluginCalendar = api_get_plugin_setting('learning_calendar', 'enabled') === 'true';
  23. if ($pluginCalendar) {
  24. $plugin = LearningCalendarPlugin::create();
  25. $plugin->setJavaScript($htmlHeadXtra);
  26. }
  27. if (api_get_configuration_value('block_my_progress_page')) {
  28. api_not_allowed(true);
  29. }
  30. $user_id = api_get_user_id();
  31. $courseUserList = CourseManager::get_courses_list_by_user_id($user_id);
  32. $dates = $issues = '';
  33. $sessionId = isset($_GET['session_id']) ? (int) $_GET['session_id'] : 0;
  34. $courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null;
  35. if (!empty($courseUserList)) {
  36. $items = MySpace::get_connections_from_course_list(
  37. $user_id,
  38. $courseUserList
  39. );
  40. $first = null;
  41. $last = null;
  42. $last_item = count($items);
  43. $count = 1;
  44. foreach ($items as $result) {
  45. $login = $result['login'];
  46. $courseId = $result['c_id'];
  47. $courseInfo = api_get_course_info_by_id($courseId);
  48. if ($count == 1) {
  49. $first = '<a href="#'.$login.'">'.get_lang('First').'</a>';
  50. }
  51. if ($count == $last_item) {
  52. $last = '<a href="#'.$login.'">'.get_lang('Last').'</a>';
  53. }
  54. $course_info = api_get_course_info_by_id($result['c_id']);
  55. $course_image = '<img src="'.$course_info['course_image_large'].'">';
  56. $dates .= '<li><a href="#'.$login.'">'.api_convert_and_format_date($login, DATE_FORMAT_SHORT).'</a></li>';
  57. $issues .= '<li id ="'.$login.'">';
  58. $issues .= '<div class="img-course">'.$course_image.'</div>';
  59. $issues .= '<div class="text-course">';
  60. $issues .= '<p>'.sprintf(
  61. get_lang('YouHaveEnteredTheCourseXInY'),
  62. '" '.$courseInfo['name'].' "',
  63. api_convert_and_format_date($login, DATE_TIME_FORMAT_LONG)
  64. ).'</p>';
  65. $issues .= '</div>';
  66. $issues .= '</li>';
  67. $count++;
  68. }
  69. }
  70. $content = Tracking::show_user_progress(api_get_user_id(), $sessionId);
  71. $content .= Tracking::show_course_detail(api_get_user_id(), $courseCode, $sessionId);
  72. if (!empty($dates)) {
  73. if (!empty($content)) {
  74. $content .= '';
  75. }
  76. $content .= Display::page_subheader(get_lang('Timeline'));
  77. $content .= '<div class="row">';
  78. $content .= '<div class="col-md-12">';
  79. $content .= '<div id="my_timeline">';
  80. $content .= '<ul id="dates">'.$dates.'</ul>';
  81. $content .= '<ul id="issues">'.$issues.'</ul>';
  82. $content .= '<div id="grad_left"></div>';
  83. $content .= '<div id="grad_right"></div>';
  84. $content .= '<a href="#" id="prev"></a>';
  85. $content .= '<a href="#" id="next"></a>';
  86. $content .= '</div></div>';
  87. }
  88. if (api_get_configuration_value('private_messages_about_user_visible_to_user') === true) {
  89. $allowMessages = api_get_configuration_value('private_messages_about_user');
  90. if ($allowMessages === true) {
  91. // Messages
  92. $content .= Display::page_subheader2(get_lang('Messages'));
  93. $content .= MessageManager::getMessagesAboutUserToString(api_get_user_info());
  94. }
  95. }
  96. $message = null;
  97. if (empty($content)) {
  98. $message = Display::return_message(get_lang('NoDataAvailable'), 'warning');
  99. }
  100. $tpl = new Template($nameTools);
  101. $tpl->assign('message', $message);
  102. $tpl->assign('content', $content);
  103. $tpl->display_one_col_template();