"index.php", "name" => get_lang('MySpace'));
Display :: display_header($nameTools);
api_display_tool_title($nameTools);
// Database Table Definitions
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
if (isset($_POST['export'])) {
$order_clause = api_is_western_name_order(PERSON_NAME_DATA_EXPORT) ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
} else {
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
}
$sql = "SELECT user.user_id,lastname,firstname,email
FROM $tbl_user as user, $tbl_admin as admin
WHERE admin.user_id=user.user_id".$order_clause;
$result_admins = Database::query($sql);
if (api_is_western_name_order()) {
echo '
'.get_lang('FirstName').' | '.get_lang('LastName').' | '.get_lang('Email').' |
';
} else {
echo ''.get_lang('LastName').' | '.get_lang('FirstName').' | '.get_lang('Email').' |
';
}
if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) {
$header[] = get_lang('FirstName', '');
$header[] = get_lang('LastName', '');
} else {
$header[] = get_lang('LastName', '');
$header[] = get_lang('FirstName', '');
}
$header[] = get_lang('Email', '');
if (Database::num_rows($result_admins) > 0) {
while ($admins = Database::fetch_array($result_admins)) {
$user_id = $admins["user_id"];
$lastname = $admins["lastname"];
$firstname = $admins["firstname"];
$email = $admins["email"];
if ($i % 2 == 0) {
$css_class = "row_odd";
if ($i % 20 == 0 && $i != 0) {
if (api_is_western_name_order()) {
echo ''.get_lang('FirstName').' | '.get_lang('LastName').' | '.get_lang('Email').' |
';
} else {
echo ''.get_lang('LastName').' | '.get_lang('FirstName').' | '.get_lang('Email').' |
';
}
}
} else {
$css_class = "row_even";
}
$i++;
if (api_is_western_name_order()) {
echo "$firstname | $lastname | $email |
";
} else {
echo "$lastname | $firstname | $email |
";
}
if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) {
$data[$user_id]["firstname"] = $firstname;
$data[$user_id]["lastname"] = $lastname;
} else {
$data[$user_id]["lastname"] = $lastname;
$data[$user_id]["firstname"] = $firstname;
}
$data[$user_id]["email"] = $email;
}
} else {
// No results
echo ''.get_lang('NoResults').' |
';
}
echo '
';
if (isset($_POST['export'])) {
export_csv($header, $data, 'administrators.csv');
}
echo "