LEFT JOIN $tbl_session_rel_course_user cu on u.user_id = cu.id_user and course_code='".api_get_course_id()."' AND id_session ='".api_get_session_id()."'
INNER JOIN $tbl_url_rel_user as url_rel_user
ON (url_rel_user.user_id = u.user_id)
@ -293,7 +296,7 @@ function get_number_of_users() {
}
}
} else {
$sql = "SELECT COUNT(u.user_id)
$sql = "SELECT COUNT(u.user_id)
FROM $user_table u
LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'";
@ -383,23 +386,39 @@ function get_user_data($from, $number_of_items, $column, $direction) {
if (api_get_setting('show_email_addresses') == 'true') {
$select_fields = "u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6";
} else {
$select_fields = "u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.active AS col4,
u.user_id AS col5";
}
if (isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') {
// adding a teacher through a session
if (!empty($_SESSION["id_session"])) {
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu on u.user_id = cu.id_user AND course_code='".$_SESSION['_course']['id']."' AND id_session ='".$_SESSION["id_session"]."' ";
@ -417,17 +436,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
}
} else {
// adding a teacher NOT through a session
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'";
@ -449,17 +458,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'
INNER JOIN $tbl_url_rel_user as url_rel_user ON (url_rel_user.user_id = u.user_id) ";
@ -482,17 +481,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
} else {
// adding a student
if (!empty($_SESSION["id_session"])) {
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $tbl_session_rel_course_user cu on u.user_id = cu.id_user and course_code='".$_SESSION['_course']['id']."' AND id_session ='".$_SESSION["id_session"]."' ";
@ -510,17 +499,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
}
} else {
$sql = "SELECT
u.user_id AS col0,
u.official_code AS col1,
".($is_western_name_order
? "u.firstname AS col2,
u.lastname AS col3,"
: "u.lastname AS col2,
u.firstname AS col3,")."
u.email AS col4,
u.active AS col5,
u.user_id AS col6
$sql = "SELECT $select_fields
FROM $user_table u
LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'";
@ -544,17 +523,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {