You are here

function agenda_admin_configure_submit in Agenda 6

Same name and namespace in other branches
  1. 6.2 agenda.admin.php \agenda_admin_configure_submit()
  2. 7.2 agenda.admin.php \agenda_admin_configure_submit()
  3. 7 agenda.admin.php \agenda_admin_configure_submit()

Save all the settings into our agenda settings table

File

./agenda.admin.php, line 285
Administration interface for the agenda module

Code

function agenda_admin_configure_submit($form, $form_state) {

  // Check if we're creating a new block, in which case the delta is 0
  $delta = $form['agenda_bid']['#value'];
  if ($delta == 0) {
    $delta = db_result(db_query('SELECT COALESCE(MAX(bid)+1,1) AS count FROM {agenda}'));
  }

  // Save the settings
  foreach ($form_state['values'] as $key => $value) {
    if (!isset($form[$key]['#agenda_setting'])) {
      continue;
    }
    $setting = substr($key, 7);
    agenda_variable_set($delta, $setting, $value);
  }
  drupal_set_message('Block settings were saved successfully');
  drupal_goto('admin/settings/agenda');
}