You are here

function acquia_lift_campaign_start_complete_callback in Acquia Lift Connector 7

Form complete callback for the acquia_lift_campaign_start_form form.

See also

acquia_lift_create_ctools_form().

1 string reference to 'acquia_lift_campaign_start_complete_callback'
acquia_lift_campaign_start_modal_callback in ./acquia_lift.admin.unibar.inc
Page callback to generate a start campaign screen.

File

./acquia_lift.admin.unibar.inc, line 1612
acquia_lift.admin.unibar.inc

Code

function acquia_lift_campaign_start_complete_callback($form, $form_state) {
  $agent_data = $form_state['values']['agent'];

  // Determine the message to display.
  if ($form_state['acquia_lift']['started']) {
    $message = t('The %campaign campaign has been started', array(
      '%campaign' => $agent_data->label,
    ));
  }
  else {
    if ($form_state['values']['campaign_start'] == 'specified') {
      $start_variable = _personalize_agent_get_starttime_variable($agent_data->machine_name);
      $start_date = variable_get($start_variable, 0);
      $message = t('The %campaign campaign will be started on %date', array(
        '%campaign' => $agent_data->label,
        '%date' => format_date($start_date, 'custom', 'M d, Y'),
      ));
    }
    else {
      $message = t('There was a problem starting your campaign.');
    }
  }
  return array(
    ctools_modal_command_dismiss(),
    ajax_command_settings(array(
      'acquia_lift' => array(
        'campaigns' => acquia_lift_get_campaign_details(variable_get('acquia_lift_unibar_allow_status_change', TRUE)),
      ),
    ), TRUE),
    acquia_lift_command_messagebox($message, 10),
  );
}