$sql = "SELECT user_id FROM $tbl_course_user as course_rel_user WHERE course_rel_user.status='5' AND course_rel_user.course_code='$course_code'
UNION DISTINCT SELECT id_user as user_id FROM $tbl_session_course_user srcu WHERE srcu. course_code='$course_code'";
$rs = Database::query($sql);
// students directly subscribed to the course
if (empty($session_id)) {
$sql = "SELECT user_id FROM $tbl_course_user as course_rel_user WHERE course_rel_user.status='5' AND course_rel_user.course_code='$course_code'";
} else {
$sql = "SELECT id_user as user_id FROM $tbl_session_course_user srcu WHERE srcu. course_code='$course_code' AND id_session = '$session_id' AND srcu.status<>2";
}
$rs = Database::query($sql);
$users = array();
while ($row = Database::fetch_array($rs)) {
$users[] = $row['user_id'];
}
while ($row = Database::fetch_array($rs)) { $users[] = $row['user_id']; }
@ -228,7 +225,7 @@ if ($_GET['studentlist'] == 'false') {
<tableclass="data_table">';
$sql = "SELECT id, title
FROM $TABLEQUIZ WHERE active <> -1";
FROM $TABLEQUIZ WHERE active <> -1 AND session_id = $session_id";
$rs = Database::query($sql);
if ($export_csv) {
@ -238,43 +235,13 @@ if ($_GET['studentlist'] == 'false') {
}
if (Database::num_rows($rs) > 0) {
// gets course actual administrators
$sql = "SELECT user.user_id FROM $table_user user, $TABLECOURSUSER course_user
WHERE course_user.user_id=user.user_id AND course_user.course_code='".api_get_course_id()."' AND course_user.status <> '1' AND course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." ";
$res = Database::query($sql);
$student_ids = array();
while($row = Database::fetch_row($res)) {
$student_ids[] = $row[0];
}
$student_ids = array_keys($a_students);
$count_students = count($student_ids);
while ($quiz = Database::fetch_array($rs)) {
$quiz_avg_score = 0;
if ($count_students > 0) {
foreach ($student_ids as $student_id) {
// get the scorn in exercises
$sql = 'SELECT exe_result , exe_weighting
FROM '.$TABLETRACK_EXERCISES.'
WHERE exe_exo_id = '.$quiz['id'].'
AND exe_user_id = '.(int)$student_id.'
AND exe_cours_id = "'.api_get_course_id().'"
AND orig_lp_id = 0
AND orig_lp_item_id = 0
ORDER BY exe_date DESC';
$rsAttempt = Database::query($sql);
$nb_attempts = 0;
$avg_student_score = 0;
while ($attempt = Database::fetch_array($rsAttempt)) {
$sql = "SELECT access_date FROM $TABLETRACK_ACCESS_2 WHERE `access_user_id` = '".$results[$j][0]."' AND `access_cours_code` = '".$_course['official_code']."' AND `access_tool` = 'learnpath' ORDER BY access_id ASC LIMIT 1";
$sql = "SELECT access_date FROM $TABLETRACK_ACCESS_2 WHERE access_user_id = '".$results[$j][0]."' AND access_cours_code = '".$_course['official_code']."' AND access_tool = 'learnpath' AND access_session_id = '".api_get_session_id()."' ORDER BY access_id ASC LIMIT 1";
$sql = "SELECT access_date FROM $TABLETRACK_ACCESS WHERE `access_user_id` = '".$results[$j][0]."' AND `access_cours_code` = '".$_course['official_code']."' AND `access_tool` = 'learnpath'";
$sql = "SELECT access_date FROM $TABLETRACK_ACCESS WHERE access_user_id = '".$results[$j][0]."' AND access_cours_code = '".$_course['official_code']."' AND access_tool = 'learnpath'";