progression.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. /**
  9. * Init
  10. */
  11. // TODO: This file seems to be unfinished and unused.
  12. require_once '../inc/global.inc.php';
  13. $nameTools = get_lang('Progression');
  14. $cidReset = true;
  15. $this_section = SECTION_TRACKING;
  16. api_block_anonymous_users();
  17. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
  18. Display :: display_header($nameTools);
  19. // Database Table Definitions
  20. $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
  21. $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
  22. $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
  23. $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
  24. $tbl_track_exercice = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
  25. /*
  26. MAIN CODE
  27. */
  28. $sql_course = "SELECT title, code, id FROM $tbl_course as course ORDER BY title ASC";
  29. $result_course = Database::query($sql_course);
  30. if (Database::num_rows($result_course) > 0) {
  31. if (isset($_POST['export'])) {
  32. $export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet.
  33. Display :: display_error_message($export_result);
  34. }
  35. 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>';
  36. $header = array(get_lang('Course', ''), get_lang('TempsFrequentation', ''), get_lang('Progression', ''), get_lang('MoyenneTest', ''));
  37. while ($a_course = Database::fetch_array($result_course)) {
  38. // TODO: This query is to be checked, there are no HotPotatoes tests results.
  39. $sql_moy_test = "SELECT exe_result,exe_weighting
  40. FROM $tbl_track_exercice
  41. WHERE c_id = ".$a_course['id'];
  42. $result_moy_test = Database::query($sql_moy_test);
  43. $result = 0;
  44. $weighting = 0;
  45. while ($moy_test = Database::fetch_array($result_moy_test)) {
  46. $result = $result + $moy_test['exe_result'];
  47. $weighting = $weighting + $moy_test['exe_weighting'];
  48. }
  49. if ($weighting != 0) {
  50. $moyenne_test = round(($result * 100) / $weighting);
  51. } else {
  52. $moyenne_test = null;
  53. }
  54. echo '<tr><td>'.$a_course['title'].'</td><td> </td><td> </td><td>'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td> </tr>';
  55. }
  56. echo '</table>';
  57. echo "<br /><br />";
  58. echo "<form method='post'><input type='submit' name='export' value='".get_lang('exportExcel')."'/><form>";
  59. } else {
  60. echo get_lang('NoCourse');
  61. }
  62. /*
  63. FOOTER
  64. */
  65. Display :: display_footer();