my_progress.php 3.4 KB

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