forked from science-ation/science-ation
Quick touch-up on the user structure, adding a subset to the user role status for the participant role. Fixing also (I think) the problem with users always seeming to have the complete status
This commit is contained in:
parent
69bc561055
commit
a773a76ed9
@ -316,21 +316,30 @@ function namecheckStatus($reg_id="")
|
|||||||
return 'complete';
|
return 'complete';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function participant_status_completion_details($u){
|
||||||
|
return array(
|
||||||
|
'namecheck' => namecheckStatus($regId),
|
||||||
|
'tour' => tourStatus($regId),
|
||||||
|
'spaward' => spawardStatus($regId),
|
||||||
|
'safety' => safetyStatus($regId),
|
||||||
|
'mentor' => mentorStatus($regId),
|
||||||
|
'project' => projectStatus($regId),
|
||||||
|
'emergencycontact' => emergencycontactStatus($regId),
|
||||||
|
'student' => studentStatus($regId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function participant_status_update(&$u){
|
function participant_status_update(&$u){
|
||||||
$regId = $u['registrations_id'];
|
$regId = $u['registrations_id'];
|
||||||
if( namecheckStatus($regId) == 'complete' &&
|
$status = participant_status_completion_details($u);
|
||||||
tourStatus($regId) == 'complete' &&
|
$overall = 'complete';
|
||||||
spawardStatus($regId) == 'complete' &&
|
$u['roles']['participant']['completesections'] = array();
|
||||||
safetyStatus($regId) == 'complete' &&
|
foreach($status as $key => $val){
|
||||||
mentorStatus($regId) == 'complete' &&
|
$u['roles']['participant']['completesections'][$key] = ($val == 'complete') ? 'yes':'no';
|
||||||
projectStatus($regId) == 'complete' &&
|
if($val != 'complete'){
|
||||||
emergencycontactStatus($regId) == 'complete' &&
|
$overall = 'incomplete';
|
||||||
studentStatus($regId) == 'complete' &&
|
}
|
||||||
registrationFormsReceived($regId) // <-- returns true/false, not text
|
|
||||||
){
|
|
||||||
$u['roles']['participant']['complete'] = 'yes';
|
|
||||||
}else{
|
|
||||||
$u['roles']['participant']['complete'] = 'no';
|
|
||||||
}
|
}
|
||||||
return ($u['roles']['participant']['complete'] == 'yes') ? 'complete' : 'incomplete';
|
$u['roles']['participant']['complete'] = ($overall == 'complete') ? 'yes':'no';
|
||||||
|
return $overall;
|
||||||
}
|
}
|
||||||
|
@ -690,7 +690,7 @@ function user_get_fields($userRoles = null){
|
|||||||
// will have a function called <role>_status_update, which updates their status with the
|
// will have a function called <role>_status_update, which updates their status with the
|
||||||
// current session data and returns 'complete' or 'incomplete' accordingly.
|
// current session data and returns 'complete' or 'incomplete' accordingly.
|
||||||
// I love the fact that this remark took more characters than the function.
|
// I love the fact that this remark took more characters than the function.
|
||||||
function user_check_role_complete($u, $role){
|
function user_check_role_complete(&$u, $role){
|
||||||
$func = $role . '_status_update';
|
$func = $role . '_status_update';
|
||||||
if(function_exists($func)){
|
if(function_exists($func)){
|
||||||
$result = $func($u); // that's right, func(u)!
|
$result = $func($u); // that's right, func(u)!
|
||||||
|
Loading…
Reference in New Issue
Block a user