Passed
Push — 1.11.x ( bce6cd...c146d9 )
by Angel Fernando Quiroz
12:25
created

main/extra/print_myStudents.php (2 issues)

1
<?php
2
/* For licensing terms, see /license.txt */
3
4
require_once '../inc/global.inc.php';
5
6
$allow = api_get_configuration_value('extra');
7
if (empty($allow)) {
8
    exit;
9
}
10
11
$from_myspace = false;
12
if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
13
    $from_myspace = true;
14
    $this_section = SECTION_TRACKING;
15
} else {
16
    $this_section = SECTION_COURSES;
17
}
18
19
//$nameTools = get_lang('StudentDetails');
20
$cidReset = true;
21
$get_course_code = Security:: remove_XSS($_GET['course']);
22
if (isset($_GET['details'])) {
23
    if (!empty($_GET['origin']) && $_GET['origin'] == 'user_course') {
24
        $course_info = CourseManager:: get_course_information($get_course_code);
0 ignored issues
show
Deprecated Code introduced by
The function CourseManager::get_course_information() has been deprecated: Use api_get_course_info() instead ( Ignorable by Annotation )

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

24
        $course_info = /** @scrutinizer ignore-deprecated */ CourseManager:: get_course_information($get_course_code);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
25
        if (empty($cidReq)) {
26
            $interbreadcrumb[] = [
27
                "url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'],
28
                'name' => $course_info['title'],
29
            ];
30
        }
31
        $interbreadcrumb[] = [
32
            "url" => "../user/user.php?cidReq=".$get_course_code,
33
            "name" => get_lang("Users"),
34
        ];
35
    } else {
36
        if (!empty($_GET['origin']) && $_GET['origin'] == 'tracking_course') {
37
            $course_info = CourseManager:: get_course_information($get_course_code);
0 ignored issues
show
Deprecated Code introduced by
The function CourseManager::get_course_information() has been deprecated: Use api_get_course_info() instead ( Ignorable by Annotation )

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

37
            $course_info = /** @scrutinizer ignore-deprecated */ CourseManager:: get_course_information($get_course_code);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
38
            if (empty($cidReq)) {
39
                //$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['title']);
40
            }
41
            $interbreadcrumb[] = [
42
                "url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&studentlist=true&id_session='.(empty($_SESSION['id_session']) ? '' : $_SESSION['id_session']),
43
                "name" => get_lang("Tracking"),
44
            ];
45
        } else {
46
            if (!empty($_GET['origin']) && $_GET['origin'] == 'resume_session') {
47
                $interbreadcrumb[] = [
48
                    'url' => '../admin/index.php',
49
                    "name" => get_lang('PlatformAdmin'),
50
                ];
51
                $interbreadcrumb[] = [
52
                    'url' => "../admin/session_list.php",
53
                    "name" => get_lang('SessionList'),
54
                ];
55
                $interbreadcrumb[] = [
56
                    'url' => "../admin/resume_session.php?id_session=".Security:: remove_XSS($_GET['id_session']),
57
                    "name" => get_lang('SessionOverview'),
58
                ];
59
            } else {
60
                $interbreadcrumb[] = [
61
                    "url" => "index.php",
62
                    "name" => get_lang('MySpace'),
63
                ];
64
                if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
65
                    $interbreadcrumb[] = [
66
                        "url" => "student.php?id_coach=".Security:: remove_XSS($_GET['id_coach']),
67
                        "name" => get_lang("CoachStudents"),
68
                    ];
69
                    $interbreadcrumb[] = [
70
                        "url" => "myStudents.php?student=".Security:: remove_XSS(
71
                                $_GET['student']
72
                            ).'&id_coach='.Security:: remove_XSS($_GET['id_coach']),
73
                        "name" => get_lang("StudentDetails"),
74
                    ];
75
                } else {
76
                    $interbreadcrumb[] = [
77
                        "url" => "student.php",
78
                        "name" => get_lang("MyStudents"),
79
                    ];
80
                    $interbreadcrumb[] = [
81
                        "url" => "myStudents.php?student=".Security:: remove_XSS($_GET['student']),
82
                        "name" => get_lang("StudentDetails"),
83
                    ];
84
                }
85
            }
86
        }
87
    }
88
    $nameTools = get_lang("DetailsStudentInCourse");
