diff --git a/balance_tracker.module b/balance_tracker.module index 41b14e0..18985c8 100644 --- a/balance_tracker.module +++ b/balance_tracker.module @@ -390,7 +390,10 @@ function balance_tracker_admin_form($form_state) { '#type' => 'radios', '#title' => t('Symbol Position'), '#default_value' => variable_get('balance_tracker_currency_symbol_position', 'before'), - '#options' => array('before' => t('Before'), 'after' => t('After')), + '#options' => array( + 'before' => t('Before'), + 'after' => t('After'), + ), '#description' => t('This controls whether the currency symbol appears before or after the currency value.'), ); $form['currency']['thousands_separator'] = array( @@ -418,10 +421,12 @@ function balance_tracker_admin_form($form_state) { '#type' => 'radios', '#title' => t('Date Format'), '#default_value' => variable_get('balance_tracker_date_format', 'small'), - '#options' => array('small' => t('Short: @time', array('@time' => format_date(time(), 'small'))), - 'medium' => t('Medium: @time', array('@time' => format_date(time(), 'medium'))), - 'large' => t('Long: @time', array('@time' => format_date(time(), 'large'))), - 'custom' => t('Custom')), + '#options' => array( + 'small' => t('Short: @time', array('@time' => format_date(time(), 'small'))), + 'medium' => t('Medium: @time', array('@time' => format_date(time(), 'medium'))), + 'large' => t('Long: @time', array('@time' => format_date(time(), 'large'))), + 'custom' => t('Custom') + ), '#description' => t('Please select a date format above. Short, Medium, and Long formats can be configured in the !link.', array('!link' => l('Date and Time settings', 'admin/settings/date-time/formats'))), ); $form['date']['custom_format'] = array( @@ -432,14 +437,30 @@ function balance_tracker_admin_form($form_state) { '#maxlength' => 20, '#description' => t('If you have chosen a Custom format above, please enter it here. See the !link for available format options.', array('!link' => 'PHP Manual')), ); - $form['show_balance_profile'] = array( + $form['display'] = array( + '#type' => 'fieldset', + '#title' => t('Display settings'), + '#tree' => TRUE, + ); + $form['display']['show_balance_profile'] = array( '#type' => 'radios', '#title' => t('User profile'), '#default_value' => variable_get('balance_tracker_show_in_profile', 'noshow'), - '#options' => array('show' => t('Show balance in user profile.'), - 'noshow' => t('Do not show balance in user profile.'), - ), - '#description' => t('Please select whether the user\'s balance should be shown in the user profile. Visibility is restricted via the \'view own balance\' and \'view all balances\' permissions.'), + '#options' => array( + 'show' => t('Show balance in user profile.'), + 'noshow' => t('Do not show balance in user profile.'), + ), + '#description' => t('Please select whether the user\'s balance should be shown in the user profile. Visibility is restricted via the \'view own balance\' and \'view all balances\' permissions.').' '.t('A balance tab in user profile is always present despite of this setting.'), + ); + $form['display']['balance_table_sort'] = array( + '#type' => 'radios', + '#title' => t('Balance table sorting'), + '#default_value' => variable_get('balance_tracker_table_sort', 'descending'), + '#options' => array( + 'ascending' => t('Ascending.'), + 'descending' => t('Descending.'), + ), + '#description' => t('Balance table date sort. Current balance amount is shown in the first table entry in descending sort.'), ); $form['submit'] = array( '#type' => 'submit', @@ -476,9 +497,10 @@ function balance_tracker_admin_form_submit($form, &$form_state) { variable_set('balance_tracker_custom_date_format', check_plain($form_state['values']['date']['custom_format'])); } - // Save user profile settings. - variable_set('balance_tracker_show_in_profile', $form_state['values']['show_balance_profile']); - + // Save display settings. + variable_set('balance_tracker_show_in_profile', $form_state['values']['display']['show_balance_profile']); + variable_set('balance_tracker_table_sort', $form_state['values']['display']['balance_table_sort']); + drupal_set_message('Configuration settings saved.'); }