0) {
$p = project_load($mysqli, $pid);
project_load_students($mysqli, $p);
$ok = true;
foreach($p['students'] as &$u) {
/* User must be "complete" */
if($u['s_complete'] != 1) {
$ok = false;
}
}
if($ok == true) {
$p['accepted'] = 1;
project_save($mysqli, $p);
foreach($p['students'] as &$u) {
$u['s_accepted'] = 1;
user_save($mysqli, $u);
}
form_ajax_response(0);
} else {
form_ajax_response(1);
}
exit();
}
form_ajax_response(1);
exit();
case 'i':
$pid = (int)$_POST['pid'];
if($pid > 0) {
$p = project_load($mysqli, $pid);
project_load_students($mysqli, $p);
$p['accepted'] = 0;
project_number_clear($mysqli, $p);
project_save($mysqli, $p);
foreach($p['students'] as &$u) {
/* User must be "complete" */
$u['s_accepted'] = 0;
user_save($mysqli, $u);
}
form_ajax_response(0);
exit();
}
form_ajax_response(1);
exit();
}
foreach($_GET as $k=>$v) {
switch($k) {
case 'roles':
$g_roles = explode(',', $v);
foreach($g_roles as $r) {
if(!array_key_exists($r, $sfiab_roles)) exit();
$roles[] = $r;
}
$_SESSION['edit_return'] = $roles;
break;
case 'edit':
$uid = (int)$v;
$new_u = user_load($mysqli, $uid);
$_SESSION['edit_uid'] = $uid;
$_SESSION['edit_roles'] = $new_u['roles'];
$_SESSION['edit_name'] = $new_u['name'];
header("Location: ".user_homepage($new_u));
exit();
case 'return':
unset($_SESSION['edit_uid']);
unset($_SESSION['edit_roles']);
unset($_SESSION['edit_name']);
$roles = $_SESSION['edit_return'];
break;
}
}
if(count($roles) == 0) {
$roles = array('committee');
$_SESSION['edit_return'] = $roles;
}
function l_projects_load_all($mysqli, $year)
{
/* Load projects first */
$q = $mysqli->query("SELECT * FROM projects WHERE year='$year' ");
$projects_tmp = array();
while($p = $q->fetch_assoc()) {
$p_temp = project_load($mysqli, $p['pid'], $p);
$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.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'];
$p_user['signatures'] = array();
$users[$p_user['uid']] = $p_user;
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'][] = &$users[$p_user['uid']];
if($p_user['s_complete'] == 0) {
$projects[$pid]['s_complete'] = false;
}
}
/* Do the same for signatures (doesn't matter if they're not enabled here) */
$q = $mysqli->query("SELECT * FROM signatures WHERE year='$year' and `date_signed`!='0000-00-00 00:00:00'");
while($s = $q->fetch_assoc()) {
$uid = $s['uid'];
$p_user = &$users[$uid];
$p_user['signatures'][$s['type']] = $s;
}
ksort($projects);
return $projects;
}
$page_id = 'c_input_signature_forms';
$help = '
There are two buttons that may appear: Mark as Complete, and Mark as Incomplete. The Mark as Complete button is red so you can scan through the list quickly and find all incomplete (red) applications. Similarly the Mark as Incomplete button is green so you can find all the complete ones. When the green Mark as Incomplete button is showing, it means the project has been marked as complete.'; sfiab_page_begin($u, "Input Signature Forms", $page_id, $help); ?>
Use the list below to mark registrations as complete. There are two buttons that may appear: Mark as Complete and Mark as Incomplete. The Mark as Complete button is red so you can scan through the list quickly and find all incomplete (red) applications. Similarly the Mark as Incomplete button is green so you can find all the complete ones. When the green Mark as Incomplete button is showing, it means the project has been marked as complete.
Marking a project as Incomplete also clears the project number. If you mark a project as incomplete, then mark it as complete again, you will need to re-assign the project numbers.
After most or all projects are complete, proceed to Assign Project Numbers. Project numbers can be safely assigned more than once without overwriting numbers already assigned.
=$status?> | =$s['name']?>, | Grade =$s['grade']?>, | =$s['school']?> |
=$signature_types[$sig['type']]?> eSig: | By =$sig['signed_name']?> on =$d?> (=$sig['email']?>) |
PayPal on | =$r['completed_time']?> for =$s['name']?>: | $=sprintf("%.02f", $r['amount'])?> | (Transaction: =$r['transaction_id']?>, Receipt: =$r['receipt_id']?>) |