my_progress.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. /**
  8. * Code
  9. */
  10. // name of the language file that needs to be included
  11. $language_file = array('registration', 'tracking', 'exercice', 'admin', 'learnpath');
  12. $cidReset = true;
  13. require_once '../inc/global.inc.php';
  14. require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
  15. require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
  16. $this_section = SECTION_TRACKING;
  17. $nameTools = get_lang('MyProgress');
  18. api_block_anonymous_users();
  19. $htmlHeadXtra[] = api_get_js('jquery.timelinr-0.9.5.js');
  20. $htmlHeadXtra[] = '
  21. <script language="javascript">
  22. $(function() {
  23. $().timelinr();
  24. $(".dialog").dialog("destroy");
  25. $(".dialog").dialog({
  26. autoOpen: false,
  27. show: "blind",
  28. resizable: false,
  29. height:300,
  30. width:550,
  31. modal: true
  32. });
  33. $(".opener").click(function() {
  34. var my_id = $(this).attr(\'id\');
  35. var big_image = \'#main_graph_\' + my_id;
  36. $( big_image ).dialog("open");
  37. return false;
  38. });
  39. });
  40. </script>';
  41. require_once api_get_path(SYS_CODE_PATH).'mySpace/myspace.lib.php';
  42. $user_id = api_get_user_id();
  43. $course_user_list = CourseManager::get_courses_list_by_user_id($user_id);
  44. $dates = $issues = '';
  45. if (!empty($course_user_list)) {
  46. $items = MySpace::get_connections_from_course_list($user_id, $course_user_list);
  47. $first = null;
  48. $last = null;
  49. $last_item = count($items);
  50. $count = 1;
  51. foreach ($items as $result) {
  52. $login = $result['login'];
  53. if ($count == 1) {
  54. $first = '<a href="#'.$login.'">'.get_lang('First').'</a>';
  55. }
  56. if ($count == $last_item) {
  57. $last = '<a href="#'.$login.'">'.get_lang('Last').'</a>';
  58. }
  59. $course_info = api_get_course_info($result['course_code']);
  60. $course_image = '<img src="'.$course_info['course_image'].'">';
  61. $dates .= '<li><a href="#'.$login.'">'.api_get_local_time($login).'</a></li>';
  62. $issues .= '<li id ="'.$login.'">
  63. <div class="row">
  64. <div class="span2"><div class="thumbnail">'.$course_image.'</div>
  65. </div>
  66. <div class="span3">'.sprintf(
  67. get_lang('YouHaveEnteredTheCourseXInY'),
  68. $result['course_code'],
  69. api_convert_and_format_date($login, DATE_FORMAT_LONG)
  70. ).'</div>
  71. </li>';
  72. $count++;
  73. }
  74. }
  75. $content .= Tracking::show_user_progress(api_get_user_id(), $_GET['session_id'], '', true, true, false);
  76. $content .= Tracking::show_course_detail(api_get_user_id(), $_GET['course'], $_GET['session_id']);
  77. if (!empty($dates)) {
  78. if (!empty($content)) {
  79. $content .= '<br /><br />';
  80. }
  81. $content .= '<div class="row"><div class="span12">'.Display::page_subheader(get_lang('Timeline')).'</div>';
  82. $content .= '<div id="my_timeline">
  83. <div class="actions">
  84. <a href="#" id="prev"></a> <!-- optional -->
  85. <a href="#" id="next"></a> <!-- optional -->
  86. </div>
  87. <ul id="dates">
  88. '.$dates.'
  89. </ul>
  90. <ul id="issues">
  91. '.$issues.'
  92. </ul>
  93. </div></div>';
  94. }
  95. if (empty($content)) {
  96. $message = Display::return_message(get_lang('NoDataAvailable'), 'warning');
  97. }
  98. $tpl = new Template($tool_name);
  99. $tpl->assign('message', $message);
  100. $tpl->assign('content', $content);
  101. $tpl->display_one_col_template();