my_progress.php 3.1 KB

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