You are here

function calendar_systems_profile_overview_submit in Calendar Systems 7.2

Same name and namespace in other branches
  1. 8 calendar_systems.admin.inc \calendar_systems_profile_overview_submit()
  2. 6.3 calendar_systems.admin.inc \calendar_systems_profile_overview_submit()
  3. 6 calendar_systems.admin.inc \calendar_systems_profile_overview_submit()
  4. 7.3 calendar_systems.admin.inc \calendar_systems_profile_overview_submit()
  5. 7 calendar_systems.admin.inc \calendar_systems_profile_overview_submit()

Submission callback for calendar systems profiles form.

File

./calendar_systems.admin.inc, line 136
Contains Calendar Systems administration form callbacks.

Code

function calendar_systems_profile_overview_submit($form, &$form_state) {
  foreach ($form_state['values']['formats'] as $format => $values) {
    if ($values['editor'] != 'default' && !empty($format)) {

      // Try to update existing profile or insert otherwise:
      $updated = db_merge('calendar_systems')
        ->key(array(
        'language' => $format,
      ))
        ->fields(array(
        'language' => $format,
        'calendar_system' => $values['editor'],
      ))
        ->execute();
    }
  }
  if (module_exists('jquery_calendar')) {
    variable_set('calendar_systems_js_date_picker_core_text_date_fields', $form_state['values']['core_text_date_fields']);
  }

  // Notify user:
  drupal_set_message(t('Calendar systems profile configuration has been saved.'));
}