progression.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Progress report.
  5. *
  6. * @deprecated seems there's no link to this page
  7. * Created on 28 juil. 2006 by Elixir Interactive http://www.elixir-interactive.com
  8. */
  9. // TODO: This file seems to be unfinished and unused.
  10. require_once __DIR__.'/../inc/global.inc.php';
  11. $nameTools = get_lang('Progress');
  12. $cidReset = true;
  13. $this_section = SECTION_TRACKING;
  14. api_block_anonymous_users();
  15. $interbreadcrumb[] = ["url" => "index.php", "name" => get_lang('Reporting')];
  16. Display :: display_header($nameTools);
  17. // Database Table Definitions
  18. $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
  19. $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
  20. $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
  21. $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
  22. $tbl_track_exercice = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
  23. /*
  24. MAIN CODE
  25. */
  26. $sql_course = "SELECT title, code, id FROM $tbl_course as course ORDER BY title ASC";
  27. $result_course = Database::query($sql_course);
  28. if (Database::num_rows($result_course) > 0) {
  29. if (isset($_POST['export'])) {
  30. $export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet.
  31. echo Display::return_message($export_result, 'error');
  32. }
  33. echo '<table class="data_table"><tr><th>'.get_lang('Course').'</th><th>'.get_lang('Frequentation time').'</th><th>'.get_lang('Progress').'</th><th>'.get_lang('Tests score').'</th></tr>';
  34. $header = [get_lang('Course'), get_lang('Frequentation time'), get_lang('Progress'), get_lang('Tests score')];
  35. while ($a_course = Database::fetch_array($result_course)) {
  36. // TODO: This query is to be checked, there are no HotPotatoes tests results.
  37. $sql_moy_test = "SELECT score,max_score
  38. FROM $tbl_track_exercice
  39. WHERE c_id = ".$a_course['id'];
  40. $result_moy_test = Database::query($sql_moy_test);
  41. $result = 0;
  42. $weighting = 0;
  43. while ($moy_test = Database::fetch_array($result_moy_test)) {
  44. $result = $result + $moy_test['score'];
  45. $weighting = $weighting + $moy_test['max_score'];
  46. }
  47. if ($weighting != 0) {
  48. $moyenne_test = round(($result * 100) / $weighting);
  49. } else {
  50. $moyenne_test = null;
  51. }
  52. echo '<tr><td>'.$a_course['title'].'</td><td> </td><td> </td><td>'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td> </tr>';
  53. }
  54. echo '</table>';
  55. echo "<br /><br />";
  56. echo "<form method='post'><input type='submit' name='export' value='".get_lang('Excel export')."'/><form>";
  57. } else {
  58. echo get_lang('This course could not be found');
  59. }
  60. Display :: display_footer();