my_progress.php 3.0 KB

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