forked from science-ation/science-ation
Added grouping to the list of user information fields
This commit is contained in:
parent
769d5ee969
commit
a7a7735347
99
user.inc.php
99
user.inc.php
@ -293,46 +293,46 @@ function user_get_role_fields($role){
|
|||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
function user_get_field_labels(){
|
function user_get_field_info(){
|
||||||
return array(
|
return array(
|
||||||
'salutation' => 'Salutation',
|
'salutation' => array('label' => 'Salutation', 'group' => 'Personal Information'),
|
||||||
'firstname' => 'First Name',
|
'firstname' => array('label' => 'First Name', 'group' => 'Personal Information'),
|
||||||
'lastname' => 'Last Name',
|
'lastname' => array('label' => 'Last Name', 'group' => 'Personal Information'),
|
||||||
'sex' => 'Sex',
|
'sex' => array('label' => 'Sex', 'group' => 'Personal Information'),
|
||||||
'phonehome' => 'Home Phone',
|
'phonehome' => array('label' => 'Home Phone', 'group' => 'Contact Information'),
|
||||||
'phonework' => 'Work Phone',
|
'phonework' => array('label' => 'Work Phone', 'group' => 'Contact Information'),
|
||||||
'phonecell' => 'Cell Phone',
|
'phonecell' => array('label' => 'Cell Phone', 'group' => 'Contact Information'),
|
||||||
'fax' => 'Fax Number',
|
'fax' => array('label' => 'Fax Number', 'group' => 'Contact Information'),
|
||||||
'organization' => 'Organization',
|
'organization' => array('label' => 'Organization', 'group' => 'Contact Information'),
|
||||||
'birthdate' => 'Date of Birth',
|
'birthdate' => array('label' => 'Date of Birth', 'group' => 'Personal Information'),
|
||||||
'lang' => 'Language',
|
'lang' => array('label' => 'Language', 'group' => 'Contact Information'),
|
||||||
'address' => 'Address',
|
'address' => array('label' => 'Address', 'group' => 'Contact Information'),
|
||||||
'address2' => '',
|
'address2' => array('label' => '', 'group' => 'Contact Information'),
|
||||||
'city' => 'City',
|
'city' => array('label' => 'City', 'group' => 'Contact Information'),
|
||||||
'province' => 'Province',
|
'province' => array('label' => 'Province', 'group' => 'Contact Information'),
|
||||||
'postalcode' => 'Postal Code',
|
'postalcode' => array('label' => 'Postal Code', 'group' => 'Contact Information'),
|
||||||
'firstaid' => 'First Aid',
|
'firstaid' => array('label' => 'First Aid', 'group' => 'Personal Information'),
|
||||||
'cpr' => 'CPR',
|
'cpr' => array('label' => 'CPR', 'group' => 'Personal Information'),
|
||||||
'displayemail' => 'Display Email',
|
'displayemail' => array('label' => 'Display Email', 'group' => 'Personal Information'),
|
||||||
'years_school' => 'Years experience judging at school level',
|
'years_school' => array('label' => 'Years experience judging at school level', 'group' => 'Judges'),
|
||||||
'years_regional' => 'Years experience judging at regional level',
|
'years_regional' => array('label' => 'Years experience judging at regional level', 'group' => 'Judges'),
|
||||||
'years_national' => 'Years experience judging at national level',
|
'years_national' => array('label' => 'Years experience judging at national level', 'group' => 'Judges'),
|
||||||
'willing_chair' => 'Willing to lead a judging team',
|
'willing_chair' => array('label' => 'Willing to lead a judging team', 'group' => 'Judges'),
|
||||||
'special_award_only' => 'Judging only for a special award',
|
'special_award_only' => array('label' => 'Judging only for a special award', 'group' => 'Judges'),
|
||||||
'cat_prefs' => 'Category Preferences',
|
'cat_prefs' => array('label' => 'Category Preferences', 'group' => 'Judges'),
|
||||||
'div_prefs' => 'Division Preferences',
|
'div_prefs' => array('label' => 'Division Preferences', 'group' => 'Judges'),
|
||||||
'divsub_prefs' => 'Subdivision Preferences',
|
'divsub_prefs' => array('label' => 'Subdivision Preferences', 'group' => 'Judges'),
|
||||||
'languages' => 'Languages',
|
'languages' => array('label' => 'Languages', 'group' => 'Judges'),
|
||||||
'highest_psd' => 'Highest post-secondary degree',
|
'highest_psd' => array('label' => 'Highest post-secondary degree', 'group' => 'Judges'),
|
||||||
'expertise_other' => 'Other areas of expertise',
|
'expertise_other' => array('label' => 'Other areas of expertise', 'group' => 'Judges'),
|
||||||
'sponsors_id' => 'Sponsor',
|
'sponsors_id' => array('label' => 'Sponsor', 'group' => 'Sponsors'),
|
||||||
'primary' => 'Primary Contact',
|
'primary' => array('label' => 'Primary Contact', 'group' => 'Sponsors'),
|
||||||
'position' => 'Position',
|
'position' => array('label' => 'Position', 'group' => 'Sponsors'),
|
||||||
'notes' => 'Notes',
|
'notes' => array('label' => 'Notes', 'group' => 'Sponsors'),
|
||||||
'schools_id' => 'School',
|
'schools_id' => array('label' => 'School', 'group' => 'Personal'),
|
||||||
'grade' => 'Grade',
|
'grade' => array('label' => 'Grade', 'group' => 'Personal Information'),
|
||||||
'special_awards' => 'Special Awards',
|
'special_awards' => array('label' => 'Special Awards', 'group' => 'Judges'),
|
||||||
'available_times' => 'Times Available'
|
'available_times' => array('label' => 'Times Available', 'group' => 'Judges,Volunteers')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,12 +415,13 @@ function user_get_fields($userRoles = null){
|
|||||||
$fieldType[$row['Field']] = $row['Type'];
|
$fieldType[$row['Field']] = $row['Type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$fieldLabels = user_get_field_labels();
|
$fieldInfo = user_get_field_info();
|
||||||
|
|
||||||
foreach($fields as $fieldName => $field){
|
foreach($fields as $fieldName => $field){
|
||||||
$ftype = $fieldType[$fieldName];
|
$ftype = $fieldType[$fieldName];
|
||||||
if(array_key_exists($fieldName, $fieldLabels)){
|
if(array_key_exists($fieldName, $fieldInfo)){
|
||||||
$fields[$fieldName]['display'] = $fieldLabels[$fieldName];
|
$fields[$fieldName]['display'] = i18n($fieldInfo[$fieldName]['label']);
|
||||||
|
$fields[$fieldName]['group'] = i18n($fieldInfo[$fieldName]['group']);
|
||||||
}
|
}
|
||||||
switch($fieldName){
|
switch($fieldName){
|
||||||
case 'languages':
|
case 'languages':
|
||||||
@ -513,7 +514,7 @@ function user_get_fields($userRoles = null){
|
|||||||
if(count(array_intersect($specialFieldRoles['special_awards'], $userRoles)) > 0){
|
if(count(array_intersect($specialFieldRoles['special_awards'], $userRoles)) > 0){
|
||||||
$fields['special_awards'] = array();
|
$fields['special_awards'] = array();
|
||||||
$fields['special_awards']['field'] = 'special_awards';
|
$fields['special_awards']['field'] = 'special_awards';
|
||||||
$fields['special_awards']['display'] = $fieldLabels['special_awards'];
|
$fields['special_awards']['display'] = $fieldInfo['special_awards']['label'];
|
||||||
$fields['special_awards']['type'] = 'multiselectlist';
|
$fields['special_awards']['type'] = 'multiselectlist';
|
||||||
$fields['special_awards']['options'] = array('yes' => 'Yes', 'no' => 'No');
|
$fields['special_awards']['options'] = array('yes' => 'Yes', 'no' => 'No');
|
||||||
$fields['special_awards']['entries'] = get_special_awards($conference['id']);
|
$fields['special_awards']['entries'] = get_special_awards($conference['id']);
|
||||||
@ -523,7 +524,7 @@ function user_get_fields($userRoles = null){
|
|||||||
if(count(array_intersect($specialFieldRoles['available_times'], $userRoles)) > 0){
|
if(count(array_intersect($specialFieldRoles['available_times'], $userRoles)) > 0){
|
||||||
$fields['available_times'] = array();
|
$fields['available_times'] = array();
|
||||||
$fields['available_times']['field'] = 'available_times';
|
$fields['available_times']['field'] = 'available_times';
|
||||||
$fields['available_times']['display'] = $fieldLabels['available_times'];
|
$fields['available_times']['display'] = $fieldInfo['available_times'];
|
||||||
$fields['available_times']['type'] = 'multiselectlist';
|
$fields['available_times']['type'] = 'multiselectlist';
|
||||||
$fields['available_times']['options'] = array('yes' => 'Yes', 'no' => 'No');
|
$fields['available_times']['options'] = array('yes' => 'Yes', 'no' => 'No');
|
||||||
$fields['available_times']['entries'] = array();
|
$fields['available_times']['entries'] = array();
|
||||||
@ -898,11 +899,11 @@ function user_set_school($u, $schoolId, $schoolCode){
|
|||||||
// now just a skin on top of account_add_role
|
// now just a skin on top of account_add_role
|
||||||
function user_add_role(&$u, $role, $password = null){
|
function user_add_role(&$u, $role, $password = null){
|
||||||
$row = mysql_fetch_assoc(mysql_query("SELECT conferences_id FROM users WHERE id = " . $u['id']));
|
$row = mysql_fetch_assoc(mysql_query("SELECT conferences_id FROM users WHERE id = " . $u['id']));
|
||||||
if(!is_array($q)){
|
$conferences_id = $row['conferences_id'];
|
||||||
return 'no conference';
|
$row = mysql_fetch_assoc(mysql_query("SELECT id FROM roles WHERE `type` = '$role'"));
|
||||||
}
|
$roleId = $row['id'];
|
||||||
$conference_id = $q['conferences_id'];
|
|
||||||
$result = account_add_role($u['accounts_id'], $roles[$role]['id'], $password);
|
$result = account_add_role($u['accounts_id'], $roleId, $conferences_id, $password);
|
||||||
if($result == 'ok'){
|
if($result == 'ok'){
|
||||||
// we need this "if" because account_add_role will return "ok" if they already have this role
|
// we need this "if" because account_add_role will return "ok" if they already have this role
|
||||||
if(!in_array($role, $_SESSION['roles'])){
|
if(!in_array($role, $_SESSION['roles'])){
|
||||||
|
Loading…
Reference in New Issue
Block a user