diff --git a/volunteer.inc.php b/volunteer.inc.php
index 41cdecc..8706d8e 100644
--- a/volunteer.inc.php
+++ b/volunteer.inc.php
@@ -25,11 +25,11 @@
-function volunteer_status_position($u = false)
+function volunteer_status_position($u)
{
global $config;
/* See if they have selected something */
- $q = "SELECT * FROM volunteer_positions_signup WHERE users_id='{$_SESSION['users_id']}'
+ $q = "SELECT * FROM volunteer_positions_signup WHERE users_id='{$u['id']}'
AND year='{$config['FAIRYEAR']}'";
$r = mysql_query($q);
if(mysql_num_rows($r) >= 1) {
@@ -37,4 +37,23 @@ function volunteer_status_position($u = false)
}
return "incomplete";
}
+
+function volunteer_status_update(&$u)
+{
+ if($u['load_full'] == false) {
+ echo "ERROR: volunteer_status_update() called without a full user.";
+ exit;
+ }
+
+ if( user_personal_info_status($u) == 'complete'
+ && volunteer_status_position($u) == 'complete' )
+ $u['volunteer_complete'] = 'yes';
+ else
+ $u['volunteer_complete'] = 'no';
+
+ user_save($u);
+ return ($u['volunteer_complete'] == 'yes') ? 'complete' : 'incomplete';
+
+}
+
?>
diff --git a/volunteer_main.php b/volunteer_main.php
index 10aaff3..8835224 100644
--- a/volunteer_main.php
+++ b/volunteer_main.php
@@ -49,8 +49,6 @@
echo "
";
echo "
";
- $u = user_load($_SESSION['users_id']);
-
user_page_summary_begin();
user_page_summary_item("Contact Information",
"user_personal.php", "user_personal_info_status", array($u));
@@ -58,12 +56,8 @@
"volunteer_position.php", "volunteer_status_position", array($u));
$overallstatus = user_page_summary_end(true);
- /* A bit of a FIXME here, if a user completes everythign but doesn't refresh
- this page, they will never be marked as complete. Not sure how to handle
- this, it's kinda hackey to call EVERY status() fucntion within EACH page to
- get teh overall status. */
- /* Change this to volunteer_status */
- user_update_complete($u, $overallstatus);
+ /* Update volunteer_status */
+ volunteer_status_update($u);
echo "
";
echo "
";
diff --git a/volunteer_position.php b/volunteer_position.php
index 0ffe618..b59b91a 100644
--- a/volunteer_position.php
+++ b/volunteer_position.php
@@ -29,18 +29,9 @@
user_auth_required('volunteer');
- $u = user_load($_SESSION['users_id']);
+ $u = user_load($_SESSION['users_id'], true);
- /* Load the user's volunteer position selections */
-
- //send the header
- $type = $_SESSION['users_type'];
- send_header("{$user_what[$type]} - Volunteer Positions",
- array("{$user_what[$type]} Registration" => "{$type}_main.php")
- );
-
-
if($_POST['action']=="save")
{
$vals = '';
@@ -59,14 +50,14 @@
if(!in_array($id, $posns)) continue;
if($vals != '') $vals .=',';
- $vals .= "('{$_SESSION['users_id']}','$id','{$config['FAIRYEAR']}')";
+ $vals .= "('{$u['id']}','$id','{$config['FAIRYEAR']}')";
}
}
/* Delete existing selections */
mysql_query("DELETE FROM volunteer_positions_signup
WHERE
- users_id='{$_SESSION['users_id']}'
+ users_id='{$u['id']}'
AND year='{$config['FAIRYEAR']}' ");
echo mysql_error();
@@ -79,20 +70,29 @@
}
- echo notice(i18n("Volunteer Positions successfully updated"));
+ message_push(notice(i18n("Volunteer Positions successfully updated")));
}
+/* update overall status */
+volunteer_status_update($u);
+
//output the current status
$newstatus=volunteer_status_position($u);
if($newstatus!='complete')
{
- echo error(i18n("Volunteer Position Selection Incomplete"));
+ message_push(error(i18n("Volunteer Position Selection Incomplete")));
}
else
{
- echo happy(i18n("Volunteer Position Selection Complete"));
+ message_push(happy(i18n("Volunteer Position Selection Complete")));
}
+ //send the header
+ send_header("Volunteer Positions",
+ array("Volunteer Registration" => "volunteer_main.php")
+ );
+
+
echo "