You are here

function rotor_admin_form_submit in Rotor Banner 5

Same name and namespace in other branches
  1. 5.7 rotor.module \rotor_admin_form_submit()
  2. 6 rotor.module \rotor_admin_form_submit()

Admin settings form submit function

File

./rotor.module, line 241
A rotor banner consists in a set of images that will be changing. This module is made using jquery.

Code

function rotor_admin_form_submit($formid, $values, $extra = NULL) {
  if ($formid == 'rotor_admin_form') {
    if ($values['op'] == $values['submit']) {
      variable_set('rotor_height', $values['height']);
      variable_set('rotor_width', $values['width']);
      variable_set('rotor_max_items', $values['max_items']);
      variable_set('rotor_seconds', $values['time']);
      variable_set('rotor_speed', $values['speed']);
      variable_set('rotor_effect', $values['effect']);
      variable_set('rotor_pause', $values['pause']);
      variable_set('rotor_random_items', $values['random_items']);
      variable_set('rotor_show_tabs', $values['show_tab']);
      variable_set('rotor_group_tabs', $values['group_tabs']);
      variable_set('rotor_tab_position', $values['tab_position']);
      variable_set('rotor_imagecache_preset', $values['imagecache']);
      variable_set('rotor_nodequeue', $values['nodequeue']);
      drupal_set_message(t('Settings saved'));
    }
    else {
      variable_set('rotor_height', 200);
      variable_set('rotor_width', 200);
      variable_set('rotor_max_items', 3);
      variable_set('rotor_seconds', 10);
      variable_set('rotor_speed', $values['speed']);
      variable_set('rotor_effect', 'fade');
      variable_set('rotor_pause', 0);
      variable_set('rotor_random_items', 0);
      variable_set('rotor_show_tabs', 1);
      variable_set('rotor_group_tabs', ROTOR_GROUP_TABS);
      variable_set('rotor_tab_position', ROTOR_TAB_POSITION_TOP);
      variable_set('rotor_imagecache_preset', 0);
      variable_set('rotor_nodequeue', 0);
      drupal_set_message(t('Settings back to defaults'));
    }
  }
}