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