reussite.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Old reporting file - probably not used anymore
  5. * @package chamilo.reporting
  6. */
  7. /**
  8. * Code
  9. */
  10. // TODO: Is this file used?
  11. $nameTools = 'Reussite';
  12. // name of the language file that needs to be included
  13. $language_file = array ('registration', 'index', 'trad4all', 'tracking');
  14. $cidReset = true;
  15. require '../inc/global.inc.php';
  16. $this_section = "session_my_space";
  17. api_block_anonymous_users();
  18. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
  19. Display :: display_header($nameTools);
  20. // Database Table Definitions
  21. $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
  22. $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
  23. $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
  24. $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
  25. $tbl_track_exercice = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
  26. if (!empty($_GET['session'])) {
  27. $sql_session = "SELECT name,id
  28. FROM $tbl_session
  29. ORDER BY name ASC";
  30. $result_session = Database::query($sql_session);
  31. echo "<a href='".api_get_self()."'>".get_lang('MoyCourse')."</a>";
  32. echo "<br /><br />";
  33. if (Database::num_rows($result_session) > 0) {
  34. echo '<table class="data_table"><tr><th>'.get_lang('Session').'</th><th>'.get_lang('MoyenneTest').'</th><th>'.get_lang('MoyenneExamen').'</th></tr>';
  35. while ($session = Database::fetch_array($result_session)) {
  36. $sql_course = "SELECT title, code, course.id
  37. FROM $tbl_course as course
  38. INNER JOIN $tbl_session_course AS rel_course
  39. ON course.id = rel_course.c_id
  40. AND rel_course.id_session = ".$session['id']."
  41. ORDER BY title ASC";
  42. $result_course = Database::query($sql_course);
  43. $total_result = 0;
  44. $total_weighting = 0;
  45. while ($course = Database::fetch_array($result_course)) {
  46. $sql_moy_test = "SELECT exe_result,exe_weighting FROM $tbl_track_exercice
  47. WHERE c_id = '".$course['id']."'";
  48. $result_moy_test = Database::query($sql_moy_test);
  49. $result = 0;
  50. $weighting = 0;
  51. while ($moy_test = Database::fetch_array($result_moy_test)) {
  52. $result = $result + $moy_test['exe_result'];
  53. $weighting = $weighting + $moy_test['exe_weighting'];
  54. }
  55. $total_result = $total_result + $result;
  56. $total_weighting = $total_weighting + $weighting;
  57. }
  58. if ($total_weighting != 0) {
  59. $moyenne_test = round(($total_result * 100) / $total_weighting);
  60. } else {
  61. $moyenne_test = null;
  62. }
  63. echo '<tr><td>'.$session['name'].'</td><td>'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td><td> </td></tr>';
  64. }
  65. echo '</table>';
  66. } else {
  67. echo get_lang('NoSession');
  68. }
  69. } else {
  70. $sql_course = "SELECT title, code, id FROM $tbl_course as course ORDER BY title ASC";
  71. $result_course = Database::query($sql_course);
  72. echo "<a href='".api_get_self()."?session=true'>".get_lang('MoySession')."</a>";
  73. echo "<br /><br />";
  74. if (Database::num_rows($result_course) > 0) {
  75. echo '<table class="data_table"><tr><th>'.get_lang('Course').'</th><th>'.get_lang('MoyenneTest').'</th><th>'.get_lang('MoyenneExamen').'</th></tr>';
  76. while ($course= Database::fetch_array($result_course)) {
  77. $sql_moy_test = "SELECT exe_result,exe_weighting
  78. FROM $tbl_track_exercice
  79. WHERE c_id = '".$course['id']."'";
  80. $result_moy_test = Database::query($sql_moy_test);
  81. $result = 0;
  82. $weighting = 0;
  83. while ($moy_test = Database::fetch_array($result_moy_test)) {
  84. $result = $result + $moy_test['exe_result'];
  85. $weighting = $weighting + $moy_test['exe_weighting'];
  86. }
  87. if ($weighting != 0) {
  88. $moyenne_test = round(($result * 100) / $weighting);
  89. } else {
  90. $moyenne_test = null;
  91. }
  92. echo '<tr><td>'.$course['title'].'</td><td>'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td><td> </td></tr>';
  93. }
  94. echo '</table>';
  95. } else {
  96. echo get_lang('NoCourse');
  97. }
  98. }
  99. Display :: display_footer();