Files
2026-10-19 15:22:52 -07:00

50 lines
1.7 KiB
PHP

<?php
require_once("include/globals.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /");
exit();
}
// Ensure that only valid user types have access to this module
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Administration Team','Schedule Team');
if (checkPermission($AllowedUserTypes) != 1) {
echo("<br>\n");
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
include "form.messages.php";
return;
}
// Get set of staff records
$query = "SELECT * FROM people " .
"WHERE school_num = $base_school_num " .
"AND people_type = 'Staff' " .
"ORDER BY last_name,first_name";
$results = db_query($query);
$data = array();
while ($row = db_fetch_assoc($results)) {
extract($row);
$staff_category = intval($staff_category);
$category = db_getVal("SELECT category_title FROM staff_categories WHERE school_num = $school_num AND record_num = $staff_category");
$userid = db_getVal("SELECT userid FROM users WHERE school_num = $base_school_num AND record_num = $user_num");
$data[] = array($first_name,$last_name,$email,$label_note,$category,$userid,$staff_description);
}
$column_headers = array(
getLanguageText('TEXT-FIRST-NAME'),
getLanguageText('TEXT-LAST-NAME'),
getLanguageText('TEXT-EMAIL'),
getLanguageText('TEXT-LABEL-NOTE'),
getLanguageText('TEXT-CATEGORY'),
getLanguageText('TEXT-USER-ID'),
);
$fname = genFileName("staff.csv");
xlsData($data,$column_headers,$fname);
exit();
?>