my_progress.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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($user_id, $course_user_list);
  28. $first = null;
  29. $last = null;
  30. $last_item = count($items);
  31. $count = 1;
  32. foreach ($items as $result) {
  33. $login = $result['login'];
  34. $courseId = $result['c_id'];
  35. $courseInfo = api_get_course_info_by_id($courseId);
  36. if ($count == 1) {
  37. $first = '<a href="#'.$login.'">'.get_lang('First').'</a>';
  38. }
  39. if ($count == $last_item) {
  40. $last = '<a href="#'.$login.'">'.get_lang('Last').'</a>';
  41. }
  42. $course_info = api_get_course_info_by_id($result['c_id']);
  43. $course_image = '<img src="'.$course_info['course_image_large'].'">';
  44. $dates .= '<li><a href="#'.$login.'">'.api_convert_and_format_date($login, DATE_FORMAT_SHORT).'</a></li>';
  45. $issues .= '<li id ="'.$login.'">';
  46. $issues .= '<div class="img-course">'.$course_image.'</div>';
  47. $issues .= '<div class="text-course">';
  48. $issues .= '<p>'.sprintf(
  49. get_lang('YouHaveEnteredTheCourseXInY'),
  50. '" '.$courseInfo['name'].' "',
  51. api_convert_and_format_date($login, DATE_TIME_FORMAT_LONG)
  52. ).'</p>';
  53. $issues .= '</div>';
  54. $issues .= '</li>';
  55. $count++;
  56. }
  57. }
  58. $content = Tracking::show_user_progress(api_get_user_id(), $sessionId);
  59. $content .= Tracking::show_course_detail(api_get_user_id(), $courseCode, $sessionId);
  60. if (!empty($dates)) {
  61. if (!empty($content)) {
  62. $content .= '';
  63. }
  64. $content .= Display::page_subheader(get_lang('Timeline'));
  65. $content .= '<div class="row">';
  66. $content .= '<div class="col-md-12">';
  67. $content .= '<div id="my_timeline">';
  68. $content .= '<ul id="dates">'.$dates.'</ul>';
  69. $content .= '<ul id="issues">'.$issues.'</ul>';
  70. $content .= '<div id="grad_left"></div>';
  71. $content .= '<div id="grad_right"></div>';
  72. $content .= '<a href="#" id="prev"></a>';
  73. $content .= '<a href="#" id="next"></a>';
  74. $content .= '</div></div>';
  75. }
  76. $message = null;
  77. if (empty($content)) {
  78. $message = Display::return_message(get_lang('NoDataAvailable'), 'warning');
  79. }
  80. $tpl = new Template($nameTools);
  81. $tpl->assign('message', $message);
  82. $tpl->assign('content', $content);
  83. $tpl->display_one_col_template();