reussite.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <?php
  2. /*
  3. * Created on 28 juil. 2006 by Elixir Interactive http://www.elixir-interactive.com
  4. */
  5. $nameTools= 'Réussite';
  6. $langFile = array ('registration', 'index','trad4all','tracking');
  7. $cidReset=true;
  8. require ('../inc/global.inc.php');
  9. $this_section = "session_my_space";
  10. api_block_anonymous_users();
  11. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
  12. Display :: display_header($nameTools);
  13. $tbl_course = Database :: get_main_table(MAIN_COURSE_TABLE);
  14. $tbl_user = Database :: get_main_table(MAIN_USER_TABLE);
  15. $tbl_session_course = Database :: get_main_table(MAIN_SESSION_COURSE_TABLE);
  16. $tbl_session = Database :: get_main_table(MAIN_SESSION_TABLE);
  17. $tbl_track_exercice = Database :: get_statistic_table(STATISTIC_TRACK_E_EXERCICES_TABLE);
  18. /*
  19. ===============================================================================
  20. MAIN CODE
  21. ===============================================================================
  22. */
  23. if(!empty($_GET['session']))
  24. {
  25. $sqlSession = " SELECT name,id
  26. FROM $tbl_session
  27. ORDER BY name ASC
  28. ";
  29. $resultSession = api_sql_query($sqlSession);
  30. echo "<a href='".$_SERVER['PHP_SELF']."'>".get_lang('MoyCourse')."</a>";
  31. echo "<br /><br />";
  32. if(mysql_num_rows($resultSession)>0)
  33. {
  34. echo '<table class="data_table">
  35. <tr>
  36. <th>
  37. '.get_lang('Session').'
  38. </th>
  39. <th>
  40. '.get_lang('MoyenneTest').'
  41. </th>
  42. <th>
  43. '.get_lang('MoyenneExamen').'
  44. </th>
  45. </tr>
  46. ';
  47. while($a_session = mysql_fetch_array($resultSession))
  48. {
  49. $sqlCourse = " SELECT title,code
  50. FROM $tbl_course as course
  51. INNER JOIN $tbl_session_course AS rel_course
  52. ON course.code = rel_course.course_code
  53. AND rel_course.id_session = ".$a_session['id']."
  54. ORDER BY title ASC
  55. ";
  56. $resultCourse = api_sql_query($sqlCourse);
  57. $totalResult = 0;
  58. $totalWeighting = 0;
  59. while($a_course = mysql_fetch_array($resultCourse))
  60. {
  61. $sqlMoyTest = " SELECT exe_result,exe_weighting
  62. FROM $tbl_track_exercice
  63. WHERE exe_cours_id = '".$a_course['code']."'
  64. ";
  65. $resultMoyTest = api_sql_query($sqlMoyTest);
  66. $result = 0;
  67. $weighting = 0;
  68. while($a_moyTest = mysql_fetch_array($resultMoyTest))
  69. {
  70. $result = $result + $a_moyTest['exe_result'];
  71. $weighting = $weighting + $a_moyTest['exe_weighting'];
  72. }
  73. $totalResult = $totalResult + $result;
  74. $totalWeighting = $totalWeighting + $weighting;
  75. }
  76. $moyenneTest = round(($totalResult*100) / $totalWeighting);
  77. echo '<tr>
  78. <td>
  79. '.$a_session['name'].'
  80. </td>
  81. <td align="center">
  82. '.$moyenneTest.'%
  83. </td>
  84. <td>
  85. </td>
  86. </tr>
  87. ';
  88. }
  89. echo '</table>';
  90. }
  91. else
  92. {
  93. echo get_lang('NoSession');
  94. }
  95. }
  96. else
  97. {
  98. $sqlCourse = " SELECT title,code
  99. FROM $tbl_course as course
  100. ORDER BY title ASC
  101. ";
  102. $resultCourse = api_sql_query($sqlCourse);
  103. echo "<a href='".$_SERVER['PHP_SELF']."?session=true'>".get_lang('MoySession')."</a>";
  104. echo "<br /><br />";
  105. if(mysql_num_rows($resultCourse)>0)
  106. {
  107. echo '<table class="data_table">
  108. <tr>
  109. <th>
  110. '.get_lang('Course').'
  111. </th>
  112. <th>
  113. '.get_lang('MoyenneTest').'
  114. </th>
  115. <th>
  116. '.get_lang('MoyenneExamen').'
  117. </th>
  118. </tr>
  119. ';
  120. while($a_course= mysql_fetch_array($resultCourse))
  121. {
  122. $sqlMoyTest = " SELECT exe_result,exe_weighting
  123. FROM $tbl_track_exercice
  124. WHERE exe_cours_id = '".$a_course['code']."'
  125. ";
  126. $resultMoyTest = api_sql_query($sqlMoyTest);
  127. $result = 0;
  128. $weighting = 0;
  129. while($a_moyTest = mysql_fetch_array($resultMoyTest))
  130. {
  131. $result = $result + $a_moyTest['exe_result'];
  132. $weighting = $weighting + $a_moyTest['exe_weighting'];
  133. }
  134. $moyenneTest = round(($result*100)/$weighting);
  135. echo '<tr>
  136. <td>
  137. '.$a_course['title'].'
  138. </td>
  139. <td align="center">
  140. '.$moyenneTest.'%
  141. </td>
  142. <td>
  143. </td>
  144. </tr>
  145. ';
  146. }
  147. echo '</table>';
  148. }
  149. else
  150. {
  151. echo get_lang('NoCourse');
  152. }
  153. }
  154. /*
  155. ==============================================================================
  156. FOOTER
  157. ==============================================================================
  158. */
  159. Display :: display_footer();
  160. ?>