89
} else {
90
    if (!empty($_GET['origin']) && $_GET['origin'] == 'resume_session') {
91
        $interbreadcrumb[] = [
92
            'url' => '../admin/index.php',
93
            "name" => get_lang('PlatformAdmin'),
94
        ];
95
        $interbreadcrumb[] = [
96
            'url' => "../admin/session_list.php",
97
            "name" => get_lang('SessionList'),
98
        ];
99
        $interbreadcrumb[] = [
100
            'url' => "../admin/resume_session.php?id_session=".Security:: remove_XSS($_GET['id_session']),
101
            "name" => get_lang('SessionOverview'),
102
        ];
103
    } else {
104
        $interbreadcrumb[] = [
105
            "url" => "index.php",
106
            "name" => get_lang('MySpace'),
107
        ];
108
        if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
109
            if (isset($_GET['id_session']) && intval($_GET['id_session']) != 0) {
110
                $interbreadcrumb[] = [
111
                    "url" => "student.php?id_coach=".Security:: remove_XSS(
112
                            $_GET['id_coach']
113
                        )."&id_session=".$_GET['id_session'],
114
                    "name" => get_lang("CoachStudents"),
115
                ];
116
            } else {
117
                $interbreadcrumb[] = [
118
                    "url" => "student.php?id_coach=".Security:: remove_XSS($_GET['id_coach']),
119
                    "name" => get_lang("CoachStudents"),
120
                ];
121
            }
122
        } else {
123
            $interbreadcrumb[] = [
124
                "url" => "student.php",
125
                "name" => get_lang("MyStudents"),
126
            ];
127
        }
128
    }
129
}
130
131
api_block_anonymous_users();
132
133
if (!api_is_allowed_to_edit() && !api_is_coach() && !api_is_drh() && !api_is_course_tutor(
134
    ) && $_user['status'] != SESSIONADMIN && !api_is_platform_admin(true)) {
135
    api_not_allowed(true);
136
}
137
138
Display:: display_header($nameTools);
139
$tbl_stats_exercices = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
140
141
if (isset($_GET['user_id']) && $_GET['user_id'] != '') {
142
    $user_id = intval($_GET['user_id']);
143
} else {
144
    $user_id = $_user['user_id'];
145
}
146
147
$session_id = isset($_GET['id_session']) ? intval($_GET['id_session']) : 0;
148
$student_id = (int) $_GET['student'];
149
150
// Action behaviour
151
$check = Security::check_token('get');
152
153
if (!empty($student_id)) { // infos about user
154
    $info_user = api_get_user_info($student_id);
155
}
156
if (api_is_drh() && !UserManager::is_user_followed_by_drh($student_id, $_user['user_id'])) {
157
    api_not_allowed();
158
}
159
160
$info_user['name'] = api_get_person_name($info_user['firstname'], $info_user['lastname']);
161
162
?>
163
<table class='table table-hover table-striped data_table'>
164
    <tr>
165
        <th colspan="6">
166
            <?php echo get_lang('result_exam_title');
167
            echo $info_user['name']; ?>
168
        </th>
169
    <tr>
170
        <th><?php echo get_lang('module_no'); ?></th>
171
        <th>
172
            <?php echo get_lang('result_exam'); ?>
173
        </th>
174
        <th>
175
            <?php echo get_lang('result_rep_1'); ?>
176
        </th>
177
        <th>
178
            <?php echo get_lang('result_rep_2'); ?>
179
        </th>
180
        <th>
181
            <?php echo get_lang('comment'); ?>
182
        </th>
183
    </tr>
184
    <?php
185
    $sqlexam = "SELECT *
186
                 FROM $tbl_stats_exercices
187
                 WHERE exe_user_id = $student_id
188
                 AND c_id = 0 AND mod_no != '0'
189
                 ORDER BY mod_no ASC";
190
    $resultexam = Database::query($sqlexam);
191
    while ($a_exam = Database::fetch_array($resultexam)) {
192
        //$ex_id = $a_exam['ex_id'];
193
        $mod_no = $a_exam['mod_no'];
194
        $score_ex = $a_exam['score_ex'];
195
        $score_rep1 = $a_exam['score_rep1'];
196
        $score_rep2 = $a_exam['score_rep2'];
197
        $coment = stripslashes($a_exam['coment']);
198
        echo "
199
            <tr>
200
                <td> ".$a_exam['mod_no']."
201
                </td>
202
                <td>
203
                    ".$a_exam['score_ex']."
204
                </td>
205
                <td>
206
                    ".$a_exam['score_rep1']."
207
                </td>
208
                <td>
209
                    ".$a_exam['score_rep2']."
210
                </td>
211
                <td>
212
                    $coment
213
                </td>
214
            </tr>
215
            ";
216
        $exe_idd = $a_exam['exe_id'];
217
    }
218
?>
219
</table>
220
</form>
221
<strong><?php echo get_lang('imprime_sommaire'); ?> </strong>
222
<a href="#" onclick="window.print()"><img align="absbottom" src="../img/printmgr.gif" border="0"></a>
223