|
|
|
|
@ -1047,25 +1047,32 @@ class CourseManager |
|
|
|
|
* @param boolean $full list to true if we want sessions students too |
|
|
|
|
* @return array with user id |
|
|
|
|
*/ |
|
|
|
|
function get_student_list_from_course_code($course_code, $full_list=false) |
|
|
|
|
function get_student_list_from_course_code($course_code, $with_session=false, $session_id=0) |
|
|
|
|
{ |
|
|
|
|
$a_students = array(); |
|
|
|
|
|
|
|
|
|
// students directly subscribed to the course |
|
|
|
|
$table = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
|
|
|
$sql_query = "SELECT user_id FROM $table WHERE `course_code` = '$course_code' AND `status` = 5"; |
|
|
|
|
$rs = api_sql_query($sql_query, __FILE__, __LINE__); |
|
|
|
|
while($student = mysql_fetch_array($rs)) |
|
|
|
|
$session_id = intval($session_id); |
|
|
|
|
|
|
|
|
|
if($session_id == 0) |
|
|
|
|
{ |
|
|
|
|
$a_students[$student['user_id']] = $student['user_id']; |
|
|
|
|
// students directly subscribed to the course |
|
|
|
|
$table = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
|
|
|
$sql_query = "SELECT user_id FROM $table WHERE `course_code` = '$course_code' AND `status` = 5"; |
|
|
|
|
$rs = api_sql_query($sql_query, __FILE__, __LINE__); |
|
|
|
|
while($student = mysql_fetch_array($rs)) |
|
|
|
|
{ |
|
|
|
|
$a_students[$student['user_id']] = $student['user_id']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// students subscribed to the course through a session |
|
|
|
|
|
|
|
|
|
if(api_get_setting('use_session_mode')=='true' && $full_list) |
|
|
|
|
if(api_get_setting('use_session_mode')=='true' && $with_session) |
|
|
|
|
{ |
|
|
|
|
$table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
|
|
|
$sql_query = "SELECT DISTINCT id_user as user_id FROM $table WHERE `course_code` = '$course_code'"; |
|
|
|
|
if($session_id!=0) |
|
|
|
|
$sql_query .= ' AND id_session = '.$session_id; |
|
|
|
|
$rs = api_sql_query($sql_query, __FILE__, __LINE__); |
|
|
|
|
while($student = mysql_fetch_array($rs)) |
|
|
|
|
{ |
|
|
|
|
|