|
|
|
@ -1752,6 +1752,7 @@ class CourseManager |
|
|
|
* @param integer $session_id |
|
|
|
* @param integer $session_id |
|
|
|
* @param string $date_from |
|
|
|
* @param string $date_from |
|
|
|
* @param string $date_to |
|
|
|
* @param string $date_to |
|
|
|
|
|
|
|
* @param boolean $includeInvitedUsers Whether include the invited users |
|
|
|
* @return array with user id |
|
|
|
* @return array with user id |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static function get_student_list_from_course_code( |
|
|
|
public static function get_student_list_from_course_code( |
|
|
|
@ -1759,7 +1760,8 @@ class CourseManager |
|
|
|
$with_session = false, |
|
|
|
$with_session = false, |
|
|
|
$session_id = 0, |
|
|
|
$session_id = 0, |
|
|
|
$date_from = null, |
|
|
|
$date_from = null, |
|
|
|
$date_to = null |
|
|
|
$date_to = null, |
|
|
|
|
|
|
|
$includeInvitedUsers = true |
|
|
|
) { |
|
|
|
) { |
|
|
|
$session_id = intval($session_id); |
|
|
|
$session_id = intval($session_id); |
|
|
|
$course_code = Database::escape_string($course_code); |
|
|
|
$course_code = Database::escape_string($course_code); |
|
|
|
@ -1768,8 +1770,14 @@ class CourseManager |
|
|
|
|
|
|
|
|
|
|
|
if ($session_id == 0) { |
|
|
|
if ($session_id == 0) { |
|
|
|
// students directly subscribed to the course |
|
|
|
// students directly subscribed to the course |
|
|
|
$sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
|
|
$sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." cu |
|
|
|
WHERE course_code = '$course_code' AND status = ".STUDENT; |
|
|
|
INNER JOIN user u ON cu.user_id = u.user_id |
|
|
|
|
|
|
|
WHERE course_code = '$course_code' AND cu.status = ".STUDENT; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$includeInvitedUsers) { |
|
|
|
|
|
|
|
$sql .= " AND u.status != " . ROLE_INVITED; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$rs = Database::query($sql); |
|
|
|
$rs = Database::query($sql); |
|
|
|
while ($student = Database::fetch_array($rs)) { |
|
|
|
while ($student = Database::fetch_array($rs)) { |
|
|
|
$students[$student['user_id']] = $student; |
|
|
|
$students[$student['user_id']] = $student; |
|
|
|
@ -1788,6 +1796,7 @@ class CourseManager |
|
|
|
|
|
|
|
|
|
|
|
$sql_query = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." scu |
|
|
|
$sql_query = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." scu |
|
|
|
$joinSession |
|
|
|
$joinSession |
|
|
|
|
|
|
|
INNER JOIN $userTable u ON scu.id_user = u.user_id |
|
|
|
WHERE scu.course_code = '$course_code' AND scu.status <> 2"; |
|
|
|
WHERE scu.course_code = '$course_code' AND scu.status <> 2"; |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($date_from) && !empty($date_to)) { |
|
|
|
if (!empty($date_from) && !empty($date_to)) { |
|
|
|
@ -1800,6 +1809,10 @@ class CourseManager |
|
|
|
$sql_query .= ' AND scu.id_session = '.$session_id; |
|
|
|
$sql_query .= ' AND scu.id_session = '.$session_id; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$includeInvitedUsers) { |
|
|
|
|
|
|
|
$sql .= " AND u.status != " . ROLE_INVITED; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$rs = Database::query($sql_query); |
|
|
|
$rs = Database::query($sql_query); |
|
|
|
while($student = Database::fetch_array($rs)) { |
|
|
|
while($student = Database::fetch_array($rs)) { |
|
|
|
$students[$student['id_user']] = $student; |
|
|
|
$students[$student['id_user']] = $student; |
|
|
|
|