reussite.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /*
  3. * Created on 28 juil. 2006 by Elixir Interactive http://www.elixir-interactive.com
  4. */
  5. // TODO: Is this file used?
  6. $nameTools = 'Reussite';
  7. // name of the language file that needs to be included
  8. $language_file = array ('registration', 'index', 'trad4all', 'tracking');
  9. $cidReset = true;
  10. require '../inc/global.inc.php';
  11. $this_section = "session_my_space";
  12. api_block_anonymous_users();
  13. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
  14. Display :: display_header($nameTools);
  15. // Database Table Definitions
  16. $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
  17. $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
  18. $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
  19. $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
  20. $tbl_track_exercice = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
  21. /*
  22. ===============================================================================
  23. MAIN CODE
  24. ===============================================================================
  25. */
  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, __FILE__, __LINE__);
  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
  37. FROM $tbl_course as course
  38. INNER JOIN $tbl_session_course AS rel_course
  39. ON course.code = rel_course.course_code
  40. AND rel_course.id_session = ".$session['id']."
  41. ORDER BY title ASC";
  42. $result_course = Database::query($sql_course, __FILE__, __LINE__);
  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
  47. FROM $tbl_track_exercice
  48. WHERE exe_cours_id = '".$course['code']."'";
  49. $result_moy_test = Database::query($sql_moy_test);
  50. $result = 0;
  51. $weighting = 0;
  52. while ($moy_test = Database::fetch_array($result_moy_test)) {
  53. $result = $result + $moy_test['exe_result'];
  54. $weighting = $weighting + $moy_test['exe_weighting'];
  55. }
  56. $total_result = $total_result + $result;
  57. $total_weighting = $total_weighting + $weighting;
  58. }
  59. if ($total_weighting != 0) {
  60. $moyenne_test = round(($total_result * 100) / $total_weighting);
  61. } else {
  62. $moyenne_test = null;
  63. }
  64. echo '<tr><td>'.$session['name'].'</td><td align="center">'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td><td> </td></tr>';
  65. }
  66. echo '</table>';
  67. } else {
  68. echo get_lang('NoSession');
  69. }
  70. } else {
  71. $sql_course = "SELECT title,code
  72. FROM $tbl_course as course
  73. ORDER BY title ASC";
  74. $result_course = Database::query($sql_course, __FILE__, __LINE__);
  75. echo "<a href='".api_get_self()."?session=true'>".get_lang('MoySession')."</a>";
  76. echo "<br /><br />";
  77. if (Database::num_rows($result_course) > 0) {
  78. echo '<table class="data_table"><tr><th>'.get_lang('Course').'</th><th>'.get_lang('MoyenneTest').'</th><th>'.get_lang('MoyenneExamen').'</th></tr>';
  79. while ($course= Database::fetch_array($result_course)) {
  80. $sql_moy_test = "SELECT exe_result,exe_weighting
  81. FROM $tbl_track_exercice
  82. WHERE exe_cours_id = '".$course['code']."'";
  83. $result_moy_test = Database::query($sql_moy_test, __FILE__, __LINE__);
  84. $result = 0;
  85. $weighting = 0;
  86. while ($moy_test = Database::fetch_array($result_moy_test)) {
  87. $result = $result + $moy_test['exe_result'];
  88. $weighting = $weighting + $moy_test['exe_weighting'];
  89. }
  90. if ($weighting != 0) {
  91. $moyenne_test = round(($result * 100) / $weighting);
  92. } else {
  93. $moyenne_test = null;
  94. }
  95. echo '<tr><td>'.$course['title'].'</td><td align="center">'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td><td> </td></tr>';
  96. }
  97. echo '</table>';
  98. } else {
  99. echo get_lang('NoCourse');
  100. }
  101. }
  102. /*
  103. ==============================================================================
  104. FOOTER
  105. ==============================================================================
  106. */
  107. Display :: display_footer();