progression.php 2.6 KB

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