progression.php 2.6 KB

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