You are here

function acquia_lift_agent_set_status_ajax in Acquia Lift Connector 7

Ajax callback to update an agent's status.

Parameters

$agent: The agent to update.

$status: The new status to set.

1 string reference to 'acquia_lift_agent_set_status_ajax'
acquia_lift_menu in ./acquia_lift.module
Implements hook_menu().

File

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

Code

function acquia_lift_agent_set_status_ajax($agent, $status) {
  $updated = personalize_agent_set_status($agent->machine_name, $status);
  $return = array(
    'success' => $updated,
  );
  if ($updated) {
    list($next_status, $text) = _personalize_status_toggle_next($status);
    $return['nextStatus'] = array(
      'status' => $next_status,
      'text' => $text,
    );
    $return['currentStatus'] = $status;
  }
  return drupal_json_output($return);
}