query("SELECT * FROM projects WHERE year='$year' AND accepted='1' ORDER BY number_sort ");
$projects_tmp = array();
while($p = $q->fetch_assoc()) {
$p_temp = project_load($mysqli, $p['pid'], $p);
if($p_temp['number_sort'] == 0) {
$p_temp['number_sort'] = $p['pid'];
}
$projects_tmp[$p['pid']] = $p_temp;
}
$projects = array();
/* Now match users to projects, copying projects
* into the real return array as we find them */
$q = $mysqli->query("SELECT users.*,schools.school FROM users
LEFT JOIN schools ON users.schools_id=schools.id
WHERE users.year='$year'
AND users.enabled = '1'
AND users.s_accepted = '1'
AND users.new = '0'
AND FIND_IN_SET('student', users.`roles`)>0
");
$users = array();
while($j = $q->fetch_assoc()) {
$p_user = user_load($mysqli, -1, -1, NULL, $j);
$pid = $p_user['s_pid'];
if($pid == 0) {
print("No project for student uid={$p_user['uid']}
");
}
if(!array_key_exists($pid, $projects)) {
$projects[$pid] = $projects_tmp[$pid];
$projects[$pid]['students'] = array();
$projects[$pid]['s_complete'] = true;
}
$projects[$pid]['students'][] = $p_user;
if($p_user['s_complete'] == 0) {
$projects[$pid]['s_complete'] = false;
}
$projects[$pid]['visit'] = false;
$projects[$pid]['visit_notes'] = '';
}
$q = $mysqli->query("SELECT pid,notes,visit FROM visit_list WHERE uid='{$u['uid']}'");
while($d = $q->fetch_row()) {
$pid = (int)$d[0];
$notes = $d[1];
$visit = (int)$d[2];
if(array_key_exists($pid, $projects)) {
$projects[$pid]['visit'] = $visit;
$projects[$pid]['visit_notes'] = $notes;
}
}
return $projects;
}
$page_id = 'c_checkin_list';
$help = '
'; sfiab_page_begin($u, "Checkin List", $page_id, $help); ?>
The "Save" button below is only for the notes field. The Checkin and Tshirt buttons update the database immediately when clicked.