json_decode always returns an object unless you tell it to give you an associative array (2nd parameter)

give multi-select-lists as full object's where appropriate (might be more too? special awards?)
This commit is contained in:
james 2010-11-16 21:19:16 +00:00
parent a0c64963e0
commit 61fba8a93c
2 changed files with 8 additions and 8 deletions

View File

@ -548,10 +548,10 @@ switch($request[0]) {
*/
case "edit":
if($origu=user_load($_SESSION['users_id'])) {
$u=json_decode($_POST['user']);
$u=json_decode($_POST['user'],true);
if(!is_array($u)) {
$ret['status']="error";
$ret['error']="user (array) is required";
$ret['error']="user (array) is required.";
break;
}

View File

@ -156,7 +156,7 @@ function user_load($users_id, $accounts_id = false)
// $u['highest_psd'] = $u['highest_psd'];
/* Sanity check the arrays, make sure they are arrays */
$should_be_arrays = array('cat_prefs','div_prefs', 'divsub_prefs','languages');
$should_be_arrays = array('cat_prefs','div_prefs', 'divsub_prefs','languages','special_awards','time_availability');
break;
case 'sponsor':
@ -314,7 +314,7 @@ function user_get_field_info(){
'fax' => array('label' => 'Fax Number', 'group' => 'Contact Information'),
'organization' => array('label' => 'Organization', 'group' => 'Contact Information'),
'birthdate' => array('label' => 'Date of Birth', 'group' => 'Personal Information'),
'lang' => array('label' => 'Language', 'group' => 'Contact Information'),
'lang' => array('label' => 'Primary Language', 'group' => 'Contact Information'),
'address' => array('label' => 'Address', 'group' => 'Contact Information'),
'address2' => array('label' => '', 'group' => 'Contact Information'),
'city' => array('label' => 'City', 'group' => 'Contact Information'),
@ -331,7 +331,7 @@ function user_get_field_info(){
'cat_prefs' => array('label' => 'Category Preferences', 'group' => 'Judges'),
'div_prefs' => array('label' => 'Division Preferences', 'group' => 'Judges'),
'divsub_prefs' => array('label' => 'Subdivision Preferences', 'group' => 'Judges'),
'languages' => array('label' => 'Languages', 'group' => 'Judges'),
'languages' => array('label' => 'Spoken Languages', 'group' => 'Judges'),
'highest_psd' => array('label' => 'Highest post-secondary degree', 'group' => 'Judges'),
'expertise_other' => array('label' => 'Other areas of expertise', 'group' => 'Judges'),
'sponsors_id' => array('label' => 'Sponsor', 'group' => 'Sponsors'),
@ -583,7 +583,7 @@ function user_get_fields($userRoles = null){
$fields['available_events']['entries'] = array();
$q=mysql_query("SELECT schedule.id, schedule.date, schedule.hour, schedule.minute, schedule.duration, events.name FROM schedule JOIN events ON schedule.events_id=events.id WHERE schedule.conferences_id='{$conference['id']}'");
while($row = mysql_fetch_assoc($q)){
$fields['available_events']['entries'][$row['id']] = $row['name'] . ' ' . $row['date'] . ', ' . $row['hour'] . ':' . $row['minute'] . ':00 (' . $row['duration'] . ' ' . i18n('minutes') . ')';
$fields['available_events']['entries'][$row['id']] = $row; //$row['name'] . ' ' . $row['date'] . ', ' . $row['hour'] . ':' . $row['minute'] . ':00 (' . $row['duration'] . ' ' . i18n('minutes') . ')';
}
}
@ -596,9 +596,9 @@ function user_get_fields($userRoles = null){
$fields['volunteer_positions']['type'] = 'multiselectlist';
$fields['volunteer_positions']['options'] = array('yes' => 'Yes', 'no' => 'No');
$fields['volunteer_positions']['entries'] = array();
$q = mysql_query("SELECT id, name FROM volunteer_positions WHERE conferences_id = {$conference['id']}");
$q = mysql_query("SELECT * FROM volunteer_positions WHERE conferences_id = {$conference['id']}");
while($row = mysql_fetch_assoc($q)){
$fields['volunteer_positions']['entries'][$row['id']] = $row['name'];
$fields['volunteer_positions']['entries'][$row['id']] = $row; //$row['name'];
}
}