my_progress.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. // Ofaj
  73. $courseId = 0;
  74. if (empty($courseCode)) {
  75. $content .= '<div class="communications">';
  76. $content .= Tracking::displayUserSkills(
  77. $user_id
  78. );
  79. $content .= '</div>';
  80. }
  81. if (!empty($dates)) {
  82. if (!empty($content)) {
  83. $content .= '';
  84. }
  85. $content .= Display::page_subheader(get_lang('Timeline'));
  86. $content .= '<div class="row">';
  87. $content .= '<div class="col-md-12">';
  88. $content .= '<div id="my_timeline">';
  89. $content .= '<ul id="dates">'.$dates.'</ul>';
  90. $content .= '<ul id="issues">'.$issues.'</ul>';
  91. $content .= '<div id="grad_left"></div>';
  92. $content .= '<div id="grad_right"></div>';
  93. $content .= '<a href="#" id="prev"></a>';
  94. $content .= '<a href="#" id="next"></a>';
  95. $content .= '</div></div>';
  96. }
  97. if (api_get_configuration_value('private_messages_about_user_visible_to_user') === true) {
  98. $allowMessages = api_get_configuration_value('private_messages_about_user');
  99. if ($allowMessages === true) {
  100. // Messages
  101. $content .= Display::page_subheader2(get_lang('Messages'));
  102. $content .= MessageManager::getMessagesAboutUserToString(api_get_user_info());
  103. }
  104. }
  105. $message = null;
  106. if (empty($content)) {
  107. $message = Display::return_message(get_lang('NoDataAvailable'), 'warning');
  108. }
  109. $tpl = new Template($nameTools);
  110. $tpl->assign('message', $message);
  111. $tpl->assign('content', $content);
  112. $tpl->display_one_col_template();