You are here

function skinr_ui_skinsets_form_submit in Skinr 6.2

Process skinr_ui_skinsets_form form submissions.

File

./skinr_ui.admin.inc, line 525
Admin page callbacks for the skinr module.

Code

function skinr_ui_skinsets_form_submit($form, &$form_state) {

  // Store list of previously enabled themes and disable all themes
  $old_skinset_list = $new_skinset_list = array();
  foreach (skinr_skinsets('skinset') as $skinset) {
    if ($skinset->status) {
      $old_skinset_list[] = $skinset->name;
    }
  }
  db_query("UPDATE {skinr_skinsets} SET status = 0");
  if ($form_state['values']['op'] == t('Save configuration')) {
    if (is_array($form_state['values']['status'])) {
      foreach ($form_state['values']['status'] as $key => $choice) {
        if ($choice) {
          $new_theme_list[] = $key;
          db_query("UPDATE {skinr_skinsets} SET status = 1 WHERE name = '%s'", $key);
        }
      }
    }
  }
  else {

    // Revert to defaults: disable all skinsets.
  }

  // Refresh skinsets from DB.
  skinr_skinsets('skinset', TRUE);

  // @todo Disable any skins from skinsets that are now disabled.
  drupal_set_message(t('The configuration options have been saved.'));
  $form_state['redirect'] = 'admin/build/skinr/skins';
  return;
}