You are here

function pm_admin_settings_form_submit in Drupal PM (Project Management) 7

Same name and namespace in other branches
  1. 7.2 pm.module \pm_admin_settings_form_submit()

Submit function for admin settings form.

1 string reference to 'pm_admin_settings_form_submit'
pm_admin_settings in ./pm.module
Defines the administration settings form for the Project Management module

File

./pm.module, line 612
Main module file for the Project Management module.

Code

function pm_admin_settings_form_submit($form, $form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';

  // RESET
  if ($op == t('Reset to defaults')) {
    $types = module_invoke_all('pm_dashboard_types');
    foreach ($types as $type => $type_data) {
      variable_del('pm_' . $type . 'dashboard_settings');
    }
    return;
  }

  // GET OPTIONS
  $types = module_invoke_all('pm_dashboard_types');
  foreach ($types as $type => $type_data) {
    $all_links = pm_dashboard_get_links(FALSE, $type);
    $settings = array();
    foreach ($all_links as $link) {
      $path = $link['path'];
      $settings[$path]['active'] = $form_state['values'][$type . '_pm_dashboard_link_active_' . $path];
      $settings[$path]['weight'] = $form_state['values'][$type . '_pm_dashboard_link_weight_' . $path];
    }
    variable_set('pm_' . $type . 'dashboard_settings', $settings);
  }
}