Issues (2128)

main/mySpace/progression.php (1 issue)

Labels
Severity
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
/**
5
 * Progress report.
6
 *
7
 * @deprecated seems there's no link to this page
8
 * Created on 28 juil. 2006 by Elixir Interactive http://www.elixir-interactive.com
9
 */
10
11
// TODO: This file seems to be unfinished and unused.
12
require_once __DIR__.'/../inc/global.inc.php';
13
14
$nameTools = get_lang('Progression');
15
16
$cidReset = true;
17
18
$this_section = SECTION_TRACKING;
19
20
api_block_anonymous_users();
21
$interbreadcrumb[] = ["url" => "index.php", "name" => get_lang('MySpace')];
22
Display::display_header($nameTools);
23
24
// Database Table Definitions
25
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
26
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
27
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
28
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
29
$tbl_track_exercice = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
30
31
/*
32
    MAIN CODE
33
*/
34
$sql_course = "SELECT title, code, id
35
               FROM $tbl_course as course
36
               ORDER BY title ASC";
37
$result_course = Database::query($sql_course);
38
39
if (Database::num_rows($result_course) > 0) {
40
    if (isset($_POST['export'])) {
41
        $export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet.
0 ignored issues
show
The function export_csv was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
        $export_result = /** @scrutinizer ignore-call */ export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet.
Loading history...
42
        echo Display::return_message($export_result, 'error');
43
    }
44
    echo '<table class="table table-hover table-striped data_table">
45
            <tr>
46
                <th>'.get_lang('Course').'</th>
47
                <th>'.get_lang('TempsFrequentation').'</th>
48
                <th>'.get_lang('Progression').'</th>
49
                <th>'.get_lang('MoyenneTest').'</th>
50
            </tr>';
51
    $header = [get_lang('Course'), get_lang('TempsFrequentation'), get_lang('Progression'), get_lang('MoyenneTest')];
52
    while ($a_course = Database::fetch_array($result_course)) {
53
        // TODO: This query is to be checked, there are no HotPotatoes tests results.
54
        $sql_moy_test = "SELECT exe_result,exe_weighting
55
			FROM $tbl_track_exercice
56
			WHERE c_id = ".$a_course['id'];
57
        $result_moy_test = Database::query($sql_moy_test);
58
        $result = 0;
59
        $weighting = 0;
60
        while ($moy_test = Database::fetch_array($result_moy_test)) {
61
            $result = $result + $moy_test['exe_result'];
62
            $weighting = $weighting + $moy_test['exe_weighting'];
63
        }
64
        if (0 != $weighting) {
65
            $moyenne_test = round(($result * 100) / $weighting);
66
        } else {
67
            $moyenne_test = null;
68
        }
69
        echo '<tr><td>'.$a_course['title'].'</td><td> </td><td> </td><td>'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td> </tr>';
70
    }
71
    echo '</table>';
72
    echo "<br /><br />";
73
    echo "<form method='post'><input type='submit' name='export' value='".get_lang('ExportExcel')."'/><form>";
74
} else {
75
    echo get_lang('NoCourse');
76
}
77
78
Display::display_footer();
79