reussite.php 4.5 KB

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