You are here

function deploy_plan_form_submit in Deploy - Content Staging 5

Same name and namespace in other branches
  1. 6 deploy.plans.admin.inc \deploy_plan_form_submit()

add deployment plan form submit function

File

./deploy.module, line 251

Code

function deploy_plan_form_submit($form_id, $form_values) {
  global $user;

  // If $form_values has 'pid', then this is an update. Otherwise it is an
  // insert.
  if (array_key_exists('pid', $form_values)) {
    db_query("update {deploy_plan} set name = '%s', description = '%s' where pid = %d", $form_values['plan_name'], $form_values['plan_description'], $form_values['pid']);
    drupal_set_message(t('Plan updated'));
  }
  else {
    $pid = db_next_id('{deploy_plan}_pid');
    db_query("insert into {deploy_plan} (pid, name, description) values (%d, '%s', '%s')", $pid, $form_values['plan_name'], $form_values['plan_description']);
    drupal_set_message(t('Plan added'));
  }
  return 'admin/build/deploy';
}